Skip to content

fix(detector): enforce #1295's css/html class-extraction scope decision (#2798) - #2837

Merged
squid-protocol merged 1 commit into
mainfrom
fix/2798-css-class-extraction-out-of-scope
Sep 7, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/2798-css-class-extraction-out-of-scope

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #2798.

What #2798 assumed, and what turned out to be there

#2798 read classes_found[css] = 1 as a reporting gap: #1295 already ruled css out of scope on the tri-comparison and accuracy charts, the bias chart just never wired it in. Reading the decision itself (how_to_extend_class_start_named_extraction.md, "Decided: not extending css or html") says otherwise:

The class_start numeric signal (used in risk-scoring equations, a different consumer entirely) is unaffected by this decision and stays exactly as-is for both languages — this is specifically about named extraction into class_data.

So #1295 covers classes_found (which is len(class_data) — record_keeper.py:758) and explicitly not class_start. Those were the two rows the issue wanted marked n/a together.

The actual defect: the decision was documented, never enforced, and silently reversed

class_data for the rosetta css corpus holds exactly what #1295 refused:

{'class_name': '.rosetta-risk', 'inheritance_parents': '[]', 'method_count': 0, 'state_entanglement': 0.0}

css is in _CLASS_START_NAMED_EXTRACTION_LANGS. It was not when the decision was written (2026-08-12, 6eb16c05). #1824 (e46bf45d, 2026-08-17) — a css class_start regex improvement — added one line, "css",, with no mention of #1295 anywhere in its description, and in the same commit:

 tests/tree_sitter_accuracy_baseline_css.json
-  "found_classes": 0,
+  "found_classes": 90,

Nothing caught it for three weeks because of the decision: tree_sitter_accuracy_audit.py and tri_comparison_chart.py each force css/html's class panels to N/A citing #1295, so the reversal landed in the one blind spot the decision itself created. The golden master could not catch it either — it records the class_start signal ("Class/Entity Declarations"), not class_data. It finally surfaced from the far end of the pipeline, as a red dot on keyword-rosetta's bias chart.

The change

  • detector.py: new _CLASS_EXTRACTION_OUT_OF_SCOPE_LANGS = {"css", "html"}, checked before the allowlist and before the legacy fallback — pinning the intent rather than relying on the generic class|struct|interface|trait|enum regex happening to miss. css removed from the allowlist.
  • Both reporting tools import that set instead of each keeping a hand-copy. Three copies of the same two names is what let the extractor drift away from them.
  • _regressions() skips the class metrics for out-of-scope languages. That gate was requiring found_classes never to fall for a language whose class panels it already refuses to show — it both pulled toward an extraction the reports had disowned and made this fix un-blessable, reading as 227 -> 0, a "regression" toward exactly the number the decision asks for.
  • Two regression tests; the decision doc records the enforcement and the Improve class_start regexes for CSS, Zig, Python, C++ #1824 history.

