* fix(#3078): sweep all-spent ack fragments on next, name the collision remedy
`guard-no-ack-on-next` only ever watched the legacy tests/emitted-drift-ack.json.
#2914 exempted the fragment directory on the premise that a persisting fragment
"cannot conflict with any other PR". Fragments do not share a FILE, but they do
share a PATH KEY SPACE, and a path claimed by two sources is a hard failure in
the same script -- so a fully-spent fragment on next owns keys it can no longer
gate, and the next PR to grow one of those paths can declare it neither there
(spent) nor in its own fragment (duplicate). Measured at the sweep: 45 fragments
owning 403 paths, up from 13/272 at triage 19 days earlier.
- `assertNoAllSpentFragments` fails a fragment only when EVERY surviving entry is
spent against the copy at HEAD^, so a partially spent fragment -- and the
re-arm-by-appending route #2639/#2993 ship on -- keeps working.
- `ackProse` duplicates the gate's zero-width/whitespace stripping across the
scripts-ship/tests-do-not line, bounded by a prose-parity test.
- The guard job's checkout takes fetch-depth: 2; at depth 1 HEAD^ is absent and
every fragment reads as brand-new, i.e. the guard passes vacuously.
- The duplicate-ack error now names both resolutions, since the guard is
post-merge by design and cannot stop the colliding PR.
- All 45 spent fragments deleted, 0000-legacy-migration.json included, and the
three tests that pinned its permanence corrected.
Verification is the remote runner (gsd-test), not a local suite.
Closes #3078
* fix(#3078): make the prose-parity test two-sided, cover the git seam, base on the pre-push tip
Three review findings, all fixed:
- The parity test was a tautology: it checked ACK_INVISIBLE against a
hardcoded list matching its own definition, never against the gate. The
gate's INVISIBLE and its reason normalizer (hoisted out of diffEmitted as
normalizeAckReason) are now exported for that sole purpose, and the test
sweeps 0x00-0xFFFF against both surfaces. Mutation-checked: adding a
codepoint to one side and not the other now fails.
- resolveBaseRef, readFragmentAtRef and assertUsableBaseRef had zero direct
coverage -- the tests reimplemented the git reads in a local helper, so the
ls-tree-vs-show discrimination, the root-commit fallback and the
option-injection guard were never executed. All are exported and tested
against real temp repositories now, plus an end-to-end --base-ref subprocess.
- HEAD^ is not 'the state of next before this push'. The default branch allows
REBASE merges, so one push can carry N commits, and a 2-commit rebase-merge
whose first commit adds a fragment would be told to git rm it on the very
push that introduced it. CI now passes github.event.before via --base-ref and
fetches it explicitly; HEAD^ remains only the local fallback.
Also adds the safe.directory guard every other git call in this repo carries
(#2767), and stops naming the deleted migration fragment by filename in
CONTEXT.md, which tripped lint-removed-but-needed.
Refs #3078
* fix(#3078): keep the fragment directory alive after the sweep empties it
Sweeping every fragment leaves the directory untracked, and check-glossary-refs
then fails: CONTEXT.md references tests/emitted-drift-acks, which no longer
exists. The empty directory IS the intended steady state, so it has to survive
its own remedy.
Adds tests/emitted-drift-acks/README.md documenting the create/use/delete
lifecycle where a contributor actually meets it, matching the existing
tests/qa/smell-acks/README.md precedent. Every reader filters on .json, so the
README is invisible to the gate.
Also sweeps #3809's ack fragment, which the rebase onto origin/next brought in
and the new guard immediately reported as all-spent -- its own remedy applied.
Refs #3078
* fix(#3078): guard the added tests' git calls, drop a second fragment-existence pin
Both defects surfaced by the remote runner (linux-node24, 4/37445 failed).
- The new --base-ref E2E test ran `git rev-parse HEAD` against the checkout
without the #2767 safe.directory guard. The runner mounts the repo at a path
owned by another uid, so git refused every operation there with 'detected
dubious ownership'. Every git call the new tests make now names its own
specific directory as safe, via one local helper, mirroring safeDirArgs in
helpers/emitted-runtime.cjs.
- tests/agent-tracked-source-rule.test.cjs pinned the existence and contents of
the 3645 and 3409 ack fragments. That is a merged PR's paperwork, not live
behavior: once the growth is in next's baseline the acks are spent and this
PR's guard sweeps them. The third assertion pinned the hand-appended
workaround for the exact collision #3078 removes. Deleted; #3645's real
protection is the two behavioral tests above it, untouched.
Also restores #3809's ack fragment, which merged one commit before this branch.
Deleting an ack in the same window as its introducing PR races any consumer
whose baseline predates it -- the runner's container proved it, resolving
origin/next to 8ed105c8a where the file is still 13847. The backlog sweep is
this PR's scope; that fragment is left for the guard's own first run.
Adds the rule to the fragment README so the class stops recurring.
Refs #3078
* test(#3078): derive the E2E guard expectation from the fragment inventory
The --base-ref E2E test asserted exit 0 while passing the checkout's own HEAD
as the base ref. HEAD-as-base makes every present fragment byte-identical to
itself, so all of them are trivially all-spent and the guard correctly exits 1.
The test only ever passed because the directory happened to be empty when it
was written; restoring #3809's fragment made it fail. The script was right and
the test was wrong.
The degenerate base ref is kept deliberately -- it is what makes 'spent'
trivially true and therefore deterministic -- but the expectation is now
derived from listFragmentFiles() at runtime: zero fragments means exit 0 and
the no-survivors line, N fragments means exit 1 with every name and its git rm.
Proven state-independent by running the suite with the fragment present, with
the directory emptied, and with it restored.
The option-shaped --base-ref rejection is split into its own test, unchanged.
Refs #3078
* chore(#3078): backfill PR number into the changeset fragment (pr:0 -> pr:3823)
---------
Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -1012,22 +1012,42 @@ file every such PR touches guarantees a merge conflict between any two of them (
|
||||
conflicting PRs in one open queue collided on this file and nothing else), and it means
|
||||
spent, already-merged entries pile up on `next`. A fragment per PR — the same shape
|
||||
`.changeset/` already uses for the identical problem — means two PRs can never conflict on
|
||||
this seam again, and a fragment left on `next` after merge is inert rather than a shared
|
||||
cell. Two ack sources (two fragments, or a fragment and the legacy file) may **never** name
|
||||
the same path; that is a hard, loudly-reported error, not a silent last-wins.
|
||||
this seam again. Two ack sources (two fragments, or a fragment and the legacy file) may
|
||||
**never** name the same path; that is a hard, loudly-reported error, not a silent
|
||||
last-wins.
|
||||
|
||||
`tests/emitted-drift-ack.json` (the legacy single file, specifically — NOT the fragment
|
||||
directory) must never persist on `next` (#2914): every entry is scoped to the diff that
|
||||
introduced it, so once merged it is, by definition, already at the base — spent and inert,
|
||||
regardless of shape, and its persistence is what makes it a shared merge-conflict cell. A
|
||||
fragment persisting on `next` is harmless, since fragments are independently named and
|
||||
cannot conflict with anything, so this guard is deliberately scoped to the legacy file
|
||||
alone. This is enforced only on `next` itself, by the `guard-no-ack-on-next` job in
|
||||
**When two sources collide (#3078).** The error names both resolutions, because which one
|
||||
applies depends on the fragment that already owns the path. If the owning fragment is
|
||||
already **merged**, its entry is spent — it is at the base, so it gates nothing — and the
|
||||
answer is to delete it (`git rm tests/emitted-drift-acks/<owner>.json`) and keep your own.
|
||||
If it is still **live** on your branch, append your explanation to its existing entry
|
||||
instead; that re-arms it, and re-arming deliberately costs an actual new sentence, because
|
||||
the reason is the whole artifact a reviewer reads. Never rename the path to dodge the
|
||||
error, and never declare it twice.
|
||||
|
||||
**Neither ack source may persist on `next`, and a fragment is not exempt (#3078).**
|
||||
`tests/emitted-drift-ack.json`, the legacy single file, must never survive there at all:
|
||||
every entry is scoped to the diff that introduced it, so once merged it is by definition
|
||||
already at the base — spent and inert, regardless of shape — and its persistence is what
|
||||
makes it a shared merge-conflict cell. A **fragment** is judged on a different rule but the
|
||||
same law. #2914 originally exempted the fragment directory on the premise that a persisting
|
||||
fragment is harmless, since fragments are independently named and cannot conflict. That
|
||||
premise was wrong: fragments do not share a *file*, but they do share a *path key space*,
|
||||
and a path claimed by two sources is the hard error above. So a fully-spent fragment left on
|
||||
`next` owns keys it can no longer gate, and the next PR that grows one of those paths can
|
||||
declare it neither there (spent) nor in its own fragment (duplicate) — the exact wall #2914
|
||||
removed for the legacy file, one level down. A fragment is therefore swept once **every**
|
||||
entry in it is spent; a **partially** spent one is left alone, which is what keeps the
|
||||
re-arm-by-appending route above working. Both rules are enforced only on `next` itself, by
|
||||
the `guard-no-ack-on-next` job in
|
||||
`.github/workflows/test.yml` (push-to-`next` trigger,
|
||||
`scripts/lint-emitted-drift-ack.cjs --guard-next`), never as a PR-lane check — a PR-lane
|
||||
"base ack must be absent" check would red every open PR the moment one landed (the #2768
|
||||
shape #2789 exists to prevent). If you ever see the legacy file present on `next`, delete
|
||||
it; do not try to make it well-formed.
|
||||
shape #2789 exists to prevent), which means the job alerts **after** the merge and cannot
|
||||
stop the offending PR — that is why the collision error above has to teach the resolution
|
||||
too. If you ever see the legacy file present on `next`, delete it; do not try to make it
|
||||
well-formed. If the job names a spent fragment, run the `git rm` it prints — that is the
|
||||
whole remedy, and there is nothing to regenerate.
|
||||
|
||||
`npm run regen:derived` still exists for the artifacts that ARE committed and derived —
|
||||
`sync-manifest-versions`, the ADR index, the capability matrix, the inventory manifest,
|
||||
|
||||
Reference in New Issue
Block a user