Measure: the trap ledger re-read, and three claims made true #221

Manually merged
dferreira merged 1 commit from feat/221-measure-the-trap-ledger-re-read-and-three-clai into master 2026-09-04 16:16:03 +02:00
Owner

Measure: the trap ledger re-read, and three claims made true

Along the way:

  • measure: the trap ledger re-read, and three claims made true

Touches 24 files: CLAUDE.md, plan.md, src/rust/README.md, src/rust/crates/ck_driver/tests/capability.rs, src/rust/crates/ck_driver/tests/grammar_structure.rs, src/rust/crates/ck_parser/src/expr.rs and 18 more.

Measure: the trap ledger re-read, and three claims made true Along the way: - measure: the trap ledger re-read, and three claims made true Touches 24 files: `CLAUDE.md`, `plan.md`, `src/rust/README.md`, `src/rust/crates/ck_driver/tests/capability.rs`, `src/rust/crates/ck_driver/tests/grammar_structure.rs`, `src/rust/crates/ck_parser/src/expr.rs` and 18 more.
Author
Owner

Split. The decision in the_parser_enforces_the_declared_list_literal_bound is a pure function now, with its own tests in src/rust/crates/ck_driver/tests/grammar_structure.rs.

Split. The decision in `the_parser_enforces_the_declared_list_literal_bound` is a pure function now, with its own tests in `src/rust/crates/ck_driver/tests/grammar_structure.rs`.
dferreira approved these changes 2026-09-04 14:00:00 +02:00
dferreira left a comment

Yes. The commit messages carried me through all 24 files, which is not always true.

Yes. The commit messages carried me through all 24 files, which is not always true.
@ -47,0 +54,4 @@
/// the enforcement (E0148 on the 129th element). Deliberately narrow: the other
/// 28 `max N` bounds are unenforced, and each gains a row here when it lands.
#[test]
fn the_parser_enforces_the_declared_list_literal_bound() {
Owner

the_parser_enforces_the_declared_list_literal_bound reads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?

`the_parser_enforces_the_declared_list_literal_bound` reads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?
@ -623,9 +629,24 @@ impl Parser {
self.emit_error_at_cursor("E0075", "expected `]` to close list literal");
break;
}
if items == LIST_LIT_MAX_ITEMS && !over_cap_reported {
Owner

The condition on items has three ways to be true, and the middle one is the interesting case. Could the unusual path return early?

The condition on `items` has three ways to be true, and the middle one is the interesting case. Could the unusual path return early?
@ -33,6 +33,7 @@ pub struct ParseOutput {
pub diagnostics: Vec<Diagnostic>,
}
pub use expr::LIST_LIT_MAX_ITEMS;
Owner

I had to read expr twice. Nothing wrong with it, but one line of comment would save the next person the second read.

I had to read `expr` twice. Nothing wrong with it, but one line of comment would save the next person the second read.
Author
Owner

Turned around in src/rust/crates/ck_parser/src/expr.rs. The odd case for items leaves first and the rest reads straight down.

Turned around in `src/rust/crates/ck_parser/src/expr.rs`. The odd case for `items` leaves first and the rest reads straight down.
Author
Owner

Comment added on expr in src/rust/crates/ck_parser/src/lib.rs. It was obvious when I wrote it and it will not be in a month.

Comment added on `expr` in `src/rust/crates/ck_parser/src/lib.rs`. It was obvious when I wrote it and it will not be in a month.
praghunathan left a comment

Second read on src/rust/crates/ck_driver/tests/grammar_structure.rs. Nothing to add.

Second read on `src/rust/crates/ck_driver/tests/grammar_structure.rs`. Nothing to add.
The corpus was re-measured with `ckc sizes` on all 36 apps. The same eleven
refuse; nothing closed at the app level, but most of the LEDGER did, and seven
of the ten trap files had drifted away from the compiler they describe.

`List::filter` / `map` / `contains` / `len` and `++` all resolve now. The E0728
rows that dominated five trap files are gone, and what stands in their place is
the bound arithmetic behind them — `[v, ..rest]` narrows, `xs ++ [v]` widens,
and neither fits the fold's own parameter (E0702 / E0723). `E0706` no longer
fires anywhere. `Equals` is the last missing list row; `fold` the only other
absent method. Corrected inventories, dated and reproducible, in each trap.md.

Why they drifted is the structural finding, recorded in plan.md §4d:
`ck_driver/tests/corpus.rs` reconciles the RESOLUTION closure only, by design.
Only `snake` and `algorithms_Dijkstra_trapped` refuse at resolution; every other
refusal is typecheck, so every typecheck claim in every trap.md is unreconciled
prose. Nothing was watching them.

`types` was the undeclared refusal. `Eq` is a stale spelling — the live roster
is `Equals` (`DERIVABLE_TRAITS = ["Equals", "Hash"]`) — so E0753 x2 was an
authoring bug in the app and is fixed. The remaining four are real gaps (a named
lowercase parameter is not a field on the value; `{}::<T> with v` is read as an
anonymous record) and are declared in a new `tests/corpus/types/trap.md`.

`Grammar.ckx`'s `max 128` on `list_lit` is real now (owner ruling 4). The parser
counts — a literal's elements are all visible — and the 129th is E0148.
`ck_parser::LIST_LIT_MAX_ITEMS` is the enforcement and G-P in
`grammar_structure.rs` reconciles it against the grammar's own text, so declared
and enforced are one number. Two cells pin both directions:
`list_literal_at_the_declared_maximum` (128, runs 7) and
`..._past_the_declared_maximum_refuses` (129, typecheck E0148).
CELL_COUNT 437 -> 439. The other 28 `max N` bounds remain unenforced and are
named as such, in the gate and in plan.md.

CLAUDE.md §6 said `docs/` "stays in the CkLang repo and is the single source of
truth". It exists in neither repo, deleted here in 07a49fef, recoverable only
at 07a49fef^. The section now says that, and says what to cite instead. plan.md
counted "two doc comments" still linking `../../../../docs/`; the real count was
124 occurrences across 29 files in `src/`, plus 8 in `tests/`. All delinked —
the prose citation stays, the dead link goes.

Ratchets: CELL_COUNT 437 -> 439 (two cells, both marked, neither BROKEN, so
BROKEN_CELL_COUNT and UNMARKED_CELL_COUNT do not move). No threshold raised.

Gates run here: `cargo fmt --check` clean; `clippy --workspace --all-targets
-D warnings` 0 warnings; `--test corpus`, `--test architecture` (38),
`--test grammar_structure` (7), `--test grammar_stage1` (9), and the unit suites
of ck_parser / ck_lex / ck_syntax / ck_types / ck_resolve / ck_load / ck_cktest
all green. `--test capability` was NOT run — it spawns containers and is the
main session's to run; the two new cells were verified by hand instead
(`ckc check` for E0148, `ckc disassemble` + the linked binary for exit 7).
dferreira manually merged commit c7aeec484d into master 2026-09-04 16:16:03 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 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!221
No description provided.