Skip to content

fix(mage): verify a compat repair builds, and discard it if it fails - #114

Merged
josephschorr merged 1 commit into
mainfrom
fix/repair-loop-verify
Sep 12, 2026
Merged

josephschorr merged 1 commit into
mainfrom
fix/repair-loop-verify

Conversation

@josephschorr

Copy link
Copy Markdown
Member

Regeneration run 34538493104 shipped a Rust client that did not compile. The repair loop I added in #84 is why.

What happened

  1. a2af576 — rust's Gen produced pub cursor + a with_cursor builder. It compiled, passed clippy and tests, and was committed. Gen did its job.
  2. The gate flagged constructible_struct_adds_field on the new public field.
  3. The repair loop asked Claude to fix it, and Claude made the field private — which satisfies that lint and breaks the build, because Rust privacy is module-scoped and client.rs cannot read a field private to types.rs.
  4. Claude's invocation then failed (exit status 1).
  5. The loop returned an error with the half-finished edit still in the tree, and create-pull-request committed it into the PR as 661ecfb:
-    pub cursor: Option<String>,
+    cursor: Option<String>,

Two gaps, both fixed

A repair is now verified. The loop re-ran only the compatibility check after a fix, so a repair that restored compatibility while breaking the build was accepted. Each repaired language's own test target now runs after the edit.

Only the language's toolchain can catch this: cargo-semver-checks reads rustdoc JSON, and rustdoc does not type-check function bodies — which is why it reported a clean build of a crate cargo build rejects, and why the gate saw nothing wrong.

A failed repair is now discarded. Everything generation produced is committed before the gates run, so anything uncommitted at that point is the repair and nothing else. git checkout -- . plus git clean -fd returns the tree to HEAD.

Ignored files are deliberately left alone — the gate tooling lives in some of them, and tools/japicmp.jar being deleted mid-run is a failure this pipeline has already had once (#91). There is a test pinning that.

Tests

Four: the tree is restored and added files removed; an ignored file survives; verification fails and names the language when its build breaks; verification passes when it doesn't.

go test -tags mage ./... passes.

🤖 Generated with Claude Code

Regeneration run 34538493104 shipped a Rust client that did not compile,
and the repair loop I added in #84 is why.

What happened: rust's Gen produced `pub cursor` plus a with_cursor
builder, which compiled and passed clippy and tests, and was committed.
The gate then flagged constructible_struct_adds_field on the new public
field. The repair loop asked Claude to fix it, Claude made the field
private -- which satisfies that lint and breaks the build, because Rust
privacy is module-scoped and client.rs cannot read a field private to
types.rs -- and Claude's own invocation then failed. The loop returned an
error with the half-finished edit still in the tree, and
create-pull-request committed it into the PR.

Two things were missing, and both are fixed here.

A repair is now verified. The loop re-ran only the compatibility check
after a fix, so a repair that restored compatibility while breaking the
build was accepted. Each repaired language's own test target now runs
after the edit, because only the language's toolchain can tell:
cargo-semver-checks reads rustdoc JSON, and rustdoc does not type-check
function bodies, so it reported a clean build of a crate cargo build
rejects.

A failed repair is now discarded. Everything generation produced is
committed before the gates run, so anything uncommitted at that point is
the repair and nothing else -- `git checkout -- .` plus `git clean -fd`
returns the tree to HEAD. Ignored files are deliberately left alone: the
gate tooling lives in some of them, and tools/japicmp.jar being deleted
mid-run is a failure this pipeline has already had once.

Tests cover both, including that an ignored file survives a discard.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@josephschorr
josephschorr merged commit e86ce57 into main Sep 12, 2026
43 checks passed
@josephschorr
josephschorr deleted the fix/repair-loop-verify branch September 12, 2026 00:56
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.

1 participant