Repository navigation
fix(detector): Mode E statement buckets leave the function population (#2792) - #2842
Merged
Merged
Conversation
…#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]>
Contributor
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sqlite records
functions_found31 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_NAMESintois_synthetic_sliceand left the other families out. This adds Mode E's.Gated on the slicing mode, not on the name shape.
_is_synthetic_satellite_namematches<KEYWORD>_Statementfor 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_Statementis a legal identifier in a language that does not slice on a terminator. Same shape as #2691'sMainguard, 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 asDeclarative_Block. Left unstripped it kept exactly one phantom function insqlite/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:
Excluding a name from the population also drops its row from
function_data, which is the recordtree_sitter_accuracy_audit.pycompares against the grammar's own nodes. tree-sitter-css has dedicated nodes for these constructs (media_statement/supports_statement/keyframes_statement/at_rule), anddocs/language_status/css.mdpublishes:So no phantom would be retired there — a true, reconciled recall claim would be deleted. A
@mediablock 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_found17 (+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_namesis 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_dependenciesalready follows.Verification
cognitive_load/Raw Cognitive Densityre-solving off afunc_complexity_ginithat no longer describes statement buckets. No other language moved; no topological churn.tree_sitter_accuracy_audit --ci --alltri_comparison_chart --all --cirosetta_auditaudit_checkCorpus pairing
rosetta_auditis green, so no manifest re-bless is owed —func_startand every other planted signal are unmoved. What the corpus does owe is the reporting side:functions_foundfor 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 readssynthesizes_all_function_namesand re-wordsslicer-segments-statements-not-functions. Labelledrosetta:rebless-owedfor that.Closes #2792
🤖 Generated with Claude Code