Skip to content

evidence: fingerprint the harness, oracle and generator per component (Fixes #4731) - #4785

Merged
squid-protocol merged 3 commits into
mainfrom
feat/4731-component-fingerprints
Oct 9, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
feat/4731-component-fingerprints

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Fixes #4731

One harness / oracle / generator fingerprint covered everything, so any edit staled every record and ledger entry. Each of the three inputs is now also fingerprinted per component, and a record stores the components its target uses.

Design

  • tests/tools/evidence.py COMPONENTS: harness (cics = equivalence_cics.py, call, db2, crucible, core), oracle (cics-stub = ggcics.c + spec, db2 = ggsql.c/uow/equivalence_sql.py, image-db2, le, file-io = ggfault.c, core), generator (each det/*.py module, each cobolrt file, core = forges + java_target + everything else). A partition of the same files; sha256 of each whole input is unchanged, so digest, approvals and rendered pages do not move.
  • Usage is recorded in inputs.<input>.components (only the components the target uses). Rules are conservative: unused only where the code path provably does not run for the target's kind / Db2 flag / LINKed programs (the why of each rule; guard tests); a crucible port uses everything; everything not attributable is core. det modules and the cobolrt runtime run in a record's proof only for a case that LINKs programs (equivalence_java.linked_programs) plus what the harness imports (det.source always; det.cics/cvda + their import closure where harness:cics is used); a port that names a runtime class ships it (closure by name, comments stripped).
  • Stale logic: a record holding components is stale on an input only if a component it uses changed (a used component it does not hold counts as changed). A record without components keeps the whole-input comparison. status() gains stale_components; stale and its meaning (evidence_report L3* logic) are unchanged.
  • det_coverage_ledger.py: entries carry inputs.components (harness/oracle); same rule.

Transition

Old records/entries behave exactly as before until migrated. evidence.py migrate / det_coverage_ledger.py migrate add components only where sound: the stored whole fingerprint equals the tree's, or some git commit's files (the entry's measured_at, or a recent main commit) reproduce it byte for byte (evidence_history.py). This PR commits that migration (45 records, 65 ledger entries; no proof, digest or approval changed). Records the migration cannot reproduce stay legacy; refresh --stale (the scheduled bot) re-proves stale ones and stores components automatically. Evidence-report files are not committed (bot).

Measurement (python tests/tools/evidence_history.py replay --merges 30)

Last 30 merges on main touching tests/tools or the Java generator; records/ledger entries stale on harness/oracle/generator per PR, as if proven at the parent.
Totals over 30 PRs: records 945 -> 922; ledger 897 -> 897. Per PR: CICS-stub/equivalence_cics PRs spare the batch/call records (45 -> 38 when only det/cics + stub + harness:cics move), det program.py-only PRs 45 -> 38/42. Most recent PRs are cross-cutting (CICS forge in generator:core, det gen.py, equivalence_common), so they still stale all, as the whole estate is regenerated by the forges for every case. Follow-up: fingerprint the generated output rather than the generator source, or split CicsForge out of core.

Tests

tests/cobol_mainframe/test_evidence_components.py: CICS stub stales no batch/call case; DetSql stales only cases that ship it (Db2 LINKing + crucible); Cobol.java stales every case shipping the runtime; det program/sql/refine stale only LINKing cases; forge/core edits stale all; legacy records unchanged; partition exact. Gates: pr_gates --fast 5/5; --ratchets 7/7 (with equivalence_env). test_evidence_report committed-reports test fails identically on origin/main in this environment (corpora).

🤖 Generated with Claude Code

https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D

@squid-protocol squid-protocol added enhancement New feature, sensor, or structural signature testing Unit, integration, and E2E pipeline verification labels Oct 9, 2026
now = fingerprints(case)
comps = now["components"] if all(inputs.get(n) == now[n] for n in INPUTS) else None
if comps is None and history: # the commit the entry was measured at, if its files reproduce the entry
import evidence_history # noqa: PLC0415


def replay(ref: str, merges: int) -> dict[str, Any]:
import det_coverage_ledger as dcl # noqa: PLC0415 -- (its fingerprint scheme, judged on the historical trees)
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

… records, re-migrated)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol
squid-protocol marked this pull request as ready for review October 9, 2026 16:40
@squid-protocol
squid-protocol merged commit 666314e into main Oct 9, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the feat/4731-component-fingerprints branch October 9, 2026 16:40
squid-protocol added a commit that referenced this pull request Oct 9, 2026
…dger re-applied from the sweep, carddemo-tranadd re-proved

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

enhancement New feature, sensor, or structural signature testing Unit, integration, and E2E pipeline verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

evidence: finer-grained fingerprints — a case goes stale only when the harness/runtime parts it uses change

2 participants