Skip to content

Pin proto companion protoc-gen-es to runtime version 2.11.0 (#83) - #84

Merged
AntoineToussaint merged 2 commits into
mainfrom
issue-83-pin-protoc-gen-es-211
Jul 26, 2026
Merged

Pin proto companion protoc-gen-es to runtime version 2.11.0 (#83)#84
AntoineToussaint merged 2 commits into
mainfrom
issue-83-pin-protoc-gen-es-211

Conversation

@AntoineToussaint

@AntoineToussaint AntoineToussaint commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Closes #83.

Summary

  • The proto companion baked @bufbuild/protoc-gen-es@2.12.0, but the ecosystem pins the Connect-ES runtime (@bufbuild/protobuf) to 2.11.0. The generator and runtime must move together: emitting 2.12.0 codegen (and its // @generated by protoc-gen-es v2.12.0 header) against a 2.11.0 runtime causes every consumer's committed *_pb.ts to sync-drift the first time its services are marked affected.
  • Pins the companion's es to 2.11.0 so companion output == committed == local-path output, and bumps the companion image to 0.0.12 so consumers pull the corrected image.
  • The image has two build definitions for the same codeflydev/proto tag: Dockerfile and flake.nix. The flake baked no protoc-gen-es at all (only nodejs), and pkgs.protoc-gen-es ships 2.12.0 — the drifting version. Both are now pinned to 2.11.0, and a guard test asserts each one, so the image's behavior no longer depends on which builder published it.
  • This is fix option (1) from the issue (pin to match the pinned runtime). The durable fix — having the companion honor the repo-requested plugin version (option 2) — is intentionally out of scope for this unblock and should be tracked separately.

Verification

  • The pinned flake derivation was built locally and confirmed to report protoc-gen-es v2.11.0.
  • go test ./companions/..., go build ./..., and gofmt are clean.
  • TestDockerfilePinsProtocGenEsToRuntimeVersion / TestFlakePinsProtocGenEsToRuntimeVersion read 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

  • The flake.nix has a separate pre-existing evaluation bug unrelated to this issue: it references protoc-gen-grpc-gateway, which is not a nixpkgs attribute (the plugins live under grpc-gateway), and it bakes none of the npx-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.
  • Guard tests assert both the Dockerfile and flake es pins.
  • Pinned flake derivation builds and reports v2.11.0.
  • go build ./... and gofmt clean.
  • After merge + companion image publish, re-run codefly ci run --phase sync-drift on the affected consumer repos to confirm the 35-file drift clears.

🤖 Generated with Claude Code

AntoineToussaint and others added 2 commits July 25, 2026 20:29
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
AntoineToussaint merged commit 51e9e84 into main Jul 26, 2026
1 check passed
@AntoineToussaint
AntoineToussaint deleted the issue-83-pin-protoc-gen-es-211 branch July 26, 2026 09:41
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>
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.

proto companion 0.0.11 pins protoc-gen-es 2.12.0 but ecosystem runtime is 2.11.0 → sync-drift on every consumer

1 participant