Skip to content

Verify the sidecar came from this workspace - #4

Merged
stuffbucket merged 4 commits into
mainfrom
ci/verify-sidecar-provenance
Aug 18, 2026
Merged

stuffbucket merged 4 commits into
mainfrom
ci/verify-sidecar-provenance

Conversation

@stuffbucket

Copy link
Copy Markdown
Owner

Stacked on #3 — base is build/sidecar-provenance-from-git, not main. The SHA assertion only means something once build-core.ts bakes git rev-parse HEAD, which is #3. Merge #3 first and this retargets to main automatically.

What this restores

The macOS packaging job removed in f1e1d04 asserted that the packaged app's sidecar reported the workspace maximal-core version — the one check that would catch the client silently falling back to the stale git pin it ships with upstream. ci.yml has carried a comment since then saying "That check has no replacement yet." This is the replacement.

Why it does not need a Mac

The old check ran maximal-core --version inside the .app. The sidecar is compiled --target=bun-darwin-arm64 and cannot execute on ubuntu-latest — but it can be read:

  1. packages/maximal/client/node_modules/@stuffbucket/maximal-core resolves to packages/maximal-core → the dependency is the workspace copy, not a git tarball.
  2. The compiled sidecar embeds HEAD → it was built from that copy in this run, not restored stale from a cache.

Together those are the property the old job proved, minus the packaging step.

Both negative cases exercised

A check that cannot fail is not a check, so I broke it deliberately:

HEAD moved one commit on   -> sha assertion FAILS   (binary predates HEAD)
sidecar removed            -> existence assertion FAILS
normal build               -> both PASS

What is still not covered

This proves the sidecar's provenance, not that electron-forge produces a working .app. That genuinely needs a Mac and belongs with stuffbucket/macos-builder at release time, per AGENTS.md.

build-core.ts parsed packages/maximal/client/package-lock.json for the git URL
maximal-core was once installed from, and baked the SHA in that URL into the
compiled sidecar as __MAXIMAL_GIT_SHA__. That is wrong twice over in a
workspace: pnpm does not install from that lockfile, and the SHA it carried
(c44284be) named a commit that is not what gets compiled -- coreRoot is a
symlink to packages/maximal-core, so the code comes from this checkout.

git rev-parse HEAD is the commit that actually produced the binary, and falls
back to an empty string where git is unavailable, as the old parse did.

Deleting the lockfile is then safe -- nothing else reads it -- and it removes a
SOURCES.md violation plus 11 dependabot alerts raised against an install that
never happens (extract-zip, tar, tmp, keyed to that manifest).

Verified: the sidecar carries HEAD once and the stale pin zero times, still
reports 0.6.3, and build+typecheck pass 8/8 after a --frozen-lockfile install.
Restores what the deleted macOS packaging job proved: that the client bundles
THIS workspace's maximal-core rather than the stale git pin it ships with
upstream. That was the one check standing between a silent fall-back and a
release, and it has had no replacement since f1e1d04.

The old check ran maximal-core --version inside the packaged .app, which needs a
Mac. Neither assertion here does. The sidecar is compiled
--target=bun-darwin-arm64 and cannot execute on ubuntu, but it can be read:

  1. packages/maximal/client/node_modules/@stuffbucket/maximal-core resolves to
     packages/maximal-core, so the dependency is the workspace copy and not a
     git tarball.
  2. The compiled sidecar embeds HEAD, so it was built from that copy during
     this run rather than restored stale from a cache.

Both negative cases were exercised rather than assumed: with HEAD moved one
commit on, the sha assertion fails; with the binary removed, the existence
assertion fails. A check that cannot fail is not a check.
Base automatically changed from build/sidecar-provenance-from-git to main August 18, 2026 08:37
The verification step added in this branch failed on its first run against main:

  sidecar does not embed HEAD (aa31080) -- built from something else

Not a flake, and not a wrong assertion. maximal-client#build declares
outputs: [resources/bin/**], so turbo restored a sidecar compiled at an earlier
commit. The git SHA baked into that binary is not part of the task's input hash,
so turbo correctly considered the task up to date while the artifact carried a
commit that was no longer HEAD.

A binary that embeds its commit has to rebuild when the commit changes.
Declaring GITHUB_SHA as an env input does exactly that, and only in CI: it is
unset locally, so developer builds keep caching. The rebuild is a sub-second
compile (754ms in the last CI run), paid once per run.

Verified: GITHUB_SHA=aaa and =bbb each produce a cache miss, while unset returns
to the same hash and replays.

Third instance this session of one pattern -- a per-commit value outside the
task hash. The others were MAXIMAL_TEST_TRACE and the restored JUnit report.
@stuffbucket
stuffbucket merged commit 61f965c into main Aug 18, 2026
5 checks passed
@stuffbucket
stuffbucket deleted the ci/verify-sidecar-provenance branch August 18, 2026 09:03
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