Skip to content

Commit f505253

Browse files
PhysShellclaude
andcommitted
fix(tests): the S0 control checks that the flag does not move the version
`tests/check_fix_candidates_facts.py` asserted `ownir_version == 0` under the message "ownir_version must stay 0". What it meant is that `--fix-candidates` is additive metadata and does not move the vocabulary version; what it checked was a literal, which held only until the vocabulary first moved. OwnIR v1 moved it, and the `C# leak extractor (Roslyn) -> OwnIR -> core` job went red on that line — with the extractor doing exactly the right thing. It now checks the claim: the flag-on facts are stamped with the core's current OWNIR_VERSION, and with the same value as the flag-off facts. This is the third control of this shape the bump has found (the validation ledger in #383, the instrument's generated facts in this branch), and the only one that needed the server to find it: the script takes the extractor's output as its argument, so it is not part of `tests/run_tests.py` and no local run of that suite could reach it. The job's steps were then run locally as written, from this one to the end of the job, on a Linux clone of the committed tree. tests/goldens/README.md records the golden's second amendment: one line, `"ownir_version": 0` -> `1`, made in the vocabulary commit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 98c062e commit f505253

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎tests/check_fix_candidates_facts.py‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515

1616
import copy
1717
import json
18+
import os
1819
import sys
1920

21+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
22+
23+
from ownlang.ownir import OWNIR_VERSION
24+
2025
_ADDITIVE_COMPONENT_KEYS = (
2126
"qualified_name",
2227
"is_partial",
@@ -65,9 +70,15 @@ def check(cond: bool, msg: str) -> None:
6570
if not cond:
6671
fails.append(msg)
6772

68-
# Top-level: additive version present, ownir_version untouched.
73+
# Top-level: additive version present, ownir_version untouched. "Untouched" is a
74+
# claim about the FLAG, not about a number: `--fix-candidates` is additive metadata,
75+
# so it must stamp the vocabulary version the core currently understands — the same
76+
# one a flag-off run stamps (compared below, where the flag-off facts are in hand).
77+
# This used to read `== 0`, which held only until the vocabulary first moved.
6978
check(on.get("fix_candidates_version") == 1, "top-level fix_candidates_version must be 1")
70-
check(on.get("ownir_version") == 0, "ownir_version must stay 0")
79+
check(on.get("ownir_version") == OWNIR_VERSION,
80+
f"--fix-candidates must not move ownir_version: the facts are stamped "
81+
f"{on.get('ownir_version')!r}, the core understands {OWNIR_VERSION}")
7182

7283
def only_fix(name: str) -> dict | None:
7384
fx = _fixes(on, name)
@@ -226,6 +237,9 @@ def only_fix(name: str) -> dict | None:
226237
if off_path is not None:
227238
off = _load(off_path)
228239
check("fix_candidates_version" not in off, "flag-off: no fix_candidates_version")
240+
check(on.get("ownir_version") == off.get("ownir_version"),
241+
f"the flag moved ownir_version: {off.get('ownir_version')!r} without it, "
242+
f"{on.get('ownir_version')!r} with it")
229243
for c in off.get("components", []): # type: ignore[union-attr]
230244
check("qualified_name" not in c, f"flag-off: {c.get('name')} has qualified_name")
231245
for s in c.get("subscriptions") or []:

‎tests/goldens/README.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ The remaining 11 followed the same derivation, and run 30443181114 (job
3131
values are what the extractor actually emits, not just the dozen that had been read
3232
off a log. The file is a measured artifact again.
3333

34+
**Amended a second time, by OwnIR v1.** The flow vocabulary gained `move` and
35+
`borrow_mut`, `OWNIR_VERSION` moved 0 → 1, and every producer stamps it. One line
36+
of this file changed — `"ownir_version": 0` became `"ownir_version": 1` — and
37+
nothing else: no record, no key, no order. That is again the "intentional
38+
alteration by an unrelated extractor change" case, and again the file is the
39+
`ff21d4a` output plus documented deltas rather than a re-recording.
40+
41+
The same bump found a control that had confused the two things this gate keeps
42+
apart. `tests/check_fix_candidates_facts.py` asserted `ownir_version == 0` under
43+
the message "must stay 0", meaning "the flag does not move the version" but
44+
checking a literal. It now checks what it meant: the flag-on facts carry the
45+
core's current `OWNIR_VERSION`, and the same one as the flag-off facts.
46+
3447
### Regenerating (only when an unrelated extractor change intentionally alters this sample's facts)
3548

3649
```bash

0 commit comments

Comments
 (0)