117 lines
5.6 KiB
Python
117 lines
5.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Walk the #2479 dichotomy-wave gap-closing construction contract for
|
|
standardized_providers through its FULL lifecycle in ONE process (shared-
|
|
store clobber hazard law): submit_need -> approved -> building ->
|
|
verifying -> closed, with the pushed feat-commit SHA as evidence on every
|
|
checkpoint. Run AFTER the feat commit is pushed (its SHA must be final —
|
|
a rebase would otherwise orphan the evidence citations).
|
|
|
|
Usage: python3 scripts/walk_contract_gap_sp.py <feat_sha>
|
|
|
|
CS_RUST_LIB must point at a BUILT capability_scoring .so (the Python
|
|
oracle is retired and raises).
|
|
"""
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
|
|
|
FEAT_SHA = sys.argv[1] if len(sys.argv) > 1 else ""
|
|
if not FEAT_SHA:
|
|
sys.exit("usage: walk_contract_gap_sp.py <feat_sha>")
|
|
|
|
from rune.construction_interface import ConstructionInterface
|
|
|
|
iface = ConstructionInterface(builder="factory-gap-sp")
|
|
|
|
r = iface.submit_need(
|
|
"Close standardized_providers PARTIAL gaps (dichotomy wave, issue "
|
|
"#2479 tranche): port the 2 audit-missing functions name-preserving "
|
|
"into the existing Go binary (list_providers -> ListProviders, "
|
|
"connect_all_local -> ConnectAllLocal) and deepen connect_provider "
|
|
"from a comment-only match to the real ConnectProvider envelope port, "
|
|
"in src/go/standardized-providers/main.go; full provider table (10 "
|
|
"entries, insertion order), error-as-data connect gates, the "
|
|
"provider_registry-backed fresh-connect envelope, and the byte-"
|
|
"identical CLI text (usage/list/connect variants/connect-all/unknown). "
|
|
"Frozen-truth battery via the shared freeze_truth.py harness under "
|
|
"scripts/sp_freeze_seams (hermetic HOME + bare sibling-import + "
|
|
"asdict/CLI seams), replayed VERBATIM (go:embed) in connect_test.go; "
|
|
"live parity 100% via scripts/check_standardized_providers_parity.py; "
|
|
"gofmt/vet/go build clean; Python oracle smoke green both pins "
|
|
"(no loader seam: pin vacuous, documented).",
|
|
origin="builder",
|
|
)
|
|
print("submit_need:", json.dumps(r)[:400])
|
|
if not r.get("success"):
|
|
print("NEED FAILED — aborting")
|
|
sys.exit(1)
|
|
c = r["ids"]["contract_id"]
|
|
print("contract_id:", c)
|
|
|
|
for phase in ("approved", "building"):
|
|
t = iface.transition(c, phase)
|
|
print(f"transition->{phase}:", json.dumps(t)[:300])
|
|
if not t.get("success"):
|
|
sys.exit(1)
|
|
|
|
# verifying + closing: evidence rides every checkpoint (field name is
|
|
# "evidence" when reading the entity, evidence_ref when transitioning).
|
|
t = iface.transition(c, "verifying", evidence_ref=f"parity {FEAT_SHA}")
|
|
print("transition->verifying:", json.dumps(t)[:300])
|
|
if not t.get("success"):
|
|
sys.exit(1)
|
|
|
|
cl = iface.close(c, observed_evidence=[{
|
|
"kind": "port_evidence",
|
|
"detail": (
|
|
f"standardized_providers dichotomy gap-close — feat commit "
|
|
f"{FEAT_SHA}, verified as gitea/master ancestor (two-commit "
|
|
"flow: feat parity commit + chore(store) contract close; store "
|
|
"segment architecture, pulled before the store-side close). "
|
|
"Module audit 3/5 PARTIAL -> 5/5 FULL (missing list empty). "
|
|
"Gap fns ported name-preserving into "
|
|
"src/go/standardized-providers/main.go (ListProviders, "
|
|
"ConnectProvider deepened from comment-match to real envelope "
|
|
"port, ConnectAllLocal, GetProviderDataclass asdict seam "
|
|
"projection; runCLI carries the byte-identical CLI contract). "
|
|
"Oracle quirks frozen as truth rows: insertion-ordered JSON "
|
|
"envelopes (TWO distinct key orders — list projection drops "
|
|
"models, asdict keeps it; Go structs in declaration order, "
|
|
"never maps) and the partial-return trap (connect_provider "
|
|
"RETURNS error dicts; connect_all_local coerces into failure "
|
|
"rows and continues). Freeze: 43-case shared-harness corpus "
|
|
"under scripts/sp_freeze_seams (pin_home hermetic HOME for the "
|
|
"providers.json write-through + src/rune sibling path for the "
|
|
"bare provider_registry import + argv-patched stdout-capture "
|
|
"main_* seams); freeze_truth.py --verify 43 cases byte-"
|
|
"identical against the live oracle; Go battery 7/7 "
|
|
"(TestFrozenTruthReplay embeds truth.json verbatim + "
|
|
"ordered-JSON/error-as-data/CLI-bytes quirk tests); CI replay "
|
|
"binary 43/43; live parity 52/52 (op dispatch + CLI "
|
|
"double-checked through stdin-op AND direct argv modes); "
|
|
"gofmt/vet/go build clean; Python oracle smoke green BOTH pins "
|
|
"(no loader seam exists — RUNE_STANDARDIZED_PROVIDERS_CORE pin "
|
|
"vacuous, 0 refs, documented). No clock sites (legacy list "
|
|
"truth format). Siblings adaptive-router/builder-bridge-cli/ "
|
|
"paths fail repo-wide informational build on landed master "
|
|
"(missing built libroute_risk_flags.a; facade main) — "
|
|
"pre-existing, untouched. Evidence: "
|
|
"verification/sp-*.{log,exit} + sp-summary.md (committed with "
|
|
"the feat commit)."
|
|
),
|
|
}], scope_files=[
|
|
"src/go/standardized-providers/main.go",
|
|
"src/go/standardized-providers/connect_test.go",
|
|
"src/go/standardized-providers/truth.json",
|
|
"scripts/gen_standardized_providers_truth.py",
|
|
"scripts/check_standardized_providers_parity.py",
|
|
"scripts/sp_freeze_seams/sitecustomize.py",
|
|
"scripts/walk_contract_gap_sp.py",
|
|
"docs/dichotomy-rebase-honest-audit.md",
|
|
"verification/sp-summary.md",
|
|
])
|
|
print("close:", json.dumps(cl)[:300])
|
|
print("CONTRACT", c, "closed" if cl.get("success") else "CLOSE_FAILED")
|
|
sys.exit(0 if cl.get("success") else 1) |