The numeric class_start signal is deliberately untouched. css still counts 1 for .rosetta-risk {, still feeding the risk equations. What it no longer does is claim a selector is a named class.

Verification

Check Result
pytest tests/ 8009 passed, 0 failed
audit_check.py (ruff/mypy/dead-key/ast-accuracy/format) all clear
crucible_check.py (both modes) PASS — no golden-master bless owed
tree_sitter_accuracy_audit.py --ci --all 30 languages, all OK
tri_comparison_chart.py --all --ci 3 languages, all OK

Direct effect: css classes [] / class_start signal still 1; rosetta corpus classes_found css 1 → 0, html 0.

The one baseline edit, css's found_classes 227 → 0, is the point of the change, not a regression — it restores the pre-#1824 number.

Two halves of #2798 deliberately declined

  1. class_start for css — Extend #1264's per-language class_start named-entity extraction to the remaining 13 languages #1295 explicitly exempts the numeric signal. css's class_start 1 is a correct reading of a real construct and stays ledgered under container-construct-reads-as-class-start. Marking it n/a would misquote the decision.
  2. html on either row — html was never in the allowlist; both its cells read an honest 0 that agrees with the corpus median. Marking them n/a would delete two real green cells.

The issue's predicted outcome still lands — classes_found loses its css cell — without adding a second, non-mechanical n/a source (a documented scope decision, not rule absence) to the corpus tooling.

Cross-repo

Companion: keyword-rosetta owes one follow-up PR, opened after this merges (AGENTS.md hard rule 4, no pins in either direction): narrow container-construct-reads-as-class by one language, since classes_found[css] 1 → 0 is now the corpus median and in band. No plant change, no manifest change (css's manifest pins class_start, which does not move), no re-bless owed; bias-history.yml regenerates the chart and bias_data.json after this lands.

🤖 Generated with Claude Code

…on (#2798)

Epic #1295 decided permanently that css and html are out of scope for NAMED
class extraction: `class_data`'s schema is class_name/inheritance_parents/
method_count/state_entanglement, and a CSS selector has none of those, so every
row it produced would carry method_count=0/inheritance_parents=[] forever.

The decision was documented but never enforced in the extractor, and so was
silently reversed. #1824 -- a css `class_start` REGEX improvement -- added
"css" to `_CLASS_START_NAMED_EXTRACTION_LANGS` five days later with no mention
of it, and css's crucible `found_classes` went 0 -> 90 in the same commit.
Nothing caught it for three weeks precisely BECAUSE of the decision: both tools
that reconcile class extraction force css/html's class panels to N/A citing
#1295, so the reversal landed in the blind spot the decision itself created. It
surfaced from the other end, as `classes_found[css] = 1` on the keyword-rosetta
bias chart, where `.rosetta-risk` was being recorded as an extracted class.

The decision now lives in one place, `_CLASS_EXTRACTION_OUT_OF_SCOPE_LANGS`,
checked before the allowlist AND before the legacy fallback (so it pins the
intent rather than relying on the generic regex happening to miss). Both
reporting tools import that set instead of each keeping a hand-copy -- three
copies of the same two names is what let the extractor drift away from them.

The numeric `class_start` SIGNAL is deliberately untouched: the decision says so
in as many words ("unaffected by this decision and stays exactly as-is for both
languages"). css still counts 1 class_start for `.rosetta-risk {`, and that
count still feeds the risk equations.

Also scopes the accuracy audit's own regression gate: it was requiring
`found_classes` never to fall for a language whose class panels it already
refuses to show, which both pulled toward an extraction the reports had
disowned and made this fix un-blessable (it reads as 227 -> 0, a "regression"
toward exactly the number the decision asks for).

Verification: full suite 8009 passed; audit_check all clear; crucible_check.py
both modes PASS -- NO golden-master bless owed, because the golden master
records the class_start SIGNAL, not class_data, which is also why it never
caught #1824; tree_sitter_accuracy_audit --ci --all 30 languages OK;
tri_comparison_chart --all --ci 3 languages OK. The css accuracy baseline's
found_classes 227 -> 0 is the point of the change, not a regression.

Cross-repo: keyword-rosetta owes a follow-up PR AFTER this merges (hard rule 4,
no pins) narrowing `container-construct-reads-as-class` by one language --
`classes_found[css]` goes 1 -> 0 = the corpus median, in band. No plant change,
no manifest change (css's manifest pins class_start, which does not move), no
re-bless; bias-history.yml regenerates the chart on merge.

Closes #2798

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@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 8c8624a into main Sep 7, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the fix/2798-css-class-extraction-out-of-scope branch September 7, 2026 12:05
squid-protocol added a commit to squid-protocol/keyword-rosetta that referenced this pull request Sep 7, 2026
…2798) (#87)

css read `classes_found` 1 for `.rosetta-risk` and this entry filed it beside
cobol/jcl as a container construct -- "a CSS class is literally what the rule
names". That was the wrong call, and the F.5 sweep that wrote it (me) made it.

`classes_found` is `len(class_data)`, i.e. NAMED class extraction, which
gitgalaxy epic #1295 ruled permanently out of scope for css and html: a selector
has no methods and no inheritance, so every row it produced carried
`method_count=0`/`inheritance_parents=[]`. The decision was documented but never
enforced in the extractor, and gitgalaxy#1824 -- a css `class_start` REGEX change
five days later -- silently added css to the named-extraction allowlist, taking
its crucible found_classes 0 -> 90. Nothing caught it for three weeks because the
two tools that reconcile class extraction already force css's class panels to N/A
citing that same decision; it surfaced here instead, as a red dot on this chart.

gitgalaxy PR #2837 enforces the decision in `detector.py`. Verified against that
branch: css reads `classes_found` 0 = the corpus median, in band, no exemption
needed. Nothing else in this repo moves -- no plant change, no manifest change
(css's manifest pins `class_start`, which does not move), no re-bless.

The numeric signal stays out of the narrowing: css still reads `class_start` 1
and remains ledgered by container-construct-reads-as-class-start, because #1295
scoped its decision to named extraction in as many words ("the `class_start`
numeric signal ... is unaffected by this decision and stays exactly as-is").

Nothing automated would have caught the stale claim: `ledger_orphan_check` bands
per TOKEN, and `classes_found` still explains cobol/dockerfile/jcl/kotlin, so the
cross-product would have gone on excusing a css cell nobody looked at -- exactly
what the ledger `_doc`'s "scope a collective entry down" rule exists to prevent.

Gates (scan-free, against engine main): na_check --ci 0 unreviewed;
ledger_orphan_check --ci no new orphan tokens.

Cross-repo: opens after squid-protocol/gitgalaxy#2837 merges (AGENTS.md hard
rule 4, no pins). bias-history.yml regenerates the chart and bias_data.json
against engine main afterwards; no artifacts shipped here.

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

classes_found[css] red on a 0 median: a CSS class is a selector, and #1295 already ruled it out of scope on the other two charts

1 participant