Repository navigation
feat(core-engine): css io counts resource-fetching declarations (#2752) - #2775
Merged
Merged
Conversation
`io` was wired to `None` under the rationale that a `url()`/`@import` fetch "happens during browser paint and does not block a computational thread". True, and not the deciding factor: html's own `io` rule counts `src=` / `href=` / `<img>` / `<iframe>` -- the same paint-time, non-blocking loads -- and counts them as I/O. `io` measures a resource boundary, not blocking-ness. Found by the #2669 pass over every non-green cell of the keyword-rosetta bias report; the corpus ledger (`css-import-url-io-triple-overlap`) had already recorded the in-code rationale as wrong. The rule is anchored on a declaration's `:`, and carries three exclusions that are what the old `None` was actually buying: - `@import url("a.css")` is NOT counted. An at-rule prelude has no colon, so the import keeps exactly the two hits it has today (`import` + `_dependency_capture`) rather than a third; `@` is excluded from the value span so no earlier declaration's colon can bridge into a prelude either. - `url(data:...)` is NOT counted -- an inline payload, nothing fetched. This is the majority construct: 59 of language-crucible's 117 `url(` tokens. - `url(#fragment)` is NOT counted -- a same-document reference. `%` and `<>` are excluded from the value span for the second exclusion's sake. A `data:image/svg+xml` value is a whole SVG document inlined as text, carrying its own `url(#...)` references and `xmlns='http:`-shaped colons; without the guard the scan walks INTO the payload and scores a fetch per embedded icon (70 hits instead of 14 on the crucible corpus, 50 from one WordPress file). Verified against a quote-aware oracle -- 136 real stylesheets on this machine, 185 fetching declarations, zero disagreement. language-crucible css: 14 declarations in 5 of 38 files. keyword-rosetta css: 0 (its only `url(` is the `@import` chain, so the ledger's overlap objection is honoured exactly). The property anchor is a fixed-width LOOKBEHIND, not a match: spelling it `[-a-zA-Z_][-\w]*[ \t]*:` puts an unbounded `[-\w]*` next to a required `:` and measures quadratic (1.3s / 5.5s / 13.5s / 54s over 10k-80k chars); the lookbehind is linear on the same inputs (0.5 / 0.8 / 1.7 / 3.2 ms). Pinned by a scaling regression. 11 new strict cases: the positive surface, the `@import` non-overlap, the data:/fragment exclusions, the SVG-payload walk-in (both percent-escaped and raw inlining), and the ReDoS regression. Docs: css status sections 1/3/4/6/7. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Both fixtures regenerated with crucible_check.py --update. The uncapped zero-dependency diff (regenerated and compared outside crucible_check's 50-difference / 4000-char caps) is 2 differences, both css, both `io`: css/element/fonts-baseline.css I/O and Network Boundaries 0 -> 2 css/odoo/icons-baseline.css I/O and Network Boundaries 0 -> 1 Zero off-target files and zero topological drift -- `io` feeds no node mass, so nothing re-solved. Both counts match the standalone measurement: fonts-baseline's two `@font-face src:` declarations (the second is a 4-format list, counted once as one boundary) and icons-baseline's one. The corpus's other css files with fetches (cytoscape style.css, the two wordpress stylesheets) are minified or otherwise filtered out of the audit's parsed-file section, so they do not appear. The changed Absolute Project Path / Remote Origin URL / timestamp / duration fields are the usual machine-to-machine churn (golden_diff sanitizes them); they flip back and forth on every bless from a different checkout. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
squid-protocol
added a commit
to squid-protocol/keyword-rosetta
that referenced
this pull request
Sep 5, 2026
…xy#2752) (#64) gitgalaxy#2752 / engine PR #2775 (merged 362e2722) gave css an `io` rule. Under AGENTS.md rule 8 that converts an honest n/a into a measured 0 against a median of 3 unless the corpus plants the idiom, so this is the pairing. **Plant.** `@keyframes probe-io` in main.css -- SPEC probe #2, which main holds -- carrying its 3 hits as three keyframe steps in ONE function rather than one per file, so the shell gains a single func_start instead of three. Screened against the live rules: io 3, args +3, structural_boundaries +1 (ungated), nothing else. Deliberately NOT planted on the existing `@import url("a.css")` chain. #2775 anchors io on a declaration's colon precisely so an at-rule prelude cannot fire it -- that is the ledger's `css-import-url-io-triple-overlap` objection honoured in the engine, and a plant there would score nothing. The rule also excludes `url(data:...)` (an inline payload) and `url(#id)` (a same-document reference), so the plant uses real relative paths. **Manifest.** main.css io 0 -> 3, args 1 -> 4, func_start 4 -> 5. `verify_language.py css` PASS, 84 assertions across 4 files; engine-side `rosetta_audit.py` 46 languages, 0 regressions; `na_check.py --ci` clean. **Ledger.** `css-import-url-io-triple-overlap` re-scoped: its @import reasoning is kept verbatim and still holds -- it simply never addressed the url() tokens that are NOT imports, which on real stylesheets is all of them. The blocking-vs-non-blocking framing it had already flagged as wrong was the entire basis for `io: None`. `still_reproduces` false, upstream issue linked. The css clause of `args-no-parameter-surface-morphology` keeps its verdict (CSS functional notation is not a parameter surface; `calc()` still declined) and updates its arithmetic: args 3 -> 6, still the same byproduct shape. **Measured effect** (full-precision regen against engine main, artifacts not committed per rule 6 -- bias-history.yml regenerates on push): `bias_report.py --gate` exit 0, 0 unexplained (10 undefined / 170 ledgered / 116 derived), avg 87% across 49 metrics. Two css cells flip, both toward green: `io` n/a -> 3 (= the median, dev 0.000) and `control_flow_ratio` RED -> GREEN (0.125 -> 0.107 against a 0.094 median -- the probe body's declarations dilute the at-rule-heavy ratio). `func_start` / `functions_found` 13 -> 14 (dev 0.077, green; the manifest's "10 @Keyframes + 3 branch-duals = 13" becomes 11 + 3) and `args` 3 -> 6, which stays out of band and stays ledgered. Nothing else moves band. `language_deviations.py css`: 0 red / 0 amber unexplained across 44 comparable metrics. **Cross-repo.** Companion to squid-protocol/gitgalaxy#2775 (MERGED as 362e2722), which also re-blessed gitgalaxy's own golden masters for two real-world stylesheets. Merge order is engine-then-corpus and the engine half is already in, so this is green against engine main by construction (no pin either way, gitgalaxy#2682). After merge: `bias-history.yml` regenerates the report, chart and history here. Co-authored-by: Joe Esquibel <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Closes #2752. Found by the #2669 pass over every non-green cell of the keyword-rosetta bias report.
The call
iowasNone. The in-code rationale — aurl()/@importfetch "happens during browser paint and does NOT block a computational thread" — is true and is not the deciding factor: html's owniorule countssrc=/href=/<img>/<iframe>, which are the same paint-time, non-blocking loads, and counts them as I/O.iomeasures a resource boundary. The corpus ledger (css-import-url-io-triple-overlap) had already recorded that comment as wrong on 2026-09-02.So: wire the rule, and turn what the
Nonewas actually buying into explicit exclusions.The issue's numbers were wrong, in a way that matters
The issue claimed "all 117 crucible
url()fetches are non-@importresource loads". A quote-aware pass over the same corpus says otherwise:url(tokenurl(data:…)inline payloadurl(#…)/url(%23…)inside those inlined SVG payloads18 fetches, in 14 declarations, in 5 of 38 files. That is what the rule counts, and it is why two of the three exclusions exist.
Exclusions
@importis not counted. The rule is anchored on a declaration's:; an at-rule prelude has none, so@import url("a.css")keeps exactly the two hits it has today (import+_dependency_capture) rather than a third.@is excluded from the value span so no earlier declaration's colon can bridge forward into a prelude either. This is the ledger's overlap objection, honoured exactly — keyword-rosetta's css shell scoresio0.url(data:…)is not counted. An inline payload, not a boundary. The majority construct in the wild.url(#fragment)is not counted.clip-path: url(#mask)references an element in the same document.%and<>are excluded from the value span for exclusion 2's sake. Adata:image/svg+xmlvalue is an entire SVG document inlined as text, carrying its ownurl(#…)references andxmlns='http:-shaped colons; without the guard the scan walks into the payload and scores a fetch per embedded icon — 70 hits instead of 14 on the crucible corpus, 50 of them from one WordPress stylesheet. Both the percent-escaped (%3Csvg) and raw (<svg) inlining styles are covered. Cost: a value writing a percentage before its url (background: 50% 50% url(x.png)) is missed — zero occurrences in the sample below.Oracle
how_to_add_a_language.mdrule 17's hand-checkable oracle, built as a quote-and-paren-aware CSS declaration walker (the same shape as #2753's PyYAML oracle): every.css/.scss/.lessfile on the machine, deduped by content — 136 unique files spanning bootstrap, tailwind v4, WordPress, MediaWiki, Odoo, Element, reveal.js, three.js, Gutenberg CSS modules and a pile of unrelated app stylesheets.185 fetching declarations, rule and oracle agreeing on every file, zero disagreement. Per-corpus: language-crucible css 14 (
fonts-baseline2,icons-baseline1,style.css1,about-rtl2,deprecated-media-rtl.min8); keyword-rosetta css 0.The unit is the declaration, not the
url()token:src: url(a.eot) format(…), url(a.ttf) format(…), url(a.woff) format(…)is one font, one boundary, one hit. That falls out of the anchor rather than being bolted on.ReDoS
The property anchor is a fixed-width lookbehind, not a match, and that is load-bearing. Spelling it
[-a-zA-Z_][-\w]*[ \t]*:puts an unbounded[-\w]*next to a required:(Rule 14), making every identifier character a start position that backtracks the whole run:background:+ 10kaQuadratic vs linear. Pinned by a scaling regression that detonates the bad spelling and asserts immunity for the shipped one.
Tests / docs
11 new strict cases in
test_css_strict.py(85 total, was 74): the positive surface, the@importnon-overlap with animport-still-fires sanity assertion, the data:/fragment exclusions, the SVG-payload walk-in in both inlining styles, and the ReDoS regression.docs/language_status/css.mdsections 1/3/4/6/7 updated (31/48 keys wired, 17 explicitNone).Gauntlet
pytest tests/audit_check.py(ruff / mypy / dead-key / ast-accuracy)tree_sitter_accuracy_audit.py --ci --alltri_comparison_chart.py --all --cirosetta_audit.pycrucible_check.pyGolden-master bless. Uncapped diff (regenerated and compared outside crucible_check's 50-difference / 4000-char caps): 2 differences, both css, both
io—css/element/fonts-baseline.css0→2 andcss/odoo/icons-baseline.css0→1. Zero off-target files and zero topological drift, sinceiofeeds no node mass. The corpus's other fetching css files are minified/filtered out of the audit's parsed-file section.Pre-existing, not this PR:
test_committed_fidelity_table_is_fresh_against_the_corpusfails onmaintoo — the committed table was generated at corpus6377eb5and keyword-rosetta has since merged the jcl and yaml waves. Regenerating it here produces a diff injcl/makefile/ thespec_exposuresignal and the corpus SHA, andcss: {}is unchanged; left alone as the separate housekeeping item it is (CI skips this test).Corpus follow-up
css/iomoves from n/a to a defined 0 against a median of 3, so keyword-rosetta needs a pairing PR after this merges (per the no-pins flow: engine first, corpus re-blesses against main). Screened plant:@keyframes probe-io { from { background-image: url("probe.png"); } }in main/a/b —io0→3 (= the median),args3→6 (a column already ledgered low for css underargs-no-parameter-surface-morphology),func_start13→16 (dev 0.23, still inside the ±25% band). The ledger'scss-import-url-io-triple-overlapentry re-scopes from "io stays None correctly" to the@importline only.🤖 Generated with Claude Code