Skip to content

Commit 21fb0c3

Browse files
authored
Merge pull request #341 from PhysShell/claude/coordinate-domain-contract-ie8jmb
feat(ownir): bound source coordinates to int32 and mirror it in the bridge (#259 final acceptance)
2 parents 834f295 + 8fc44ff commit 21fb0c3

69 files changed

Lines changed: 6259 additions & 799 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/evidence/p022-coord-1.json‎

Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
1+
{
2+
"schema": 1,
3+
"campaign": "p022-coord-1",
4+
"description": "#259 final acceptance, the STRICT door: the coordinate domain of spec/OwnIR.md §4.2 in both implementations. Every rule is mutated twice — once in the reference (ownlang/ownir.py, ownlang/obligations.py) and once in its Rust mirror (own-ir/src/strict.rs, own-ir/src/protocol.rs) — because a domain that only one side enforces is a divergence the ledger would report as a category mismatch rather than as the missing rule it is. Both ends of both bounds are attacked, and off-by-one at each, since a domain checked only far outside cannot tell a correct limit from a narrow one; the two fields §4.2 used to record as validated NOWHERE are attacked at every nesting shape, because then/else/body are three separate recursion sites. Two mutations attack the CATEGORY and the message rather than the verdict: a domain violation filed as `shape` is the exact defect #326's census found in `column`, and it would leave every accept/reject green.",
5+
"layers": [
6+
{
7+
"id": "py-limits",
8+
"cwd": ".",
9+
"command": [
10+
"python3",
11+
"tests/test_ownir_defensive_limits.py"
12+
],
13+
"parser": "python-fail"
14+
},
15+
{
16+
"id": "py-ledger",
17+
"cwd": ".",
18+
"command": [
19+
"python3",
20+
"tests/test_ownir_validation_fixtures.py"
21+
],
22+
"parser": "python-fail"
23+
},
24+
{
25+
"id": "rust-door",
26+
"cwd": "rust",
27+
"command": [
28+
"cargo",
29+
"test",
30+
"-p",
31+
"own-ir",
32+
"--no-fail-fast"
33+
],
34+
"parser": "cargo"
35+
}
36+
],
37+
"control": {
38+
"id": "M00",
39+
"description": "harness-honesty control: no mutation at all, which must report zero failing layers"
40+
},
41+
"mutations": [
42+
{
43+
"id": "M01",
44+
"rule": "§4.2 line domain",
45+
"description": "the strict door loses the domain's LOWER bound, so a negative line is accepted again",
46+
"target": "ownlang/ownir.py",
47+
"pattern": " if not LINE_MIN <= v <= LINE_MAX:",
48+
"replacement": " if not v <= LINE_MAX:",
49+
"expected_catchers": [
50+
"py-limits::line-domain",
51+
"py-ledger::ledger-stale"
52+
]
53+
},
54+
{
55+
"id": "M02",
56+
"rule": "§4.2 line domain",
57+
"description": "…and the UPPER bound, so an int64 line is accepted again",
58+
"target": "ownlang/ownir.py",
59+
"pattern": " if not LINE_MIN <= v <= LINE_MAX:\\n raise OwnIRError\\(\\n f\\\"\\{where\\} \\{field!r\\} must be a source line in \\\"",
60+
"replacement": " if not LINE_MIN <= v:\n raise OwnIRError(\n f\"{where} {field!r} must be a source line in \"",
61+
"expected_catchers": [
62+
"py-limits::line-domain",
63+
"py-ledger::ledger-stale"
64+
]
65+
},
66+
{
67+
"id": "M03",
68+
"rule": "§4.2 line domain",
69+
"description": "off-by-one at the bottom: 0 stops being legal, which would break the reference's own absent-line default",
70+
"target": "ownlang/ownir.py",
71+
"pattern": " if not LINE_MIN <= v <= LINE_MAX:\\n raise",
72+
"replacement": " if not LINE_MIN < v <= LINE_MAX:\n raise",
73+
"expected_catchers": [
74+
"py-limits::line-domain",
75+
"py-ledger::ledger-stale"
76+
]
77+
},
78+
{
79+
"id": "M04",
80+
"rule": "§4.2 line domain",
81+
"description": "…and at the top: 2147483647 stops being legal",
82+
"target": "ownlang/ownir.py",
83+
"pattern": " if not LINE_MIN <= v <= LINE_MAX:\\n raise OwnIRError",
84+
"replacement": " if not LINE_MIN <= v < LINE_MAX:\n raise OwnIRError",
85+
"expected_catchers": [
86+
"py-limits::line-domain",
87+
"py-ledger::ledger-stale"
88+
]
89+
},
90+
{
91+
"id": "M05",
92+
"rule": "§4.2 message",
93+
"description": "the domain diagnostic stops naming the domain",
94+
"target": "ownlang/ownir.py",
95+
"pattern": "f\"\\{where\\} \\{field!r\\} must be a source line in \"",
96+
"replacement": "f\"{where} {field!r} must be a bad coordinate \"",
97+
"expected_catchers": [
98+
"py-limits::line-domain",
99+
"py-ledger::ledger-stale"
100+
]
101+
},
102+
{
103+
"id": "M06",
104+
"rule": "§4.2 / D2",
105+
"description": "the subscriptions walk stops checking its line — the field §4.2 used to record as validated nowhere",
106+
"target": "ownlang/ownir.py",
107+
"pattern": " _check_line_domain\\(sln, \"subscription\"\\)",
108+
"replacement": " _ = sln",
109+
"expected_catchers": [
110+
"py-limits::line-domain",
111+
"py-ledger::ledger-stale"
112+
]
113+
},
114+
{
115+
"id": "M07",
116+
"rule": "§4.2 / D2",
117+
"description": "…and the flow-op walk stops checking its line",
118+
"target": "ownlang/ownir.py",
119+
"pattern": " _check_line_domain\\(ln, what\\)",
120+
"replacement": " _ = ln",
121+
"expected_catchers": [
122+
"py-limits::line-domain",
123+
"py-ledger::ledger-stale"
124+
]
125+
},
126+
{
127+
"id": "M08",
128+
"rule": "§4.2 / D2",
129+
"description": "the flow walk stops recursing into one nesting shape, so a `while` body's line escapes",
130+
"target": "ownlang/ownir.py",
131+
"pattern": " for key in \\(\"then\", \"else\", \"body\"\\):",
132+
"replacement": " for key in (\"then\", \"else\"):",
133+
"expected_catchers": [
134+
"py-limits::line-domain",
135+
"py-ledger::ledger-stale"
136+
]
137+
},
138+
{
139+
"id": "M09",
140+
"rule": "§4.2 / D2",
141+
"description": "the subscriptions line loses its bool guard, so `true` reads as line 1 — the bool-is-int trap the contract calls out by name",
142+
"target": "ownlang/ownir.py",
143+
"pattern": " if not isinstance\\(sln, int\\) or isinstance\\(sln, bool\\):",
144+
"replacement": " if not isinstance(sln, int) or False:",
145+
"expected_catchers": [
146+
"py-limits::line-type",
147+
"py-ledger::ledger-stale"
148+
]
149+
},
150+
{
151+
"id": "M10",
152+
"rule": "§4.2 line domain",
153+
"description": "the root-resolve site array stops checking its coordinate",
154+
"target": "ownlang/ownir.py",
155+
"pattern": " _check_line_domain\\(site\\.get\\(\"line\", 0\\), \"service root_resolve_site\"\\)",
156+
"replacement": " _ = site",
157+
"expected_catchers": [
158+
"py-limits::line-domain",
159+
"py-ledger::ledger-stale"
160+
]
161+
},
162+
{
163+
"id": "M11",
164+
"rule": "§4.1 / §4.2 column",
165+
"description": "the column loses its domain upper bound",
166+
"target": "ownlang/ownir.py",
167+
"pattern": " if v > COLUMN_MAX:",
168+
"replacement": " if v > INT64_MAX:",
169+
"expected_catchers": [
170+
"py-limits::column-domain",
171+
"py-ledger::ledger-stale"
172+
]
173+
},
174+
{
175+
"id": "M12",
176+
"rule": "§4.1 column",
177+
"description": "…and its 1-based lower bound, so `0` becomes a legal column",
178+
"target": "ownlang/ownir.py",
179+
"pattern": "or v < COLUMN_MIN:",
180+
"replacement": "or v < COLUMN_MIN - 1:",
181+
"expected_catchers": [
182+
"py-limits::column-domain",
183+
"py-ledger::ledger-stale"
184+
]
185+
},
186+
{
187+
"id": "M13",
188+
"rule": "§4.2 two doors",
189+
"description": "the strict door stops refusing an out-of-domain event line and degrades instead",
190+
"target": "ownlang/obligations.py",
191+
"pattern": " if not strict:\\n return 0",
192+
"replacement": " if True:\n return 0",
193+
"expected_catchers": [
194+
"py-limits::line-domain",
195+
"py-ledger::ledger-stale"
196+
]
197+
},
198+
{
199+
"id": "M14",
200+
"rule": "§4.2 line domain",
201+
"description": "the Rust door loses the domain's LOWER bound",
202+
"target": "rust/crates/own-ir/src/strict.rs",
203+
"pattern": " LINE_MIN <= value && value <= LINE_MAX",
204+
"replacement": " value <= LINE_MAX",
205+
"expected_catchers": [
206+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
207+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
208+
]
209+
},
210+
{
211+
"id": "M15",
212+
"rule": "§4.2 line domain",
213+
"description": "…and its UPPER bound",
214+
"target": "rust/crates/own-ir/src/strict.rs",
215+
"pattern": " LINE_MIN <= value && value <= LINE_MAX\\n\\}",
216+
"replacement": " LINE_MIN <= value\n}",
217+
"expected_catchers": [
218+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
219+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
220+
]
221+
},
222+
{
223+
"id": "M16",
224+
"rule": "§4.2 line domain",
225+
"description": "off-by-one at the bottom in the Rust door",
226+
"target": "rust/crates/own-ir/src/strict.rs",
227+
"pattern": " LINE_MIN <= value && value <= LINE_MAX\\n\\}\\n",
228+
"replacement": " LINE_MIN < value && value <= LINE_MAX\n}\n",
229+
"expected_catchers": [
230+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
231+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
232+
]
233+
},
234+
{
235+
"id": "M17",
236+
"rule": "§4.2 line domain",
237+
"description": "…and at the top",
238+
"target": "rust/crates/own-ir/src/strict.rs",
239+
"pattern": " LINE_MIN <= value && value <= LINE_MAX\\n\\}\\n\\n",
240+
"replacement": " LINE_MIN <= value && value < LINE_MAX\n}\n\n",
241+
"expected_catchers": [
242+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
243+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
244+
]
245+
},
246+
{
247+
"id": "M18",
248+
"rule": "cp1 taxonomy",
249+
"description": "the Rust domain rejection is filed as `shape` — the category read off the wrong axis, the exact defect #326's census found in `column`",
250+
"target": "rust/crates/own-ir/src/strict.rs",
251+
"pattern": " Err\\(location\\(format!\\(\\n \\\"\\{what\\} '\\{key\\}' must be a source line in",
252+
"replacement": " Err(shape(format!(\n \"{what} '{key}' must be a source line in",
253+
"expected_catchers": [
254+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
255+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
256+
]
257+
},
258+
{
259+
"id": "M19",
260+
"rule": "§4.2 message",
261+
"description": "the Rust domain diagnostic stops naming the domain",
262+
"target": "rust/crates/own-ir/src/strict.rs",
263+
"pattern": "must be a source line in \\[\\{LINE_MIN\\}, \\{LINE_MAX\\}\\]",
264+
"replacement": "must be a bad coordinate [{LINE_MIN}, {LINE_MAX}]",
265+
"expected_catchers": [
266+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
267+
]
268+
},
269+
{
270+
"id": "M20",
271+
"rule": "§4.2 / D2",
272+
"description": "the Rust subscriptions walk stops checking its line",
273+
"target": "rust/crates/own-ir/src/strict.rs",
274+
"pattern": " defaulted_line\\(sub, \"line\", \"subscription\"\\)\\?;",
275+
"replacement": " let _ = &sub;",
276+
"expected_catchers": [
277+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language"
278+
]
279+
},
280+
{
281+
"id": "M21",
282+
"rule": "§4.2 / D2",
283+
"description": "…and the Rust flow-op walk stops checking its line",
284+
"target": "rust/crates/own-ir/src/strict.rs",
285+
"pattern": " defaulted_line\\(op, \"line\", &label\\)\\?;",
286+
"replacement": " let _ = &label;",
287+
"expected_catchers": [
288+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
289+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
290+
]
291+
},
292+
{
293+
"id": "M22",
294+
"rule": "§4.2 / D2",
295+
"description": "the Rust flow walk stops recursing into one nesting shape",
296+
"target": "rust/crates/own-ir/src/strict.rs",
297+
"pattern": " for key in \\[\"then\", \"else\", \"body\"\\] \\{",
298+
"replacement": " for key in [\"then\", \"else\"] {",
299+
"expected_catchers": [
300+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language"
301+
]
302+
},
303+
{
304+
"id": "M23",
305+
"rule": "§4.2 line domain",
306+
"description": "the Rust site array stops checking its coordinate",
307+
"target": "rust/crates/own-ir/src/strict.rs",
308+
"pattern": " defaulted_line\\(obj, \\\"line\\\", &singular\\)\\?;",
309+
"replacement": " let _ = &singular;",
310+
"expected_catchers": [
311+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language"
312+
]
313+
},
314+
{
315+
"id": "M24",
316+
"rule": "§4.1 / §4.2 column",
317+
"description": "the Rust column loses its domain upper bound",
318+
"target": "rust/crates/own-ir/src/strict.rs",
319+
"pattern": " if n > COLUMN_MAX \\{",
320+
"replacement": " if n > i64::MAX {",
321+
"expected_catchers": [
322+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
323+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
324+
]
325+
},
326+
{
327+
"id": "M25",
328+
"rule": "§4.1 column",
329+
"description": "…and its 1-based lower bound",
330+
"target": "rust/crates/own-ir/src/strict.rs",
331+
"pattern": " if n < COLUMN_MIN \\{",
332+
"replacement": " if n < COLUMN_MIN - 1 {",
333+
"expected_catchers": [
334+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
335+
"rust-door/tests/validation_replay.rs::the_coordinate_rules_report_the_axis_they_are_on"
336+
]
337+
},
338+
{
339+
"id": "M26",
340+
"rule": "§4.2 two doors",
341+
"description": "the Rust strict door stops refusing an out-of-domain event line and degrades instead",
342+
"target": "rust/crates/own-ir/src/protocol.rs",
343+
"pattern": " Door::Strict => line_domain\\(value, what, \"line\"\\)\\.map\\(\\|\\(\\)\\| value\\),",
344+
"replacement": " Door::Strict => Ok(0),",
345+
"expected_catchers": [
346+
"rust-door/tests/validation_replay.rs::the_two_loaders_accept_the_same_language",
347+
"rust-door/src/lib.rs::protocol::tests::an_absent_line_is_zero_and_an_out_of_domain_one_follows_the_door"
348+
]
349+
}
350+
]
351+
}

0 commit comments

Comments
 (0)