Skip to content

ci(release): release the start commit even after the branch moves - #481

Merged
nixuuu merged 1 commit into
devfrom
ci/release-pinned-sha
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
ci/release-pinned-sha

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026

Copy link
Copy Markdown
Member

Release currently abandons its starting commit when the branch advances before planning or during CI. This keeps nightly (dev), beta (next) and stable (main) on EXPECTED_SHA, including a manual dispatch whose expected_sha is an older ancestor. Later commits remain for the next run.

Design

  • Fetch the release branches, tags and semantic-release notes. Check that checkout equals EXPECTED_SHA and that it remains an ancestor of the freshly fetched release branch. Recheck ancestry immediately before pushing release refs.
  • Run semantic-release 25.0.9 against a disposable local bare mirror with only the current branch ref pinned to that SHA. Its supported repositoryUrl option allows the normal push-access/up-to-date checks to succeed without modifying semantic-release internals. Keep its analyzer, version calculation, tag format and channel notes, including promotion behavior.
  • Disable the GitHub plugin for this invocation because it derives owner/repo from repositoryUrl and verifies access even in dry runs. Generate the same Angular notes with the real repository URL so compare/commit links remain correct. After CI, atomically push only the new tag and changed notes to origin, then create a GitHub draft through the API with the same name, notes and prerelease flag. No branch is pushed. addChannel: [] and publication through the existing asset verification stages remain intact.
  • Keep the whole-workflow release-${ref} concurrency lock with cancel-in-progress: false. It covers the gap between planning and tagging, so another run of the same branch cannot plan until the current run finishes and its tags/notes are available. EXPECTED_VERSION and “Same version as planned” still refuse a changed version before publishing.
  • Pin every Release/CI checkout, image revision, manifest, upload and stable back-merge to the selected SHA. Pass the released SHA to the separate Mobile release workflow through a per-run release-revision artifact; workflow_run.head_sha alone is insufficient for a dispatch of an older commit. Preserve bootstrap, manual stable tags, no-release skips and cancellation after failed checks.

Verification

  • bun install --frozen-lockfile — passed.
  • TMPDIR=/var/tmp bun test scripts/release.test.ts — 14 tests passed. Real local git fixtures cover branch movement before planning and during checks for all three channels, exact tag targets, consecutive numbering, remote branch preservation, persisted notes, pinned draft content, planned-version rejection, rewritten history and the full nightly → beta → stable promotion cycle. Draft creation is injected; no GitHub release is created.
  • Promotion tests (scripts/promote.test.ts, scripts/promotion-policy.test.ts, scripts/promotion-attribution.test.ts) — 48 tests passed.
  • scripts/mobile-release.test.ts — 17 tests passed; scripts/release-upload.test.ts — 10 tests passed.
  • bun run typecheck, subsequent scripts-only TypeScript check, bun run lint, bun run format:check, and actionlint 1.7.12 with ShellCheck 0.11.0 on all three changed workflows — passed. Full integration/build CI and real publication are left to GitHub; no E2E/live runs or Release dispatches were performed.

Risks and safe rollout verification

GitHub Actions scheduling, artifact handoff and real publication cannot be reproduced by these local fixtures. Existing tag/notes conflicts fail the atomic push without replacing refs. Changes on other release channels can still invalidate a planned version and fail safely. As before, a GitHub API failure after the git push can leave a tag without a draft. Mobile now requires the SHA artifact from its exact parent run; a pre-change Release still in flight will lack it and its mobile follow-up will fail closed.

After merge, observe the next naturally scheduled nightly. Record its starting SHA, then allow normal merges to land during checks. Confirm the release tag, manifest commit, image revision and Mobile checkout still identify the starting SHA; the GitHub release must remain a draft until all assets/feeds pass verification. Confirm the next scheduled run includes the later commits with the next nightly number. This needs no manual tag, force push, Release dispatch, or repository-settings change.

@nixuuu
nixuuu merged commit 080ecc9 into dev Nov 10, 2026
15 of 17 checks passed
@nixuuu
nixuuu deleted the ci/release-pinned-sha branch November 10, 2026 09:52
nixuuu added a commit that referenced this pull request Nov 10, 2026
The alias-checkout test can observe `threadReady` / `idle` before the
`createThread` command acknowledgment is persisted. Its final branch
switch can therefore correctly fail with “A thread is using this
directory.” This is a fixture readiness race: holding that
acknowledgment reproduced `idle` with a pending command and the exact
refusal; releasing it allowed the switch. No product lock remained held
after settlement.

Add a shared fixture wait for idle, terminal turns and acknowledged
admission commands, including checkout aliases without a worktree ID.
Also wait for the worktree inventory to stop reporting busy and, for
managed worktrees, provide a scan status. Reuse it in tree setup, branch
switching, lifecycle/automation cleanup and local/linked
external-worktree adoption. Poll only observations; branch-switch and
post-delete/settings cleanup assertions remain direct, with no sleeps or
mutation retries.

Validation:
- `thread-branches.test.ts`, sequential file runs: unchanged baseline
30/30; final version 30/30 (8 tests per run). The natural flake did not
reproduce in the baseline; the acknowledgment-gated diagnostic
reproduced its failure window. An earlier implementation also passed
30/30 before the external-worktree scan condition was corrected.
- All 67 tests in 11 other fixture-consumer files passed, one file at a
time, on the final version.
- `bun run typecheck`, `bun run lint`, `bun run format:check` and `git
diff --check` passed.
- Full-suite `check:tmp`, generation checks and web build were not run
locally in this focused verification scope.

Based on `dev` after #482 merged. CI evidence:
https://github.com/itsoltech/canopy/actions/runs/42792779962/attempts/1

Related: #481
Related: #482
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant