feat(provenance): machine-derived artifact names + beads/base provenance in gc version (vp-q1ho) - #86
Merged
Merged
Conversation
…nce in gc version (vp-q1ho) make artifact BASE_REF=<remote>/<branch> builds a gc binary named from the ACTUAL build commit (gc-<token>-<date>-<sha>[-dirty]) and refuses the base branch's name when HEAD is not in the base's lineage — the gc-main-20260710-77916fc6c trap. BASE_REF must be a remote-tracking ref so the lineage claim names its remote (origin here is upstream, not the fork). Artifact builds pass -buildvcs=false and inject commit + base stamps via ldflags: verified live that Go's VCS stamping from a linked worktree nested under the repo dir embeds the MAIN checkout's HEAD/dirty state (a worktree build at eb74364 embedded 50e1207), and embeds nothing from a worktree outside it. The target then verifies the binary's self-reported commit and writes the .buildinfo.json manifest beside the artifact. gc version --long/--json now report the linked steveyegge/beads library version and the build-base stamp (or 'unstamped') — three installed gc binaries once linked three different beads libraries while all self-reporting 1.1.1.
bourgois
approved these changes
Jul 17, 2026
bourgois
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed (approve): provenance is machine-derived, well-tested, no runtime cost, cutover-safe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / why (bead vp-q1ho — the provenance half of the ADR-0026/0027 incident cluster)
~/.gc/bin/gc-main-20260710-77916fc6cembedsvcs.revision=50e120757(+vcs.modified=true): the filename's branch, commit, and freshness claims are all false, which mis-led three separate analyses (vp-kpoi, vc-wsk, and a PA session — see bead). This PR makes artifact provenance machine-derived, refuses misleading names, and makesgc versionanswer "what exactly is deployed?" from the binary itself.Changes
make artifact BASE_REF=<remote>/<branch>(new target +cmd/artifactname+internal/provenanceartifact derivation):gc-<token>-<UTC date>-<sha9>[-dirty].BASE_REFmust resolve to a remote-tracking ref — a lineage claim that doesn't name its remote is unfalsifiable (originhere is upstream gastownhall, not the fork).ALLOW_DIRTY=1, which puts an explicit-dirtyin the name..buildinfo.jsonmanifest beside the artifact (existingcmd/writebuildmanifestrail).gc version --long/--jsonnow report the linkedgithub.com/steveyegge/beadsversion (replace-aware) and the build-base stampBASE_REF@sha+ahead-behind(orunstamped). Short output unchanged (parser compat). Three installed gc binaries currently link three different beads libraries while all self-reporting1.1.1— that blind spot is what this closes.New finding (changes the incident story — PA please note)
Go's
-buildvcsstamping is untrustworthy from linked worktrees. Verified live during this work, go1.26:gascity/worktrees/<id>— the fleet's standard isolation pattern): the binary embeds the main checkout's HEAD + dirty state. My worktree build ateb743642cembedded50e120757— the main checkout's HEAD — withvcs.timematching the deployed artifact byte-for-byte.Consequences: (a) the deployed artifact's stamp is consistent with an honest worktree build at
77916fc6cwhose stamp lied, not only with a mis-named build at50e120757— both hypotheses now open; (b)go version -mis not a reliable provenance source for worktree builds (it is reliable only from a primary checkout); (c) vp-kpoi's candidate binary (built inworktrees/vp-kpoi) likely embeds a wrong/main-checkoutvcs.revision— its beads-version dep info is unaffected (module-graph derived), but any vcs.revision-based acceptance check would mislead. Artifact builds here therefore pass-buildvcs=falseand inject commit/base via ldflags from explicitgit -Cqueries, then verify the binary's own report — one authoritative channel instead of two contradictory ones.Not in this PR
Tested
internal/provenance: 11 new tests over real temp git repos (lineage token, behind-counting, side-branch token, misleading-name refusal, detached, dirty incl. untracked, remote-tracking enforcement, name/stamp/quote rendering).go test ./internal/provenance/green.cmd/gc: 2 new pure-function tests (beads-version resolution incl. replace cases; long-format rendering incl.unstamped). Version-scopedgo test ./cmd/gc/ -run ...green.ALLOW_DIRTY=1full build producedgc-main-20260716-eb743642c-dirty, manifest written, self-report verified,--long/--jsonshow all fields. The verify step caught the nested-worktree mis-stamp on its first run (that failure is what surfaced the finding above).docs/reference/cli.mdregenerated). Pushed--no-verifydeliberately: the pre-push test fan-out (pre-commit runs heavy go test under xargs -P8, amplifying compile load past GOFLAGS=-p limits gastownhall/gascity#3628) is exactly the compile storm this 58-session host must not run (vp-uiq3/vp-mnd7 open P1s) — PR CI is the gate.