Skip to content

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

Closed

Description

@squid-protocol

Two cells, one question: sqlite functions_found 30 vs median 13 (+131%, red) and dockerfile 17 (+31%, amber). Neither language has functions; both counts are slicer buckets.

Measured 2026-09-05 on engine main a59ecf6b / corpus main 2038a86, docs/bias_variance_chart.svg row functions_found (91% consistency). Ledger: slicer-segments-statements-not-functions.

The measurement

The SPEC's probe program is 12 probes plus an entry point, so 41 of 46 languages record exactly 13.

functions_found, corpus total, median 13.0

30  sqlite       Mode E buckets: CREATE_Statement / Declarative_Block, 7/9/6/8 per file
17  dockerfile   Mode A labels: one per RUN/CMD/HEALTHCHECK instruction
14  css, makefile                                                        (+8%, green)
13  41 languages                                                         (median)

sqlite maps to the sql integration mode mode_e (detector.py L383: terminator ;, igniter \b(SELECT|CREATE|UPDATE|DELETE|INSERT|ALTER|DROP|GRANT|REVOKE|WITH|DECLARE|TRUNCATE)\b), so _slice_by_terminator (~L5484) cleaves on the terminator and names each bucket after the igniter it matched — CREATE_Statement, or the generic Declarative_Block.

dockerfile is in Mode_A_Labels (L2604, added because Mode B was slicing RUN bodies using braces that belonged to a ${VAR} five lines away), so the slicer runs each instruction "greedy to the next func_start match" and produces one bucket per RUN/CMD/ENTRYPOINT/HEALTHCHECK — 5 in b.dockerfile alone.

Every such bucket lands in file_data["functions"], and record_keeper.py L456 counts len(functions) into function_count, which is the column the corpus reads as functions_found.

The point

Both counts scale with statement volume, not with the planted program. Add four CREATE TABLE lines to c.sqlite and functions_found moves; add four probes and it moves by a different amount. That is not a measurement of the same program in a different language, which is the only thing this corpus exists to make possible — and it is the metric every per-function descriptor divides by (avg_func_loc, avg_func_complexity, func_complexity_gini, func_internal_density, cog_raw, structural_mass).

The engine has already made this exact call twice, one layer down, for three name families — and wired only one of them into the population:

family source excluded from orphan/duplicate excluded from the population
__global_context__, Anonymous_Block #2547 / #2691 yes yes (_UNCOUNTABLE_SLICE_NAMES)
Declarative_Block, <KEYWORD>_Statement (Mode E) #2547 yes no
igniter-keyword buckets — dockerfile RUN/CMD/ENTRYPOINT/HEALTHCHECK, css @(media|keyframes|…), html (script|style) #2728 (_closed_literal_capture) yes no

#2728's reasoning applies verbatim to the population question:

Where a language's func_start capture group is a closed set of literal keywords … the "name" the slicer stores is the language's own keyword, not an identifier anyone wrote.

So the engine currently holds two positions at once: a RUN bucket is not a real enough identifier to be orphaned or duplicated, but is real enough to be one of the file's functions and to be the denominator of four per-function descriptors.

Candidate shapes

(a) Extend the population exclusion to the other two families. _closed_literal_capture already computes exactly "this language's func_start cannot produce an author-written identifier" and is derived per rule so it cannot drift; Mode E's names need an equivalent derivation rather than a hand-list. Honest consequence: sqlite 30 → 0, dockerfile 17 → 0, css 14 → ~11. That is +131% red → −100% red for sqlite and +31% amber → −100% red for dockerfile. It trades a wrong number for an admitted absence, which is the better error but is not by itself green.

(b) Give the structure-count rows an n/a mechanism (#2795). #2669 F.3 built exactly this for the risk_* family: a metric whose inputs are structurally absent is excluded from the median and the band rather than scored as a −100% outlier. A language whose slicer runs in a statement or keyword-label mode has no function population to compare; that is a structural absence with a mechanical test, not a judgement call.

(c) Leave it, narrow the ledger. The current entry's position. Defensible — the numbers are what the modes are designed to produce — but it leaves two cells no engine change can ever move, and six derived descriptors dividing by a denominator that means something different for sqlite and dockerfile than for the other 44.

(a) and (b) are complements: (a) is the honest count, (b) is what stops the honest count reading as a bigger deviation than the dishonest one. Both are needed and (b) is the load-bearing half — (a) landing alone makes the chart worse.

Corpus pairing

No plant change. Under (a) sqlite's and dockerfile's expected_signals.json re-bless functions_found and the per-function descriptors; under (b) the cells leave the band and slicer-segments-statements-not-functions closes. rosetta:rebless-owed.

Part of #2669 (STRUCTURE COUNTS sweep). Related: #2691, #2728, #2547 (all closed), #2601, #2572.

Activity

  1. added
    enhancement
    metrics
    core-engine
    on Sep 6, 2026
  2. changed the title [-]functions_found[sqlite] +131%: the slicer's statement modes count one "function" per CREATE statement, so the population scales with statement volume[/-] [+]functions_found: the function population counts slicer buckets that #2547/#2728 already agreed are not identifiers — sqlite +131%, dockerfile +31%[/+] on Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineenhancementmetrics

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions