Skip to content

Evidence record per ported program: claim, oracle, provenance, approval, staleness (#4048) - #4316

Merged
squid-protocol merged 7 commits into
mainfrom
feat/4048-evidence-record
Oct 4, 2026
Merged

squid-protocol merged 7 commits into
mainfrom
feat/4048-evidence-record

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Implements #4048 (epic #4055), following the approved schema proposal gitgalaxy-evidence/1.

Stacked PR. This branch merges #4313 (#4309, the oracle pin) and #4314 (#4308, crucible provenance), because every record's oracle fingerprint comes from #4309. Review and merge those two first; this PR's own commits are the last two.

What changed

  • tests/tools/evidence.py builds the record:
    • Input fingerprints: port, case, corpus pin, declared differences, harness, oracle, generator. Each is a repo-relative tree digest.
    • Status is computed and never stored. It is one of not-proven / stale / proven, unapproved / proven, approved, and always carries every reason.
    • The claim is derived from the numbers.
    • Commands: rendered pages (render [--check]), schema validation, prove, refresh --stale, mutation, approve and reject.
  • equivalence.py run CASE --record writes the record for the committed port on the committed case. It refuses --port, --reuse, overrides and similar flags.
  • Crucible ports are recorded through cics_crucible.py --report-dir. Their coverage comes from tests/cics_crucible/coverage.json.
  • Overlay: equivalence_java.prepare_project and cics_crucible.lay_overlay now keep the generated file each overlay replaces, under generated_before_overlay/. This lets proof_reach tell left as generated apart from ported.
  • mutation_scores.py build refreshes each record's mutation section. That section is judged against the inputs at its commit, recomputed from git, so a score made before The test-strengthening loop: mutation survivors -> model-proposed inputs, the COBOL as oracle #4049 changed the case shows as stale.
  • New workflow .github/workflows/evidence-refresh.yml runs nightly and on workflow_dispatch (with db2 and keys inputs).
    • It runs evidence.py refresh --stale, with the oracle strict check and the crucible at its pin.
    • It opens a draft PR with the refreshed records and never merges.
  • tests/cobol_mainframe/test_evidence.py contains these tests:
    • every committed record is current on the blocking inputs;
    • the records cover the ports (the MISSING ratchet);
    • schema validation;
    • the rendered pages are current;
    • test_no_tool_writes_an_approval: an AST check plus a key scan over the tools and the engine;
    • the approval flow;
    • status and policy.
  • Docs: docs/language_status/evidence_records.md, plus generated pages under docs/language_status/evidence/.
  • .gitignore now admits evidence.json. The repo-wide *.json rule would otherwise have silently dropped the records.

Owner decisions encoded

  • Q1: a change to the port, case, corpus pin or declared differences makes the record stale and fails CI. A change to the harness, oracle or generator makes it stale (shown as stale, never as proven) and the scheduled job re-proves it.
  • Q5: approval comes from evidence.py approve KEY --by NAME --for PURPOSE, run by a person.
    • The command refuses in each of these cases:
      • stdin or stdout is not a TTY;
      • --by looks like a tool or model;
      • --for is empty;
      • the record is not proven and current;
      • the typed name does not match.
    • The record stores what the person attests: "I reviewed this evidence summary (scenarios run, coverage, unproven methods, declared differences) and accept it for <purpose>", together with the claim shown and the inputs digest it covers. The docs state that the sign-off is accountability, not COBOL expertise.
    • Tools never write approvals, and a test enforces it.
  • Q7 (owner decision, superseding the earlier "report only"): PORTED_UNPROVEN_POLICY = "block".
    • A port with any ported_unproven method is not proven. Its status says why, for example "1 ported_unproven method (executeCsutldtc)".
    • Stubs and left-as-generated methods are counts only.
    • The single switch can be set to "report" later without a schema change.
  • Oracle: the fingerprint from Equivalence oracle: the GnuCOBOL version every proof compares against is neither pinned nor recorded #4309. Every equivalence record shows cobc (GnuCOBOL) 3.1.2.0, package 3.1.2-5+b1, the image id and matches_pin: true.

Decisions taken by default (owner may revisit)

  • Q2: the generator fingerprint covers gitgalaxy/tools/cobol_to_java/** only.
  • Q3: the mutation score goes stale on port, case, corpus, harness or oracle changes, not on generator changes. Only a mutation run refreshes it.
  • Q4: crucible ports get a new evidence.json beside provenance.json. cics-crucible-port/1 is kept as the loop log.
  • Q6: hand ports get written_by: "person", with the author and first commit taken from git (acctview, intcalc, posttran).
  • Q8: coverage is recorded as numbers only, with no threshold.
  • Q9: the image id is recorded but is not part of the digest. The Dockerfile pin is part of it.
  • Q10: customer projects are out of v1.
  • Corpus and crucible pin bumps count as blocking inputs.

The records: 41 written, all unapproved

All 41 non-Db2 ports were proven again at 2f770970 with JDK 17, the pinned oracle in strict mode and cics-crucible v0.2.0. Every proof's verdict is proven. Under the blocking policy:

  • 21 are "proven, unapproved".
  • 20 drop out of "proven" because of ported_unproven methods. No ports were changed:
  • carddemo-acctview not-proven 1 ported_unproven method (dispatchCdemoToProgramL349)
  • carddemo-cardview not-proven 2 ported_unproven methods (onAbendL250, onAbendL871)
  • carddemo-dateutil not-proven 1 ported_unproven method (executeCsutldtc)
  • carddemo-intcalc not-proven 1 ported_unproven method (readAllTcatbalFile)
  • carddemo-readcard not-proven 1 ported_unproven method (executeCbact02c)
  • carddemo-readcust not-proven 1 ported_unproven method (executeCbcus01c)
  • carddemo-readxref not-proven 1 ported_unproven method (executeCbact03c)
  • carddemo-useradd not-proven 1 ported_unproven method (writeUsrsec)
  • crucible:ca-link-lengths/CALINK not-proven 1 ported_unproven method (executeCalink)
  • crucible:ca-link-lengths/CASUB not-proven 2 ported_unproven methods (executeCasub, handleLink)
  • crucible:ca-xctl-versions/CAXB not-proven 3 ported_unproven methods (handleLink, handleTransaction, returnedCommarea)
  • crucible:gt-start-retrieve/GTWORK not-proven 1 ported_unproven method (executeGtwork)
  • crucible:hc-abend-link/HCMAIN not-proven 5 ported_unproven methods (bridgeHcsub, executeHcmain, onAbendL26, onConditionQiderrL25, seed)
  • crucible:hc-abend-link/HCSUB not-proven 2 ported_unproven methods (handleLink, onAbendL32)
  • crucible:hc-perform-range/HCQREAD not-proven 7 ported_unproven methods (current, executeHcqread, handleTransaction, onConditionErrorL25, onConditionItemerrL25, onConditionItemerrL56, onConditionQiderrL25)
  • crucible:hx-attr-bytes/HXATTR not-proven 3 ported_unproven methods (handleTransaction, renderHxm1, submitHxm1)
  • crucible:hx-extended-cursor/HXEXT not-proven 2 ported_unproven methods (handleTransaction, submitHxm2)
  • crucible:pc-aid-menu/PCDETL not-proven 1 ported_unproven method (handleTransaction)
  • crucible:pc-aid-menu/PCMENU not-proven 1 ported_unproven method (handleTransaction)
  • crucible:pc-wizard/PCWIZ not-proven 6 ported_unproven methods (handleLink, handleTransaction, renderPcm1, renderPcm2, returnedCommarea, submitPcm1)

The CSUTLDTC worked example is tests/equivalence/carddemo-dateutil/evidence.json:

  • 17/17 calls; 2/2 paragraphs and 4/10 branches;
  • mutation 135/201 raw, 135/145 adjusted, and stale: the case, harness and oracle all changed since be2561306;
  • not proven, because of executeCsutldtc.

Missing: the 4 Db2 cases (cbsa-inqacc, cbsa-updacc, genapp-lgicdb01, genapp-lgupdb01). They are on the MISSING ratchet. Their proof needs IBM's Db2 container plus gitgalaxy-gnucobol-db2:3 rebuilt on the pinned oracle. The local image predates the pin, and the #4309 strict check correctly refused it. I did not rebuild the shared image. evidence-refresh.yml with db2=true writes these records.

Checks

  • test_evidence.py passes, along with the equivalence, crucible, proof_reach and mutation suites: 282 passed.
  • ruff_audit, mypy_audit and dead_key_audit with --ci are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo

squid-protocol and others added 5 commits October 4, 2026 10:18
gnucobol.Dockerfile pins the base by digest (debian:bookworm-slim@sha256:3783cc01...)
and gnucobol3/libcob4 to 3.1.2-5+b1 (what bookworm ships today, and what the local
oracle already ran: no change in oracle behaviour). The build asserts
`cobc --version` = "cobc (GnuCOBOL) 3.1.2.0" and labels the image with the pin.

tests/tools/equivalence_oracle.py fingerprints the image a run uses (id, labels,
cobc --version, installed package) against the pin. Every proof report
(equivalence.py batch/CALL/CICS, cics_crucible results and --report-dir proofs)
records it under `oracle`; a mismatch warns, and stops the run under
GITGALAXY_ORACLE_STRICT=1, which the CICS crucible workflow sets (plus an explicit
check step after the image build). --reuse carries the earlier run's oracle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
…ve all 17 at v0.2.0 (#4308)

tests/tools/crucible_port_provenance.py: `check` lists port provenance records whose
latest proof is not at PINNED_REF and that do not say they are stale against it;
`reprove` RUNS each port's proof (cics_crucible.py --sides java-ported --program P
--report-dir) at the pinned checkout and appends a proof.reproven entry (ref,
summary, port tree sha256, harness commit), or marks proof.stale with the reason.
The loop's own proof/history are never rewritten.

tests/cics_crucible/test_port_provenance.py fails on a silent mismatch, and on a
re-proof whose port tree has changed since.

All 17 ports were re-proven at v0.2.0 (94f2afcb) on 2026-10-04: every scenario of
every program 1/1. Pin-bump docs (BUMPING_THE_CRUCIBLE_PIN.md, ecosystem.md, the
pin file, ports/NOTICE) add the re-prove step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
…and 'origin/fix/4308-crucible-port-provenance' into feat/4048-evidence-record
…approval (#4048)

tests/tools/evidence.py implements gitgalaxy-evidence/1 as approved in the #4048
proposal: input fingerprints (port, case, corpus, differences, harness, oracle,
generator), status computed from them (never stored), the derived claim, the
rendered pages, schema validation, and `approve`/`reject` -- the only writer of an
approval, refused unless a person signs at a terminal.

- equivalence.py run --record writes the record of the run (committed port and
  case only); evidence.py prove/refresh does the same for crucible ports.
- equivalence_java / cics_crucible keep the generated file each overlay replaces,
  so proof_reach can tell "left as generated" from "ported".
- mutation_scores.py build refreshes each record's mutation section.
- Q1: port/case/corpus/differences staleness fails test_evidence.py; harness/
  oracle/generator staleness is re-proven by the nightly evidence-refresh workflow.
- Q7 (owner decision): PORTED_UNPROVEN_POLICY = "block" -- a ported_unproven method
  makes the record not proven; stubs and left-as-generated never block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Every committed port except the four Db2 cases was proven again at 2f77097 with
`evidence.py prove` (JDK 17, the pinned oracle under GITGALAXY_ORACLE_STRICT=1,
cics-crucible at v0.2.0), and its record written; the pages under
docs/language_status/evidence/ are rendered from them. Every proof's verdict is
proven; under the default policy (ported_unproven blocks) 21 are "proven,
unapproved" and 20 are "not proven" because of ported_unproven methods.

The four Db2 cases (cbsa-inqacc, cbsa-updacc, genapp-lgicdb01, genapp-lgupdb01)
are on the MISSING ratchet: their proof needs IBM's Db2 container and the Db2
COBOL image rebuilt on the pinned oracle.

The harness's dirty check counts tracked files only (the records being written are
untracked until committed); the records' harness_commit is 2f77097, whose tracked
tree was clean during the runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Comment thread tests/tools/evidence.py Fixed
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits October 4, 2026 10:57
The two literals are one table header row split for line length; the
explicit + says so, and clears CodeQL's implicit-concatenation-in-a-list
warning. Output is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants