test(scripts): assert the AGENTS.md symlink the guard's coverage depends on - #1809
Conversation
4d7eafe to
b87b8c1
Compare
|
Refresh:
Carry evidence, so the CLEAR at One commit, one file ( Re-run at |
b87b8c1 to
705669b
Compare
…nds on (vera 70645, wren 70661)
The scan names CLAUDE.md, and AGENTS.md is covered only because git mode
120000 makes it the same file. That is a convention the comment described and
nothing checked.
Two events take AGENTS.md out of scope, and both are asserted because
`isSymbolicLink()` alone only catches the first:
- replaced by a real copy -> not a symlink at all
- retargeted (`ln -s README.md`) -> still a symlink, pointing somewhere the
scan does not follow, so `isSymbolicLink()` passes while AGENTS.md has left
scope. The target is now resolved against the link's own directory and must
be one of SCANNED_ROOT_FILES, derived from that constant rather than
hard-coded, so the title and the assertion cannot drift apart.
Also names, in the same comment, the other form the boundary rejects — a
parent-relative `../docs/….md` — as a known blind spot rather than leaving it
to be discovered; its target depends on the referencing file's directory,
which this scan does not model, and there are zero instances in the scanned
dirs.
Mutations: replace AGENTS.md with a real copy -> RED; retarget it to README.md
-> RED (wren's case, and the one the first version of this test let through);
invert the symlink assertion -> RED. Restored clean, 6/6.
Disclosed survivor: loosening the target assertion to `target.length > 0`
survives, because removing a check is undetectable on a tree whose link target
is correct — the retarget mutation is what supplies the failing input, and it
is the case that goes RED.
Held as a follow-up rather than folded into #1807: that head carried two
reviewers' stamps and the press was authorised on it.
705669b to
08cb985
Compare
Follow-up to #1807, from Vera's residual on it (pod message 70645) — deferred out of that PR so its two stamps stayed attached to a head that was already authorised for press. Extended while under wren's HOLD at
e47bdfea(message 70661), which found the first version of this test asserting less than its own title.The gap
The guard names
CLAUDE.mdas a scanned root file, andAGENTS.mdis covered — but only because it is a symlink to it (git mode120000, blob = the 9 charactersCLAUDE.md), which the file's own comment says and nothing checked. Two events takeAGENTS.mdout of scope silently, with every other test still green:lstatSync, notstatSync—statfollows the link and would reporttruefor a regular file too. And the second assertion is the fix for the HOLD:isSymbolicLink()alone passes forln -s README.md AGENTS.md, which is a symlink the scan does not follow. The target is derived fromSCANNED_ROOT_FILESrather than hard-coded toCLAUDE.md, so the assertion and the scan's own notion of "the scanned file" cannot drift apart.Also recorded, in the same comment
Her second finding, kept as a named limitation rather than left to be discovered: a parent-relative
../docs/….mdis rejected byDOC_REF's lookbehind ((?<![A-Za-z0-9_/.-])fails on the.before..), and there are zero instances in the scanned dirs. Its target depends on the referencing file's directory, which this scan does not model, so widening the boundary without modelling that would trade a false negative for false positives.Mutations
M5 and M7 are the two ways the file leaves scope, and each reddens only this test — nothing else in the suite notices. M6 shows the assertion is live rather than vacuously true.
Disclosed survivor: loosening the target assertion to
expect(target.length).toBeGreaterThan(0)survives. That is the expected shape forM8— removing a check is undetectable on a tree whose link target is correct — and it is not a gap:M7is the mutation that supplies the wrong target and goes RED. Recording it because a survivor that is explained is evidence and a survivor that is not is a hole.Test-only:
backend/__tests__/⇒ no package version slot.