You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: golden-file test for the plugin's generated code #8
Part of #2. A golden-file test for the plugin's output, the counterpart of Go's cmd/protoc-gen-go-mcp/golden_test.go at 9e072f9.
Do
In cargo test, build a CodeGeneratorRequest for examples/protos/example.protowith source info (comments). Use protox, a pure-Rust protobuf compiler and the counterpart of Go's protocompile, so the test needs neither protoc nor the network.
Set compiler_version to 29.3 so the header matches make generate's output.
Run generate on it, and compare the produced examples.v1.mcp.rsbyte for byte with the committed examples/src/gen/examples.v1.mcp.rs.
UPDATE_GOLDEN=1 cargo test -p protoc-gen-rust-mcp golden rewrites the golden file. Document this in AGENTS.md, replacing the "once the golden-file test exists" placeholder: an unexpected change in generated code is a bug until explained.
On a mismatch, the failure message shows a readable diff and the update command.
Acceptance criteria
The test passes on main's output, and fails with a useful diff if you hand-edit the golden file (show this in the PR).
🤖 Factory: opened #24 with the golden-file test (protoc-gen-rust-mcp/tests/golden.rs), compiling example.proto in-process via protox, comparing byte for byte against the committed examples.v1.mcp.rs, and UPDATE_GOLDEN=1 cargo test -p protoc-gen-rust-mcp golden to refresh it. AGENTS.md updated to describe it. All four checks pass; PR includes a hand-edit demonstration of the failure diff.
Activity
erikist commentedon Oct 9, 2026
🤖 Factory: picked up by dispatcher; working on branch factory/8-test-golden-file-test-for-the.
erikist commentedon Oct 9, 2026
🤖 Factory: opened #24 with the golden-file test (
protoc-gen-rust-mcp/tests/golden.rs), compilingexample.protoin-process viaprotox, comparing byte for byte against the committedexamples.v1.mcp.rs, andUPDATE_GOLDEN=1 cargo test -p protoc-gen-rust-mcp goldento refresh it.AGENTS.mdupdated to describe it. All four checks pass; PR includes a hand-edit demonstration of the failure diff.test: golden-file test for the plugin's generated code (#8) (#24)