Skip to content

refactor(ast): close the #1862 review follow-ups — required with-code predicates, byte-axis backstop, linear Python loc - #1877

Merged
dekobon merged 21 commits into
mainfrom
chore/1863-roles-followups
Nov 12, 2026
Merged

dekobon merged 21 commits into
mainfrom
chore/1863-roles-followups

Conversation

@dekobon

@dekobon dekobon commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #1863, the seven follow-up items from the review of #1862. Every item is done or declined with a reason recorded on the issue. No metric value, space name or snapshot moves: git diff 389d879f..HEAD -- '*.snap' tests/repositories man '.role-coverage*' is empty.

Full record with commands and numbers: https://gist.github.com/dekobon/4dd5e8ab3d67b87c444f1df0dc2a4613

Changes

  • Trait defaults (items 1, 2). Checker::is_func_with_code, is_func_space_with_code, is_call_with_code, is_string_with_code and Getter::get_space_kind_with_code are required, with no default. Byte-less Checker::is_func is deleted; its readers (six NArgs::compute impls, holds_doc_comment_in_body, which gains code) ask is_func_with_code. The byte-less is_func_space / get_space_kind are required too and emitted by macros that pin at build time that the rows read neither bytes nor chain. big-code-analysis-ast is outside STABILITY.md; nothing the root crate re-exports changes.
  • Byte-axis backstop (item 3). unmarked_owners_answer_alike_without_the_bytes asks every owner a row does not mark text_gated_by with the source bytes and with &[]. It found three gates declared gated_by that read bytes, now re-declared: the Tcl family's is_braced_literal, Bash's comparison_operator and short_circuit_operator. In-tree BYTE_GATE_FIXTURES keep it meaningful on the legs with no submodule.
  • Record header (items 4, 5). roles::{java,groovy}::record_header / is_record_header replace four spellings of the same relation. The header gate reads the header's types once per evaluation. Probes nargs/{java,groovy}-record-alternative-ctors.
  • Python loc (item 6). Ancestors::nearest_level_answer, a climb memoised per level, answers "does code precede this node on its logical line". Probes loc/python-deep-paren-extra-prefix and loc/python-block-comments-paren-strings.
  • Smaller (item 7), CHANGELOG.md, docs/development/*, the add-lang skill, the book (English and the one ja.po entry), .bca-baseline.toml regenerated.

Read this before the commits

  • 54589594 is wrong and 8061e967 replaces it. The issue suggests a FoldLane for item 6. That fold fixed the nested shape and made another quadratic that main reads in linear time: an if block behind k comment rows holding n parenthesised strings cost n × k. The per-level memo ships instead, and the second probe guards that shape. Both commits are kept so the history shows why.
  • Declined: a C# record_header (its list sits in no field); the per-record memo and arity pre-pass of item 5; count_args in the Groovy nargs header arm, which is not equivalent on recovery input (record R(int a,) {} reads 1 by kind, 2 through count_args) and would move nargs. A test pins both readings.

Evidence

Scaling exponents, cargo bench -p big-code-analysis-bench --bench scaling -- --no-gate, one run each, rustc 1.99.0, aarch64 Linux, host not idle:

Probe climb (main) fold (54589594) memoised climb Top rung
loc/python-deep-paren-extra-prefix 1.96 1.06 0.99 100 ms → 3.5 ms
loc/python-block-comments-paren-strings 1.08 2.02 1.00 763 ms (fold) → 26 ms
nargs/java-record-alternative-ctors 1.01 abandoned at 47 s with the gate asked per constructor
nargs/groovy-record-alternative-ctors 1.01 abandoned at 49 s likewise

Each new test was shown to fail when the code it guards is reverted (utils/perturb.py); the list is in the record.

Validation

Rebased onto main 389d879f (#1876) on 2026-11-12; tip 68b70b08.

  • The rebase. Every replayed commit passed cargo check --workspace --all-features --all-targets, and .bca-baseline.toml was regenerated at each commit that moves it (make self-scan-write-baseline-headroom), never merged. Three conflicts were resolved by hand: the note refactor(ast): make a walk state whether it records siblings #1876 added to Checker::is_func, which this branch deletes, moved to is_func_with_code; the node.rs re-export list took both names; suppression.rs took refactor(ast): make a walk state whether it records siblings #1876's for_walk_without_siblings call under this branch's comment. The rebased tree differs from the pre-rebase tip only in the 19 files refactor(ast): make a walk state whether it records siblings #1876 touched, and 15 of those equal the mechanical three-way merge.
  • make pre-commit at 68b70b08: BCA_GATE: pass (gate=pre-commit), 7249 tests.
  • The chain-audit leg's command (RUSTFLAGS="-D warnings --cfg chain_audit" cargo test -p big-code-analysis -p big-code-analysis-ast --lib --all-features --locked) at 68b70b08: pass.
  • make bench-scaling at 68b70b08: all 132 probes within bound.
  • The partial-feature legs and the no-submodule lib run were replayed locally before the rebase and passed; after it they are left to CI.
  • Coverage: Codecov read the patch at 92.79% before the last commit. That commit covers the five missed lines that had a reason to be covered; a local run of the coverage job's commands puts the patch near 93.9%. The remaining 33 lines are the bodies of trait-required methods on three test doubles that no test calls.

The numbers under Evidence were measured before the rebase, on the same code over the older base.

Review

Seven independent reviews at 601a0742; their findings are fixed in 6198f3fe, f0774c39, e3d0cca8, 6dd823a9, and a follow-up review of those four commits found nothing to act on.

Follow-ups filed

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.90018% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.47%. Comparing base (389d879) to head (68b70b0).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
src/metrics/cyclomatic.rs 0.00% 23 Missing ⚠️
big-code-analysis-ast/src/getter.rs 16.66% 10 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1877      +/-   ##
==========================================
- Coverage   98.48%   98.47%   -0.02%     
==========================================
  Files         400      403       +3     
  Lines      124088   124408     +320     
  Branches   123653   123973     +320     
==========================================
+ Hits       122210   122511     +301     
- Misses       1152     1173      +21     
+ Partials      726      724       -2     
Flag Coverage Δ
python 100.00% <ø> (ø)
rust 98.46% <93.90%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
big-code-analysis-ast/src/checker.rs 97.04% <100.00%> (+0.24%) ⬆️
big-code-analysis-ast/src/checker/bash.rs 71.42% <100.00%> (ø)
big-code-analysis-ast/src/checker/c.rs 100.00% <100.00%> (ø)
big-code-analysis-ast/src/checker/ccomment.rs 100.00% <100.00%> (ø)
big-code-analysis-ast/src/checker/cpp.rs 100.00% <100.00%> (ø)
big-code-analysis-ast/src/checker/csharp.rs 100.00% <100.00%> (ø)
big-code-analysis-ast/src/checker/elixir.rs 100.00% <ø> (ø)
big-code-analysis-ast/src/checker/go.rs 81.25% <100.00%> (ø)
big-code-analysis-ast/src/checker/groovy.rs 100.00% <100.00%> (ø)
big-code-analysis-ast/src/checker/irules.rs 81.25% <100.00%> (ø)
... and 53 more

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dekobon added a commit that referenced this pull request Nov 12, 2026
…o be covered

Codecov on #1877 reports patch coverage 92.79% (489 of 527 lines), with
38 lines missed. Five of them are fixed here:

- `marked_kind` (`roles/mod.rs`, 3 lines) is a `const fn` that only
  runs at compile time, in `TEXT_GATED_OWNERS`, so instrumentation
  sees none of it. Its siblings `count_some` and `some_kinds` have a
  run-time test for that reason; `marked_kind` gets one beside it.
- The two exact-count tests guarded their assertion with
  `if cfg!(not(chain_audit))`, whose implicit else is a region no
  build of the coverage job enters (`node.rs`, `loc.rs`, 1 line each).
  The guard also meant the chain-audit leg asserted no count at all.
  Both now assert exactly in either configuration, without a branch:
  under `--cfg chain_audit` the audit's unmemoised climb runs beside
  every ask, so each count is the memoised one plus the climb's.

The other 33 lines are left: 23 in `cyclomatic.rs` and 10 in
`getter.rs` are the bodies of the methods `Checker` and `Getter` now
require, on three test doubles (`Probe` and `Empty`, `Conflict`) whose
tests never call them. They can only be covered by a test of the
doubles themselves, which exercises no production code.

Measured at this commit with the coverage job's commands and
`utils/patch-coverage.py coverage-llvm.json a62077d`, an LLVM line
approximation of Codecov's figure: patch 508 of 541 lines, 93.90%, the
33 missed lines being exactly those stubs.

Also corrects the probe's doc in `cyclomatic.rs`, which still said it
carries "the default `Checker`".

Refs #1863
…te-less is_func

`Checker::is_func_with_code`, `Checker::is_func_space_with_code` and
`Getter::get_space_kind_with_code` defaulted to their byte-less
spellings, the reverse of what `roles/mod.rs` and
`grammar_dispatch.md` §7 document. A language that wrote only the
byte-less one handed a text-gated row no bytes without a word, which
is how the Java record-header gate read every same-arity constructor
as canonical on #1862.

The three are now required. `is_func_space` and `get_space_kind`
default to the with-code form asked with no bytes and a known-empty
chain, so the forward runs one way only.

Byte-less `is_func` is removed. It had three contracts: 20 languages
passed the caller's chain with no bytes, Java and Groovy discarded the
chain, Elixir answered `false`. Its production readers move to
`is_func_with_code`:

- the Go, Kotlin, Lua, Tcl, iRules and Perl `NArgs::compute` impls;
- `holds_doc_comment_in_body`, which gains a `code` parameter, as do
  `held_in_body` and `outside_function_bodies`. The JS family and C#
  need the real chain there, so a derived kind-table `is_func` would
  have moved `dloc`.

No metric value moves: 7287 workspace tests pass unchanged, corpus
snapshots included.

The baseline loses `Checker` `nom` and `Getter` `wmc`, which fell under
their limits, and records `checker.rs` and `roles/mod.rs` `sloc`. It
also picks up `node/ancestors.rs` `sloc` 1292 -> 1294, which was
already stale on main at a62077d.

Refs #1863
Dropping the chain from the callable half of
`holds_doc_comment_in_body` failed nothing in the workspace, for the JS
family or for C# (two `utils/perturb.py` cases over
`cargo test --workspace --all-features --no-fail-fast`, both UNCAUGHT).

- JS family: a doc comment in a bound arrow's or bound function
  expression's body, above a call. Without the chain the function is
  neither a callable nor a closure, its body holds nothing, and the
  comment binds forward to the call: `dloc` 0 where it reads 1.
- C#: no `dloc` reads the difference, since a `///` in a primary
  constructor's parameter list binds forward to a parameter. The pin is
  at the `Checker`: the list holds under its type declaration and a
  method's own list does not.

Refs #1863
… found

`TEXT_GATED` is the author's word: a gate that reads source bytes under
a plain `gated_by` builds, passes every `!TEXT_GATED` assertion a
byte-less forward makes, and answers that forward from an empty slice.
The chain axis has had a behavioural backstop since #1793; the byte
axis had none.

`unmarked_owners_answer_alike_without_the_bytes` asks every owner a row
does not mark `text_gated_by`, and the table's `opens_space` fold, with
the walk's bytes and with `&[]`, on every corpus candidate. It is per
owner: `role_table!` now emits `TEXT_GATED_OWNERS` under `test-support`
so a row one owner marks is still asked through its others. Both asks
share one chain that lends no `FoldCache`, since a memo is keyed by
node and would serve the byte-less ask the answer the real bytes
stored.

It found three owner gates declared `gated_by` that read bytes, now
`text_gated_by`:

- the Tcl family's `is_braced_literal` (Tcl and iRules `StringLit`),
  which tells a script body by the enclosing command's leading word;
- Bash's `comparison_operator` and `short_circuit_operator`, which read
  a `test_operator`'s bytes to tell `-a` / `-o` from a comparison.

The keyword changes no expansion and no metric value. No forward
asserts `!TEXT_GATED` on those rows.

A gate is seen only where its answer moves, so `BYTE_GATE_FIXTURES`
adds the shapes no other source spells: a record with a same-arity
alternative constructor for Java and Groovy, and a `[ … -a … ]` test
for Bash. The Bash fixture gives `ShortCircuit` `binary_expression` its
first positive, so that `NO_POSITIVE_IN_CORPUS` entry goes.

The baseline records `roles/mod.rs` `ploc` and `sloc`.

Refs #1863
The example's last sentence described the #1862 state as current: both
checkers overriding `is_func_with_code` and a byte-less `is_func`
forwarding a known-empty chain. #1863 removed that method. The sentence
now reads as history and names what replaced it. Found by the
checkpoint review of steps 1 and 2.

Refs #1863
…ovy tables

"The header is the record's `parameters` / `components` field" was
spelled four times: in the `FuncOpener` gate, in the getter's naming
closure as a kind pair, in Java's `NArgs::params_owner`, and as a
string argument to `record_header_is_a_method` in `npm`.

`roles::java::record_header` and `roles::groovy::record_header` project
the list from a record declaration and answer `None` for any other
node, as `is_switch_body_kind` names the `Switch` owner's body. The
gate, the naming helper, `nargs` and `npm` read them.
`func_space_name_from_owner` takes the list and its parent as nodes, so
a language can match by identity or, as C# does, by kind.

C# is left as it is: a primary constructor's list sits in no field, the
pinned grammar admits more than one `parameter_list` under a type
declaration, and the row's `under` list already is the relation. An
identity projection would rename the second list's space.

No metric value, space or name moves. One row test per language pins
the projection against the row.

The baseline records `roles/mod.rs` `sloc` and adds `nargs.rs` `ploc`
at 525, three lines over the soft limit.

Refs #1863
…e gate

The record-header gate (#1842) scans a record's body for a canonical
constructor and tells one from an alternative by its parameter types.
It re-spelled the header's component types for every constructor it
compared. `opens_record_header` now builds them once, on the first
constructor it meets, for Java and Groovy alike. The comparison is the
same pairwise equality with the same arity rule; two rows pin a
constructor that runs past the components and one that stops short.

No probe rendered a record. `nargs/java-record-alternative-ctors` and
its Groovy twin render one record of ten components with `width`
alternative constructors whose first nine types match, the most a
constructor can cost. Both fit 1.01. With the gate asked once per
constructor instead, one walk of 2 000 constructors took 47 s (Java)
and 49 s (Groovy) against 32 ms and 26 ms, and the gate abandons both
probes over the per-walk budget.

Reading the types once took the same top rung from 44 ms to 29 ms for
Java and from 35 ms to 21 ms for Groovy on a warm tree. The issue's
other two optional changes are not made: an arity pass would either
change answers on recovery input or repeat the filter, and a per-record
memo adds walk state for a constant factor on a gate that costs
microseconds on a real record.

Measured on a host that was not idle; the numbers and commands are on
the issue.

Refs #1863
…e chain

A bare `\` run inside a parenthesised docstring asks whether its
parenthesis sits on the string's line with no code before it. The
answer is read at the nearest level, from the node's own upward, that
holds a token before its node; a level holding only comments and
splices defers to the one above. Where no level answers, each of
`depth` nested parentheses climbed to the root: `depth² / 2` levels,
bounded only by CPython's 200-level cap. Every existing Python
parenthesis probe grows the nesting or one level's prefix, never both.

`Ancestors::nearest_level_answer` folds such a question down the walk's
chain on a new `LevelLane`, each ancestor's own answer once per walk,
and climbs where no cache is lent. `python_code_before_node` reads its
own level and then the fold, so a parenthesis reads three levels.

`loc/python-deep-paren-extra-prefix` renders a docstring `depth`
parentheses deep with 30 run-and-comment pairs per level, the most that
keeps a parenthesis under `WIDE_PARENT`, so a level's read is a seek
and the number of levels read shows in the timing. It fits 1.00. With
the climb put back it reads 1.95 and fails the gate, 92 ms at the top
rung against 5.3 ms.

The measurement decided this. Probe-only was the plan if a bound
separated the memoised climb from an unmemoised one; on the issue's
shape they read 1.56 and 1.98, with no bound that clears both on a
shared host.

`python_code_before_a_parenthesis_reads_three_levels_each` pins the
count: 120 levels over 40 parentheses, 900 with the climb. `make
chain-audit` checks every folded answer against the climb and passes.
No `loc` value moves.

The baseline records `node/ancestors.rs`, which gained the method.

Refs #1863
The header gate spells a record's component types once per evaluation
since 582b533. No answer can see that: three alternative constructors
leave the header open whether its types are spelled once or three
times, and the scaling probes fit the same exponent either way. A
counter beside each gate and one exact-count test per language pin it:
one read for a record with three alternatives, none for a record with
no constructor.

Also corrects the Python probe's shape doc, which said it grows the
prefix; the prefix is fixed at 30 pairs per level and only the nesting
grows. Both found by the checkpoint review of steps 3 to 5.

Refs #1863
…view

- `ops_and_metrics_agree_on_the_space_tree` asserts the Java and Groovy
  record's header space is in the rendered tree. Dropped by both walks
  it left the two trees equal, and the fixture's other members kept the
  non-empty check true.
- `check_gated` takes `Option<&str>` for the gated kind instead of `""`
  as the no-kind sentinel.
- `has_public_modifier` reads `modifiers` as `child(0)` again rather
  than searching for it with a cursor per declaration. `bca dump`
  confirms it is the first child of a documented, annotated record and
  method; comments and annotations sit beside or inside it.
- `python_is_extra` states tree-sitter-python's two extras once.
  `not_extra` and `python_code_among` read it.

The Groovy `nargs` header arm keeps its kind filter. The issue proposed
`count_args::<Self>` as giving the same answer; it does on a clean
parse only. `count_args` takes every child that is no parenthesis,
comma or comment, so the `ERROR` recovery leaves in the list reads as
an argument: `record R(int a,) { }` would move from 1 to 2. A test pins
both readings and the comment says why the arm is not shared.

The Java row test in `roles/java.rs` keeps its own gated-kind loop: it
gates two kinds and asserts three more rows, so `check_gated` is no
drop-in.

No metric value moves.

Refs #1863
One entry under Changed for the AST-crate trait change and what came
with it (the byte-axis backstop and the three re-declared gates, the
record-header projection, the header-type hoist and its probes), and
one under Fixed for the Python `loc` fold. Neither moves a metric
value.

Refs #1863
`python_deep_paren_extra_prefix` is `pub` and its doc linked the
private `PAREN_PREFIX_PAIRS`, which `make doc-check` rejects
(`rustdoc::private_intra_doc_links`). `make pre-commit` named the stage.

Refs #1863
- `is_record_header(list, record)` beside each `record_header` states
  "this list is that record's header" once. The gate, the two getters
  and Java's `params_owner` each spelled the id comparison.
- `opens_record_header` holds the header's component types in a
  `LazyCell` rather than an `Option` filled through
  `get_or_insert_with`, which drops a `mut`, a shadowing rebind and, in
  Groovy, a block used as an `&&` operand. Still one read per
  evaluation, on the first constructor; the count tests are unchanged.
- `record_header_types_read` is read by this crate's tests only, so its
  accessor takes the default `cfg(test)` gate.
- `byte_less_is_closure_reads_only_rows_without_a_text_gate` in
  `nargs.rs` is removed. With its `FuncOpener` half gone (#1863) its
  seven rows were a subset of the same-named test in `nom.rs`, which
  pins every language's `Closure` row, and its doc named the wrong set
  of impls. The `nom.rs` test now says it stands for `NArgs` too.
- Comments: two stale sentences about the callable test's spelling
  (`nargs.rs`, `spaces_tests.rs`), Elixir's byte-less spelling
  (`checker.rs`), exact test names in the `record_header` docs, two
  rename slips, and five paragraphs re-wrapped.

No behaviour changes. Findings of three read-only review agents
(reuse, clarity, efficiency). Declined: a macro for the 75 identical
space-tree forwards (50 files of churn for code this change did not
add), and keying `BYTE_GATE_FIXTURES` by `LANG` (the per-language test
gate check rejects it without a hand-written marker; the file's other
exception tables are keyed by table name).

Refs #1863
…old lane

798ee09 folded "does code precede this parenthesis on its logical
line" down the walk's chain. That fixed the nest it was written for and
made another shape quadratic that `main` reads in linear time.

A fold evaluates every ancestor, the ones above the nearest answer
included, and stores an ancestor's state under the child on the path.
That is free where the step is a kind test. Here a level's answer is a
scan of the comments and `\` splices before it. In an `if` block that
opens with `k` comment rows and holds `n` parenthesised strings, each
string's own statement answers, yet the fold read the block's level,
the scan of the `k` comments, once per statement: `n × k` where the
climb costs `n + k`. Unlike the nest, this shape has no 200-level cap.

`Ancestors::nearest_level_answer` now memoises the climb itself. It
stops at the first level that answers or already holds an answer, and
hands what it found to the levels it passed (`LevelQuestion`, a
`NodeMemo` keyed by level). A level is read at most once per walk and
never above the nearest answer. `FoldLane::CodeBeforeOnLine` is gone.
`fold_down`'s doc states what a step costs.

Scaling (`cargo bench -p big-code-analysis-bench --bench scaling --
--no-gate`, one run each, host not idle):

  probe                                    climb   fold    memo
  loc/python-deep-paren-extra-prefix       1.96    1.06    0.93
  loc/python-block-comments-paren-strings  1.08    2.02    1.04

Top rungs: 100 ms climbed against 4.7 ms on the first; 763 ms folded
against 28 ms on the second, which is new. Each defect passes the other
probe, so both stay.

`python_code_before_a_parenthesis_reads_each_level_once` pins the
levels read on both shapes at size 40: 81 and 81; 900 and 81 climbed;
120 and 122 folded. `nearest_level_answer_answers_the_climb_on_every_path`
counts the answer fn's calls per ask, which is what tells a memo from
a climb. `make chain-audit` passes. No `loc` value moves.

Also parenthesises the `||` / `&&` in `python_code_among`.

Found by the efficiency agent of the simplify-rust pass.

Refs #1863
The per-ask call counts in
`nearest_level_answer_answers_the_climb_on_every_path` could not see
whether the level that answered was stored: every later asker met a
passed level first. A closure with a typed parameter gives one asker
that climbs to the closure through its parameter list and a second
that is its direct child, which meets the stored answer or asks again.

Refs #1863
…heir own

`sources_for` asserted that every `BYTE_GATE_FIXTURES` row names a
table on each of its calls, once per language per test. The check is a
property of the table, not of loading one language's sources.

The rust-optimize pass over the branch found nothing else: the
workspace already gates `clippy::pedantic` at `-D warnings`, and the
catalog's remaining candidates in the changed code are established
idioms of the surrounding files.

Refs #1863
…is read once

`python_code_before_node` read the asked parenthesis's own level
directly and handed only the levels above it to
`Ancestors::nearest_level_answer`. The parenthesis was therefore never
looked up or stored in the memo: the next parenthesis in read it again
as its parent, and a second asker of the same parenthesis (a
`\`-continuing run through `python_code_before_string`, which is not
behind the per-parenthesis memo) rescanned its prefix. The docs said
"a level is read at most once per walk"; the count test pinned
`2n + 1` reads for `n + 2` levels.

Both callers now ask from the run itself, whose first ancestor is the
parenthesis, so the parenthesis is a level like the rest.
`python_code_before_node` is replaced by `python_code_before_parent`.
The answer is the same `find_map` over the same levels.

`python_code_before_a_parenthesis_reads_each_level_once`: 42 and 81
levels read at size 40 (was 81 and 81), one per level on both shapes.
Scaling, one `--no-gate` run on a busy host:
`loc/python-deep-paren-extra-prefix` 0.99 and 3.5 ms at the top rung
(was 0.93 and 4.7 ms; 1.96 and 100 ms with a climb per parenthesis),
`loc/python-block-comments-paren-strings` 1.00 and 26 ms.

`benchmarking.md` also gains what the reviews of the batch asked for:
`nearest_level_answer` in the climb sweep's pattern, a note that the
timer starts after the parse (tree-sitter-python's scanner is itself
quadratic on two of these shapes, which no probe prices), and the
record-header passage's two timings told apart.

Found by four of the seven reviewers of the batch.

Refs #1863
…e byte-less pair

c935311 made three with-code predicates required and gave the
byte-less `is_func_space` / `get_space_kind` a provided forward. Two
gaps were left, both the silent default this work removes:

- The provided forward carried no build-time pin. `Ccomment` and
  `Preproc` took it, and a new language that left out
  `impl_byte_less_func_space!` would have compiled and forwarded a
  gated opener under `&[]` with no assertion. The pair is required
  again: the two helper grammars invoke the macros (their rows are
  absent, so the assertions hold), and Ruby takes the `opener_gated`
  form in place of an identical hand-written forward, which pins its
  `Container` row. C# keeps its hand-written forward with its own
  assertion and Elixir its kind table.
- `Checker::is_call_with_code` and `is_string_with_code` still
  defaulted to their byte-less spellings. Both are required. Every
  language already emitted them through `impl_row_predicates!` except
  the two helper grammars' `Call` rows, which are absent.

`doc_body_residual_kind!` passes the bytes `holds_doc_comment_in_body`
now has, in place of `&[]` behind an assertion that the row reads none.

No answer changes: every body a language now writes is the one the
default gave it. The module doc of `roles/mod.rs`, the add-lang skill,
the book's new-language page and the CHANGELOG say what is required.
The rustdoc on `holds_doc_comment_in_body` named a record's header as
a callable its `code` serves; Java and Groovy exclude that kind first,
so the examples are C#'s primary constructor and a bound arrow.

The baseline records `roles/mod.rs` `sloc`.

Found by the review, code-review, under-reviewed-areas, Argon and
architecture reviewers.

Refs #1863
- The byte backstop walked a bare chain. A gate that reads a sibling
  under a parent wider than `WIDE_PARENT` (the `ElseIf` rows of Java,
  Groovy, C# and Kotlin) would have tripped the walk-must-lend
  assertion on the first such fixture, as a panic rather than a byte
  finding. It now walks with the sibling cache and withholds only the
  `FoldCache` (`Ancestors::without_folds`, test-only).
- Nothing checked that a `BYTE_GATE_FIXTURES` row still moves the gate
  it was written for. The backstop skips a marked owner, so a fixture
  a grammar bump left answering alike both ways would leave that gate
  unguarded with every test green.
  `byte_gate_fixtures_each_move_a_marked_gate` asserts it, and still
  checks the table names.
- `has_public_modifier` reads `modifiers` as child 0 and no test wrote
  anything ahead of `public`. `java_public_is_read_past_what_precedes_it`
  pins a doc comment, annotations, a comment among them, a comment
  after the keyword and type parameters.
- `header_answers` and `header_type_reads` rebuilt "is this list its
  parent's header" from `record_header`; they read `is_record_header`,
  which had no direct row.
- `record_header_is_a_method` took the projection as an `impl FnOnce`
  it called once on its own argument; it takes the header.

Docs: `nearest_level_answer` states that it needs the node's whole
ancestry, and `below` that a level question must not be asked from a
re-rooted chain; `NodeMemo` and `MemoQuestion` describe the ancestry
answer they now hold; "each ancestor once per walk" is "once per child
the walk asks under" on the two fold entry points; lessons 65 and 120
name the current predicates; `BYTE_GATE_FIXTURES` says why it is keyed
by table name.

The baseline records `node/ancestors.rs` `sloc`.

Refs #1863
`byte_gate_fixtures_each_move_a_marked_gate` asked for *some* marked
owner to move. Rewriting the Groovy fixture's alternative constructor
into a canonical one, which stops the header gate moving, still passed:
another text gate of the Groovy table moves on the same source. Each
fixture now lists the `(role, owner kind)` gates it was written for,
and the test, `byte_gate_fixtures_each_move_their_gates`, requires each.

Found by reverting the fixture the first form of the test was meant to
guard.

Refs #1863
…nese

19b637f changed the bullet to name `get_space_kind_with_code` and its
byte-less `get_space_kind`. The `ja.po` entry for it was already fuzzy
against an older English sentence (`getter.rs` as one file), so the
item rendered in English on the `/ja/` page.

The entry now carries the current `msgid`, taken from a freshly
generated `messages.pot`, and a new translation, with the fuzzy flag
dropped. Only this entry changes: `msgcat` is a no-op on the rest of
the catalog, and a full `make book-po-update` would have rewritten
4,727 lines of unrelated stale entries. Fuzzy entries: 991 -> 990.

Checked with mdbook 0.5.2 and mdbook-i18n-helpers 0.4.0 built with
`syntect/regex-onig`: `msgfmt --check` passes, a scratch `msgmerge`
against the new pot leaves the entry non-fuzzy, and
`make book && make book-ja` renders the Japanese sentence on
`ja/developers/new-language.html` with the link target intact.

Refs #1863
…o be covered

Codecov on #1877 reports patch coverage 92.79% (489 of 527 lines), with
38 lines missed. Five of them are fixed here:

- `marked_kind` (`roles/mod.rs`, 3 lines) is a `const fn` that only
  runs at compile time, in `TEXT_GATED_OWNERS`, so instrumentation
  sees none of it. Its siblings `count_some` and `some_kinds` have a
  run-time test for that reason; `marked_kind` gets one beside it.
- The two exact-count tests guarded their assertion with
  `if cfg!(not(chain_audit))`, whose implicit else is a region no
  build of the coverage job enters (`node.rs`, `loc.rs`, 1 line each).
  The guard also meant the chain-audit leg asserted no count at all.
  Both now assert exactly in either configuration, without a branch:
  under `--cfg chain_audit` the audit's unmemoised climb runs beside
  every ask, so each count is the memoised one plus the climb's.

The other 33 lines are left: 23 in `cyclomatic.rs` and 10 in
`getter.rs` are the bodies of the methods `Checker` and `Getter` now
require, on three test doubles (`Probe` and `Empty`, `Conflict`) whose
tests never call them. They can only be covered by a test of the
doubles themselves, which exercises no production code.

Measured at this commit with the coverage job's commands and
`utils/patch-coverage.py coverage-llvm.json a62077d`, an LLVM line
approximation of Codecov's figure: patch 508 of 541 lines, 93.90%, the
33 missed lines being exactly those stubs.

Also corrects the probe's doc in `cyclomatic.rs`, which still said it
carries "the default `Checker`".

Refs #1863
@dekobon
dekobon force-pushed the chore/1863-roles-followups branch from 9d2f893 to 68b70b0 Compare November 12, 2026 15:10
@dekobon
dekobon merged commit 68b70b0 into main Nov 12, 2026
54 checks passed
@dekobon
dekobon deleted the chore/1863-roles-followups branch November 12, 2026 16:25

This branch was previously deployed

1 inactive deployment
github-pages — 68b70b08 Deployed Nov 12, 2026 by dekobon via deploy to GitHub Pages #1058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(roles): follow-ups from the PR #1862 whole-branch review — Checker forwarding direction, byte-axis backstop, record-header projection and probes

1 participant