Skip to content

Commit 29ccc80

Browse files
authored
Merge pull request #325 from PhysShell/claude/own259-cp1-validation
feat(ownir): make the strict door accept the same language as the reference
2 parents 5cf36c0 + 0738d29 commit 29ccc80

11 files changed

Lines changed: 9294 additions & 56 deletions

File tree

‎docs/proposals/P-022-rust-core-migration.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ was #258 alone, which is satisfied. Per the checkpoints #259 itself defines:
5353

5454
| #259 checkpoint | Status | Evidence / what remains |
5555
|---|---|---|
56-
| 1 — typed OwnIR validation | **partial** | `OwnIr::from_json` + the #294 OD-2 fail-loud unknown-kind rule. Full validation acceptance/rejection parity (fixture layer 1) is out of the current slice |
56+
| 1 — typed OwnIR validation | **complete — no known strict-door divergence** | Three censuses. The first froze 77 controls and read 0/0/0 — then review found seven divergences the ledger could not express, because the same author wrote the ledger and the port and one gap in reading BR-D1 produced a matching gap in each (`_svc()` always supplied `lifetime`, so no control could omit it). The second is derived from `load()` and `obligations.py` line by line: **193 controls**, opening a further **58** permissive documents and **9** category mismatches. Closing them was architectural — the strict door is a sequential validator over the raw document (`own-ir/src/strict.rs`) reproducing BR-D1's interleaving of shape and semantics *per section, in declaration order*; `serde` is the typed constructor, and a document it rejects after validation is reported as a hole in the validator and asserted against. The obligation **acceptance grammar** is ported (`own-ir/src/protocol.rs`); protocol *analysis* is not, and is not part of what the door accepts. The third census admitted the two families the second had measured and deliberately excluded — source coordinates beyond signed 64 bits, and nesting depth — once #326 closed them Python-first. That opened 7 permissive documents and 8 more category mismatches, and the classification defect underneath them was the ledger reading its category off the reference's *diagnostic* rather than off the mechanism: `_check_column` raises one message for a bool, a string, a float, an out-of-range integer and a zero alike, so a bool column was filed as a 1-based-contract violation. Taxonomy is **seven** categories on **two axes** — `Shape` is now "no representable primitive or container form", `Location` is "a representable coordinate violating its domain rule", and `WellFormedness` covers records that are typed and vocabulary-legal and still cannot mean anything. **216 controls, matrix 35/181, 0/0/0**, no control escaping into serde; 48 mutations across the three rounds, all caught. #294 OD-2 remains a separate tolerant-door concern |
5757
| 2 — fact lowering | **complete** | `lower()` → `own_lowered`; **27/27** `rust_replay` cases in `tests/fixtures/lowered/manifest.json` byte-exact |
5858
| 3 — interprocedural MOS | **complete for the stage-1 domain** | `dump_summaries()` byte-identical to `python -m ownlang summaries` across **35** `*.summaries.json` goldens. Container-valued metadata is **outside** the declared scalar-metadata parity domain — a separate #294-class door decision, not a silent gap |
5959
| 4 — analysis wiring | **not started** | the crate states its own boundary: "no diagnostics, no analysis" |
@@ -72,7 +72,15 @@ was #258 alone, which is satisfied. Per the checkpoints #259 itself defines:
7272
| 7b | Rust `own-cli`: command/output/exit-code parity | #261 | blocked — needs the production bridge and the output surfaces |
7373
| 8 | Rust-default **cutover**, rollback gate, Python distribution removal | #262 | blocked by #260/#261 and final parity |
7474

75-
**Preferred queue:** #259 remaining (cp1 → cp4 → cp5) → #260/#269.
75+
**Preferred queue:** #259 cp4 → cp5 → #260/#269.
76+
77+
The defensive limits that used to head this queue landed in #326, and the order
78+
was load-bearing rather than tidy. cp1 could report 0/0/0 only over a set with
79+
two known divergence families removed from it, and closing them by widening Rust
80+
— arbitrary-precision integers, `unbounded_depth` — was refused: the limit
81+
belongs in the contract, not in the representation. Because the limits changed
82+
what the reference *accepts*, they had to land Python-first and cp1 had to be
83+
re-measured against them, not merged beside them.
7684

