Skip to content

feat(chart): score the non-planted rules, retitle the groups, count the band - #93

Merged
squid-protocol merged 1 commit into
mainfrom
feat/chart-groups-and-band-count
Sep 7, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
feat/chart-groups-and-band-count

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Group titles

before after
Keywords Keyword Extraction
(new position, see below) Non-planted Keyword Extraction
Dependency Graph Dependency Graph Creation
Shape Descriptors Internal Function Metrics
Risk Scores Calculated Risk Exposure — Per File
Program Length + Vocabulary Program Size & Vocabulary (merged)

Length and vocabulary merge because they answer one question — how big and how wordy did the same
program come out — and are ungated for one reason.

Languages in band, per row

Every row now prints the count in the band's own bottom-right corner (43/45). The bar to the left
already gives the share, but a reader comparing two rows at the same percentage still has to know
whether that is 43 of 45 or 4 of 5 — n varies per row as n/a cells and population-less languages
drop out. Drawn after the dots with a white halo (paint-order="stroke"), because anything near
+25% sits directly under the label; verified by rasterising the SVG rather than assuming.

Non-planted keyword extraction is now SCORED

It sat with length and vocabulary on the "languages vary too much for a band to mean anything"
argument. That argument does not apply to it: the corpus plants nothing these rules match, so the
honest reading is 0 in every language
— which is exactly the comparable claim the chart exists to
make. It now scores on exact agreement against the zero median, the basis every zero-median metric
already uses, and sits directly after Keyword Extraction because it asks the same question with the
answer inverted.

