build(proto): resolve protoc-gen-es from the nix toolchain, not the bun store - #18
Merged
Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryThis PR moves TypeScript protobuf generation from the Bun dependency store to the pinned Nix toolchain.
Confidence Score: 3/5The PR should not merge until the previously reported generator-version enforcement gap is fixed or the documentation stops claiming that a stamp gate enforces it. The current generation and drift tasks accept any PATH-resolved Files Needing Attention: README.md, proto/moon.yml
|
| Filename | Overview |
|---|---|
| proto/moon.yml | Moves generation and drift to the PATH-resolved Nix plugin, adds presence checks, and updates task inputs. |
| devenv.nix | Adds protoc-gen-es to the pinned development toolchain alongside the existing protobuf generators. |
| README.md | Documents non-Nix installation but incorrectly states that CI has a generated-stamp comparison gate. |
| packages/compass-client/package.json | Removes the Bun-managed generator development dependency after moving codegen to the Nix toolchain. |
| bun.lock | Removes the generator and its now-unused transitive lockfile entries. |
| package.json | Removes the obsolete exact generator override and updates workspace documentation. |
| packages/compass-agent/src/gen/compass/v1/agent_gateway_pb.ts | Restamps generated output from protoc-gen-es 2.12.1 to 2.12.0 without changing its generated body. |
| packages/compass-agent/src/gen/compass/v1/agent_pb.ts | Restamps generated output from protoc-gen-es 2.12.1 to 2.12.0 without changing its generated body. |
| packages/compass-agent/src/gen/compass/v1/comms_pb.ts | Restamps generated output from protoc-gen-es 2.12.1 to 2.12.0 without changing its generated body. |
| packages/compass-agent/src/gen/compass/v1/compass_pb.ts | Restamps generated output from protoc-gen-es 2.12.1 to 2.12.0 without changing its generated body. |
| packages/compass-client/src/gen/compass/v1/comms_pb.ts | Restamps generated output from protoc-gen-es 2.12.1 to 2.12.0 without changing its generated body. |
| packages/compass-client/src/gen/compass/v1/compass_pb.ts | Restamps generated output from protoc-gen-es 2.12.1 to 2.12.0 without changing its generated body. |
Reviews (4): Last reviewed commit: "docs(compass): scope the stamp-gate reje..." | Re-trigger Greptile
…un store buf lazily requires a plugin's closure while executing it. A nix store path cannot be rewritten mid-execution; a package store can, and a torn read of that closure is what flakes the codegen gate with a fault that reads like a codegen error rather than a missing file. So protoc-gen-es joins buf and the Go plugins in devenv.nix and comes off PATH like they do. The gen and drift tasks drop their PATH manipulation and their compass-client:install dependency: codegen no longer depends on any package-install state, and no concurrent writer can tear a plugin mid-exec. Both tasks carry the same preflight, because a shell without the plugin makes buf report `exec: executable file not found`, which reads as a codegen fault; the check is a no-op whenever the plugin is present. The trade is that the plugin version becomes the pinned nixpkgs's to choose rather than a lockfile's. A nixpkgs bump that moves it restamps the `@generated by` header, so drift reds with a comment-only diff on a PR that touched neither the schema nor the gen trees. That is real drift, not a flake: regenerate and commit the restamp alongside the bump. The root override pinning the plugin exact goes with it — that pin existed to stop a float from restamping headers, and a store path cannot float. The generated trees are regenerated here rather than patched, so their headers record this repo's toolchain. nixpkgs supplies 2.12.0 where the bun devDep resolved 2.12.1; a literal port of the sealed diff would have asserted a version this tree does not produce. Ported from sealedsecurity/sealed#971. The generator-stamp gate that PR adds lives in sealed's tools/root-checks, which has no counterpart here — it follows in its own change. Co-Authored-By: seal <noreply@sealedsecurity.com>
Moving the plugin to a store path took it out of the lockfile, so `bun install` no longer supplies it — but the README's without-nix path still listed only the four Go-lane plugins, and the preflight's error named only the devenv fix. A contributor following the documented path hit a hard stop whose message pointed somewhere they were not. State why it is resolved from PATH rather than node_modules: the version is stamped into every generated header, so it is pinned by the toolchain instead of by a lockfile that can float underneath it. Co-Authored-By: seal <noreply@sealedsecurity.com>
The non-nix install pointer named no version; point it at the in-repo generated-header stamp (v2.12.0) the drift gate enforces. Co-Authored-By: seal <noreply@sealedsecurity.com>
seal-agent
force-pushed
the
compass-agent-1405-protoc-gen-es
branch
from
July 29, 2026 17:17
b4b85cf to
fc8d0c7
Compare
…ugin A locally-consistent off-version regenerate passes on the contributor's machine; the gate rejects it in CI against the nix-pinned plugin. Co-Authored-By: seal <noreply@sealedsecurity.com>
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.

