fix(fixtures): align the baseline graph and pin with the current contracts

Follow-up to a5969af3, which gave the catalog entry the native_result the
contract requires.  Two consequences had to be carried through.

1. The declared pin now carries that native_result.  resolve_baseline_pin returns
   it for the metric entry, so the fixture's own baseline_pin - which the resolver
   oracle in test_baseline_resolver.py is built from - must declare the same block;
   otherwise the oracle asserted a pin the resolver could never produce.  The
   migration script syncs it from the entry revision rather than duplicating it.

2. _GRAPH_WITH_REF no longer carries an unbound compare_to_baseline step.  A graph
   holds its baseline references declaratively in `baselines`, and that is what
   graph_has_baseline_refs reads (baseline_resolver.py:60-63) and what needs_pin
   consults - the step is not the reference.  A v1 graph may not carry that step at
   all: runner_plan.py:144-150 refuses the shape as UNBOUND_BASELINE_GRAPH before
   the resolver runs, which is why two start_run tests in this file read as a
   regex mismatch rather than as the refusal they target.  The step becomes a
   literal assertion, so the derived plan stays non-empty (an empty plan would
   mark a walked run passed without executing anything) while the resolver still
   sees a graph with baseline refs and no explicit selector.  The test's own
   assertion graph_has_baseline_refs(...) is True keeps holding.

Measured with the Molecular CoT digest: the NATIVE_RESULT_CATALOG_INVALID EXPLORE
records that dominated this suite are gone, and nothing replaced them.

execution 3 failed / 411 passed -> 414 passed; registry 12 failed / 968 passed;
scenario 414 passed.  No production code touched.
This commit is contained in:
2026-10-09 21:30:18 +03:00
parent a5969af341
commit e0b6bec875
3 changed files with 114 additions and 4 deletions

View File

@@ -59,6 +59,20 @@ PATH = Path(__file__).resolve().parents[0] / ".." / "specs" / "044-dashboard-sce
TABLE_INDEX = 1
def sync_pin_native_result(data: dict) -> int:
"""The pin declares what resolution returns; the metric entry now carries a native_result."""
by_baseline = {wrapper["baseline_id"]: wrapper["entry"]
for wrapper in data["catalog_revision"]["entry_revisions"]}
synced = 0
for pin_entry in data["baseline_pin"].get("entries", []):
entry = by_baseline.get(pin_entry.get("baseline_id"))
block = (entry or {}).get("native_result")
if block is not None and pin_entry.get("native_result") != block:
pin_entry["native_result"] = json.loads(json.dumps(block))
synced += 1
return synced
def canonical_holders(data: dict, entry: dict):
"""Every canonical table the fixture repeats: the entry's own and both comparison sides."""
yield entry["expected"]["canonical"]
@@ -101,8 +115,16 @@ def main() -> int:
revision = data["catalog_revision"]
wrapper = revision["entry_revisions"][TABLE_INDEX]
entry = wrapper["entry"]
if "native_result" in entry and "canonical" not in entry.get("expected", {}):
raise SystemExit("fixture already carries a native_result block; nothing to migrate")
already = "native_result" in entry and "canonical" not in entry.get("expected", {})
if already:
# Idempotent second half: the declared pin must return what the resolver now produces from
# this entry, which includes the native_result block the pin oracle did not carry before.
synced = sync_pin_native_result(data)
print(f"entry already migrated; pin entries synced: {synced}")
if "--write" in sys.argv:
PATH.write_text(json.dumps(data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
print(f"written: {PATH}")
return 0
entry.setdefault("dataset_id", 4)
canonical = entry["expected"]["canonical"]