7785
### What #256 asked for that the tree does not have
7886

‎docs/proposals/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ proposal is marked `done` with a pointer.
4141
| [P-017](P-017-multi-stack-frontends.md) | Multi-stack frontends (OwnTS / OwnJVM: OwnJava + OwnKotlin) | draft |
4242
| [P-020](P-020-ownts-react-effects.md) | OwnTS React effects profile (`Own.React`) — the effect-storm angle | draft |
4343
| [P-021](P-021-async-audit-pack.md) | Async audit pack (`Own.Async`) | draft |
44-
| [P-022](P-022-rust-core-migration.md) | Rust core migration: crate DAG, patterns, prior art, differential oracle (Python = golden) | in execution — steps 0–4 built (#214/#249); step 5a done (full diagnostic contract, #255 via #319/#320/#321); step 5b SARIF done (#256; `.ownreport.json` struck — a buffer report needing the AST, not a diagnostics surface); step 6a done (`spec/Bridge.md`, #258); step 6b underway (`own-lowered`/`own-bridge`, #259: lowering + MOS parity landed, analysis wiring open); Python authoritative until cutover |
44+
| [P-022](P-022-rust-core-migration.md) | Rust core migration: crate DAG, patterns, prior art, differential oracle (Python = golden) | in execution — steps 0–4 built (#214/#249); step 5a done (full diagnostic contract, #255 via #319/#320/#321); step 5b SARIF done (#256; `.ownreport.json` struck — a buffer report needing the AST, not a diagnostics surface); step 6a done (`spec/Bridge.md`, #258); step 6b underway (`own-lowered`/`own-bridge`, #259: lowering and MOS parity landed; strict-door validation complete at 216 controls with no known divergence — the first 0/0/0 proved to be the ledger agreeing with its own author, and the second omitted two families that a Python-first defensive-limit change (#326) had to close before the third could measure them; analysis wiring open); Python authoritative until cutover |
4545
| [P-023](P-023-architecture-guard.md) | Architecture guard (`Own.Arch`): rules.yaml intent model + dependency-graph gate + baseline ratchet | draft |
4646
| [P-024](P-024-security-audit-profile.md) | Security audit profile (external tools + SARIF adapters; rejects own scanner engine) | draft |
4747
| [P-025](P-025-obligation-protocols.md) | Obligation protocols (`Own.Protocols`): barrier-sensitive project invariants (OBL001–005) | first slice built (core + bridge + fixtures; extractor pending) |

‎rust/crates/own-bridge/tests/replay.rs‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,20 @@ fn read(name: &str) -> String {
4141
}
4242

4343
/// facts text → the canonical Layer 2 bytes, through the Rust pipeline only.
44+
///
45+
/// Deserialized **without** `OwnIr::from_json`, on purpose. That is the strict
46+
/// door (BR-D1), and this harness exercises the **tolerant** one — the path
47+
/// `check_facts`/`to_module` take when an embedder hands over a dict directly,
48+
/// never having called `load()`. Routing through the strict door would make
49+
/// this suite test the wrong entry surface, and since #259 cp1 taught that door
50+
/// to enforce IR4 it would also make `tolerant_unknown_kind` unreachable: the
51+
/// strict door would reject the facts before the lowerer could demonstrate that
52+
/// it rejects them too. The lowerer's own fail-loud check (#294 OD-2) exists
53+
/// precisely because this path bypasses `load()`, so the test must bypass it as
54+
/// well or it proves nothing.
4455
fn lower_bytes(facts_text: &str, case: &str) -> String {
45-
let facts = own_ir::OwnIr::from_json(facts_text)
46-
.unwrap_or_else(|e| panic!("{case}: own-ir rejected the shared facts: {e}"));
56+
let facts: own_ir::OwnIr = serde_json::from_str(facts_text)
57+
.unwrap_or_else(|e| panic!("{case}: shared facts do not deserialize: {e}"));
4758
let surface = match own_bridge::lower(&facts) {
4859
Ok(doc) => Surface::Lowered(doc),
4960
Err(e) => Surface::Rejected(Rejected {

0 commit comments

Comments
 (0)