Skip to content

Commit 44b405c

Browse files
committed
P-037 A2.2-D tooling: the a2d closure, epoch and environment on every take, the policy field read as an enum
Step 2 of the frozen order (formal note 10.6.14, docs/evidence/p037-a2d-epoch.json). Tooling only: no door, extractor, spec or instrument line other than the two measurement scripts moves; the production-diff gate reports IDENTICAL for this head against 6f9c373, so this head is the T_D candidate the R_D manifest may name. scripts/p037_evidence.py measures in the a2d epoch and in no other. Its instrument roots are the record's, the extractor first among them; the closure is the roots minus the two carved-out doors (instrument_pathspec() for git's diff, instrument_identity() as one digest of the closure's blobs at a commit), so a door change moves nothing in it and an extractor change moves it; the treatment paths are the doors and spec/. Every take records epoch and environment_id, both read from the epoch record as committed at the take's source commit and never from an operator string, plus that record's blob and the instrument identity. A record without an epoch (every a2 record), of another epoch, of another environment, or whose instrument identity does not re-derive at its source commit is refused, and so is any comparison whose two sides differ in epoch, environment or instrument identity: an a2 record cannot become a before side by construction. A HEAD whose epoch record disagrees with the tool's roots, carve-outs or treatment paths fails closure_problems. `python scripts/p037_evidence.py identity` prints what a take at a commit records. scripts/p037_cumulative_evidence.py imports the production-diff gate from the measured checkout as a seventh measurement module, proven by path and hashed against the treatment's blob before import; it refuses a run whose gate blob differs between T_D and the treatment or whose treatment is not IDENTICAL or WITHIN_ALLOWLIST against T_D. It reads the record at the treatment for the epoch, the environment id and measurement_policy.fact_diff, a closed vocabulary held in three equal copies (instrument, gate, driver) that the tests hold equal; it never parses the claims' prose. The baseline records and the four takes must carry that epoch and environment and T_D's instrument identity; the artifact names derive from the epoch (p037-a2d-after-*.json, p037-a2d-cumulative.json, p037-a2d-manifest.md, baseline prefix p037-a2d-baseline-). Under "unchanged" the fact claims are that every fact document is identical between before and after and that both MOS takes count zero moved facts; under "allowed_surfaces" the a2 claims stand as they were. The artifact records epoch, environment, policy, the record's blob, the gate report and the instrument identity digest. Controls: tests/test_p037_evidence.py builds the synthetic history with the Python door as the treatment file and adds the extractor and the Rust door (an extractor change is instrument drift and refuses the pair, a door change is treatment and is admitted, the instrument identity is equal across a door change and differs across an extractor change), the epoch controls (a record without an epoch, of another epoch, of another environment, missing its environment, with a tampered instrument identity or carve-outs, refused; the closure digest covers the extractor and excludes the doors; the tool refuses a record that disagrees with its closure; a take under another epoch's record or under no record refused). The driver's selftest adds: under "unchanged" a moved document or a take counting moved facts is negative evidence; under "allowed_surfaces" the a2 claims hold; an unknown policy, a gate VIOLATION, a take from another environment or without an epoch are refused. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfeUtLRm6KFRWcTGQZxQQb
1 parent ecec3ea commit 44b405c

6 files changed

Lines changed: 659 additions & 53 deletions

File tree

‎AGENTS.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ This file provides guidance to agents when working with code in this repository.
1717
- `audit/` must stay decoupled from `ownlang` and consumes `own-check` only through its CLI/SARIF; `audit/README.md` says active audit development currently lives in the separate OwnAudit repo.
1818
- `frontend/roslyn/OwnSharp.Oracle` is P-037 evidence infrastructure, not production: it must share no source with the extractor, never writes OwnIR, and is held to the designed classifications in `corpus/p037-hostile/expected.json` (generated; regenerate with `python scripts/p037_hostile_census.py generate`, never edit by hand) and the findings ledger `corpus/p037-relevance/oracle_findings.json`; run it with `python scripts/p037_completeness_oracle.py check`.
1919
- `corpus/p037-mutation` is the A2.2-5 mutation campaign against that oracle: `manifest.json` and `sources/` are generated (`python scripts/p037_mutation_campaign.py generate`, never edited by hand), `report.json` is recorded by `run --record` for one manifest and one production digest and must be re-recorded when either moves; a mutant counts as killed only by its preregistered oracle reason, never by a build failure, an extractor crash or an unrelated test.
20-
- `scripts/p037_cumulative_evidence.py` is the A2.2-S governed cumulative measurement (four takes verified and compared against the R baseline by the snapshot tools, a fact-diff classified by the allowed surfaces `functions[*].guarded_facts` / `guarded_functions[]`, an anchored per-document layer differential on both engines); it is evidence orchestration, not part of the frozen instrument closure, its provenance is fail-closed (head must equal the named treatment; in evidence mode it is one command with no `--stage`, `--out` must not exist and is published transactionally so a `REFUSED` leaves nothing, the driver must run from a clean checkout byte-identical to its HEAD blob and that HEAD must be the `--orchestrator-commit` named on the command line, the measured checkout is authenticated with git alone before any of its modules is imported, every imported measurement module must resolve to the measured checkout by path, and the outcome is exactly one of REFUSED / negative evidence / accepted with `is_evidence` true for every published evidence artifact) and its outputs go under an `--out` outside the checkout; the evidence run is the operator's, on the measurement machine.
20+
- `scripts/p037_cumulative_evidence.py` is the governed cumulative measurement (four takes verified and compared against the baseline by the snapshot tools, a per-document fact diff whose expectation is the epoch record's closed field `measurement_policy.fact_diff` (`unchanged` in a2d; `allowed_surfaces` was the a2 policy of A2.2-S, movement confined to `functions[*].guarded_facts` / `guarded_functions[]`), an anchored per-document layer differential on both engines, the production-diff gate applied to the treatment head against T_D as eligibility); it is evidence orchestration, not part of the frozen instrument closure, its provenance is fail-closed (head must equal the named treatment; in evidence mode it is one command with no `--stage`, `--out` must not exist and is published transactionally so a `REFUSED` leaves nothing, the driver must run from a clean checkout byte-identical to its HEAD blob and that HEAD must be the `--orchestrator-commit` named on the command line, the measured checkout is authenticated with git alone before any of its modules is imported, every imported measurement module must resolve to the measured checkout by path, and the outcome is exactly one of REFUSED / negative evidence / accepted with `is_evidence` true for every published evidence artifact) and its outputs go under an `--out` outside the checkout; the evidence run is the operator's, on the measurement machine.
2121
- `docs/evidence/p037-a2d-epoch.json` freezes the A2.2-D epoch (formal note §10.6.14): the a2 epoch is closed by A2.2-S, its T/R/S are historical predecessors (full 40-char SHAs) and never baselines; the a2d treatment is the two OwnIR doors (`ownlang/ownir.py`, `rust/crates/own-ir/`) plus `spec/`, the extractor is instrument now, the environment is `P037_A2D_MEASUREMENT_M2`, and `tests/test_p037_a2d_epoch.py` refuses any door change on the branch until the R_D manifest names T_D.
22+
- `scripts/p037_evidence.py` measures in the a2d epoch only: its instrument closure is the roots minus the carve-outs (`instrument_pathspec()`, `instrument_identity()`), every take records `epoch` and the `environment_id` read from the epoch record at its source commit (never an operator string), a record without an epoch (every a2 record) or from another epoch or environment is refused as a before side by construction, and `closure_problems()` refuses a HEAD whose epoch record disagrees with the tool's closure.
2223
- Inside those wide treatment units the D production diff is bounded by `scripts/p037_door_diff_gate.py` reading the record's `production_diff_gate` (Python: only top-level `load()` plus registered door-only helpers, every other top-level definition AST-identical; Rust: `src/strict.rs` free, in `src/lib.rs` only `struct Function` / `struct OwnIr` plus registered new items, the rest of the crate's production files byte-identical, `tests/` free; spec: only `spec/OwnIR.md` and `spec/ownir.schema.json`); verdicts IDENTICAL / WITHIN_ALLOWLIST / VIOLATION, anything undecidable is REFUSED. The driver's fact expectation is the closed field `measurement_policy.fact_diff`, never the prose of `claims_preregistered`.
2324
- Existing Cursor guidance: if CodeGraph MCP tools are available, prefer them for structural symbol/caller/impact questions; use text search for literal strings and comments.

‎docs/notes/p037-formal-kernel.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,3 +1926,36 @@ the gate script and is mirrored by the tooling), and a missing or unknown
19261926
value is REFUSED; the prose of `claims_preregistered` is for people and is
19271927
never parsed. After this the freeze is not touched again; the next substantive
19281928
boundary is tooling, then T_D.
1929+
1930+
**Tooling (step 2).** `scripts/p037_evidence.py` now measures in the a2d
1931+
epoch and in no other: its instrument roots are the record's (the extractor
1932+
first among them), the closure is the roots minus the two carve-outs
1933+
(`instrument_pathspec()` for git, `instrument_identity()` as one digest of
1934+
the closure's blobs at a commit, so a door change moves nothing in it and an
1935+
extractor change moves it), the treatment paths are the doors and `spec/`.
1936+
Every take records `epoch` and `environment_id`, both taken from the epoch
1937+
record as committed at the take's source commit and never from an operator
1938+
string, plus the blob of that record and the instrument identity; a record
1939+
without an epoch (every a2 record), of another epoch, of another environment
1940+
or with an instrument identity that does not re-derive at its source commit is
1941+
refused, so an a2 record cannot become a before side by construction, and a
1942+
HEAD whose record disagrees with the tool's closure fails `closure_problems`.
1943+
`python scripts/p037_evidence.py identity` prints what a take at a commit
1944+
records. The cumulative driver imports the production-diff gate from the
1945+
measured checkout as a seventh measurement module (proven by path, hashed
1946+
against the treatment's blob before import) and refuses a run whose gate
1947+
blob differs between T_D and the treatment or whose treatment is not
1948+
IDENTICAL or WITHIN_ALLOWLIST against T_D; it reads the record at the
1949+
treatment for the epoch, the environment id and `measurement_policy.fact_diff`
1950+
(closed vocabulary held in three equal copies: instrument, gate, driver;
1951+
`tests/test_p037_cumulative_evidence.py` holds them equal), requires the
1952+
baseline records and the four takes to carry that epoch and environment and
1953+
T_D's instrument identity, and derives its artifact names from the epoch
1954+
(`p037-a2d-after-*.json`, `p037-a2d-cumulative.json`, `p037-a2d-manifest.md`,
1955+
baseline prefix `p037-a2d-baseline-`). Under `unchanged` the fact claims are
1956+
that every fact document is identical between before and after and that both
1957+
MOS takes count zero moved facts; under `allowed_surfaces` the a2 claims
1958+
stand as they were. No door, extractor, spec or instrument line other than
1959+
this tooling moves; the gate reports IDENTICAL against `6f9c373`. The
1960+
terminal-green head of this step is the T_D candidate; the R_D manifest names
1961+
it.

0 commit comments

Comments
 (0)