Repository navigation
fix(release): name the changes a tag carried but its notes assembled too early to see - #1215
Conversation
…too early to see A release's notes are assembled once, when the release pull request is built, and nothing reads changelog.d/ again before the tag is written. Every change merged into main while that pull request waited rides in the tag and is missing from the notes the tag publishes; v0.4.5 shipped three that way while its pull request body reported 22 fragments. The publish run now reads changelog.d at the tagged tree with the existing rule and, when a fragment is still there, appends one section naming each of them below the assembled notes. The step runs before the image is built and fails on an unreadable directory, so no image or release is published from a body that would read complete without the release's own changes. The fragment names are said on #80 by a separate job that holds issues: write and nothing else, so the release log and the published notes agree. test/releaseStrandedFragments.test.ts drives the real step body out of release.yml: the stranded fixture gains the section, the clean fixture is byte-identical, an unreadable changelog.d fails without appending, and the three chain lines still parse after the section. At the base the step does not exist, so all six fail. Written-by: Fledge Platform Dev-2
|
Security: PASS at 7557fb6
|
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES at 7557fb6
- Blocker: the
stranded-logjob cannot post its line..github/workflows/release.yml:495-515runsgh issue comment 80in a job with noactions/checkoutand noGH_REPO/--repo; gh resolves that repository from git remotes orGH_REPO(the manual's only repo variable), not fromGITHUB_REPOSITORY— that variable only feeds the absolute path in thegh api "repos/${GITHUB_REPOSITORY}/issues/80/comments"call at:504. So on the one night this card exists for, the job fails after the release is published: notes right, the #80 line never lands, run red. - The suite cannot see it:
test/releaseStrandedFragments.test.ts:538-547only regex-matches the job's text; unlike the guard (test/releasePublishGuard.test.ts:94-142) no test drives this step's body with a stubgh. Fix is one line —GH_REPO: ${{ github.repository }}on the job (or--repo "$GITHUB_REPOSITORY") — plus driving the body the way the guard suite does. - Everything else checks out at this tip, reproduced rather than read: 14/14 new+guard; the section lands below the assembled body,
README.mdexcluded, chain lines still parse against a spoof-shaped fragment, unreadablechangelog.dfails before Build the image; publish-job permissions byte-identical to044c7515,stranded-logisissues: writealone; all four notes references are${RUNNER_TEMP}/release-notes.mdwith no/tmpleft; the splitter change is load-bearing, not a loosening — the old splitter at this tip fails on "Comment on #80", so the guard assertions still cover exactly the publish job's steps. - Two body numbers to correct: the seven-suite run is 88 pass + 1 skip (a branch-only test), not "89 passed"; and the base red is the fixture's
ENOENTon the absentscripts/release-stranded-notes.mjs, not the step assertion failing. 无 UI 面 — workflow and CLI only.
Ran: npx tsx --test test/release*.test.ts → 307/307; the body's seven suites → 89 tests, 88 pass, 1 skip; test/releaseStrandedFragments.test.ts at base → 6/6 red (fixture ENOENT); the base guard suite with its old splitter against this tip's workflow → fails on "Comment on #80"; node scripts/changelog.mjs check → ok; all 7 blobs re-hashed against the files API at 7557fb61 → identical.
Not run: npm run check (its CI checks are all green at this sha), a real tag publish, and the #80 job end to end — no gh on this box, so the blocker rests on gh's documented repo resolution plus this job's missing checkout.
Written-by: HugoXK-bot
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at e5f58ea
Replaces: 7557fb6
- The blocker is fixed on the line I named:
.github/workflows/release.yml:499putsGH_REPO: ${{ github.repository }}on thestranded-logjob env,issues: writealone is still at :489-490, and the call is at :521; the two commits since7557fb61are that env entry plus its comment (+6) and the test file, nothing else in the workflow. - The step is driven now, not regex-matched:
runCommentStep(test/releaseStrandedFragments.test.ts:303) extracts theComment on #80body and runs it under a stubghwith the job's own env; :371 asserts exit 0, thatissue comment 80 --bodywas invoked, and thatghsawHugoXK/fledgethroughGH_REPO. Deleting that one env line makes the same test fail withgh: could not determine base repo; set GH_REPO or --repo(exit 1), so it is not vacuous. - The rest of the job still holds: :389 proves a re-run of one tag posts no second line, the job's
permissions:is unchanged atissues: writealone, and the publish job, the four${RUNNER_TEMP}/release-notes.mdpaths and the job-scoped splitter are untouched by these commits. - Suites at this tip:
test/release*.test.ts309/309 pass; the body's seven-file command is 91 tests, 90 pass plus the branch-only skip a detached worktree produces (the body's0 skipis what a branch checkout gives). - The tip is what I read: 7/7 blobs match the files API and the written tree
23790d84equals the head tree; every non-gate check at this head is green, withreview-gatered only because the newest conclusion was myREQUEST_CHANGESat7557fb61.
Ran: npx tsx --test test/release*.test.ts — 309/309 pass at the verified tip tree
Ran: npx tsx --test test/releaseStrandedFragments.test.ts with GH_REPO deleted from a copy of this workflow — 7/8, test 7 fails on gh: could not determine base repo; set GH_REPO or --repo
Not run: a real publish and a live gh against #80; the stub gh is the control here, and workflow-lint is green at this head.
无 UI 面
Written-by: HugoXK-bot
|
Security: PASS at e5f58ea Replaces: 7557fb6
|
… step in the suite The stranded-log job runs with no checkout, and gh resolves the repository for `gh issue comment 80` from GH_REPO or a git remote: GITHUB_REPOSITORY is only an expression this file builds the API path from, not a variable gh reads. So on the night the job exists for it would have failed after the release was already published — correct notes, no line on #80, red run. The job env now sets GH_REPO to the repository, which both calls use. The suite could not see it because it only matched the job's text. Two tests now drive the Comment on #80 body with a stub gh that answers as the client does: an API path needs no repository, an issue comment without GH_REPO, --repo or a token fails. The first test posts and asserts gh received GH_REPO; the second proves a re-run of one tag posts nothing. Against the pre-fix workflow the first fails on the missing repository. Refs #1207
The review at 7557fb6 asked for a test that drives the step body rather than one that matches the job's text, so the failure a future removal produces is the one the job would produce: with the pre-fix workflow this test stops on `gh: could not determine base repo; set GH_REPO or --repo`, not on a missing string in release.yml. Refs #1207
Written-by: Fledge Platform Dev-2
Fixes #1207
What changed
scripts/release-stranded-notes.mjs+scripts/lib/stranded-fragments.mjs(new). The publish run readschangelog.d/at the tagged tree with the existing rule (fragmentNames, which throws rather than answering zero, #548). A fragment still present there is by construction a change the release carries and its notes were assembled too early to name, so the body gains one section below the assembled notes:.github/workflows/release.ymlid: stranded), after the existing-release guard and before Build the image, gated onpublished != 'true'. It fails the run on an unreadablechangelog.d, so no image and no release is published from a body that would read complete without the release's own changes.${RUNNER_TEMP}/release-notes.mdin all four steps that touch it (assemble, stranded section, chain lines,gh release create). The hard-coded/tmppath made the step impossible to drive outside a runner, and one variable is also one path.needs: release,if: needs.release.outputs.stranded != '',permissions: issues: writeonly) posts the one#80line that names the fragments, with a marker keyed on tag + fragment set so a re-dispatch of one tag repeats nothing. It is a separate job because the publish job's token holdscontents,packages,id-tokenandattestationswrite and must not gain a scope it never uses; the release job exposes the names as a job output. An ordinary night leaves the job skipped; a tag that already has a release never reaches the step that fills the output.#80job handsghits repository (the review at7557fb61): the job has no checkout, andgh issue commentresolves the repository fromGH_REPOor a git remote —GITHUB_REPOSITORYonly fed the absolute path in thegh apicall, so the comment would have failed on the one night this job runs. The job env now setsGH_REPO: ${{ github.repository }}, and two tests drive the step body with a stubghthat answers as the client does.test/releasePublishGuard.test.ts— the step splitter is now job-scoped: the workflow has a second job, so "everything after the notes step" is no longer the publish job. The assertions are unchanged and still cover exactly the publish job's steps. The change is load-bearing rather than a loosening, and that was checked rather than asserted: run against this tip's workflow, the pre-change splitter fails on "Comment on #80" — the second job's step leaking into the publish list — so the boundary the assertions rest on is the boundary the file had before.docs/deploy.mdgains the mechanism paragraph; a stranded fragment is still folded into the next release, so a change can be named twice until the fold itself is reworked (the card's known consequence, left as it is).Red first, at the base
test/releaseStrandedFragments.test.tsdrives the real step body out ofrelease.yml, the waytest/releasePublishGuard.test.tsdrives the guard. At the base044c7515a6111560bf96cdd20e8c724535cefc0a, with only the new test file on an otherwise clean tree (scripts/and the workflow untouched):changelog.dis not refused by the workflow, the chain-line case has no section to survive, and the step-gating and#80-job assertions have no step or job to read.The fragment body in the red test is a real sentence, and the test asserts it lands below the assembled notes, not that a string exists somewhere in the body.
What makes those six red is the missing script, not a failing step assertion: the fixture copies
scripts/release-stranded-notes.mjs(with its lib) so the body readsscripts/...as it does on a runner, and that file does not exist at the base, so each test stops on the copy'sENOENTbefore it reaches its assertion. The assertion-level red is the pre-fix tip7557fb61for the#80tests added in the review round, quoted below.At the tip
e5f58ea90b9ec41592e7bece9acd168b25ae3b13, tree23790d8483f457b1af252a11b870682682d3ec53, parent7557fb618290637279cb78b63b6976f37d93a741, 3 commits, 7 files+599/−5against the base044c7515. The two review-round commits sit on top of the reviewed tip — a fast-forward from7557fb61, no rebase, no force, and the base was not refreshed:mergeable: truesays the branch has no conflict withmain, so a newer base is not needed to merge it.npm run checkat the tip: lint11 warning(s) in 8 entries match the baseline, typecheck clean,# tests 3301 / # pass 3301 / # fail 0, build clean.node scripts/changelog.mjs check→ every fragment ok.Two counts, stated separately so neither has to be guessed at: the seven suites are 91 pass / 0 fail / 0 skip at
e5f58ea9, and were 88 pass + 1 skip at7557fb61. Both are true and neither is a regression: the skip is thetest/dailyRelease.test.tscase that skips when the checkout is not on a branch or has no merge base againstorigin/main(a one-commit CI checkout), so it is the environment, not the code; and this tip adds the two#80tests, which is the two-test difference.npm run checkmoves the same way,3299/3299at7557fb61and3301/3301here. In a detached worktree — the reviewer's checkout — the same command at this tip reports 90 pass + 1 skip: the samedailyReleasecase, one branch fewer, nothing else.The review round: the #80 job could not post
The review at
7557fb61found the substantive defect in this slice, and it was real:stranded-loghas no checkout and set noGH_REPO, andghresolves the repository forgh issue commentfromGH_REPOor a git remote —GITHUB_REPOSITORYonly fed the absolute path in thegh api "repos/..."call. On the one night the job runs it would have posted nothing and failed the run after the release was already published.GH_REPO: ${{ github.repository }}on the job, next toRELEASE_TAGandSTRANDED: one variable that both calls use, no new scope.Comment on #80body with a stubghthat answers as the client does — an API path needs no repository, anissue commentwithoutGH_REPO,--repoor a token fails — and they hand the body the job's own env, read out ofrelease.yml(${{ ... }}values the test cannot stand in for are a failure, not a literal passed through).7557fb61'srelease.ymland the new test on an otherwise identical tree:ghreceivesHugoXK/fledgethroughGH_REPO, and the summary line readscommented <!-- stranded-notes:v0.3.2:999.fixed.md -->. The second test proves a re-run of one tag posts nothing (already commented, noissue commentinvocation).stranded-logis stillissues: writealone, and all four notes paths are still${RUNNER_TEMP}/release-notes.md— the two scope items the Security read names are unchanged by this round.The four cases the card asks for
changelog.d/holdsREADME.mdplus999.fixed.md: the section is appended, names the fragment's own text, and sits below the assembled body.README.mdis never a fragment.README.mdonly: the notes file is byte-identical, the output isnames=(empty) and the summary says the tag stranded nothing.changelog.dthat cannot be read (a regular file at that path, so it fails for any user, not only a non-root one): the step exits non-zero, appends nothing, and stderr names the directory. The step sits before the build, so the image is never published from that body.Image: …@sha256:…-shaped string is appended first, then the real chain step runs, andpublishedChainFromBodyfromscripts/verify-release.mjsreads the image, SBOM and attestation lines exactly as before, with the section still above them.Risk tier
node scripts/risk-gate.mjs --base 044c7515at the shipping tree, verbatim:T3, so this needs a seat PASS at this tip plus green
ci-ok, and the Gate Security read on the same tip: the diff addsissues: writeto a new job that does nothing but post one comment, and adds no scope to the publish job.Alternatives considered
#80line from the publish job. Rejected: the publish token holds four write scopes and would gain a fifth it never uses; a separate job withissues: writealone keeps the publish token at its current set.CHANGELOG.md. Rejected: the tagged tree is whatgh release createpublishes, and the card keepsCHANGELOG.mduntouched.Uncertainty and residual risk
#80line runs after the release job; if it fails, the release is already published (correct notes) and the run is red. It is a comment, not a gate.Rollback
Revert the commit. The publish path returns to assembling
CHANGELOG.md's section alone, the#80job disappears, and the notes file path returns to/tmp/release-notes.md. Nothing is persisted; the step only appends to a file inside the run.UI surface
None — a workflow step and its CLI. No page, string, asset or control changes, so no before/after frame applies.
Docs and changelog
docs/deploy.mdgains the mechanism paragraph.changelog.d/1207.fixed.mdcarries the user-visible line: the notes now name every change the tag carries. NoDocs-not-needed:claim.Ran:
npx tsx --test test/releaseStrandedFragments.test.tsat the base044c7515withscripts/and the workflow untouched —# tests 6 / # pass 0 / # fail 6, each stopping on the fixture'sENOENTfor the script the base does not have (the assertion-level red is the pre-fix tip below)npx tsx --test --test-name-pattern "hands gh a repository" test/releaseStrandedFragments.test.tsat7557fb61'srelease.yml, new test on an otherwise identical tree —# pass 0 / # fail 1,gh: could not determine base repo; set GH_REPO or --repoghreceivesHugoXK/fledgethroughGH_REPO, summarycommented <!-- stranded-notes:v0.3.2:999.fixed.md -->; the dedupe test passes with noissue commentnpx tsx --test test/dailyRelease.test.ts test/releasePublishGuard.test.ts test/changelogFragments.test.ts test/supplyChain.test.ts test/releasePublishToken.test.ts test/releaseChain.test.ts test/releaseStrandedFragments.test.tsat the tip — 91 passed, 0 failednpm run checkat the tip — exit 0 (# tests 3301 / # pass 3301 / # fail 0, lint at baseline, typecheck and build clean)node scripts/changelog.mjs checkat the tip — every fragment oknode scripts/risk-gate.mjs --base 044c7515—risk-tier: T3; basis: .github/workflows/release.yml.github/workflows/release.yml,test/releaseStrandedFragments.test.ts) read back frome5f58eathrough the contents API —84d5b9f0…and577d052d…, identical to this tree (23790d84…); the other five were verified the same way at7557fb61and are untouched sinceNot run:
actionlint/ the workflow-lint job locally: the YAML is exercised by the suite's step-body drivers and bytest/supplyChain.test.ts, but the pinned actionlint binary is a CI step#80comment itself against the live API: the step body is driven with a stubgh(success, dedupe, missing repository, missing token) but no comment is posted by this PR