Repository navigation
fix(ci): make the mirror-mode fold land and the promote reset safe - #1507
Merged
Merged
Conversation
…ture The render pins assert the steps EXIST; they cannot assert they work, which is how a newline-joined FILE_PATHS (#1502) and a mis-authenticated force-push (#1503) both shipped green. Extract the rendered run blocks and execute them against a throwaway repo whose origin is a local bare clone. Refs: #1502, #1503
commit-action parses FILE_PATHS as comma-separated and exits 0 with "No files to commit" when nothing resolves, so the newline-joined list folded nothing while every step stayed green. Build the list from the staged diff with NUL framing (also correct for spaces and renames) and assert the release branch actually carries the archive afterwards. Refs: #1502
…rchive Checkout's persisted extraheader outranked the token embedded in the push URL, so the force-push ran under the default Actions identity and 403'd against contents: read. Generate the App token first and check out with it. The push is now also gated on main actually carrying every archive path the mirror holds, so a broken or skipped fold degrades to a stale mirror instead of deleted snapshots. Refs: #1503
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the two mirror-mode release defects surfaced by
vig-os/org-configv1.1.0— together, a data-loss path. They ship as one PR deliberately: both live in
the same
MANIFEST_SYNC_TARGETrendering block ofassets/init-workspace.sh,and #1503 must not land ahead of #1502 (a working reset over a broken fold is
what deletes the archive). One PR makes that ordering unrepresentable.
Type of Change
fix-- Bug fixtest-- Adding or updating testsChanges Made
#1502 — the fold committed nothing, silently. The path list reached
commit-actionnewline-separated; the action splitsFILE_PATHSon commas, sothe whole blob was one nonexistent path, and it logged
No files to commitandreturned success. The job printed "Folding 92 mirror archive path(s)" and the
release branch never moved.
git diff --cached --name-only -z. Thetrruns inside the pipeline because command substitution drops NUL bytes.
git status --porcelain | awk '{print $2}': porcelain C-quotes pathscontaining spaces, and renders renames as
R old -> new(awk took the oldpath).
FILE_PATHS, so the step nowfails loudly on one instead of mis-splitting it.
Re-pull release branch after foldis nowRe-pull release branch and verify the fold landed: it asserts thepost-condition (the release branch carries the mirror's archive) rather than
trusting the action's exit code. Deletions still don't propagate — archives
only grow — so a release-only path is tolerated.
#1503 — the reset 403'd, and would have deleted the archive if it hadn't.
The job embedded the Commit App token in the push URL, but
actions/checkoutpersists its own credentials as
http.<host>.extraheader, which outranks URLuserinfo. The push ran under the default Actions identity against
contents: read→ 403 on every mirror-mode consumer, after the release wasalready published.
the fetches and the push carry the App identity.
contents: readstaysdeliberately — there's an inline comment saying so, since granting
contents: writewould "fix" a future 403 by silently moving mirror resets tothe Actions identity.
persist-credentials: falsealone (the issue's suggested one-liner)would have fixed the push but broken the job's
git fetchon privateconsumers, which have no anonymous read. Checking out with the App token
fixes both halves and matches how
release-core.ymlalready does it.Verify main carries the mirror archivestep that asserts main holds everydocs/issues/docs/pull-requestspath the mirror carries. Otherwise itskips with a
::warning::— a stale mirror self-heals at the next nightlysync; deleted snapshots do not. The step's "a force reset loses nothing"
comment is now true by construction.
Changelog Entry
(Full entries in
CHANGELOG.mdunder## Unreleased→### Fixed.)Testing
just test,just test-bats,prek run --all-files)Both defects passed review and CI because the only tests over this code are
render pins — they assert the steps exist, never that they work. That is the
part worth fixing structurally, so this PR adds
tests/bats/release-mirror-fold.bats(11 tests), which extracts the renderedrun:blocks and executes them against a throwaway repo whoseoriginis alocal bare clone: real
git fetch/checkout/diff, real$GITHUB_OUTPUT, nonetwork. The fixture mirrors a consumer mid-release, including a spaced path and
a mirror-side rename.
Only the two steps that genuinely need GitHub are uncovered —
commit-actionitself and the force-push — which is exactly why both are now gated on a
locally verifiable precondition instead of trusted.
RED-before-GREEN, against the unfixed renderer:
All 11 green after the fix, as are the 6 mirror render pins (incl. the existing
actionlintpass over the rendered workflows) and the full 524-test bats suite.Manual Testing Details
just testreports two failures on this host, both environmental and unrelated:test_image.py::test_manifest_filescomparesCHANGELOG.mdagainst the copybaked into the locally-built image (stale by construction after any changelog
edit; the local mirror at
assets/workspace/.devcontainer/CHANGELOG.mdisbyte-identical), and
test_integration.py::test_github_cli_authenticationfailson a missing
dbus-launchin the container. 931 passed.Checklist
defect fix inside an already-documented mechanism ([FEATURE] sync-issues mirror mode: sync + fold the snapshot archive into the release branch at finalize, reset the mirror after promote #1424)
CHANGELOG.mdin the[Unreleased]sectionAdditional Notes
Rollout. These steps are rendered at scaffold time, so the fix reaches
vig-os/org-configonly through adevkit-upgradeadoption PR after the nextrelease. That is safe to wait for: with the 403 still in place, nothing is
deleted — the 403 is currently the only reason org-config's 55 issue files still
exist.
Adjacent, deliberately not fixed here. The
floating-tagsjob in the basepromote-release.yml(:669) has the identical shape — token in the push URL,default checkout,
contents: read— so its comment about pushing "as the ReleaseApp EXPLICITLY" looks unenforceable in practice. It is a different job and a
different token, out of scope for these two issues; happy to file it separately.
Refs: #1502, #1503