Skip to content

fix(detector): Mode E statement buckets leave the function population (#2792) - #2842

Merged
squid-protocol merged 1 commit into
mainfrom
fix/2792-uncountable-slice-population
Sep 7, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/2792-uncountable-slice-population

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

sqlite records functions_found 31 against a 13-function planted program. Mode E (_slice_by_terminator) never captures a name from source: it cleaves on the terminator and labels each bucket after the igniter keyword it matched (CREATE_Statement, Declarative_Block). The count scales with statement volume, not with the program — and it is the denominator of six per-function descriptors (avg_func_loc, avg_func_complexity, func_complexity_gini, func_internal_density, avg_func_args, max_func_complexity).

#2547 already ruled these names are never real callable identifiers — that is why they are skipped by the orphan and duplicate checks. Only the FUNCTION POPULATION had not been told: #2691 wired _UNCOUNTABLE_SLICE_NAMES into is_synthetic_slice and left the other families out. This adds Mode E's.

Gated on the slicing mode, not on the name shape. _is_synthetic_satellite_name matches <KEYWORD>_Statement for every language, which is right for the orphan check (a false positive costs nothing) and wrong here (a false positive erases a real declaration). SELECT_Statement is a legal identifier in a language that does not slice on a terminator. Same shape as #2691's Main guard, and tested as one.

Truncation suffixes are stripped for this family, and per #2691 deliberately not for _UNCOUNTABLE_SLICE_NAMES: Main_[Truncated] is a real function that ran off the end of the file; Declarative_Block_[Unterminated] is the same bucket label as Declarative_Block. Left unstripped it kept exactly one phantom function in sqlite/main.sql, so the count could never reach the honest 0 — and an honest 0 is what lets keyword-rosetta report the cell as incomparable at all.

The half of #2792 this declines, with the measurement that settled it

The issue's candidate (a) proposed extending the exclusion to both of the other families. I implemented that first and the engine's own accuracy gate rejected it:

=== css ===
tree_sitter_accuracy_audit: 2 regression(s) against the baseline:
  found_functions:   25 -> 0   (higher is better, this got worse)
  args_exact_match:  19 -> 0   (higher is better, this got worse)

Excluding a name from the population also drops its row from function_data, which is the record tree_sitter_accuracy_audit.py compares against the grammar's own nodes. tree-sitter-css has dedicated nodes for these constructs (media_statement / supports_statement / keyframes_statement / at_rule), and docs/language_status/css.md publishes:

| Functions found | 25 | 25 | 0 | … |
| Function precision | 100% (25/25) | 100% (25/25) | — |
…GitGalaxy and tree-sitter agree exactly on every file

So no phantom would be retired there — a true, reconciled recall claim would be deleted. A @media block is a real construct GitGalaxy correctly locates. Whether to call it a function is a cross-language comparison judgement, and keyword-rosetta answers that by reporting the cell incomparable (squid-protocol/keyword-rosetta#88), not by making the engine forget it found something.

dockerfile's functions_found 17 (+31%) therefore stays scored and stays ledgered. The issue's second named cell is answered "no engine change", with evidence, rather than moved. Mode E is the opposite case: no grammar anywhere has a node for "whatever fell between two semicolons".

synthesizes_all_function_names is exported for keyword-rosetta's bias report to read, so the corpus cannot hand-list a set that drifts from what the slicer emits — the doctrine _registry.risk_dependencies already follows.

Verification

gate result
golden masters (both) re-blessed, 17 differences each, every one sqlite — cognitive_load / Raw Cognitive Density re-solving off a func_complexity_gini that no longer describes statement buckets. No other language moved; no topological churn.
tree_sitter_accuracy_audit --ci --all 30 languages, all OK
tri_comparison_chart --all --ci 3 languages, all OK
rosetta_audit 46 languages, 0 regressions — no registry signal moves
audit_check all clear (ruff / mypy / dead-key / ast-accuracy)
full suite 8022 passed, 4 skipped

Corpus pairing

rosetta_audit is green, so no manifest re-bless is owed — func_start and every other planted signal are unmoved. What the corpus does owe is the reporting side: functions_found for sqlite goes 31 → 0, and that 0 must be rendered n/a rather than scored as −100%. That is keyword-rosetta#88 (the mechanism, gitgalaxy#2795) plus a follow-up that reads synthesizes_all_function_names and re-words slicer-segments-statements-not-functions. Labelled rosetta:rebless-owed for that.

Closes #2792

🤖 Generated with Claude Code

…#2792)

sqlite records `functions_found` 31 against a 13-function planted program.
Mode E (`_slice_by_terminator`) never captures a name from source: it cleaves on
the terminator and labels each bucket after the igniter keyword it matched
(`CREATE_Statement`, `Declarative_Block`). The count therefore scales with
statement volume rather than with the program -- and it is the denominator of six
per-function descriptors (`avg_func_loc`, `avg_func_complexity`,
`func_complexity_gini`, `func_internal_density`, `avg_func_args`,
`max_func_complexity`).

#2547 already ruled these names are never real callable identifiers, which is why
they are skipped by the orphan and duplicate checks. Only the FUNCTION POPULATION
had not been told: #2691 wired `_UNCOUNTABLE_SLICE_NAMES` (the placeholder names)
into `is_synthetic_slice` and left the other families out. This adds Mode E's,
gated on the slicing mode the engine actually dispatches on rather than on the
name shape alone -- `_is_synthetic_satellite_name` matches `<KEYWORD>_Statement`
for every language, which is right for the orphan check where a false positive
costs nothing, and wrong here where it would erase a real declaration.
`SELECT_Statement` is a legal identifier in a language that does not slice this
way.

The truncation suffixes are stripped for this family and, per #2691,
deliberately not for `_UNCOUNTABLE_SLICE_NAMES`: `Main_[Truncated]` is a real
function that ran off the end of the file, while
`Declarative_Block_[Unterminated]` is the same bucket label as
`Declarative_Block`. Left unstripped it kept exactly one phantom function in
`sqlite/main.sql`, so the count could never reach the honest 0.

## #2728's other family stays counted, and this re-tested that rather than
   inheriting it

Excluding a name from the population also drops its row from `function_data` --
the record `tests/tools/tree_sitter_accuracy_audit.py` compares against the
grammar's own nodes. Measured on the pinned crucible, excluding the closed-literal
keyword buckets (dockerfile `RUN`, css `@media`, html `script`, yaml `run`) takes
css from `found_functions: 25 -> 0` and `args_exact_match: 19 -> 0`, against
`docs/language_status/css.md`'s published 25/25 function precision -- "GitGalaxy
and tree-sitter agree exactly on every file" -- because tree-sitter-css has
dedicated nodes for exactly these constructs. A `@media` block is a real
construct GitGalaxy correctly locates; only calling it a *function* is arguable,
and that argument belongs to the corpus's cross-language comparison, which
keyword-rosetta answers by reporting the cell incomparable rather than by
deleting a true recall claim. So dockerfile's `functions_found` 17 stays scored
and stays ledgered. Mode E is the opposite case: no grammar anywhere has a node
for "whatever fell between two semicolons".

`synthesizes_all_function_names` is exported for keyword-rosetta's bias report to
read, so the corpus cannot hand-list a set that drifts from what the slicer
emits -- the doctrine `_registry.risk_dependencies` already follows.

## Verification

- golden masters re-blessed: **17 differences each, every one sqlite**, all
  `cognitive_load` / `Raw Cognitive Density` re-solving off a
  `func_complexity_gini` that no longer describes statement buckets. No other
  language moved, no topological churn.
- `tree_sitter_accuracy_audit --ci --all`: 30 languages, all OK.
- `tri_comparison_chart --all --ci`: 3 languages, all OK.
- `rosetta_audit`: 46 languages, 0 regressions -- no registry signal moves, so
  the corpus owes no manifest re-bless.
- `audit_check`: all clear. Full suite: 8022 passed.

Closes #2792

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@squid-protocol squid-protocol added the rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 5449b3d into main Sep 7, 2026
44 checks passed
@squid-protocol
squid-protocol deleted the fix/2792-uncountable-slice-population branch September 7, 2026 13:30
squid-protocol added a commit that referenced this pull request Sep 7, 2026
Golden masters re-blessed on the merged code (main's #2842 Mode E
function-population fix + this branch's io contract). bless_scope vs
main's masters: identical 482-diff scope — I/O and Network Boundaries +
Amplified Rce (+ weighted view) only, newly parsed/excluded none.
Extraction suite 6904 passed on the merge.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FCF3viid5wUh2dLqzfZ16v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

functions_found: the function population counts slicer buckets that #2547/#2728 already agreed are not identifiers — sqlite +131%, dockerfile +31%

1 participant