Skip to content

functions_found[markdown] −100%: func_start is n/a for markdown but functions_found scores it anyway — the structure-count rows have no n/a mechanism #2795

Closed
squid-protocol/keyword-rosetta
#88

Description

@squid-protocol

functions_found markdown 0, median 13, −100% — red, while func_start, args and import for the same language are correctly rendered n/a on the row directly above it.

Measured 2026-09-05 on engine main a59ecf6b / corpus main 2038a86, docs/bias_variance_chart.svg. Ledger: markdown-lit-plane-morphology.

The measurement

markdown is deliberately measured on the literary plane: standards/…/markdown.py wires only lit_code_blocks, lit_diagrams, lit_headers and lit_links, and the detector's #691 prose deflection routes the body to the doc surface, leaving the code payload empty. It has no func_start rule at all.

bias_report.py handles that correctly for the governed signals — na in docs/bias_data.json lists func_start: {markdown: ledgered}, import: {markdown: ledgered} — and the chart renders those cells as a dash, excluded from median, band and consistency score. The row counts say so:

row              comparable   consistency
func_start          45          96%      (markdown n/a)
functions_found     46          91%      (markdown scored, -100%)

import              45          96%      (markdown n/a)
dependency_links    46          93%      (markdown scored -- green at 3, but scored)

class_start         41          85%      (shell, agc_assembly, makefile, markdown, m4 n/a)
classes_found       46          89%      (all five scored)

functions_found, classes_found and dependency_links do not read a registry rule — they read the engine's function_count/class_count/import_count columns — so the n/a inference, which rests on rule absence, never reaches them. A language can be simultaneously "has no function concept, do not compare" on func_start and "records 0 functions, −100% outlier" on functions_found.

The point

This is the same defect #2669 F.3 already fixed one family over. Before it, the risk_* columns "had no n/a mechanism at all, so a language whose every input was structurally absent was scored as a −100% outlier against languages that actually measured something" — and markdown was the worked example there too. The fix defined a four-condition test for a derived metric being n/a. The structure-count rows never got the equivalent.

The cost is not only markdown's dot. Seven cells across five languages are n/a on the governing rule and scored on its structure count anyway (markdown on func_start and import; shell, agc_assembly, makefile, m4 and markdown on class_start), so classes_found's 89% is computed over five languages whose class_start the report itself says is incomparable. The row percentages in the STRUCTURE COUNTS group are measured over a different, larger population than the rows they summarise.

Candidate shape

Extend the n/a inference to the structure-count family. functions_found is n/a for a language when func_start is n/a; classes_found when class_start is; dependency_links when _dependency_capture is None (note this is not the import rule — see the dependency_links issues in this sweep, where the two diverge). Conditions 3 and 4 of the F.3 test carry over unchanged: no engine-derived input that can be nonzero regardless of the registry, and the scan must confirm the observed value really is 0.

Mechanically this is DERIVED_INPUTS-shaped and already half-built — bias_report.py L477 declares "dependency_links": ("import",) for the derivation machinery, so the edge from structure count to governing rule exists; it is just not consulted by classify_na.

All 46 corpus languages currently declare a _dependency_capture, so that third edge produces no n/a cell today — it is there so the family is defined consistently rather than per-metric.

Guard rail from GATING: this must stay mechanical. It is n/a because the registry has no rule, not because the number is inconvenient. markdown records dependency_links 3 (green) with no import rule, via _dependency_capture on relative links — that cell is comparable and must stay scored, which is exactly why the edge has to be capture-based rather than copied from import.

Corpus pairing

Reporting-side only; no manifest edit and no engine change. markdown-lit-plane-morphology narrows by one signal. The three row consistency figures move (they will be computed over the same population as the rules they aggregate), and docs/bias_variance_chart.svg regenerates.

Part of #2669 (STRUCTURE COUNTS sweep). This is the shared prerequisite for #2792 (sqlite, dockerfile), whose honest fix converts an over-count into an absence, and for reading the classes_found family (#2796) honestly. Related: #2638.

Metadata

Metadata

Assignees

No one assigned

    Labels

    data-qualityenhancementmetrics

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions