refactor(gates): runtime_registry splits under the R3 file cap — the orchestrator's own +99 debt paid #81

Manually merged
mdoorn merged 7 commits from feat/081-refactor-gates-runtime-registry-splits-under-t into master 2026-04-14 15:46:42 +02:00
Owner

refactor(gates): runtime_registry splits under the R3 file cap — the orchestrator's own +99 debt paid

Along the way:

  • docs(handoff): thirteenth-session close-out — the suite exits 0; the pattern engine is CkLang
  • feat(literals): slice 8d-i·a — claimed literals lex; the content-free matcher seam lands
  • feat(tooling): ckc disassemble — assembly visibility as a compiler verb (T1)
  • harden(syntax): iterative CST teardown — tree drop is O(1) native stack
  • chore(deps): cranelift 0.132.0 → 0.133.1 — NOT the #69 fix; ceiling ratchets 135 → 132
  • feat(literals): slice 8d-i·b — the from_literal fold; a claimed literal is an iconst

Touches 58 files: handoff.md, plan.md, src/rust/Cargo.lock, src/rust/crates/ck_codegen/Cargo.toml, src/rust/crates/ck_codegen/src/arena.rs, src/rust/crates/ck_codegen/src/arg.rs and 52 more.

refactor(gates): runtime_registry splits under the R3 file cap — the orchestrator's own +99 debt paid Along the way: - docs(handoff): thirteenth-session close-out — the suite exits 0; the pattern engine is CkLang - feat(literals): slice 8d-i·a — claimed literals lex; the content-free matcher seam lands - feat(tooling): ckc disassemble — assembly visibility as a compiler verb (T1) - harden(syntax): iterative CST teardown — tree drop is O(1) native stack - chore(deps): cranelift 0.132.0 → 0.133.1 — NOT the #69 fix; ceiling ratchets 135 → 132 - feat(literals): slice 8d-i·b — the from_literal fold; a claimed literal is an iconst Touches 58 files: `handoff.md`, `plan.md`, `src/rust/Cargo.lock`, `src/rust/crates/ck_codegen/Cargo.toml`, `src/rust/crates/ck_codegen/src/arena.rs`, `src/rust/crates/ck_codegen/src/arg.rs` and 52 more.
mdoorn approved these changes 2026-04-14 08:30:00 +02:00
mdoorn left a comment

Approving. I would have split src/rust/crates/ck_driver/tests/date_literal_run.rs differently, but not enough to hold this up.

Approving. I would have split `src/rust/crates/ck_driver/tests/date_literal_run.rs` differently, but not enough to hold this up.
@ -0,0 +212,4 @@
pat,
Value::Int(pattern.len() as i64),
sub,
Value::Int(body.len() as i64),
Owner

The as cast truncates silently if Value is ever wider than the target. Is the bound guaranteed, or should this be try_from?

The `as` cast truncates silently if `Value` is ever wider than the target. Is the bound guaranteed, or should this be `try_from`?
@ -0,0 +133,4 @@
.arg("-d")
.arg(binary)
.output()
.expect("spawn `objdump -d`");
Owner

The expect message on expect is the only thing a user sees if this fires. Does it say what they should do, or only what we assumed?, at src/rust/crates/ck_driver/tests/date_literal_run.rs:136.

The expect message on `expect` is the only thing a user sees if this fires. Does it say what they should do, or only what we assumed?, at src/rust/crates/ck_driver/tests/date_literal_run.rs:136.
Author
Owner

It said what I assumed. Reworded in src/rust/crates/ck_driver/tests/date_literal_run.rs so it names the input that broke it, which is what the bug report will need.

It said what I assumed. Reworded in `src/rust/crates/ck_driver/tests/date_literal_run.rs` so it names the input that broke it, which is what the bug report will need.
Author
Owner

Not guaranteed. Value goes through try_from now and the overflow is a typed error in src/rust/crates/ck_driver/src/literal_lex.rs.

Not guaranteed. `Value` goes through try_from now and the overflow is a typed error in `src/rust/crates/ck_driver/src/literal_lex.rs`.
The RUNTIME_EXEMPT landing (b82dc88) pushed runtime_registry.rs to 941
lines past the 850 cap and its post-check missed the arch tier — caught
one slice later by the full-suite re-run. Fix is structural, not a cap
raise (this file grows a justified row per corpus stone; a raise would be
a ceiling): the single-file test becomes tests/runtime_registry/{main.rs
30, registry.rs 733, coverage.rs 202} — pure motion, every doc comment
and test name verbatim; cargo keeps the same target name. registry.rs
sits above the 700 target at its structural floor (the const body + its
per-entry docs alone are 726 lines) with 14% headroom, flagged honestly.
R3's walk was already recursive — no scan extension needed, no gate
escape. Verified first-hand: arch 22/22 incl. r3 green, runtime_registry
green, fmt 0, clippy -D 0.
The slice-8/lift-out session recorded: the operator-inline perf repair
(wheel_v3 10.2k -> 55k restored, diagnosed by disassembly), the never-regress
mandate as gates, slices 8-pre/8a/8b-i/8b-ii/8c landed (claims LIVE,
stdlib-type-clean green, the CkLang matcher in production through the bounded
evaluator), the session's seven owner rulings recorded where they bind, the
first exit-0 workspace suite on the branch, debts #69-#72 minted, E0754/E0755
+ MAX_FILE_LOC 850 queued for ratification, and slice 8d (the end-to-end
literal pipeline + the String/List retrofit KILL) as the next act.
The front half of the exotic-literal pipeline (plan_literals §5): ck_lex gains
an injected LiteralMatcher capability (content-free — Cargo deps unchanged);
the driver's ClaimMatcher drives the CkLang LiteralDSL::match_literal through
the bounded evaluator off the settled LiteralClaimTable (prefix on sight;
suffix/embedded digit-gated per §6·2). A match emits one SyntaxKind::TypedLit +
span-keyed side-record naming no type; Lit::Typed(TypeId) self-types at check
with zero by-name branches. Stdlib lexes content-free; app-root files only.

ADD: ck_lex/{matcher,numeric,render}.rs (numeric/render are R3 moves),
lower_body_typed (ck_resolve), load_project_with_matcher (ck_load),
ck_driver/literal_lex.rs, arch literals.rs guard (23rd test) + R8 roster
widened with world-type names/markers (owner-ratified). Red-fire proven by the
orchestrator (copy-based probe: 22 passed/1 failed, restored to 23/23).

KILL: none (ADD half; the String/List retrofit KILL rides 8d-ii). An exotic
literal reaching codegen fails honestly (Unsupported) until the 8d-i·b fold.
Net Rust +735 (1340 insertions − 605 move-deletions). Gates: fmt 0 · clippy
-D warnings 0 · build 0 warnings · suite exit 0 (202 result lines) · arch 23/23.
Geo's space-aware scan deferred (§6·4, noted in-code); debt #72 closes in ·b.
Owner directive 2026-07-20 (the tooling trio, first slice). The verb drives
the exact run compile+link path, objdump -d's the freestanding ELF from a
Drop-cleaned scratch dir, and filters to function blocks by case-insensitive
symbol query; no-match lists symbols and exits 1. Reveals-only: no new
compilation mode, no name→symbol map, zero new deps. Floor IR interleave
reported out (no pretty-printer exists) — recorded as a candidate follow-up.

ADD: ck_driver/src/disassemble.rs (453, pub(crate), 9 unit tests),
ckc/tests/disassemble_run.rs (145, end-to-end against the real binary),
lib.rs dispatch +7, plan.md intrusion entry. KILL: none (tooling ADD).
Net Rust +605. Gates (post-rebase onto dc6362b, orchestrator-run): fmt 0 ·
clippy -D warnings 0 · build 0 warnings · suite exit 0 (203 result lines) ·
arch 23/23 · verb hand-verified (query, no-match exit 1).
Defense-in-depth from the debt-#69 investigation, explicitly NOT its fix:
the corrupting write (32-bit clobber of 64-bit CST pointer low halves,
dependency-unsafe origin, cranelift-codegen 0.132 prime suspect) is upstream
of teardown and re-fired through this change during verification. What this
DOES buy: compiler-generated drop glue recursed the full parse depth on the
native stack, so a deep chain overflowed at teardown (proven: 200k-deep tree
SIGABRTs with recursive glue, drops cleanly with the worklist). Bounded-
everything now holds for tree teardown. +70 (impl Drop + drain + regression
test). Root-cause slice (cranelift bump) follows separately.
Attempted as the corruption root-cause fix (the 0.132 u32-entity-ref
fingerprint theory): the bump is a pure mechanical MemFlags → MemFlagsData
rename (34+2 sites, 11 ck_codegen files, zero semantic forks) and every gate
is green — but the corruption REPRODUCED post-bump under orchestrator
verification load (fresh SIGSEGV core 08:49:35, same SEGV_ACCERR / wild-rip /
CST-drop fingerprint, route_parse_run, green ×2 isolated). Cranelift 0.132 is
exonerated as sole cause; suspicion moves to a version-independent software
write or the i9-14900KS Raptor Lake degradation defect (load-dependent,
ASAN-shy, survives dep changes) — discrimination experiment queued.

Kept because it stands on its own: current cranelift, and the new isel emits
wheel_v3 in 132 calls (< the 135 ceiling) — CALL_COUNT_CEILING ratcheted
135 → 132 per operating rule 3 in this commit. Race floor held (5.47s pass).
Net Rust +10 (fmt reflow); agent 5×suite clean + orchestrator suite caught
the flake (203 result lines, the one runtime death above).
The back half of the exotic-literal pipeline (plan_literals §5). A claimed
literal now const-folds at compile time to its representation word: the Date
literal 2026-07-20 lowers to a single `mov $0x50ae,%eax` (20654 epoch days),
no runtime call to days_from_civil — proven by ckc disassemble on the stone.

ADD:
- Lit::Typed(TypeId) → Lit::Typed(TypeId, i64) carries the folded word;
  ck_lower's Typed arm → Const(Int{bits, leaf}) via the existing identity-retype
  value-type law → one iconst. ZERO new ck_codegen arms.
- build_matcher_and_claims: ONE load → ONE link_project → ONE interner, claims
  extracted from the same linked artifacts — so every claim.fold_fns FnId
  resolves in the harness provider. CLOSES debt #72 (the mismatched-interner
  second build that returned EvalError::Unresolved is gone from the run path).
- ClaimMatcher::fold runs match_literal for capture spans, decodes by shape tag,
  builds Value::Record, evaluate(fold_fns[0]), unwraps to the repr word — no
  type name or glyph in Rust.
- bounded_eval gains ONE generic value-type construction law, keyed on
  resolution SHAPE (construction_head), never a name (R8 green).
- production path threads the single harness through lex + fold + recursion +
  reconcile; apps without exotic literals are a byte-identical no-op.

STONE: tests/corpus/date_literal (RUNTIME_TESTED); exit 174 (20654 & 0xFF).
Color/Geo/TimeSpan park on debt #71 (Option/Float captures) — fold returns
None, literal fail-softs; noted in-code, never forced by naming Option in Rust.

KILL: none (ADD half; the String/List retrofit KILL rides 8d-ii).
Net Rust +623 (of which +238 gate test). Gates (orchestrator-run): fmt 0 ·
clippy -D warnings 0 · build 0 warnings · suite exit 0 (204 result lines) ·
arch 23/23. Fold-is-a-fold verified via ckc disassemble; #72 closure verified.
mdoorn manually merged commit a38733e6f6 into master 2026-04-14 15:46:42 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
northgale/cklang-bootstrap!81
No description provided.