Pin proto companion protoc-gen-es to runtime version 2.11.0 (#83) - #84
Merged
Conversation
The companion baked @bufbuild/protoc-gen-es@2.12.0 while the ecosystem pins the Connect-ES runtime (@bufbuild/protobuf) to 2.11.0. Any consumer whose committed *_pb.ts were generated with es 2.11.0 fails sync-drift the moment its services are marked affected, because the companion regenerates every file with the 2.12.0 header and codegen. Pin the companion's es to 2.11.0 so companion output matches the pinned runtime and the local generation path, and bump the companion image to 0.0.12 so consumers pull the corrected image. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ds (#83) The proto companion image has two build definitions for the same codeflydev/proto tag: the Dockerfile and flake.nix. The Dockerfile now pins protoc-gen-es to 2.11.0, but the flake baked no protoc-gen-es at all (only nodejs), so it could not reproduce the pinned generator — and pkgs.protoc-gen-es ships 2.12.0, the exact version that drifts. Build protoc-gen-es from the pinned protobuf-es source in the flake so both image definitions bake es 2.11.0, and extend the guard test to assert the flake pin alongside the Dockerfile pin. The pinned derivation was verified to build and report `protoc-gen-es v2.11.0`. Note: the flake has a separate pre-existing evaluation bug (`protoc-gen-grpc-gateway` is not a nixpkgs attribute — the plugins live under `grpc-gateway`), left untouched as out of scope for this issue. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AntoineToussaint
added a commit
that referenced
this pull request
Jul 26, 2026
…ators The es-2.11.0 pin and 0.0.12 bump already landed on main via #84, so this reduces to the net-new flake work on top of it: - Fix flake evaluation: `protoc-gen-grpc-gateway` and `protoc-gen-openapiv2` are not top-level nixpkgs attrs (referencing them was `undefined variable`, so the flake never evaluated). Both binaries ship from the `grpc-gateway` package; use that. `nix eval` of dockerImage/streamDockerImage now succeeds for x86_64-linux and aarch64-linux. - Pin the other two TypeScript generators reproducibly. main pins protoc-gen-es from source but left openapi-typescript and swagger2openapi to an unpinned runtime `npx`, so the Nix image could drift from the Dockerfile's `npm install -g`. Add ./ts-generators (package.json + package-lock.json) built via buildNpmPackage; expose both CLIs on PATH. Verified on-host: openapi-typescript v7.13.0, swagger2openapi 7.0.8. - Add TestTSGeneratorPinsInLockstep: asserts the Dockerfile and ts-generators/package.json pin these two identically, both directions. protoc-gen-es is excluded (guarded by companion_plugins_test.go from #84). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AntoineToussaint
added a commit
that referenced
this pull request
Jul 26, 2026
…ators (#85) The es-2.11.0 pin and 0.0.12 bump already landed on main via #84, so this reduces to the net-new flake work on top of it: - Fix flake evaluation: `protoc-gen-grpc-gateway` and `protoc-gen-openapiv2` are not top-level nixpkgs attrs (referencing them was `undefined variable`, so the flake never evaluated). Both binaries ship from the `grpc-gateway` package; use that. `nix eval` of dockerImage/streamDockerImage now succeeds for x86_64-linux and aarch64-linux. - Pin the other two TypeScript generators reproducibly. main pins protoc-gen-es from source but left openapi-typescript and swagger2openapi to an unpinned runtime `npx`, so the Nix image could drift from the Dockerfile's `npm install -g`. Add ./ts-generators (package.json + package-lock.json) built via buildNpmPackage; expose both CLIs on PATH. Verified on-host: openapi-typescript v7.13.0, swagger2openapi 7.0.8. - Add TestTSGeneratorPinsInLockstep: asserts the Dockerfile and ts-generators/package.json pin these two identically, both directions. protoc-gen-es is excluded (guarded by companion_plugins_test.go from #84). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.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.
Closes #83.
Summary
@bufbuild/protoc-gen-es@2.12.0, but the ecosystem pins the Connect-ES runtime (@bufbuild/protobuf) to2.11.0. The generator and runtime must move together: emitting 2.12.0 codegen (and its// @generated by protoc-gen-es v2.12.0header) against a 2.11.0 runtime causes every consumer's committed*_pb.tstosync-driftthe first time its services are marked affected.2.11.0so companion output == committed == local-path output, and bumps the companion image to0.0.12so consumers pull the corrected image.codeflydev/prototag:Dockerfileandflake.nix. The flake baked noprotoc-gen-esat all (onlynodejs), andpkgs.protoc-gen-esships2.12.0— the drifting version. Both are now pinned to2.11.0, and a guard test asserts each one, so the image's behavior no longer depends on which builder published it.Verification
protoc-gen-es v2.11.0.go test ./companions/...,go build ./..., andgofmtare clean.TestDockerfilePinsProtocGenEsToRuntimeVersion/TestFlakePinsProtocGenEsToRuntimeVersionread the real build files and fail if either pin diverges from the runtime version, with a pointer to this coordination requirement.Out of scope / notes
flake.nixhas a separate pre-existing evaluation bug unrelated to this issue: it referencesprotoc-gen-grpc-gateway, which is not a nixpkgs attribute (the plugins live undergrpc-gateway), and it bakes none of thenpx-driven npm tools (openapi-typescript,swagger2openapi). The flake therefore does not currently evaluate/build and is not the active publish path (the Dockerfile is). I left that breakage untouched — repairing the flake end-to-end is a separate task. My es pin is a verified, self-contained improvement that will be correct whenever the flake is revived.Test plan
go test ./companions/...passes.v2.11.0.go build ./...andgofmtclean.codefly ci run --phase sync-drifton the affected consumer repos to confirm the 35-file drift clears.🤖 Generated with Claude Code