Scoring it moves 37 nonzero cells from unverdicted to needing a verdict, so all 37 were audited
— each language's own rule run over its code and comment streams, reading what actually matched.
They resolve three ways, ledgered as non-planted-rules-match-idiom-and-planted-tokens
(intended-morphology):

  1. The language's mandatory form, which the probe program cannot avoid writing — const
    (javascript 17, typescript 14), let (swift 11), val (kotlin/scala), final/FINAL,
    INTEGER, PARAMETER, .freeze; DISPLAY/WRITE/echo as the language's only output
    primitive; %% as yacc's mandatory section separator.
  2. A token planted for another signal, counted again — eval, iex, Type.forName and
    solidity's assembly are the high_risk_execution / safety_bypasses plants; jcl's DISP=(OLD is
    keyword-rosetta#72's; swift's Sendable is on the immutability line above it.
  3. Actually planted, despite the group's name — spec_exposure jcl/yaml are the [SPEC-2732]
    tags SPEC.md plants in exactly those two languages, and dead_code jcl is //*PROBEDEAD.
    unplanted_inputs is derived as "governed by a risk formula and not in the manifest's PLANTED
    18"
    , so a signal the SPEC plants in a language or two without giving it a manifest column lands
    in this group anyway. Worth knowing before the group's name is taken literally.

The one that was none of those

makefile dead_code = 7, and every hit is prose. # decoy: ×4 (the corpus's own furniture),
# HACK: (the fragile_debt plant), # TODO: (planned_debt), # author: (ownership). makefile's is
the only comment-anchored dead_code rule that is shape-anchored (<identifier>:) rather than
keyword-anchored — shell, python and yaml all require a real keyword, and those languages carry the
identical comments and correctly read 0. Two of the seven double-count the debt plants, and
dead_code feeds risk_dead_code.

Filed as gitgalaxy#2851 and ledgered separately as makefile-dead-code-reads-prose-labels
(upstream-bug), so it reads as the open defect it is instead of hiding inside the morphology entry.

Effect

before after
unexplained cells 6 6 (unchanged — the epic's close criterion does not move)
gated metrics 48 55
ledgered cells 100 137
open-defect share 34/2296 35/2645 (the one new defect is the makefile cell)

Verified end to end against engine main with PYTHONPATH pointed at the same worktree — the
provenance guard added in #92 confirms it. All three ledger gates pass.

Artifacts are not committed here: bias-history.yml regenerates them on merge, and this PR touches
tools/** so that runs automatically.

…he band

Chart changes:

* Every row prints the number of languages actually IN the band in the band's
  own bottom-right corner (`43/45`). The bar already gives the share, but a
  reader comparing two rows at the same percentage still has to know whether
  that is 43 of 45 or 4 of 5 -- n varies per row as n/a cells and
  population-less languages drop out. Drawn after the dots with a white halo,
  because anything near +25% sits under the label.
* Group titles: "keywords" -> "keyword extraction", "dependency graph" ->
  "dependency graph creation", "shape descriptors" -> "internal function
  metrics", "risk scores" -> "calculated risk exposure — per file". "program
  length" and "vocabulary" merge into "program size & vocabulary" -- they answer
  one question (how big and how wordy did the same program come out) and are
  ungated for one reason.

"unplanted inputs" becomes "non-planted keyword extraction", moves directly
after keyword extraction, and is now SCORED rather than charted as context. It
sat with length and vocabulary on the "languages vary too much to band"
argument, which does not apply to it: the corpus plants nothing these rules
match, so the honest reading is 0 in every language and that is exactly the
comparable claim the chart exists to make. It scores on exact agreement against
the zero median, the basis every zero-median metric already uses.

Scoring it takes the group's 37 nonzero cells from unverdicted to needing one,
so all 37 were audited by running each language's own rule over its code and
comment streams and reading what matched. They resolve three ways, ledgered as
`non-planted-rules-match-idiom-and-planted-tokens` (intended-morphology):

  1. the language's mandatory form -- `const` (javascript 17, typescript 14),
     `let` (swift), `val` (kotlin/scala), `DISPLAY`/`WRITE` as the only output
     primitive (cobol/abap), `%%` as yacc's section separator;
  2. a token planted for another signal, counted again -- `eval`, `iex`,
     `Type.forName` and solidity's `assembly` are the high_risk_execution and
     safety_bypasses plants; jcl's `DISP=(OLD` is keyword-rosetta#72's;
  3. actually planted despite the group's name -- spec_exposure jcl/yaml are the
     `[SPEC-2732]` tags, dead_code jcl is `//*PROBEDEAD`. `unplanted_inputs` is
     derived as "governed by a risk formula and not in the manifest's PLANTED
     18", so a signal SPEC plants in one or two languages without giving it a
     manifest column lands here anyway.

One of the 37 was none of those and is a real defect: makefile dead_code 7,
where every hit is a `# Word:` prose comment (`# decoy:`, `# HACK:`, `# TODO:`,
`# author:`) read as a commented-out target -- makefile's is the only
comment-anchored dead_code rule that is shape-anchored rather than
keyword-anchored, and two of the seven double-count the debt plants. Filed as
gitgalaxy#2851 and ledgered separately as `makefile-dead-code-reads-prose-labels`
(upstream-bug), so it reads as the open defect it is rather than hiding inside
the morphology entry.

Unexplained cells are unchanged at 6 -- the epic's close criterion does not move.
Gated metrics 48 -> 55, ledgered cells 100 -> 137, open-defect share 34/2296 ->
35/2645 (the one new defect is the makefile cell).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@squid-protocol
squid-protocol merged commit 8bef7ec into main Sep 7, 2026
1 check passed
squid-protocol added a commit that referenced this pull request Sep 7, 2026
Conflicts resolved by regeneration, not hand-merging: the four generated docs
(bias_data.json, bias_report.md, bias_variance_chart.svg,
findings_by_language.md) were regenerated with tools/bias_report.py on the
merged code (main's #93 non-planted scoring included) against engine main
1dc25e08, which now carries gitgalaxy#2854. deviation_ledger.json resolved
programmatically: main's two non-planted-sweep entries kept, this branch's
test-contract-2852 append and its two entry edits re-applied (117 entries).
Verified post-merge: zero test cells in cell_categories, extraction 26,
open-defect 32/2645 on the re-scoped report; na_check/decoy_check/
ledger_orphan_check green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VnsC1A6TUhGS5QcmM7fg8L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant