Repository navigation
Description
Status (2026-11-11): landed on
mainat68b70b08through #1877 on 2026-11-12, as a fast-forward of the 21 signed commits. Evidence and per-item detail: #1863 (comment)
- 1. Required with-code predicates (also
is_call_with_code/is_string_with_code)- 2. Byte-less
is_funcdeleted; byte-lessis_func_space/get_space_kindrequired and pinned- 3. Byte-axis backstop; three gates re-declared. Remaining blind spot: refactor(roles): make the gated_by keyword exact on the byte axis #1874
- 4.
record_headerfor Java and Groovy. C# declined- 5. Header types read once; two probes. Per-record memo and arity pre-pass declined
- 6. Probe added. The
FoldLanesuggested below regresses another shape; a per-level memoised climb ships instead, with a second probe- 7. Four of five done.
count_argsin the Groovy header arm declined: not equivalent on recovery inputFollow-ups filed from the reviews: #1872, #1873, #1874, #1875.
Follow-ups the whole-branch review of PR #1862 (batch of #1857 #1859 #1858 #1830 #1842) identified as out of that PR's scope. Each is small on its own; none blocks the merge.
1. Checker default forwarding runs with-code → byte-less, the reverse of the documented contract
big-code-analysis-ast/src/checker.rs defaults is_func_with_code to is_func(node, ancestors) and is_func_space_with_code to is_func_space(node). roles/mod.rs ("Reading a row") and docs/development/grammar_dispatch.md §7 say the opposite: the _with_code spelling is what the walk calls and the byte-less defaults forward to it. Only Elixir, Groovy and Java override is_func_with_code; for the other 23 languages a with-code consumer silently gets is_callable(node, &[], ancestors). This is how 80c737e7 on #1862 happened: Java's record-header gate read type bytes, is_func dropped them, and every same-arity constructor read as canonical until is_func_with_code was overridden.
Plan: make is_func_with_code the required Checker method and derive the byte-less is_func from it as the kind table (&[], Ancestors::known(&[])) for every language. The AST crate is outside STABILITY.md; Checker is not re-exported from the root crate. Mechanical across 26 languages.
2. Byte-less is_func has three contracts
Ruby/C#/Kotlin honour the caller's chain and drop bytes; Java/Groovy discard the chain and force a known-empty one (checker/java.rs, checker/groovy.rs, #1842); Elixir returns false. roles/mod.rs was edited to document the Java/Groovy carve-out. The derived parity suite never compares byte-less is_func (derived_parity_tests.rs forwards_on lists is_closure, is_else_if, is_func_space, get_space_kind, is_func_with_code), so the forward is pinned only by *_byte_less_spellings_omit_the_record_header. KNOWN_DISAGREEMENTS grew 6 → 10 entries. Resolve with item 1: one definition of the byte-less spelling, with the chain-honouring variants becoming the exceptions to argue about.
3. No byte-axis backstop for a gate declared under the wrong keyword
roles/mod.rs documents that TEXT_GATED is the author's word and "a gate named under the wrong keyword is the author's error". The chain axis has a behavioural backstop (no_chain_rows_answer_alike_under_the_empty_chain); the byte axis has none. A symmetric derived test — for every !TEXT_GATED owner on corpus candidates, owns(node, code, chain) == owns(node, &[], chain) — would have failed on the #1842 doc fixture as soon as a same-arity alternative constructor was added.
4. Record-header structural projection is restated per consumer
"The header is the record's parameters / components field" is spelled in the gate (roles/java.rs, roles/groovy.rs), the getter's naming closure (kind pair only), nargs params_owner, and npm's stringly field: &str argument to record_header_is_a_method. roles/mod.rs prescribes a named fn beside the table for a structural projection one consumer needs (is_switch_body_kind is the precedent). A record_header(record) -> Option<Node> per language would hold the field name once; C#'s #1828 code has the same shape.
5. Per-record memo for the header gate, and a record width probe
opens_record_header is evaluated 6× per record in bca metrics (walk promotion, get_space_kind_with_code, nargs, nom, cognitive owns_kind, npm) and 2× in bca ops, each re-scanning the body and allocating a Vec<u8> per parameter per constructor. Linear in the file (doubling ratios 1.86–2.1 measured at M=4000 members, C=200 constructors, P=10), ≈1 ms per evaluation at that shape, ≈10 µs on realistic records; 25 % of walk time only on an absurd 2 MB file of 4000 constructors. Optional: NodeQuestion::RecordHeaderOpens memo keyed on the record; build the header's Vec<ParameterType> once per evaluation; compare arity before types. Add nargs/java-record-alternative-ctors (Axis::Width, one record with width alternative constructors whose first 9 types match) and a Groovy twin so the gate's class is pinned; no probe renders a Java/Groovy record today.
6. Python depth × width paren probe
python_code_before_node's climb over extras at every level above a parenthesis is Σ_j Σ_{i<j} k_i, bounded by CPython's 200-level cap (measured exponent ≈1.3–1.4 up to the cap, dropping at d=400). Pre-existing, not introduced by #1830; every Python paren probe is depth-only or width-only. A loc/python-deep-paren-extra-prefix probe (Axis::Depth, depth × 50 \+# c pairs per level, ladder below 200) would pin it; a FoldLane for "code precedes this level's node on its logical line" would make it O(Σk).
7. Smaller
tests/parity/ops_metrics_space_parity.rs: the Java/Groovy record fixture cannot see a two-sided drop of the header space (space.spacesis non-empty from other members); acontains("Function Some(\"R\")")on the rendered tree would make it self-checking.- Groovy
nargsheader arm countsrecord_componentchildren by kind filter;count_args::<Self>gives the same answer today and is the one definition of "a parameter". check_gatedinspace_tree_tests.rsuses""as the no-gated-kind sentinel;Option<&str>says the same. The Java row test inroles/java.rshand-rolls the same gated-kind pattern.impl_npm_java_like!'shas_public_modifierswappedchild(0)for a cursor scan: oneTreeCursorallocation per method; the directiondocs/development/benchmarking.mdwarns about, measurably nothing today.not_extra(lang_helpers/python.rs) states the tree-sitter-python extra pair once;loc/python.rspython_code_amongrestates it in askip_while. Export aspython_is_extrawhen LOC is next touched.
Activity
docs(lessons): three lessons from the batch, and a probe test that re…
docs(lessons): three lessons from the batch, and a probe test that re…
dekobon commentedon Nov 12, 2026
Implemented on the local branch
chore/1863-roles-followups, 19 commits onmaina62077d5, tip51bd1ad6. Not pushed and no PR yet, so this stays open.Full record (commands, revisions, numbers, per-item detail): https://gist.github.com/dekobon/4dd5e8ab3d67b87c444f1df0dc2a4613
No metric value, space name or snapshot moves (
git diff a62077d5..51bd1ad6 -- '*.snap' tests/repositories man '.role-coverage*'is empty). At the tip:make pre-commitendsBCA_GATE: pass(7242 tests),make bench-scalingpasses all 132 probes,make chain-auditpasses.is_call_with_codeandis_string_with_codehad the same default and are included).is_funcis deleted, not derived: the JS family and C# need the real chain in the doc-body test. The byte-lessis_func_space/get_space_kindare required and pinned at build time.is_braced_literal, Bashcomparison_operatorandshort_circuit_operator. Six gates re-declaredgated_byeach fail it. Its blind spot is #1874.FoldLanethis issue suggests: that fold made another shape quadratic (2.02, wheremainreads 1.08). A per-level memoised climb ships instead, with a second probe for that shape.count_argsin the Groovy header arm declined: it is not equivalent on recovery input (record R(int a,) {}reads 1 by kind and 2 throughcount_args), so the swap would movenargs. A test pins both.Scaling exponents for item 6 (
--no-gate, one run each, busy host):main)loc/python-deep-paren-extra-prefixloc/python-block-comments-paren-strings(new)Follow-ups filed from the reviews: #1872, #1873, #1874, #1875.
dekobon commentedon Nov 12, 2026
One more local commit,
530da1b0: the Japanesepo/ja.poentry for the book line this work changed (theGetterbullet of the new-language page) is translated. It was already fuzzy against an older English sentence, so the item rendered in English on/ja/. Only that entry changes (fuzzy entries 991 -> 990).msgfmt --checkpasses, themsgidmatches a freshly generatedmessages.pot, andmake book && make book-jarenders it. The record gist is updated. The gates above were taken at51bd1ad6; this commit touches no code.dekobon commentedon Nov 12, 2026
The branch is pushed and in review as #1877 (
Fixes #1863), tip530da1b0.test(node,loc,roles): cover the five patch lines that have a reason t…
refactor(checker): require the with-code space predicates and drop by…
test(loc,roles): pin the chain the doc-body callable test reads
test(roles): add the byte-axis backstop and re-declare three gates it…
docs(lessons): bring lesson 120 up to the removal of byte-less is_func
refactor(roles): name a record's header once, beside the Java and Gro…
perf(roles): read a record header's types once per scan, and probe th…
perf(loc/python): fold the code-before-a-parenthesis question down th…
test(roles): count the record-header type reads the hoist saves
3 remaining items
refactor(roles,nargs): apply the simplify-rust pass over the #1863 batch
perf(loc/python): memoise the code-before climb per level, not on a f…
test(node): make the answering level's memo observable
test(roles): check the byte-gate fixtures' table names in a test of t…
perf(loc/python): ask the level question from the run, so each level …
refactor(checker): leave no default on the with-code predicates or th…
test(roles,npm): close the test gaps the reviews of the batch found
test(roles): name the gates each byte-gate fixture must move
docs(book): translate the new-language page's Getter bullet into Japa…
test(node,loc,roles): cover the five patch lines that have a reason t…
dekobon commentedon Nov 12, 2026
The branch was rebased onto
main389d879f(#1876) and force-pushed; #1877 is now at68b70b08. The hashes in the comments above and in the record gist are the pre-rebase ones. Old to new:Each replayed commit passed
cargo check --workspace --all-features --all-targets, and.bca-baseline.tomlwas regenerated per commit, not merged. At68b70b08:make pre-commitendsBCA_GATE: pass(7249 tests), the chain-audit leg's command passes, andmake bench-scalingpasses all 132 probes. The measurements in the record were taken before the rebase.dekobon commentedon Nov 12, 2026
Landed:
mainwas fast-forwarded to68b70b08(#1877) after CI passed on that commit (52 checks passed; the two Pages jobs do not run on pull requests). GitHub's rebase merge was not available becausemainrequires signed commits, so the 21 signed commits were pushed as they are. Every item above is done or declined with its reason recorded; follow-ups are #1872, #1873, #1874 and #1875.refactor(roles): make gated_by exact on the bytes
docs(changelog): consolidate the 2026-11-12 batch