Repository navigation
ci: gate releases on executed candidate artifacts - #99
Conversation
The release workflow built Rust assets and then published npm from the source tree: nothing that shipped had ever been installed or run. The macOS arm64 asset was never executed at all, and `strip` invalidates the ad-hoc signature Apple silicon requires, so it may not have run. Publishing now depends on two smokes over the exact candidate artifacts. `scripts/candidate-smoke.sh` installs only the packed npm tarball and the built Rust asset into an isolated home and checks all three command versions, Flutter detection, `doctor`, `init` dry-run isolation, `init` idempotency, a real Dart MCP handshake, evidence recording, an unchanged project tree, and an untouched real home. It runs in a clean Flutter container and on an Apple silicon runner, and both upload bounded logs and evidence. The publish job publishes the same tarball the smokes installed, and it is the only job holding write or OIDC permissions: a dispatch without the exact release tag in `confirm` has nothing to publish with. Also: re-sign the macOS asset after `strip`, document and enforce the signing/notarization policy, make the checklist version-parametric, and keep UNRELEASED.md publishable rather than a drafting scratchpad. Closes #97 Refs #89
|
CI evidence, run 33930949301: both gates green, including a real Apple silicon run. macOS ( Linux container: same script and checks, plus the candidate npm tarball install and all three command versions. The first CI run caught a real bug in the gate: on macOS Evidence artifacts: |
|
Heads-up on the red The same test passed on the previous run of this branch (33930675933), and the only commit since then ( I have not re-run it, to avoid masking. Deciding whether to re-run or to fix the flake first is the owner's call. |
Review findings on #99. Each one is a way the gate could pass, hang, or publish something other than what was smoked. - The MCP handshake now rejects on its own timeout, on spawn failure, and on child exit, and terminates and reaps the server it spawned. It previously only SIGKILLed the child and waited forever on a Promise that nothing could reject, so a hung server held a confirmed publish until GitHub's job timeout. Pinned by test/release/mcp-handshake-timeout.test.ts against real servers that never answer, answer once, or die. - The checklist selects the release run by event, branch, and head SHA instead of `--limit 1`, which could watch step 7's dry run after a tag push, exit green immediately, and send step 9 at a draft that did not exist. It also reads each smoke summary from its own artifact subdirectory, where `gh run download` actually puts it. - Sourcemaps are uploaded from inside the verified tarball, unmodified. Injecting debug IDs into a copy of `dist` after the smokes had installed the packed tarball meant Sentry held maps for bytes npm never received. - The publish job refuses a GitHub release that is no longer a draft, so a re-run or second dispatch cannot replace public assets. The checklist already forbade this; the job now enforces it. - The version must be semver and a tag must be `v<semver>` before either reaches a tarball name, a container environment, or a workflow output. - The PR smoke runs for every input that can change the packed bytes: the CLI bundles all workspace packages, so `bun.lock`, the root manifest, the TypeScript build config, and `packages/**` all belong in the filter. - The Linux gate's container is pinned by image digest and its Node.js by version and checksum, instead of a floating tag plus a remote setup script piped into a root shell. - Both gates checksum every artifact before using it. The npm tarball is verified where it is installed and re-verified afterwards, not only in publish, long after the smokes have run. Permissions and candidate identity are unchanged: the workflow default stays `contents: read`, only publish holds write and OIDC, and the tarball that is packed once is the one smoked and published. Dropping the unused `candidate/dist` copy removes the last second copy of those bytes.
Pinning the image by digest was right; fetching a Node.js into it was not. The bootstrap (apt update, apt install, a nodejs.org download) took 22 of the gate's 24 minutes on the runner, and the PR filter now sends far more pull requests through it. None of it was necessary. The pinned image already ships curl, tar, xz and CA certificates, and the runner is the same Ubuntu 24.04 (glibc 2.39) as the image, so its Node is mounted read-only at /opt/node and the container installs and downloads nothing at all. The smoke refuses to run if that mount is not the expected Node major. The checklist keeps downloading a pinned, checksummed Node for its local run, because a maintainer's machine is not the runner. That difference, and how to refresh the pin, are now written down next to the command. Locally, against the pinned image: the full smoke runs in 13s, and a Node 20 mount is rejected.
|
Review findings from
Least privilege and candidate identity are unchanged: default Verification: actionlint and shellcheck clean; typecheck, lint (complexity 15 / depth 4 / 100-line), 105 test files / 1318 tests, build, All 10 checks pass on #103 is still a dependency: |
Closes #97
Refs #89
What was wrong
release.ymlbuilt the Rust assets and then published npm straight from the source tree. Nothing that shipped had ever been installed or executed: the alpha.1 macOS arm64 asset was never run, and the "clean Linux smoke" was a local substitute, not a gate.stripalso invalidates the ad-hoc signature Apple silicon requires, so a stripped arm64 asset can fail to execute at all — exactly the class of defect the old ordering could not catch.What this does
One smoke script, two real environments.
scripts/candidate-smoke.shinstalls only candidate artifacts — the packed npm tarball and the built Rust asset, through the publicscripts/install.sh— into an isolatedHOME/PICKFORGE_HOME, then asserts:pickforge --version,pickforge-lab --version, andpickforge-mcpthrough a real MCPinitialize, since it has no--versionflag)doctor(a clean image has no agent harness; that one gap is tolerated, every other check must pass, anddoctormust exit non-zero rather than claim readiness)init --dry-runwrites nothing (home and state snapshots compared byte for byte)initapplies the Flutter integration, and a secondinitchanges nothing and rewrites no fileinitgenerated (initialize,notifications/initialized,tools/list)evidence recordlands underPICKFORGE_HOME, never in the project, with a planted token redacted and the artifact hash matching its copyflutter createproduced, with no Pickforge stateLinux gate: the script runs inside
ghcr.io/cirruslabs/flutter:stableagainst the candidate tarball andpickforge-linux-x86_64.macOS gate:
macos-14, assertsuname -m = arm64, verifies the exact asset's checksum, enforces the signing policy, executes the binary, and runs the same workflow with isolated homes. The Rust CLI only — the TypeScript lab stays Linux-only and is not installed there.Ordering and permissions.
publishneeds both smokes plus the lab and Rust gates, and publishes the same tarball the smokes installed. The workflow default iscontents: read; onlypublishgetscontents: writeandid-token: write, and it only runs whenresolvesays so: a tag push matching the package version, or a dispatch whoseconfirmis exactlyv<version>onmain. A dry run therefore has no token to publish with, not just a skipped step.macOS signing, honestly. The asset is re-signed ad-hoc after
strip, andscripts/smoke/macos-asset-policy.shfails the gate if reality drifts fromdocs/releases/SIGNING.mdin either direction: arm64-only, ad-hoc signature that verifies, not notarized.docs/releases/SIGNING.mdrecords the decision (ship unsigned for the 0.4 train; integrity from checksums and npm provenance) andINSTALL.mddocuments the browser-download Gatekeeper workaround.Docs.
docs/releases/CHECKLIST.mdis now version-parametric (export VERSION=...) and reusable, with the one-time npm/trusted-publisher steps moved to a recovery appendix.scripts/check-release-versions.mjsis the single version-consistency gate shared by the workflow and the checklist.docs/releases/UNRELEASED.mdno longer carries drafting instructions or a "updated during release preparation" placeholder; it is publishable text passed togh release create --notes-file, anddocs/releases/TEMPLATE.mdplus checklist step 11 close the lifecycle.Evidence
The Linux smoke was run end to end locally against real candidate artifacts (
npm packofpackages/cliplus a strippedcargo build --releaseasset) in the clean Flutter container. It passed: three versions verified,doctorreporting only the harness gap,initidempotent, a realdart mcp-serverhandshake returning 13 tools, evidence recorded under the isolated state root, project tree unchanged, real home untouched. A negative control with a tampered.sha256fails at asset verification, as it should. Full logs:~/Projects/Boards/pickforge/0.4-release/candidate-smokes/.Local gates:
bun run typecheck,bun run lint,bun run test(1229 passed, 4 skipped),bun run build,cargo fmt --check,cargo clippy -- -D warnings,cargo test --workspace --locked,PICKFORGE_LIVE_FLUTTER=1 cargo test --test live_flutter,complexity-gate check --changed(no FAIL; the two shell scripts are UNVERIFIED — no grammar for.sh), shellcheck and actionlint clean.Not done here
candidate-smokes-pr.ymlruns the whole candidate pipeline on this PR, so CI exercises it before merge.workflow_dispatchdry run was triggered: a dispatch runsrelease.ymlfrommain, which is still the old workflow that carriescontents: writeandid-token: writeon its only job. That would prove nothing about this change while granting publish permissions. After merge, the owner can dry-run it with checklist step 7 (gh workflow run release.yml --ref main -f confirm=).npm publish <tarball> --provenanceis the one step no gate can exercise before a real publish. The workflow comments say what to do if npm ever rejects it: fix the workflow, never fall back to publishing a rebuilt, unsmoked tree.