Skip to content

clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf: A test run never leaves a .clens marker in a shared parent folder - #22

Merged
silouone merged 1 commit into
mainfrom
adw/clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf
Oct 30, 2026
Merged

silouone merged 1 commit into
mainfrom
adw/clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf

Conversation

@silouone

Copy link
Copy Markdown
Owner

clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf

Ticket: clens/clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf.md

Risk

  • Files changed: 4 (+181 / -42)
  • no ODD declared

How to undo

Revert this PR's commits with git revert.

Build — clens-014

What changed

  • packages/cli/test/utils.test.ts: resolveProjectRoot suite now uses a per-test mkdtemp root removed in afterEach. The two fallback tests (plus a new prefers .clens over a nearer .git) call resolveProjectRoot(start, fakeExists), with no fs access. Added R2 test ignores a .clens in the parent of the project root (parent built inside an mkdtemp dir) and two R1 pins (private root / no parent marker written; earlier roots removed and distinct).
  • packages/cli/test/hook.test.ts: TEST_DIR is a per-test mkdtemp root seeded with its own .clens (nearest marker wins, so a stray parent can't capture it). Added R2 test (ignores a .clens in the parent of the project root) and two R1 pins.
  • packages/cli/src/utils.ts: seam resolveProjectRoot(start, exists = existsSync); behavior-preserving, all existing callers unchanged.

Deliberate coverage move (per plan)

Removed hook test nested cwd falls back to .git root when no .clens exists yet: the hook subprocess cannot take an injected predicate, so against a real fs it is inherently host-dependent. The .git fallback is pinned at unit level in utils.test.ts. Reviewer: this is a deletion of a test, made by the plan, not to reach green.

Verification

  • Red: before the seam, falls back to .git… and prefers .clens over a nearer .git failed on the 2nd argument being ignored.
  • With $TMPDIR/.clens created by hand: utils.test.ts + hook.test.ts → 42 pass, 0 fail; marker removed afterwards.
  • biome (cli) clean, bun run typecheck clean, utils/hook/distill tests: 769 pass.
  • Full bun test was not run by me (blocked by an in-stage hook); the gates node covers it.

Discrepancies

None. Note: the web package biome lint was not run separately (no web changes).

{
  "status": "done",
  "summary": "Tests use mkdtemp roots; hook tests seed their own .clens; resolveProjectRoot gains an injectable exists predicate for fs-free fallback tests; R1/R2 pins added; unshieldable hook .git-fallback test removed.",
  "filesChanged": ["packages/cli/src/utils.ts", "packages/cli/test/utils.test.ts", "packages/cli/test/hook.test.ts"],
  "testsAdded": ["packages/cli/test/utils.test.ts", "packages/cli/test/hook.test.ts"],
  "requirements": {
    "R1": {"state": "done"},
    "R2": {"state": "done"}
  }
}

Gates: last pass green in run clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf-1793364256470.

Gates

  • (no gates recorded)

  • Gate suite ran in: 0ms

  • Repair rounds used: 0

  • Total duration: 9035ms

  • Run id: clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf-publish-1793368494554

Requirement trace

Matrix computed at commit eecf3bc21bdda8c2329465edcf7164aecfc23b14; links are pinned to it.

Req Status Requirement Implementation Tests
R1 test-only each test owns a private root. The resolveProjectRoot and hook-handler tests create their roots w… — packages/cli/test/hook.test.ts:14, packages/cli/test/hook.test.ts:266, packages/cli/test/hook.test.ts:294, packages/cli/test/utils.test.ts:111
R2 covered a stray parent marker cannot fool them. With a .clens folder present in the temp dir's parent, th… packages/cli/src/utils.ts:30 packages/cli/test/hook.test.ts:14, packages/cli/test/hook.test.ts:229, packages/cli/test/utils.test.ts:111, packages/cli/test/utils.test.ts:158

Captured sessions

(none captured)


Opened by adw-factory. A human reviews and merges — the factory never merges,
approves, or closes its own pull requests.

…run clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf-publish-1793368494554)
@silouone
silouone merged commit bcf04aa into main Oct 30, 2026
1 check passed
@silouone
silouone deleted the adw/clens-014-tests-never-leave-a-clens-marker-in-tmp-853cdf branch October 30, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants