chore(store): close drift_compression dichotomy contract BUILDER-2026-10-14T04:58:34Z-5fc73f-factory-gap-dcomp (parity d4640a7f, phase B 998c2adf)
This commit is contained in:
1 parent
224bcfe3e0
commit
e383331f05
4 files changed
+6099
No files matched your search
@@ -0,0 +1,145 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Close the #2479 dichotomy-wave drift_compression gap contract (RUST port).
|
||||
Full lifecycle walk in ONE process (shared-store clobber hazard; segment
|
||||
transitions take ~60s each — do NOT split across processes). The final
|
||||
step is iface.close() with contract_quality observed_evidence (the bare
|
||||
`transition -> closed` is rejected by the quality gate). Safe to re-run:
|
||||
pass the existing contract id to resume an interrupted walk.
|
||||
|
||||
Carries the already-pushed parity SHA as evidence:
|
||||
feat 1fbc504b close PARTIAL gaps — dichotomy wave (3/7 -> 7/7)
|
||||
refactor 772b1758 Phase B language-advantage pass
|
||||
|
||||
Usage: close_contract_drift_compression.py [contract_id]
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
os.environ.setdefault(
|
||||
"CS_RUST_LIB",
|
||||
"/mnt/workdrive/rune/src/rust/capability_scoring/target/release/libcapability_scoring.so",
|
||||
)
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
||||
|
||||
from rune.construction_interface import ConstructionInterface
|
||||
|
||||
PARITY_SHA = "1fbc504b"
|
||||
PHASEB_SHA = "772b1758"
|
||||
EVIDENCE = f"parity {PARITY_SHA}, phase B {PHASEB_SHA}"
|
||||
|
||||
NEED = (
|
||||
"drift_compression dichotomy gap-close (RUST): name-preserving port "
|
||||
"of the 4 audit-missing functions into src/rust/memory_scoring "
|
||||
"compression.rs — the audit alias now follows the live delegation "
|
||||
"chain (drift_compression -> drift_core._ms_core -> ms_loader -> "
|
||||
"libmemory_scoring.so) instead of cognition_core. NEW kernel: "
|
||||
"get_compression_stats (SQL stays in the Python facade per the "
|
||||
"boundary law; row-reduction math — int() truncation after the float "
|
||||
"multiply, banker's rounding at the 1e2 scale, SQL-null coercion, "
|
||||
"empty-store int-shaped 0 — in Rust + ms_get_compression_stats FFI + "
|
||||
"loader wrapper + oracle delegation with a load-bearing "
|
||||
"_py_get_compression_stats fallback). Fix-first defect proven by the "
|
||||
"new frozen battery: warn_before_compress emitted the COERCED "
|
||||
"rock_status where the oracle emits the raw value (present-None rides "
|
||||
"the warning dict as null). Frozen truth 65 cases via the shared "
|
||||
"freeze_truth harness (the six _py_* kernels — delegation-proof by "
|
||||
"construction), byte-identical across repeated gen + --verify runs; "
|
||||
"cargo battery 7/7 (include_str! embed); clippy -D warnings + fmt "
|
||||
"clean; live parity 1935/1935 (pinned facade / live facade / kernel "
|
||||
"direct / db-level sqlite seam / fuzz seed 2479); Python both pins "
|
||||
"green; ruff clean. Dichotomy audit 3/7 PARTIAL -> 7/7 FULL (RUST). "
|
||||
"Delivered on gitea/master: feat " + PARITY_SHA + ", phase B "
|
||||
+ PHASEB_SHA + "."
|
||||
)
|
||||
|
||||
iface = ConstructionInterface(builder="factory-gap-dcomp")
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
cid = sys.argv[1]
|
||||
print("resuming contract:", cid)
|
||||
else:
|
||||
r = iface.submit_need(NEED, origin="builder")
|
||||
print("submit_need:", json.dumps(r)[:300])
|
||||
if not r.get("success"):
|
||||
print("NEED FAILED — aborting")
|
||||
sys.exit(1)
|
||||
cid = r["ids"]["contract_id"]
|
||||
print("contract_id:", cid)
|
||||
|
||||
|
||||
def phase_of(cid):
|
||||
doc = iface.scaffold.load()
|
||||
e = iface.scaffold.contract(doc, cid)
|
||||
return e.get("phase") if e else "MISSING"
|
||||
|
||||
|
||||
phase = phase_of(cid)
|
||||
print("current phase:", phase)
|
||||
for want in ("approved", "building", "verifying"):
|
||||
if phase == want or phase in ("verifying", "closed"):
|
||||
break
|
||||
t = iface.transition(cid, want, evidence_ref=EVIDENCE)
|
||||
ok = t.get("success")
|
||||
print(f"transition->{want}:", "ok" if ok else json.dumps(t)[:300])
|
||||
if not ok:
|
||||
sys.exit(1)
|
||||
phase = want
|
||||
|
||||
c = iface.close(
|
||||
cid,
|
||||
observed_evidence=[{
|
||||
"kind": "port_evidence",
|
||||
"detail": "drift_compression dichotomy completion — parity "
|
||||
f"{PARITY_SHA} feat(drift_compression): close PARTIAL "
|
||||
"gaps — dichotomy wave; pushed gitea/master. Rust port "
|
||||
"at src/rust/memory_scoring (compression.rs kernels + "
|
||||
"ms_* FFI + ms_loader seam) closes the audit gaps "
|
||||
"name-preserving: the pure five already lived there "
|
||||
"(H3 slice 2) behind a stale audit alias (now mapped to "
|
||||
"the live delegation chain); get_compression_stats is "
|
||||
"new kernel work (SQL stays Python — boundary law; "
|
||||
"int() truncation, banker's rounding at 1e2, SQL-null "
|
||||
"coercion, empty-store int-shaped 0; crash parity: "
|
||||
"short rows -> 'list index out of range'). Generator "
|
||||
"scripts/gen_drift_compression_truth.py: 65-case frozen "
|
||||
"truth (shared freeze_truth harness, the six _py_* "
|
||||
"kernels — delegation-proof by construction) "
|
||||
"regenerates byte-identical; freeze_truth --verify OK "
|
||||
"twice against the live oracle. Battery 7/7 replay "
|
||||
"VERBATIM (65 rows, include_str! embed + crash-parity "
|
||||
"row shapes); live parity "
|
||||
"scripts/check_drift_compression_parity.py 1935/1935 "
|
||||
"(pinned facade / live facade / kernel direct / "
|
||||
"db-level sqlite seam / fuzz seed 2479); clippy -D "
|
||||
"warnings + fmt clean; Python both pins green "
|
||||
"(test_ms_loader_seam 7/7 incl. 2 new stats tests; "
|
||||
"shims failures pre-exist identically on base). Audit "
|
||||
"3/7 → 7/7 FULL (RUST). Phase B 772b1758: zero-copy "
|
||||
"char_indices prefix, exhaustive match dispatch, "
|
||||
"try_fold accumulators — behavior-identical, battery + "
|
||||
"parity re-green. Divergences (documented): integral "
|
||||
"floats crossing the FFI render int-shaped "
|
||||
"(savings_pct 50.0 oracle-side vs 50 envelope-side) — "
|
||||
"compared structurally, byte shape pinned by the Rust "
|
||||
"battery's frozen replay.",
|
||||
}],
|
||||
scope_files=[
|
||||
"src/rust/memory_scoring/src/compression.rs",
|
||||
"src/rust/memory_scoring/src/lib.rs",
|
||||
"src/rust/memory_scoring/src/branch_battery.rs",
|
||||
"src/rust/memory_scoring/src/frozen_dcomp_truth.json",
|
||||
"src/rune/drift_compression.py",
|
||||
"src/rune/ms_loader.py",
|
||||
"scripts/gen_drift_compression_truth.py",
|
||||
"scripts/check_drift_compression_parity.py",
|
||||
],
|
||||
)
|
||||
print("close:", json.dumps(c)[:400])
|
||||
final = phase_of(cid)
|
||||
print("FINAL PHASE:", final)
|
||||
ok = c.get("success") and final == "closed"
|
||||
print("CLOSED" if ok else "CLOSE_FAILED", cid)
|
||||
sys.exit(0 if ok else 1)
|
||||
@@ -0,0 +1,24 @@
|
||||
# Contract BUILDER-2026-10-14T04:58:34Z-5fc73f-factory-gap-dcomp
|
||||
|
||||
**Phase:** closed · **Mode:** n/a · **Depth:** n/a
|
||||
|
||||
## What was built
|
||||
|
||||
drift_compression dichotomy gap-close (RUST): name-preserving port of the 4 audit-missing functions into src/rust/memory_scoring compression.rs — the audit alias now follows the live delegation chain (drift_compression -> drift_core._ms_core -> ms_loader -> libmemory_scoring.so) instead of cognition_core. NEW kernel: get_compression_stats (SQL stays in the Python facade per the boundary law; row-reduction math — int() truncation after the float multiply, banker's rounding at the 1e2 scale, SQL-null coercion, empty-store int-shaped 0 — in Rust + ms_get_compression_stats FFI + loader wrapper + oracle delegation with a load-bearing _py_get_compression_stats fallback). Fix-first defect proven by the new frozen battery: warn_before_compress emitted the COERCED rock_status where the oracle emits the raw value (present-None rides the warning dict as null). Frozen truth 65 cases via the shared freeze_truth harness (the six _py_* kernels — delegation-proof by construction), byte-identical across repeated gen + --verify runs; cargo battery 7/7 (include_str! embed); clippy -D warnings + fmt clean; live parity 1935/1935 (pinned facade / live facade / kernel direct / db-level sqlite seam / fuzz seed 2479); Python both pins green; ruff clean. Dichotomy audit 3/7 PARTIAL -> 7/7 FULL (RUST). Delivered on gitea/master: feat 1fbc504b, phase B 772b1758.
|
||||
|
||||
## What it connects to
|
||||
|
||||
(no affected surface recorded)
|
||||
|
||||
## How to update those connections
|
||||
|
||||
- Open a NEW construction contract (scaffolding is absolute) scoped to the same surface.
|
||||
- Evidence trail: 4 checkpoint(s) recorded on the contract entity.
|
||||
- Quality at close: {"candidate_corrections": [], "captured_at": "2026-10-14T05:02:48Z", "contract": "BUILDER-2026-10-14T04:58:34Z-5fc73f-factory-gap-dcomp", "correctly_predicted": [], "evidence_sources": ["unattributed"], "expected_new_entities": [], "expected_new_missing": [], "expected_new_observed": [], "expected_runtime_effects": [], "expected_runtime_missing": [], "expected_runtime_observed": [], "genuinely_unexpected_new": [], "missed": [], "needless": ["module:deploy_qualify"], "observed": [], "observed_existing": [], "observed_new": [], "predicted_but_unaffected": ["module:deploy_qualify"], "predicted_existing_affected": ["module:deploy_qualify"], "scope_check": {"in_scope": [], "out_of_scope": ["scripts/check_drift_compression_parity.py", "scripts/gen_drift_compression_truth.py", "src/rune/drift_compression.py", "src/rune/ms_loader.py", "src/rust/memory_scoring/src/branch_battery.rs", "src/rust/memory_scoring/src/compression.rs", "src/rust/memory_scoring/src/frozen_dcomp_truth.json", "src/rust/memory_scoring/src/lib.rs"], "reason": "contract has no approved scope", "verdict": "unknown"}}.
|
||||
|
||||
## Evidence
|
||||
|
||||
- parity 1fbc504b, phase B 772b1758
|
||||
- parity 1fbc504b, phase B 772b1758
|
||||
- parity 1fbc504b, phase B 772b1758
|
||||
- closure-record
|
||||
+5925
File diff suppressed because it is too large.
Load diff
@@ -6552,3 +6552,8 @@
|
||||
{"builder": "factory-gap-dc", "detail": "BUILDER-2026-10-14T04:45:57Z-42397f-factory-gap-dc \u2192 building", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T04:46:42Z", "operation": "transition"}
|
||||
{"builder": "factory-gap-dc", "detail": "BUILDER-2026-10-14T04:45:57Z-42397f-factory-gap-dc \u2192 verifying", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T04:47:04Z", "operation": "transition"}
|
||||
{"builder": "factory-gap-dc", "detail": "BUILDER-2026-10-14T04:45:57Z-42397f-factory-gap-dc closed", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T04:47:27Z", "operation": "close"}
|
||||
{"builder": "factory-gap-dcomp", "detail": "need-2026-10-14T04:58:32Z-factory-gap-dcomp \u2192 REUSE", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T04:58:34Z", "operation": "submit_need"}
|
||||
{"builder": "factory-gap-dcomp", "detail": "BUILDER-2026-10-14T04:58:34Z-5fc73f-factory-gap-dcomp \u2192 approved", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T04:58:56Z", "operation": "transition"}
|
||||
{"builder": "factory-gap-dcomp", "detail": "BUILDER-2026-10-14T04:58:34Z-5fc73f-factory-gap-dcomp \u2192 building", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T04:59:31Z", "operation": "transition"}
|
||||
{"builder": "factory-gap-dcomp", "detail": "BUILDER-2026-10-14T04:58:34Z-5fc73f-factory-gap-dcomp \u2192 verifying", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:00:08Z", "operation": "transition"}
|
||||
{"builder": "factory-gap-dcomp", "detail": "BUILDER-2026-10-14T04:58:34Z-5fc73f-factory-gap-dcomp closed", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:02:48Z", "operation": "close"}
|
||||
Reference in new issue
Block a user