Context
Leaf of epic #14483. Operator verdict (2026-07-02): the flat-root release-notes staging file cannot be committed because a prior-session unit test forbids it — and the test, not the flow, is the defect. Live demonstration: PR #14480's first head (8cdc5d0b6, the v13.1.0 notes draft at the flat root) failed unit solely on this guard.
Sweep: epic-reshape execution under live operator direction; latest-20 live sweep 14:42Z + no competing claim on this surface (the guard was authored via #13273/#13276 and has no open follow-up).
The Problem
test/playwright/unit/ai/buildScripts/release/PublishReleaseNoteOrphan.spec.mjs (second test) asserts resources/content/release-notes/ contains zero flat v*.md files at all times. But the release pipeline's own contract requires exactly that file pre-cut: buildScripts/release/publish.mjs:83-87 pre-flight ERRORS unless resources/content/release-notes/v{version}.md exists; :161-173 appends the atomic-hash line to it on dev; :210 creates the GitHub Release from it; :223-226 removes it itself post-release. The guard outlaws the pipeline's mandatory staging state — the designed flow (v13.0 lineage: the flat file lived on dev through a month of refinement PRs, #12695→#12924) is unrepresentable under green CI.
The test's actual defect class (from #13273): a flat file lingering after publish, duplicating its chunk-N mirror and double-listing the version in the release index/sitemap.
The Architectural Reality
- Guard:
PublishReleaseNoteOrphan.spec.mjs — test 1 (publish.mjs cleanup-ordering source assertion) and test 3 (releases.json leaf uniqueness) are correct and stay.
- Post-publish mirror:
GH_SyncService.runFullSync() re-materializes the published release under resources/content/release-notes/chunk-N/ with frontmatter; _index.json maps version → chunk.
- Known interplay (observation, NOT this leaf's scope):
buildScripts/docs/index/release.mjs scans the directory recursively including flat files, so a committed pre-cut staging file surfaces the unreleased version in releases.json when the docs index regenerates. Recorded for the epic; whether the index builder should skip flat files is a separate editorial/product call.
The Fix
Narrow test 2 to the defect class: a flat v{X}.md fails the guard iff version X already exists in the chunked record (presence in _index.json keys or a chunk-*/v{X}.md file). A staging file for a not-yet-published version passes; a lingering post-publish duplicate still fails. No production code changes.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback / Edge Case |
Docs |
Evidence |
PublishReleaseNoteOrphan.spec.mjs test 2 |
publish.mjs staging contract (:83-226) + #13273 defect class |
Orphan = flat file whose version is already chunk-mirrored |
Missing/unreadable _index.json → fall back to chunk-*/ directory scan |
Spec docblock updated to state the staging-window contract |
Spec green with a staging file present AND red with a simulated post-publish duplicate |
Decision Record impact
none — test-scope refinement restoring an existing pipeline contract.
Acceptance Criteria
Out of Scope
buildScripts/docs/index/release.mjs flat-file scan behavior (observation recorded above; separate call).
- Any publish.mjs change.
Related
Related: #14483 (parent epic), #13273 / #13276 (guard origin), #14480 (the PR this unblocks)
Origin Session ID: 8cf234b7-e698-47ca-99e2-bf865196b6aa
Retrieval Hint: release-note orphan guard staging window flat root chunk mirror refinement
Context
Leaf of epic #14483. Operator verdict (2026-07-02): the flat-root release-notes staging file cannot be committed because a prior-session unit test forbids it — and the test, not the flow, is the defect. Live demonstration: PR #14480's first head (
8cdc5d0b6, the v13.1.0 notes draft at the flat root) failedunitsolely on this guard.Sweep: epic-reshape execution under live operator direction; latest-20 live sweep 14:42Z + no competing claim on this surface (the guard was authored via #13273/#13276 and has no open follow-up).
The Problem
test/playwright/unit/ai/buildScripts/release/PublishReleaseNoteOrphan.spec.mjs(second test) assertsresources/content/release-notes/contains zero flatv*.mdfiles at all times. But the release pipeline's own contract requires exactly that file pre-cut:buildScripts/release/publish.mjs:83-87pre-flight ERRORS unlessresources/content/release-notes/v{version}.mdexists;:161-173appends the atomic-hash line to it on dev;:210creates the GitHub Release from it;:223-226removes it itself post-release. The guard outlaws the pipeline's mandatory staging state — the designed flow (v13.0 lineage: the flat file lived on dev through a month of refinement PRs, #12695→#12924) is unrepresentable under green CI.The test's actual defect class (from #13273): a flat file lingering after publish, duplicating its chunk-N mirror and double-listing the version in the release index/sitemap.
The Architectural Reality
PublishReleaseNoteOrphan.spec.mjs— test 1 (publish.mjs cleanup-ordering source assertion) and test 3 (releases.json leaf uniqueness) are correct and stay.GH_SyncService.runFullSync()re-materializes the published release underresources/content/release-notes/chunk-N/with frontmatter;_index.jsonmaps version → chunk.buildScripts/docs/index/release.mjsscans the directory recursively including flat files, so a committed pre-cut staging file surfaces the unreleased version inreleases.jsonwhen the docs index regenerates. Recorded for the epic; whether the index builder should skip flat files is a separate editorial/product call.The Fix
Narrow test 2 to the defect class: a flat
v{X}.mdfails the guard iff versionXalready exists in the chunked record (presence in_index.jsonkeys or achunk-*/v{X}.mdfile). A staging file for a not-yet-published version passes; a lingering post-publish duplicate still fails. No production code changes.Contract Ledger Matrix
PublishReleaseNoteOrphan.spec.mjstest 2:83-226) + #13273 defect class_index.json→ fall back tochunk-*/directory scanDecision Record impact
none — test-scope refinement restoring an existing pipeline contract.
Acceptance Criteria
v*.mdwhose version has no chunk mirror (the staging state)v*.mdcoexists with its chunk-N mirror (the #13273 orphan class) — proven via a temp-fixture case, not by committing a real orphanResolvesthis leaf andRefs#14483Out of Scope
buildScripts/docs/index/release.mjsflat-file scan behavior (observation recorded above; separate call).Related
Related: #14483 (parent epic), #13273 / #13276 (guard origin), #14480 (the PR this unblocks)
Origin Session ID: 8cf234b7-e698-47ca-99e2-bf865196b6aa
Retrieval Hint:
release-note orphan guard staging window flat root chunk mirror refinement