Skip to content

Epic: contracts at every layer — stream, count, score (the rosetta roadmap; child of #2560) #2812

Description

@squid-protocol

Child of #2560; supersedes #2669 as the handoff surface for cross-language consistency work. Strategy approved 2026-09-06. The document is docs/contract_roadmap.md (lands with #2811; formatted copy: https://claude.ai/code/artifact/debf7286-7958-48d6-91e5-48b1bbc4abc0). Read it before claiming anything here.

Why this epic exists (one paragraph)

The bias report's consistency badge paints every out-of-band cell the same red, whether the ledger validated it as "this language cannot express that" or as an open engine defect — so the scoreboard could not tell an extraction problem from a language fact, and the work kept looking like an extraction problem. Rolling the 267 gated red cells up by cause: 102 echo (derived), ~45 language inherency, ~50 extraction defects, 38 proximity-correlation effects, ~32 scoring choices. The largest engine-side finding is a layer leak, not a regex: core/spatial_correlation.py edits recorded signal counts in place (×3 cascading flux, silencer dampeners, ×5/×100 amplifiers; documented and pinned by #2631), so the count the corpus reads is never the raw count. The fix is a stated contract at each of the engine's three layers — what text a rule sees (stream), what one hit means (count), how counts combine (score) — and tooling that enforces them.

The goal restated: equal counts for equal constructs. Every remaining cross-language difference comes from one of three declared sources — a strictness stratum (design), an n/a (the language cannot express it), or a filed defect. After that a red dot is a defect by construction. The close criterion is open-defect share 0 and no draft row in the contract sheet, replacing "nothing unexplained".

Session start protocol (every session, every time)

  1. gh issue view <this> --comments — the last comment per item is its true state. Claim by comment: claiming <item> — <model> — branch <name>; stop with status <item>: <done|blocked|partial> — <branch/PR> — <what remains>. Unfinished branches are pushed, never left local.
  2. Read keyword-rosetta docs/bias_report.md from main (regenerated on every corpus push and nightly): the "What the red cells are" section and the open-defect share. Do not regenerate locally to triage; regenerate only to verify a change before a PR.
  3. Read the signal's row in gitgalaxy/standards/signal_contracts.py and the ledger entries naming it before calling any rule a defect (two of the four issues filed from the args audit were already settled in the ledger).
  4. One layer per engine PR (rule regex | slicer/DAG | correlation | scoring). One Closes #N per line. Label rosetta:rebless-owed when the corpus moves; corpus re-bless PR opens against engine main after the engine PR merges (no pins since Cross-repo choreography is circular, and every way it broke today failed green — drop the ENGINE_REF dance, machine-check the invariants #2682/ci: rosetta-audit without pins -- baseline-classified, refuses to no-op (#2682) #2699).
  5. Claim a family (one signal, or one formula), never a language. The per-language issues rosetta[abap]: cross-language consistency — 3 red / 3 amber metrics, 2 ledgered shapes #2561rosetta[zig]: cross-language consistency — 4 red / 2 amber metrics, 5 ledgered shapes #2607 are closed; per-language classification is the keyword-rosetta rosetta-language-sweep skill, called from a family audit, and live standing is python tools/language_deviations.py <lang>.

Decisions (approved 2026-09-06)

Phases

Status snapshot (updated 2026-09-07)

Phases 0–2 done; Phase 3 in progress; Phase 4 not started. Corpus is healthy — the remaining work is completing the sheet, not repairing a broken scoreboard.

Scoreboard: open-defect share 31 of 2296 comparable cells (1.4%) pending #2854/kr#94 merge, average consistency 93% (was 88% at the roadmap's start). test was the latest family cleared; every one of its 43 comparable cells is now in band.

The sheet — 68 rows, 6 stated (9%), 62 draft:

bucket rows what "stated" needs carries open defects?
stated 8 (api args branch io state_mutation test func_start class_start) done args 2, api-family 2 → corollary issues only
planted, draft 11 full 46-language rule-contract-audit (engine PR + corpus PR) 6 of 11 do (~9 cells)
unplanted risk inputs 8 a plant or a contract-level absence no (reported, not gated)
unplanted domain sensors 41 transcribed sentence + kind/unit + absence; batchable, no audit no (no corpus cell)

What percentage needs a contract, and how much is left:

Housekeeping owed (not blocking)

  • gitgalaxy/standards/fidelity_table.py is stale against corpus main (tests/tools/fidelity_table.py --check fails on main since keyword-rosetta#74) — regen owed by the next PR touching the fidelity layer.
  • Untracked scratch files in the engine working tree (gitgalaxy/tests.py, gen_tests.py, parse_regex.py, regexes.txt, temp_search.txt) trip the local ruff/mypy audits; CLAUDE.md's scratch rule applies.

Issue disposition

issues action
#2561#2607 (40) + #2560 closed 2026-09-06 as superseded (D2)
#2669 closed with final status; F.4 → Phase 3 families, F.5 → STRUCTURE COUNTS, F.6 retired
#2765 #2806 #2822 #2841 · #2805 closed — Phase 3 families landed (state_mutation, orphan census, branch, io; cobol globals)
#2804 open — Phase 3, cobol args corpus shape (a) still owed (engine half in #2830)
#2766 #2772 open — Phase 3 (rule half); #2772 formula half is Phase 4
#2817 #2824 #2827 #2832 #2833 #2843 open — corollaries of stated contracts (args/state_mutation/api/branch/io→cleanup); do not block Phase 3 close
#2770 #2771 open — Phase 4
#2792 #2795 #2801 #2803 closed — engine defects + structure-count n/a landed; #2796 open (classes_found declaration-requirement stratum, Phase 3 structure)
keyword-rosetta#75 closed via Phase 0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineModifications to the central physics and parsing engineepicLarge-scale architectural milestone or multi-issue initiativemetricsHeuristics, risk exposures, and topological math updates

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions