Skip to content

ci(release): rebuild the ncc bundle in prepare-release-extension.yml instead of by hand #157

Closed

Description

@c-vigo

The committed bundle dist/index.js on dev is stale again, for the third
time and for exactly the reason #130
described. Rather than land another one-off rebuild commit, move the rebuild
into the release pipeline's designated mutating extension point so it stops
recurring.

Current state

src/, action.yml and README.md are byte-identical to v0.3.2, but five
lock-file-maintenance PRs (#139, #143, #146, #148, #152) moved runtime
transitive dependencies that ncc inlines into the shipped bundle:

package v0.3.2 dev
@octokit/core 7.0.7 7.0.8
@octokit/request 10.0.13 10.0.16
@octokit/endpoint 11.0.4 11.0.5
@octokit/request-error 7.1.1 7.1.2
@octokit/graphql 9.0.4 9.0.5
content-type (via @octokit/request) 2.0.0 3.0.0

@vercel/ncc also moved 0.44.1 -> 0.45.0 (#142), so the bundler itself
differs. A clean just sync && just bundle from the current lock produces a
bundle that differs from the committed one (1 295 769 -> 1 295 957 bytes,
different SHA-256, one fewer webpack chunk as content-type 3.x is inlined
differently). npm audit is clean on both the old and the new lock, so this is
not a security fix — but it is a real change to the only artifact consumers of a
released tag execute.

Why it keeps happening

The enforcement we have is read-only. release-extension.yml's verify-dist
job rebuilds at finalize and fails the release, telling a human to go run
just bundle — a gate with no actuator. dist-check.yml is deliberately scoped
to pull requests into release/** and main, because gating dev made every
Renovate runtime-dep bump fail (#71), and nothing rebundles after lock-file
maintenance. So every release cycle inherits a stale bundle and needs a manual
rebuild PR before it can be cut.

Proposal

prepare-release-extension.yml is a devkit-seeded no-op whose own header names
this use case verbatim: "Replace this file to prepare the release branch before
the PR opens (e.g. rebuild + commit a generated artifact)."
It is
consumer-owned, so it survives re-scaffolds. The wiring in prepare-release.yml
already suits:

  • extension needs [validate, prepare] — runs after release/X.Y.Z exists and
    has been fast-forwarded onto the changelog-freeze commit.
  • secrets: inherit — it can mint the COMMIT_APP token and push to the
    write-protected release branch, the same bypass the freeze commit uses.
  • open-pr needs extension — the release PR opens after the rebuild, so
    Dist Check sees a fresh bundle on its first run and the PR diff shows the
    real shipped-artifact change.
  • rollback needs extension — a failed rebuild deletes the release branch,
    which erases the extension's commit. No new rollback machinery.

Replace the no-op with a job that resolves the toolchain from .vig-os (as
release-extension.yml does — toolchain inputs are not part of the
workflow_call contract), runs just sync && just bundle, and commits dist/
to the release branch only when it actually changed.

This turns the pipeline into build-then-verify: the extension produces the
bundle at prepare time, and verify-dist stays untouched at finalize as a
genuine backstop rather than the only gate. dev stays ungated, preserving the
#71 property.

Acceptance criteria

  • prepare-release-extension.yml rebuilds the bundle on release/X.Y.Z and
    commits it when it differs; no-ops cleanly when it does not.
  • dry_run is honored — rebuild and report, never write.
  • The commit is authored through vig-os/commit-action at its last released
    tag (not the un-rebuilt local dist/), matching how the changelog freeze
    commits.
  • The commit message passes this repo's own validate-commit-range gate.
  • release-extension.yml is unchanged and still verifies at finalize.
  • dist-check.yml triggers are unchanged — dev stays ungated.

Implementation notes

  • Commit type: .vig-os leaves DEVKIT_REFS_POLICY empty, which resolves to
    chore-optional — every type but chore requires a Refs: line. A bot
    rebuild has no issue to reference, so the commit must be chore(dist): ...,
    matching the existing chore: freeze changelog for release X.Y.Z. A
    build(dist): subject would fail the gate.
  • just sync already resolves to npm ci for a Node repo
    (justfile.project:65).
  • A bugfix PR landing on release/X.Y.Z after prepare can still restale the
    bundle. That is covered: 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.

Related

Activity

  1. added
    task
    on Sep 7, 2026
  2. c-vigo commented on Sep 7, 2026

    @c-vigo
    ContributorAuthor

    Re-verified against the branch base after #156 merged (01f5cd7), which added one more lock-file-maintenance PR to the window:

    Nothing about the proposal changes — the window just grew by one PR, which is exactly the recurrence this issue is about.

  3. c-vigo commented on Sep 7, 2026

    @c-vigo
    ContributorAuthor

    Delivered in #158 (merged to dev as c14c608) and exercised for the first time by the 0.3.3 cut — run 34099538885.

    Acceptance criteria, against that run:

    The point of the exercise: Dist Check passes on release PR #159. Before this change that gate would have failed on the stale bundle, and the cut would have needed a hand-written rebuild PR first — which is what happened at #130 and was accruing again here.

    Changelog synthesis also came out clean: no duplicate #138 entry (removed in the same PR), and the #### Dependencies block covers all six lock-maintenance PRs, all four devkit adoptions, and every dev-dep bump at its net delta.

  4. added a commit that references this issue on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions