Skip to content

Allocate engine-support CSS by exact owner set - #5278

Merged
chubes4 merged 1 commit into
trunkfrom
fix/5212-owner-set-support
Nov 9, 2026
Merged

chubes4 merged 1 commit into
trunkfrom
fix/5212-owner-set-support

Conversation

@chubes4

@chubes4 chubes4 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #5212.

Problem

Engine-support CSS was written per route, so a rule needed on N routes was copied into N stylesheets. Each copy also got its own ~600-byte enqueue condition that resolved the current document inline.

Change

  • Allocate by exact owner set. allocateDocumentSupport() splits engine-support rules by the exact set of documents that consume them, keeping before-author and after-author support separate. A rule set consumed by every canonical page becomes global, as trunk's dedup path already did. Subsets keep exact owner scopes, so the Page-owned engine-support stylesheets are enqueued unconditionally on every route #4007/Preserve document scopes when deduplicating support stylesheets #4016 invariant holds and document-support-stylesheet-scope.php is unchanged. Sheets with url( references or at-rule statements keep their original resource.
  • Resolve the document once. The wp_enqueue_scripts callback resolves the document id, reconciliation identity and page-uri fallback at the top. Each resource then gets one enqueue that tests membership in its owner list.
  • No empty CSS resources. Editor-state occurrence ownership is now replay metadata on the real resource, and support or editor-state sheets left empty by dead-selector removal are dropped.

Evidence

Real site: the tarotkarima.carrd.co capture (10 routes), compiled by ArtifactCompiler, trunk vs fix:

trunk fix
support CSS bytes 62,522 16,121 (−74%)
total CSS bytes 241,592 195,191
support files 19 25 (one per distinct owner set)
global support files 4 6
empty CSS files 0 0
functions.php bytes 71,834 68,023

Most of what remains in functions.php is the editor presentation tables (~16.5 KB), which is out of scope here.

  • New contract support-owner-set-allocation.php (with a realistic 6-page fixture): every rule is written once, all-pages rules are global, subset rules have exact owner scopes, no empty support or editor-state assets, and per-document cascade order holds. It fails on trunk (Each generated rule is written exactly once: all-copy).
  • Lab hand gate on 00e622be30: composer test:canonical GATE=0.
  • Test updates: condition-string expectations now point at the compact form. declaration-addressed-chrome.php now expects that editor-state sheets left empty after chrome extraction are not published.

AI disclosure: Implemented across three Homeboy Cooks (pi, gpt-6.1-sol). Franklin (Claude Code, Claude Opus) rejected the first design for regressing #4007, reviewed the revisions, gated on Lab, measured the real site, and wrote this PR.

@chubes4
chubes4 force-pushed the fix/5212-owner-set-support branch from 00e622b to 479d6fa Compare November 9, 2026 18:45
@chubes4

chubes4 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 479d6fa. CI parity caught a real ordering bug: all allocated support sheets were spliced in at the first eligible index, which put after-author support ahead of the author inline sheet in the asset inventory (artifact-author-selector-inline-projection). Each allocated sheet now takes the slot of the first sheet it draws rules from. Lab: test:canonical + test:parity (351 fixtures) pass. Tarot numbers unchanged (support 62,522 → 16,121 bytes).

AI disclosure: Franklin (Claude Code, Claude Opus) made this fix and gated it on Lab.

@chubes4
chubes4 merged commit 937d840 into trunk Nov 9, 2026
13 checks passed
@chubes4
chubes4 deleted the fix/5212-owner-set-support branch November 9, 2026 18:57
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.

Site plan repeats shared engine-support CSS per route (93% duplicate bytes, 18 files, 27 KB of enqueue code)

1 participant