Repository navigation
Tier 4: support canvases rendered by a JS framework (phase 1) - #9
Merged
Merged
Conversation
A Vue 3 + Vite build ships an empty canvas mount point, so the derived protected token set swells with shared Bootstrap words the app uses at runtime, and the file-level script gate tripped on slide prose and then flagged Vue's scheduler setting .id on job objects. - CSS: a selector whose leftmost compound is the canvas root, followed only by descendant/child combinators, is not flagged for naming a protected token. Sibling combinators and non-leftmost anchors still are; page-ground and canvas-components/ global checks are unchanged. - JS: gate id mutations per nearest named function (plus lexically enclosing scopes), counting only string literals in code position: selector-API arguments, selector-shaped strings, and id values. - decorator-kit.json gains an optional, human-owned `thirdParty` list of built third-party JS the script scan skips (CSS is never skipped). verify prints the tier 4 scope every run; the CI template warns on added patterns; sync preserves the list; rules tell agents not to add to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its canvas selector decides what tier 4 protects and what counts as canvas-anchored, so "canvas": "body" would empty most of the check in one line, and nothing flagged it. - templates/claude-settings.json denies Edit/Write on decorator-kit.json. init/add/sync still write it through Node. - The CI workflow template now warns when canvas changes, alongside the existing thirdParty warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
In a Vue 3 + Vite port of a Decorator deck,
npm run build && npx ucsd-decorator-kit verifyreported 3 ×chrome/styling/scriptindist/assets/index-*.js, and--acceptrefused because of them. Tiers 1–3 were fine. There were three causes:<div id="deck-app">, soderiveProtectedTokensprotected 59 tokens. That included shared Bootstrap words the app really uses at runtime (.row,.glyphicon,.sr-only, …). Canvas-scoped CSS such asmain#main-content .deck-card .glyphiconwas flagged..id =in it was flagged, including Vue's scheduler settingjob.id = uidon objects that aren't DOM elements.What changed
A. Canvas-anchored selectors are exempt (no config). A selector is not flagged for a protected token when its leftmost compound is the canvas root (
canvasin decorator-kit.json, defaultmain#main-content) and every combinator after it is a descendant or child combinator. These are still flagged:main#main-content ~ footer).navbar main#main-content .row,body main#main-content …)Page-ground and
canvas-components/strict checks are unchanged.B. The JS gate works per function. An id mutation is flagged only when its nearest named enclosing function, or a function lexically enclosing it (module scope included), references a protected token in a string literal in code position. Three kinds of literal count:
querySelector(All),closest,matches,getElementById,getElementsByClassName,$/jQuery,.find)el.id = "search",setAttribute("id", "search"))Prose, comments, identifiers like
location.search, and[href='#…']contents don't count. The two-viewstripJsNoiseapproach is kept. The trade-off is in checks/README.md: an element fetched in one function and mutated in an unrelated one is not flagged. The closure shape (fetched at module scope or in an outer function, mutated in a nested handler) still is.C.
thirdPartyin decorator-kit.json. This is an optional list of globs or paths for built third-party JS that the script scan skips. CSS is never skipped. Each pattern must start with a literal path segment, so**/*.jsis refused.verifyprints the tier-4 scope on every run, e.g.tier 4 scanned 2 CSS files and 5 JS files; skipped …. It also notes any pattern that matched nothing.--explainlists the patterns.synckeeps the list.D.
decorator-kit.jsonis guarded like the chrome*.local.jsonfiles. Itscanvasdecides what tier 4 protects and what counts as canvas-anchored, so"canvas": "body"would empty most of the check in one line, and nothing flagged that before. Two changes:templates/claude-settings.jsonnow denies Edit/Write on the file.init,addandsyncstill write it, because they go through Node, not those tools.canvaschanges, alongside thethirdPartywarning. A new manifest with the default canvas doesn't trigger it.Compiled CLAUDE.md is 24,770 chars, under the 25,000 budget.
Verification
npm test: 152 pass.#search/.navmenu, closures, prose/comments/identifiers); C (declared JS skipped and reported, undeclared flagged, declared CSS still scanned, glob validation, sync preserves the list, scope line printed).decorator-kit-deck-vueby runningnode <worktree>/checks/chrome-contract.mjs --check:thirdPartyentry..deck-card-iconworkaround back tomain#main-content .deck-card .glyphiconalso passes;mainflags it twice. The project's files were restored byte-for-byte afterward.--acceptfor those.🤖 Generated with Claude Code