Ported from
sealedsecurity/sealed#971— the code half. The generated trees are regenerated here, not patched.The defect
buflazily requires a plugin's closure while executing it. A nix store path cannot be rewritten mid-execution; a package store can, and a torn read of that closure flakes the codegen gate with a fault that reads like a codegen error rather than a missing file.protoc-gen-eswas the last plugin still resolved frompackages/compass-client/node_modules/.bin—buf,protoc-gen-goandprotoc-gen-connect-goalready came from the pinned nixpkgs. This puts the TS plugin where the other three already are.What changes
devenv.nix— bakeprotoc-gen-es.proto/moon.yml—gen/driftdrop thePATH=prefix and thecompass-client:installdep; both gain a preflight./package.json+/bun.lockleave the input sets,/devenv.lockjoins them — the inputs now name what the output actually depends on.package.json— the rootoverridespin goes. It existed so a float could not restamp headers; a store path cannot float.packages/compass-client/package.json+bun.lock— devDep removed, 14 lock lines drop.*_pb.ts— regenerated.Regenerated, not patched — and the versions differ
moon run compass-proto:gen --forceproduced exactly the 6 files sealed#971 touches, with an identical2.12.1 → 2.12.0delta — derived from this repo's toolchain rather than copied. A literal port of the sealed diff would have asserted a version this tree does not produce; here it happens to agree, and the agreement is a result rather than an assumption.Gate — run locally, in this repo, forced
This repo has no CI. Zero workflows, so
CLEANmeans nothing ran. Local testimony.The wide gate, not
compass-proto:ci— a narrow green is evidence about the narrow thing, and this diff reaches the workspace root.Both new mechanisms proven capable of failing
Drift — mutate a committed header and confirm it reds:
The preflight — the new code in this diff, so it gets the same treatment in both directions:
A guard that has only ever been observed passing is indistinguishable from one that cannot fail.
Not in this PR
sealed#971 also adds
assertGeneratorStamptotools/root-checks— a gate asserting the@generated byheaders agree with each other and with the baked plugin.sealedsecurity/compasshas notools/directory and its CI is GitHub Actions rather than moon, so the harness is a rewrite, not a move. The gate's own logic is pure (runner and source texts injected) and ports cleanly; it follows in its own change.Worth stating plainly rather than leaving implicit: until it lands, the version relationship this PR establishes is enforced by
driftalone. Drift catches a gen tree that disagrees with the plugin currently on PATH. It does not name the skew — adevenv.lockbump surfaces as a comment-only diff on an unrelated PR, which is exactly the mystery red the stamp gate exists to convert into "baked X ≠ gen-tree stamp Y".Spec-impact: none
Refs SEA-1405
The version delta is stamp-only today — measured, not assumed
The body above states
2.12.1 → 2.12.0and calls it what it is. What it did notstate is the blast radius, which is the part a reviewer actually needs: does
generating with the older plugin change any code, or only the header?
Measured across every generated file in the repo, comparing
main's body tothis branch's with the stamp line excluded:
So the delta is entirely the header for the protos we have today. That is a
measurement of this schema against these two versions, not a property of the
two versions — a later minor may well emit different code, which is precisely
why the stamp is worth gating rather than normalising away.
compass#30collides with this PR, and the merge is clean while being wrong#30regeneratescomms_pb.tsin both packages with 2.12.1 (it predatesthis PR's cutover). Textual overlap with this branch is 2 files;
git merge-treereports zero conflicts and produces a tree whose header says2.12.0 over a body generated by 2.12.1.
Verified on the materialised merge, rather than reasoned about:
Drift passes because 2.12.0 and 2.12.1 emit identical bodies for this proto, so
the merged tree is genuinely correct — the stamp is not lying about anything
observable. But it passes for a reason that holds only while the bodies agree.
Had
#30landed a proto whose output differed between the two versions, thatsame merge would be textually clean, semantically wrong, and — since drift
compares against the plugin on PATH — green.
tools/stamp-gate(compass#20) is what names that class: it compares thechecked-in stamps against the plugin on PATH and against each other, so a
partial regeneration reads as
baked X != gen-tree stamp Yinstead of as acomment-only diff on a PR that touched neither the schema nor the gen trees.
No action needed on either PR. Whichever lands second regenerates; if
#30lands second under this PR's toolchain, its regeneration restamps to 2.12.0 and
drift stays green. Recording it because a zero-conflict merge between two
generated-code PRs is the case least likely to be looked at, and here the clean
merge was load-bearing on a coincidence.