chore(store): close voice_sync dichotomy contract BUILDER-2026-10-14T05:29:33Z-a69ece-factory-gap-vs (parity 056fa974, phase B 86ece218)

This commit is contained in:
Nick committed 2026-10-14 06:34:59 +01:00
1 parent a915a3b072
commit f07d8f3843
19 files changed
+6250

No files matched your search

+191
View File
@@ -0,0 +1,191 @@
#!/usr/bin/env python3
"""Close the #2479 dichotomy-wave voice_sync gap contract (RUST port).
Full lifecycle in ONE process (shared-store clobber hazard; segment
transitions take ~30-60s each — do NOT split across processes). Carries
the already-pushed parity SHAs as evidence:
feat 3a2c7646 port to FULL Rust — dichotomy wave
phaseB b2652913 Phase B language-advantage pass — dichotomy wave
QUALITY-GATE LAW (scaffold.py 2026-10-13): the walk stops at `verifying`
and closes through the DESIGNED iface.close() entry (predicted-vs-
observed quality + material-change) — a raw transition to 'closed' is
REFUSED.
Usage: close_contract_voice_sync.py
"""
import json
import os
import sys
from pathlib import Path
os.environ.setdefault(
"CS_RUST_LIB",
"/mnt/workdrive/rune-wave-db/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 = "3a2c7646"
PHASEB_SHA = "b2652913"
EVIDENCE = f"parity {PARITY_SHA}, phase B {PHASEB_SHA}"
iface = ConstructionInterface(builder="factory-gap-vs")
r = iface.submit_need(
"voice_sync dichotomy gap-close (RUST): name-preserving port of the 7 "
"audit-missing functions into src/rust/voice_sync (the module's "
"classification side — sqlite3 storage-backed; a stale Go voice-sync "
"dir exists from an early partial batch and is untouched; my diff "
"brings zero Go files): get_delivery_register_from_db / "
"get_delivery_register (the chunk row-selection loop — rows fetched "
"Python-side, SQL WHERE + fresh-store OperationalError guard stay in "
"the facade), extract_voice_section (section parser), "
"generate_voice_section (assembler), update_rune_md_content / "
"update_rune_md (pure splice view, composite {result,new_content} so "
"the facade performs the write; the oracle gains the same oracle-level "
"pure view the shared freeze gate pins — salience_gate "
"evaluate_salience_dict precedent), check_sync, handle_hook, "
"sync_voice (parts-shaped decisions), _vs_core (kernel mirror of the "
"facade probe contract, pin lattice) plus plugin. Facade delegation "
"via vs_loader.py (10 vs_* doc-envelope symbols, free via "
"capability_scoring cs_free_string, VOICE_SYNC_RUST_LIB override, "
"RUNE_VOICE_SYNC_CORE=python pin — the shared harness derives EXACTLY "
"this pin name, inverting salience's wrong-name quirk). SQLite I/O, "
"rune.md writes, wall-clock _now and the argparse main() CLI stay "
"facade-side (behavior crate precedent). Dichotomy audit PARTIAL 3/10 "
"-> FULL 12/12. Parity defects pinned pre-landing: len>200 is a "
"CODEPOINT count; the +10 offset past the ## Voice header advances by "
"CHARS (char-boundary safe with multibyte tails); handle_hook's "
"auto-sync branch reports synced:true even on error details (oracle "
"verbatim); whitespace-only register parses to the four-empty-lists "
"TRUTHY dict while the empty string is None. Frozen truth via the "
"shared scripts/freeze_truth.py harness (generator "
"scripts/gen_voice_sync_truth.py, poisoned-truth law "
"RUNE_VOICE_SYNC_CORE=python): frozen_vs_truth.verify.json 37 pure "
"rows byte-identical under freeze_truth.py --verify; envelope "
"frozen_vs_truth.json 64 rows (verify rows first + rig-required "
"store/file rows whose kernel-shaped inputs ride in args with "
"fixtures for --replay; branch_battery.rs replays both VERBATIM via "
"include_str!, order-sensitive canonical-string compare — the facade "
"consumes kernel JSON directly so Python insertion order must "
"survive: serde_json preserve_order). Live parity 100%: gen --replay "
"facade-delegating + kernel-direct 125/125; crate canary 15/15; "
"second-modality differential 2479-seed fuzz beyond the corpus 486 "
"comparisons / 0 divergences; pytest 17/17 in three pin states (live "
"/ RUNE_VOICE_SYNC_CORE=python / VOICE_SYNC_RUST_LIB poisoned); full "
"suite 2763+2764 passed with every remaining failure PROVEN "
"pre-existing by stashing the voice_sync diff. Phase B (b2652913): "
"contains_ci_upper ASCII-anchored zero-alloc needle matching (full "
"to_uppercase fallback so Unicode case mappings are never skipped), "
"chars().take(201) bounded length probe, #[must_use] pure surface, "
"ci<=>upper-contains equivalence self-check over the frozen corpus + "
"std-only bench (register probe 8.6us/call over 65 rows, needle scans "
"3.3us/text, chain 10.8us/call). rustfmt clean, clippy -D warnings "
"clean, zero Go surface. Evidence read back: "
"verification/voice-sync-{freeze-verify,cargotest,clippy,replay,"
"canary,differential,python-pins,goladder,audit,phaseb-cargotest,"
"phaseb-parity,phaseb-canary,phaseb-python}.log (all exit 0). "
f"Delivered on gitea/master: feat {PARITY_SHA}, phase B {PHASEB_SHA}.",
origin="builder",
)
print("submit_need:", json.dumps(r)[:300])
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", "verifying"):
t = iface.transition(c, phase, evidence_ref=EVIDENCE)
ok = t.get("success")
print(f"transition->{phase}:", "ok" if ok else json.dumps(t)[:300])
if not ok:
sys.exit(1)
doc = iface.scaffold.load()
e = iface.scaffold.contract(doc, c)
print("PHASE:", e.get("phase") if e else "MISSING")
if not e or e.get("phase") != "verifying":
print("walk did not reach verifying — aborting before close")
sys.exit(1)
# QUALITY-GATE LAW: raw transition to 'closed' is REFUSED — designed close.
closed = iface.close(
c,
observed_evidence=[
{
"kind": "port_evidence",
"detail": (
f"voice_sync RUST dichotomy gap-close — parity commit {PARITY_SHA}, "
f"Phase B commit {PHASEB_SHA}; dichotomy audit fn coverage 3/10 "
"PARTIAL -> 12/12 FULL (update_rune_md_content + _vs_core join "
"the surface per the salience_gate precedent; _py_* helpers "
"are the audit's machinery class; the module's classification "
"side is RUST sqlite3 storage-backed — no Go surface). "
"Ported name-preserving: get_delivery_register_from_db / "
"get_delivery_register (chunk row loop, rows fetched "
"Python-side), extract_voice_section, generate_voice_section, "
"update_rune_md_content / update_rune_md (pure splice view, "
"composite result/new_content — facade performs the write), "
"check_sync, handle_hook, sync_voice (parts-shaped), _vs_core "
"(probe pin lattice), plugin. Facade delegation via "
"vs_loader.py (10 vs_* doc-envelope symbols, free via "
"capability_scoring cs_free_string, VOICE_SYNC_RUST_LIB "
"override, RUNE_VOICE_SYNC_CORE=python pin — the shared "
"harness pin derives EXACTLY this name). Frozen truth via "
"the shared scripts/freeze_truth.py harness (generator "
"scripts/gen_voice_sync_truth.py, poisoned-truth law): "
"verify view 37 pure rows byte-identical under "
"freeze_truth.py --verify; envelope 64 rows whose "
"kernel-shaped inputs ride in args with replay fixtures "
"(branch_battery.rs include_str replay, order-sensitive "
"canonical-string compare via serde_json preserve_order, 16 "
"tests). Live parity 100%: gen --replay facade-delegating + "
"kernel-direct 125/125; canary 15/15; second-modality "
"differential 486 comparisons / 0 divergences (2479-seed "
"fuzz incl. multibyte splices + sandboxed I/O decisions); "
"pytest 17/17 in three pin states (live / "
"RUNE_VOICE_SYNC_CORE=python / VOICE_SYNC_RUST_LIB "
"poisoned); full suite 2763+2764 passed with all remaining "
"failures stash-proven pre-existing (none involve "
"voice_sync). Phase B (b2652913): contains_ci_upper "
"zero-alloc ASCII needle matching with full-mapping "
"fallback, take(201) bounded length probe, #[must_use] "
"pure surface, equivalence self-check + std-only bench. "
"rustfmt clean, clippy -D warnings clean, zero Go surface. "
"Evidence read back: verification/voice-sync-{freeze-verify,"
"cargotest,clippy,replay,canary,differential,python-pins,"
"goladder,audit,phaseb-cargotest,phaseb-parity,phaseb-canary,"
"phaseb-python}.log (all exit 0). Delivered on gitea/"
f"master: feat {PARITY_SHA}, phase B {PHASEB_SHA}."
),
}
],
scope_files=[
"src/rune/voice_sync.py",
"src/rune/vs_loader.py",
"src/rust/voice_sync/src/lib.rs",
"src/rust/voice_sync/src/branch_battery.rs",
"src/rust/voice_sync/src/frozen_vs_truth.json",
"src/rust/voice_sync/src/frozen_vs_truth.verify.json",
"src/rust/voice_sync/Cargo.toml",
"src/rust/voice_sync/Cargo.lock",
"src/rust/voice_sync/canary_voice_sync.py",
"scripts/gen_voice_sync_truth.py",
"tests/test_voice_sync_port.py",
"scripts/close_contract_voice_sync.py",
],
)
print("close:", json.dumps(closed)[:400])
doc = iface.scaffold.load()
e = iface.scaffold.contract(doc, c)
phase = e.get("phase") if e else None
print("FINAL PHASE:", phase)
if phase == "closed":
print("CLOSED", c)
sys.exit(0)
print("not closed — inspect store")
sys.exit(1)
@@ -0,0 +1,24 @@
# Contract BUILDER-2026-10-14T05:29:33Z-a69ece-factory-gap-vs
**Phase:** closed · **Mode:** n/a · **Depth:** n/a
## What was built
voice_sync dichotomy gap-close (RUST): name-preserving port of the 7 audit-missing functions into src/rust/voice_sync (the module's classification side — sqlite3 storage-backed; a stale Go voice-sync dir exists from an early partial batch and is untouched; my diff brings zero Go files): get_delivery_register_from_db / get_delivery_register (the chunk row-selection loop — rows fetched Python-side, SQL WHERE + fresh-store OperationalError guard stay in the facade), extract_voice_section (section parser), generate_voice_section (assembler), update_rune_md_content / update_rune_md (pure splice view, composite {result,new_content} so the facade performs the write; the oracle gains the same oracle-level pure view the shared freeze gate pins — salience_gate evaluate_salience_dict precedent), check_sync, handle_hook, sync_voice (parts-shaped decisions), _vs_core (kernel mirror of the facade probe contract, pin lattice) plus plugin. Facade delegation via vs_loader.py (10 vs_* doc-envelope symbols, free via capability_scoring cs_free_string, VOICE_SYNC_RUST_LIB override, RUNE_VOICE_SYNC_CORE=python pin — the shared harness derives EXACTLY this pin name, inverting salience's wrong-name quirk). SQLite I/O, rune.md writes, wall-clock _now and the argparse main() CLI stay facade-side (behavior crate precedent). Dichotomy audit PARTIAL 3/10 -> FULL 12/12. Parity defects pinned pre-landing: len>200 is a CODEPOINT count; the +10 offset past the ## Voice header advances by CHARS (char-boundary safe with multibyte tails); handle_hook's auto-sync branch reports synced:true even on error details (oracle verbatim); whitespace-only register parses to the four-empty-lists TRUTHY dict while the empty string is None. Frozen truth via the shared scripts/freeze_truth.py harness (generator scripts/gen_voice_sync_truth.py, poisoned-truth law RUNE_VOICE_SYNC_CORE=python): frozen_vs_truth.verify.json 37 pure rows byte-identical under freeze_truth.py --verify; envelope frozen_vs_truth.json 64 rows (verify rows first + rig-required store/file rows whose kernel-shaped inputs ride in args with fixtures for --replay; branch_battery.rs replays both VERBATIM via include_str!, order-sensitive canonical-string compare — the facade consumes kernel JSON directly so Python insertion order must survive: serde_json preserve_order). Live parity 100%: gen --replay facade-delegating + kernel-direct 125/125; crate canary 15/15; second-modality differential 2479-seed fuzz beyond the corpus 486 comparisons / 0 divergences; pytest 17/17 in three pin states (live / RUNE_VOICE_SYNC_CORE=python / VOICE_SYNC_RUST_LIB poisoned); full suite 2763+2764 passed with every remaining failure PROVEN pre-existing by stashing the voice_sync diff. Phase B (b2652913): contains_ci_upper ASCII-anchored zero-alloc needle matching (full to_uppercase fallback so Unicode case mappings are never skipped), chars().take(201) bounded length probe, #[must_use] pure surface, ci<=>upper-contains equivalence self-check over the frozen corpus + std-only bench (register probe 8.6us/call over 65 rows, needle scans 3.3us/text, chain 10.8us/call). rustfmt clean, clippy -D warnings clean, zero Go surface. Evidence read back: verification/voice-sync-{freeze-verify,cargotest,clippy,replay,canary,differential,python-pins,goladder,audit,phaseb-cargotest,phaseb-parity,phaseb-canary,phaseb-python}.log (all exit 0). Delivered on gitea/master: feat 3a2c7646, phase B b2652913.
## 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:30:42Z", "contract": "BUILDER-2026-10-14T05:29:33Z-a69ece-factory-gap-vs", "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/close_contract_voice_sync.py", "scripts/gen_voice_sync_truth.py", "src/rune/voice_sync.py", "src/rune/vs_loader.py", "src/rust/voice_sync/Cargo.lock", "src/rust/voice_sync/Cargo.toml", "src/rust/voice_sync/canary_voice_sync.py", "src/rust/voice_sync/src/branch_battery.rs", "src/rust/voice_sync/src/frozen_vs_truth.json", "src/rust/voice_sync/src/frozen_vs_truth.verify.json", "src/rust/voice_sync/src/lib.rs", "tests/test_voice_sync_port.py"], "reason": "contract has no approved scope", "verdict": "unknown"}}.
## Evidence
- parity 3a2c7646, phase B b2652913
- parity 3a2c7646, phase B b2652913
- parity 3a2c7646, phase B b2652913
- closure-record
@@ -6576,3 +6576,8 @@
{"authority": "", "detail": "live parity 35/35 + byte-identical re-freeze (scripts/check_layout_contract_parity.py); layout+consumer tests 64/64 BOTH pins", "entity": "module:layout_contract", "kind": "observed_consequence", "observed_at": "2026-10-14T05:24:41Z", "source": "unattributed", "task": "BUILDER-2026-10-14T05:21:12Z-4723a5-factory-gap-lc"}
{"authority": "", "detail": "dichotomy audit 2/6 PARTIAL -> 6/6 FULL (RUST)", "entity": "module:layout_contract", "kind": "observed_consequence", "observed_at": "2026-10-14T05:24:41Z", "source": "unattributed", "task": "BUILDER-2026-10-14T05:21:12Z-4723a5-factory-gap-lc"}
{"builder": "factory-gap-lc", "detail": "BUILDER-2026-10-14T05:21:12Z-4723a5-factory-gap-lc closed", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:24:41Z", "operation": "close"}
{"builder": "factory-gap-vs", "detail": "need-2026-10-14T05:29:29Z-factory-gap-vs \u2192 REUSE", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:29:33Z", "operation": "submit_need"}
{"builder": "factory-gap-vs", "detail": "BUILDER-2026-10-14T05:29:33Z-a69ece-factory-gap-vs \u2192 approved", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:29:53Z", "operation": "transition"}
{"builder": "factory-gap-vs", "detail": "BUILDER-2026-10-14T05:29:33Z-a69ece-factory-gap-vs \u2192 building", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:30:09Z", "operation": "transition"}
{"builder": "factory-gap-vs", "detail": "BUILDER-2026-10-14T05:29:33Z-a69ece-factory-gap-vs \u2192 verifying", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:30:24Z", "operation": "transition"}
{"builder": "factory-gap-vs", "detail": "BUILDER-2026-10-14T05:29:33Z-a69ece-factory-gap-vs closed", "kind": "builder_session", "mode": "rune_internal", "observed_at": "2026-10-14T05:30:42Z", "operation": "close"}
+83
View File
@@ -0,0 +1,83 @@
# voice_sync — dichotomy gap-close (wave #2479, worktree rune-wave-db)
## Outcome
- Audit: voice_sync **3/10 PARTIAL → 12/12 FULL** (RUST side — the
module's classification; sqlite3 storage-backed. A stale Go
`src/go/voice-sync` dir exists from an early partial #2479 batch —
untouched; my diff brings zero Go files). The surfaced fns grew 10→12
per the salience_gate precedent: `update_rune_md_content` (oracle-level
pure splice view) and `_vs_core` (kernel mirror of the facade probe
contract) join the surface; `_py_*` helpers are the audit's machinery
class.
- Ported name-preserving into src/rust/voice_sync/src/lib.rs:
get_delivery_register_from_db / get_delivery_register (chunk row loop,
rows fetched Python-side; SQL WHERE + fresh-store OperationalError
guard stay facade), extract_voice_section, generate_voice_section,
update_rune_md_content / update_rune_md (pure splice view, composite
{"result","new_content"} — the facade performs the write), check_sync,
handle_hook, sync_voice (parts-shaped), _vs_core, plugin.
- Facade delegation: vs_loader.py (10 vs_* doc-envelope symbols, free via
capability_scoring cs_free_string — no free-symbol export,
VOICE_SYNC_RUST_LIB override) + RUNE_VOICE_SYNC_CORE=python pin — the
shared harness derives EXACTLY this pin name, inverting salience's
wrong-name quirk. SQLite I/O, rune.md writes, wall-clock `_now` and the
argparse main() CLI stay facade-side (behavior crate precedent).
- Parity defects caught pre-landing: len>200 is a CODEPOINT count;
the +10 offset past "## Voice" advances by CHARS (char-boundary safe
with multibyte tails); handle_hook's auto-sync branch pins the oracle's
"synced: true with error details" verbatim; extract's whitespace-only
register parses to the four-empty-lists TRUTHY dict (only the empty
string is None).
- Phase B (b2652913): contains_ci_upper ASCII-anchored zero-alloc needle
matching (full to_uppercase fallback so Unicode case mappings are never
skipped), chars().take(201) bounded length probe, #[must_use] on the
pure surface, ci<=>upper-contains equivalence self-check + std-only
bench (register probe 8.6 µs/call over 65 rows; needle scans 3.3
µs/text; chain 10.8 µs/call).
## SHAs (pushed gitea/master, captured post-push)
- feat: **3a2c7646** `feat(voice_sync): port to FULL Rust — dichotomy wave`
- phase B: **b2652913** `refactor(voice_sync): Phase B language-advantage
pass — dichotomy wave`
- rebased twice onto live gitea/master during the wave (master moved with
claim_audit/layout_contract/builder_bridge closes); audit doc resolved
by regeneration from the mid-rebase tree (derived artifact, no marker
editing).
## Verification (evidence read back; all .exit = 0)
- verification/voice-sync-freeze-verify.log — 37 pure rows byte-identical
under freeze_truth.py --verify (shared harness).
- verification/voice-sync-cargotest.log — 14 tests (battery 64-row
envelope + 37-row verify view, verbatim include_str!, order-sensitive
canonical-string compare; superset check; kernel unit lattice; bench).
- verification/voice-sync-clippy.log — clippy -D warnings clean (also
after Phase B: voice-sync-phaseb-cargotest.log, 16 tests).
- verification/voice-sync-replay.log — live parity 125/125
(facade-delegating + kernel-direct over every frozen row incl. Plugin
and the _vs_core probe).
- verification/voice-sync-canary.log — cdylib canary 15/15.
- verification/voice-sync-differential.log — second-modality differential
(2479-seed adversarial fuzz beyond the corpus incl. multibyte splices
and sandboxed I/O decisions): 486 comparisons / 0 divergences.
- verification/voice-sync-python-pins.log — three pin states (delegation
live / RUNE_VOICE_SYNC_CORE=python / VOICE_SYNC_RUST_LIB poisoned):
module suite 17/17 in the active states, floor probes verified, full
suites 2763+2764 passed with every remaining failure PROVEN pre-existing
by re-running with the voice_sync diff stashed (scaffold x3, structural
store, contract mini-doc x2, tier delegation, time awareness x2,
scaffolding coverage, ci lint S110 drift, umbrella loader mapping — none
involve voice_sync; 18 further failures were worktree-core artifacts,
recovered by building all 103 crates).
- verification/voice-sync-goladder.log — zero Go surface (git diff lists
no src/go files; untouched sibling voice-sync: go vet + build + gofmt
clean).
- verification/voice-sync-audit.log — dichotomy audit: FULL 55%
(106/192); voice_sync 12/12 FULL; vs_loader RETIRES (machinery).
- verification/voice-sync-phaseb-{cargotest,parity,canary,python}.log —
Phase B re-proof (16 tests, replay 125/125, canary, both pins).
## Store-closure contract
Contract submitted/closed in ONE process per the quality-gate law
(scaffold.transition refuses raw 'closed' — closed via the designed
iface.close() entry with predicted-vs-observed quality + material-change:
scripts/close_contract_voice_sync.py).
+1
View File
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
differential-exit=0
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
0