Repository navigation
feat(cobol-to-java): AI-agent guardrail — agent changes checked against the verified skeleton (#3652) - #3692
Merged
Merged
Conversation
…st the verified skeleton (#3652) Generation now writes guardrail_baseline.json, an inventory of the generated project: each class with its fields, methods and endpoints, the services / repositories / clients it calls (plus the program's mock services), and the SQL tables the project's own SQL names. After an agent edits the project or returns a ticket's java_code, python -m gitgalaxy.tools.cobol_to_java.cobol_to_java_guardrail <project> [--result TICKET RESULT] checks the changed code and reports unknown-call, new-component, layout-changed, unknown-table and new-endpoint violations. The report goes to agent_guardrail.md / .json and into audit section [4]; a ticket result gets a `guardrail` verdict (passed / rejected). It exits 1 on any violation. On all 6 corpora x 3 configs, re-checking every generated file finds 0 violations. A CardDemo copy with 6 planted hallucinations reports all 6; the legitimate edit alongside them passes. Generated Java byte-identical; refraction snapshots re-blessed (the new baseline file + audit section [4] only). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
Contributor
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 #3652. Part of #3625.
What
The converter generates the Java skeleton and leaves the business logic for an AI agent. The agent's ticket says "use the verified skeleton, don't invent calls or resources". This checks that it didn't.
At generation: the controller writes
guardrail_baseline.json, an inventory of the generated project. It records:After an agent edits the project, or returns a ticket result:
unknown-callnew-componentlayout-changedunknown-tablenew-endpointutil/), or a deleted file.agent_guardrail.md/.jsonand into the audit as section[4]; the section is replaced on each run, not appended. A ticket result gets aguardrail: {status: passed|rejected, violations}verdict written into its JSON.Evidence
No false positives. On all 6 corpora × 3 configs I marked every generated file as changed, so every rule ran against 1,627 files. The result was 0 violations.
Planted hallucinations. A CardDemo copy with 6 planted hallucinations reported all 6:
PaymentGatewayService;CARDDEMO.CUSTOMER_LOYALTY;CarddemoCommarea;/refundendpoint;RefundService.A new
DateHelperinutil/came through as a notice only. A legitimate edit alongside them passed: it uses the program's own repository, its already-injected service and a libraryExecutorService.How it reads Java
It uses a small scanner, not a parser:
@Column(name = …) private String x;is still a field;Library types are allowed when imported, or fully qualified (
java.util.concurrent.ExecutorService).Safety
guardrail_baseline.jsonplus audit section[4]("not run yet" plus the command). The refraction snapshots were re-blessed for exactly that.tests/cobol_mainframe+tests/tools_recordersgave 889 passed. Preflight--javais all PASS.^[ \t]*, not^\s*underre.M.java_codeis allowlisted in the dead-key audit, because it's written by the external agent, never by gitgalaxy.Tests (
test_agent_guardrail.py)Scope notes
migration_worklist. The worklist is what the generators left; the guardrail is what an agent changed.features.agent_tickets). The project mode covers agents that edit files directly.🤖 Generated with Claude Code
https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g