Never regenerate mf.pb.go during checks; fail when it is stale (closes #71) #138

Merged
clawbot merged 1 commits from issue-71-no-regen-in-check into next 2026-10-04 13:31:58 +02:00
Collaborator

Implements #71.

script/test, script/fmt and script/fmt-check-go no longer regenerate mfer/mf.pb.go. The only way to regenerate it is make generate (script/generate), which runs go generate and records the hash of mfer/mf.proto in mfer/mf.proto.sha256. It refuses to run unless protoc 33.4 and protoc-gen-go v1.36.11, the versions named in the committed file's header, are on PATH; other versions write a very different file. The README says how to install them.

Staleness is checked in one place: TestGeneratedCodeMatchesProto in mfer/mf_test.go compares the recorded hash with mfer/mf.proto and fails with a message telling the developer to run make generate. A recorded hash, unlike regenerating to a temporary file, needs no protoc, so the check runs wherever the tests run.

Removed because they only served the old regeneration: the Makefile's mtime rule for mfer/mf.pb.go, the protoc --version line under bin/mfer, both touch mfer/mf.pb.go steps in the Dockerfile, and the unused Makefile rule installing protoc-gen-go v1.28.1, one of the items in #68.

Not visible in the diff:

  • A change to mfer/mf.proto now means committing three files: the .proto, the regenerated .pb.go and mf.proto.sha256.
  • protoc 33.4 names itself v6.33.4 in the mf.pb.go header.

Disclosures:

  • Judgement call: make clean no longer deletes mfer/*.pb.go; it is committed, and only make generate could recreate it.
  • Judgement call: script/generate hashes with sha256sum, else shasum -a 256, and stops before regenerating when neither exists.
  • Deviation: the README names the protoc download by version, not hash; hash-pinning developer tools is #68.
  • Deviation: no TODO.md entry, per #76.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/mfer/issues/71. `script/test`, `script/fmt` and `script/fmt-check-go` no longer regenerate `mfer/mf.pb.go`. The only way to regenerate it is `make generate` (`script/generate`), which runs `go generate` and records the hash of `mfer/mf.proto` in `mfer/mf.proto.sha256`. It refuses to run unless `protoc` 33.4 and `protoc-gen-go` v1.36.11, the versions named in the committed file's header, are on `PATH`; other versions write a very different file. The README says how to install them. Staleness is checked in one place: `TestGeneratedCodeMatchesProto` in `mfer/mf_test.go` compares the recorded hash with `mfer/mf.proto` and fails with a message telling the developer to run `make generate`. A recorded hash, unlike regenerating to a temporary file, needs no `protoc`, so the check runs wherever the tests run. Removed because they only served the old regeneration: the Makefile's mtime rule for `mfer/mf.pb.go`, the `protoc --version` line under `bin/mfer`, both `touch mfer/mf.pb.go` steps in the `Dockerfile`, and the unused Makefile rule installing `protoc-gen-go` v1.28.1, one of the items in https://git.eeqj.de/sneak/mfer/issues/68. Not visible in the diff: - A change to `mfer/mf.proto` now means committing three files: the `.proto`, the regenerated `.pb.go` and `mf.proto.sha256`. - `protoc` 33.4 names itself v6.33.4 in the `mf.pb.go` header. Disclosures: - Judgement call: `make clean` no longer deletes `mfer/*.pb.go`; it is committed, and only `make generate` could recreate it. - Judgement call: `script/generate` hashes with `sha256sum`, else `shasum -a 256`, and stops before regenerating when neither exists. - Deviation: the README names the `protoc` download by version, not hash; hash-pinning developer tools is https://git.eeqj.de/sneak/mfer/issues/68. - Deviation: no `TODO.md` entry, per https://git.eeqj.de/sneak/mfer/issues/76. Model: opus-5-5
clawbot added the needs-review label 2026-10-04 12:24:39 +02:00
clawbot self-assigned this 2026-10-04 12:24:39 +02:00
Author
Collaborator

Review failed.

  1. How to get the code generator. The README Entrypoints line for script/generate says it needs protoc and protoc-gen-go, but neither the README nor script/bootstrap says how to get them or which versions. The committed mfer/mf.pb.go was generated by protoc 33.4 and protoc-gen-go v1.36.11, as its header says. The Makefile's only install rule, $(PROTOC_GEN_GO), is used by nothing and pins v1.28.1. Running make generate with that version produces a very different mfer/mf.pb.go, and the staleness test still passes. Acceptable: script/bootstrap installs the exact protoc and protoc-gen-go versions named in that header (pinned, with any downloaded archive hash-verified as REPO_POLICIES.md requires), or at least the README names those versions and how to install them. The $(PROTOC_GEN_GO) rule then either becomes a prerequisite of generate with the matching version or is removed.

  2. script/generate line 14 hashes with shasum only. shasum is missing on Alpine and slim Debian, both hosts script/bootstrap supports (apk, apt). There the script has already rewritten mfer/mf.pb.go and then leaves mfer/mf.proto.sha256 empty. So the PR body's disclosure that shasum is present on Linux is not true. Acceptable: use sha256sum when it is present and fall back to shasum -a 256, as verify_sha256 in script/bootstrap already does (both print the same format), and correct the disclosure.

  • Judgement call: the recorded hash covers only mfer/mf.proto. A hand edit of mfer/mf.pb.go goes unnoticed, and so does a .proto change committed with its new hash but without the regenerated file. The issue allows hashing only the .proto, so this is not a finding.

Model: opus-5-5

Review failed. 1. **How to get the code generator.** The README Entrypoints line for `script/generate` says it needs `protoc` and `protoc-gen-go`, but neither the README nor `script/bootstrap` says how to get them or which versions. The committed `mfer/mf.pb.go` was generated by `protoc` 33.4 and `protoc-gen-go` v1.36.11, as its header says. The Makefile's only install rule, `$(PROTOC_GEN_GO)`, is used by nothing and pins v1.28.1. Running `make generate` with that version produces a very different `mfer/mf.pb.go`, and the staleness test still passes. Acceptable: `script/bootstrap` installs the exact `protoc` and `protoc-gen-go` versions named in that header (pinned, with any downloaded archive hash-verified as `REPO_POLICIES.md` requires), or at least the README names those versions and how to install them. The `$(PROTOC_GEN_GO)` rule then either becomes a prerequisite of `generate` with the matching version or is removed. 2. **`script/generate` line 14 hashes with `shasum` only.** `shasum` is missing on Alpine and slim Debian, both hosts `script/bootstrap` supports (apk, apt). There the script has already rewritten `mfer/mf.pb.go` and then leaves `mfer/mf.proto.sha256` empty. So the PR body's disclosure that `shasum` is present on Linux is not true. Acceptable: use `sha256sum` when it is present and fall back to `shasum -a 256`, as `verify_sha256` in `script/bootstrap` already does (both print the same format), and correct the disclosure. - Judgement call: the recorded hash covers only `mfer/mf.proto`. A hand edit of `mfer/mf.pb.go` goes unnoticed, and so does a `.proto` change committed with its new hash but without the regenerated file. The issue allows hashing only the `.proto`, so this is not a finding. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-04 12:47:56 +02:00
clawbot added 1 commit 2026-10-04 12:54:58 +02:00
The test and format scripts regenerated mfer/mf.pb.go whenever
mfer/mf.proto looked newer by mtime, which a fresh checkout often causes,
so make check could rewrite a committed file and needed protoc. Nothing
regenerates it any more except make generate (script/generate), which
refuses to run unless protoc 33.4 and protoc-gen-go v1.36.11, the
versions that wrote the committed file, are on PATH, and records the
hash of mf.proto in mfer/mf.proto.sha256. A Go test compares that hash
with mf.proto and fails, naming make generate, when they differ. The
mtime rule, the unused protoc-gen-go v1.28.1 install rule, make clean's
deletion of mf.pb.go and the Dockerfile's touch workarounds are removed.

Model: opus-5-5
clawbot force-pushed issue-71-no-regen-in-check from 74185ae5d6 to ba7d755dc2 2026-10-04 12:54:58 +02:00 Compare
Author
Collaborator
  1. README.md now names protoc 33.4 and protoc-gen-go v1.36.11 and how to install them; script/generate refuses to run when either one's --version differs; the unused v1.28.1 install rule is removed.
  2. script/generate uses sha256sum, falling back to shasum -a 256, and hashes mf.proto before regenerating, so a missing hash tool stops it with nothing changed; the PR body's disclosure is corrected.

Model: opus-5-5

1. `README.md` now names `protoc` 33.4 and `protoc-gen-go` v1.36.11 and how to install them; `script/generate` refuses to run when either one's `--version` differs; the unused v1.28.1 install rule is removed. 2. `script/generate` uses `sha256sum`, falling back to `shasum -a 256`, and hashes `mf.proto` before regenerating, so a missing hash tool stops it with nothing changed; the PR body's disclosure is corrected. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-04 12:55:06 +02:00
Author
Collaborator

Review passed.
Gated on next at 0a99630.

  • Judgement call: the recorded hash covers only mfer/mf.proto, so a hand edit of mfer/mf.pb.go, or a regenerated mfer/mf.pb.go left out of the commit, goes unnoticed; the issue allows hashing only the .proto, so this is not a finding.
  • Judgement call: the name TestGeneratedCodeMatchesProto says more than the test checks (it compares mfer/mf.proto with the recorded hash); its comment says what it does, so this is not a finding.

Model: opus-5-5

Review passed. Gated on `next` at `0a99630`. - Judgement call: the recorded hash covers only `mfer/mf.proto`, so a hand edit of `mfer/mf.pb.go`, or a regenerated `mfer/mf.pb.go` left out of the commit, goes unnoticed; the issue allows hashing only the `.proto`, so this is not a finding. - Judgement call: the name `TestGeneratedCodeMatchesProto` says more than the test checks (it compares `mfer/mf.proto` with the recorded hash); its comment says what it does, so this is not a finding. Model: opus-5-5
clawbot merged commit 0501568203 into next 2026-10-04 13:31:58 +02:00
clawbot deleted branch issue-71-no-regen-in-check 2026-10-04 13:31:59 +02:00
Sign in to join this conversation.