Skip to content

A dozen suites write .test-<id> scratch dirs into the live tree and none are gitignored #302

Description

@pseudoseed

Root-cause class behind #298 and #263. Surfaced by the integration review of PR #300.

The convention

Roughly a dozen test suites create scratch directories named .test-<id> in the live repository tree: .test-pir-832, .test-bugfix-298, and others. None of them are gitignored.

What it costs

It produces the #298 class directly. Anything that walks the repository, and npm pack --dry-run is the example that bit, can list one of these directories and then stat it after the owning test has removed it. That failed 5 of 5 gate approvals today and blocked four projects.

It puts test litter in git status. An untracked directory left behind by an interrupted run is indistinguishable from work in progress, and afx spawn refuses a dirty tree.

It is how #297 happened, one level along: untracked directories in the main checkout that no builder worktree has, because git worktree add does not copy untracked files. A test asserting on the live tree is then green everywhere except the one place gates run.

What would close this

  • Add .test-*/ to .gitignore. Cheap, and stops the litter being visible to git status and to anything reading tracked state.
  • Better: put scratch directories under the system temp directory rather than the repository. mkdtemp is already the pattern in several suites, including the fix in Fix #298: derive the pack list from git, not from a live-tree walk #300. Nothing that walks the repo can then observe them at all.

The second is the real fix. The first is worth doing today regardless, because it is one line.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreCore libraries and shared logic

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions