Skip to content

ci(release): rebuild the ncc bundle in prepare-release-extension.yml - #158

Merged
c-vigo merged 2 commits into
devfrom
feature/157-rebuild-bundle-in-prepare-release
Sep 7, 2026
Merged

c-vigo merged 2 commits into
devfrom
feature/157-rebuild-bundle-in-prepare-release

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Replaces the devkit-seeded no-op in prepare-release-extension.yml with the use case its own header names: resolve the devkit toolchain, run just sync && just bundle on the freshly cut release/X.Y.Z, and commit dist/ when it differs.

The release pipeline only ever verified the bundle. release-extension.yml's verify-dist rebuilds at finalize and fails the release, telling a human to go run just bundle — a gate with no actuator — while dist-check.yml deliberately leaves dev ungated so Renovate runtime-dep bumps do not fail there (#71). Nothing rebundles after lock-file maintenance, so every cut inherited a stale bundle and needed a hand-written rebuild commit first. That is #130, and it had accrued again by #157.

Building here makes the pipeline build-then-verify: this job produces the bundle at cut time, and verify-dist becomes a genuine backstop rather than the only gate.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • .github/workflows/prepare-release-extension.yml (+157/-22)
    • resolve-toolchain job — self-resolves delivery mode and image from .vig-os at inputs.branch_sha, mirroring release-extension.yml and ci.yml, because toolchain inputs are not part of the workflow_call contract.
    • bundle job — mints the COMMIT_APP token scoped to permission-contents: write, checks out branch_sha with persist-credentials: false, runs just sync then just bundle.
    • Drift detection reads git status --porcelain -- dist/ rather than walking the dist/ directory, so the gitignored declaration byproducts under dist/src/ stay untracked — force-adding a bare directory walk is the release-core finalize commits the whole dist/ (force-includes gitignored tsc emit), re-tracking dist/src + *.tsbuildinfo every release devkit#1159 bug that chore(dist): untrack the gitignored dist/src byproducts left by the v0.3.0 finalize commit #134 had to clean up.
    • Commits only the paths git reports, and only when there are any, so a fresh bundle produces no empty-diff commit.
    • dry_run is honored on the only write (the call site already skips the whole workflow on a dry run, but the extension contract requires it).
    • The commit is made through vig-os/[email protected] — the last released tag, not the possibly-stale local bundle this job exists to refresh.
    • Commit subject is chore(dist): ...: .vig-os leaves DEVKIT_REFS_POLICY empty → chore-optional, so every type but chore needs a Refs: line and a bot rebuild has none to cite.
    • git_user_name / git_user_email are kept in the input contract but unused — the commit goes over the API, authored by the release App and signed by GitHub.
  • CHANGELOG.md — adds the entry under ## Unreleased → ### Changed, and removes the
    hand-written **Renovate dependency update** (#138) entry (see below).

Not touched: release-extension.yml (still verifies at finalize) and dist-check.yml (triggers unchanged, dev stays ungated).

Changelog Entry

Changed

  • The release pipeline rebuilds the action bundle instead of relying on a hand-written commit (#157). prepare-release-extension.yml — the devkit-seeded, consumer-owned no-op whose header names exactly this use case — now resolves the devkit toolchain, runs just sync && just bundle on the freshly cut release/X.Y.Z, and commits dist/ when it differs. It runs after the branch is fast-forwarded onto the changelog freeze and before open-pr, so the refreshed bundle is in the release PR diff from its first CI run and Dist Check validates it; rollback already lists extension in its needs, so a failed rebuild deletes the branch and takes the commit with it. release-extension.yml's finalize-time verify-dist is untouched and becomes a genuine backstop rather than the only gate, and dist-check.yml triggers are unchanged so dev stays ungated (#71). This removes the recurring manual rebuild that #130 fixed once by hand and that had accrued again: six lock-file-maintenance PRs moved @octokit/core, @octokit/request, @octokit/endpoint, @octokit/request-error, @octokit/graphql, content-type and undici — all runtime transitives that ncc inlines — while the committed bundle stood still.

(Full entry as committed in CHANGELOG.md.)

Also removed from ## Unreleased, in a separate commit:

- **Renovate dependency update** ([#138](https://github.com/vig-os/commit-action/pull/138))
  - Update `eslint` from `10.8.0` to `10.8.1`
  - Update `tsx` from `4.23.7` to `4.23.11`

It predates devkit 1.12.0's release-time synthesize-bot-changelog (vig-os/devkit#1423), which never touches hand-written entries — so v0.3.3 would have listed those bumps twice. Nothing is lost: a dry run of the synthesizer on this branch cites #138 for both its bumps, at their net deltas (eslint 10.8.0 → 10.10.0, tsx 4.23.7 → 4.23.13) rather than the intermediate versions that never shipped.

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

The workflow itself cannot run until a release is cut, so the evidence is for the premise and the statics:

  • Drift is real and reproducible. A clean npm ci && npm run bundle from the current lock, in a scratch checkout, produces dist/index.js at 1 295 957 bytes / faf8100f… against the committed 1 295 769 bytes / 625a5ee6… — different SHA-256, one fewer webpack chunk (content-type 3.x inlines differently), and the inlined @octokit/core / @octokit/request VERSION constants move.
  • Not a security fix. npm audit reports 0 vulnerabilities on both the v0.3.2 lock and the current one, with and without dev dependencies.
  • Test suite green against the current lock: 3 suites, 84/84 tests.
  • Changelog synthesis checked, not assumed. synthesize-bot-changelog --dry-run on this branch renders a #### Dependencies block covering all six lock-maintenance PRs, all four devkit adoptions, and every dev-dep bump — including both of the deleted build(npm): update npm dev dependencies #138 entry's bumps.
  • Statics: actionlint clean on the new workflow; full prek run --all-files green (yamllint, pymarkdown, shellcheck, typos, commit-message validation).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

  • No tests added: a reusable workflow has no unit-testable surface in this repo's jest suite. Its first real exercise is the v0.3.3 cut, where a failure deletes the release branch via the existing rollback → needs: extension wiring and costs nothing but a re-run.
  • Mid-train staleness is still covered. A bugfix PR landing on release/X.Y.Z after prepare can restale the bundle; Dist Check triggers on pull requests into release/**, and verify-dist remains the final net. release-core.yml's finalize pushes (changelog date stamp, synthesize-bot-changelog, the sync-issues commit) touch no source or lock file, so a bundle built at prepare time is still fresh at finalize.
  • Accepted consequence: dev's dist/ stays stale between releases, refreshed when sync-main-to-dev brings the release commit back. That is already true today, and consumers run tags rather than dev SHAs.

Refs: #157

Replace the devkit-seeded no-op with the use case its own header names:
resolve the devkit toolchain, run `just sync && just bundle` on the freshly
cut release/X.Y.Z, and commit dist/ when it differs.

The pipeline only verified before. release-extension.yml's verify-dist
rebuilds at finalize and fails the release, telling a human to run
`just bundle` -- a gate with no actuator -- while dist-check.yml deliberately
leaves dev ungated so Renovate runtime-dep bumps do not fail there. Nothing
rebundled after lock-file maintenance, so every cut inherited a stale bundle
and needed a hand-written rebuild commit first.

Building here makes it build-then-verify: this job produces the bundle at cut
time and verify-dist becomes a real backstop rather than the only gate.
dist-check.yml triggers are unchanged.

Drift is read from `git status` rather than a walk of dist/, so the gitignored
declaration byproducts under dist/src/ stay untracked, and the commit is made
through vig-os/commit-action at its last released tag rather than the
possibly-stale local bundle.

Refs: #157
…esis

devkit 1.12.0 replaced the per-PR Renovate changelog pipeline with release-time
`synthesize-bot-changelog` (vig-os/devkit#1423), which enumerates merged bot PRs
since the last stable tag and regenerates a `#### Dependencies` block coalesced
to the net delta per dependency. The hand-written entry predates that switch,
and the synthesizer never touches hand-written entries -- so v0.3.3 would have
listed the same bumps twice.

Nothing is lost: a dry run of the synthesizer on this branch cites #138 for both
its bumps, at their net deltas (eslint 10.8.0 -> 10.10.0, tsx 4.23.7 -> 4.23.13)
rather than the intermediate versions that never shipped.

Refs: #157
@c-vigo c-vigo self-assigned this Sep 7, 2026
@c-vigo

c-vigo commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

CodeQL alert #32 — dismissed as won't-fix

actions/cache-poisoning/poisonable-step (high) fired on the Resolve toolchain step. The API dismissal comment is capped at 280 characters, so the full rationale is recorded here.

This is the same construct as #30 / #31 in release-extension.yml, dismissed 2026-08-17, and #29 in setup-devkit-toolchain/action.yml. This workflow mirrors release-extension.yml deliberately, so it inherits the finding. Both limbs of the accepted rationale were re-checked against this job rather than assumed:

  1. The tainted input is train-computed, not dispatchable. branch_sha is needs.prepare.outputs.freeze_sha, which prepare-release.yml derives from a gh api read of refs/heads/dev after the freeze commit. That workflow's only dispatch inputs are version and dry-run; neither reaches branch_sha. Steering it requires push access to dev.
  2. There is no cache surface. No actions/cache anywhere under .github/actions/. This job passes no cachix-cache, and the cachix push step is gated if: mode == 'direnv' && cachix-cache != ''. setup-uv — the only other cache-writing action in the composite — is if: mode == 'bare', and this repo is direnv.

One difference from #30/#31, stated rather than papered over: unlike read-only verify-dist, this job writes — it commits the rebuilt bundle through an App token. That is not the cache-poisoning sink, and it sits behind the same trust boundary: reaching it at all requires the ability to dispatch a release.

No clean code fix exists. Resolving the toolchain from any ref other than branch_sha would be wrong on the merits — it must match the scaffold being released, which is exactly why release-extension.yml checks out finalize_sha. Avoiding the alert would mean diverging from the sibling workflow and reading .vig-os from the wrong ref.

Residual risk accepted.

@c-vigo
c-vigo merged commit c14c608 into dev Sep 7, 2026
14 checks passed
@c-vigo
c-vigo deleted the feature/157-rebuild-bundle-in-prepare-release branch September 7, 2026 08:13
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.

2 participants