feat(lint): layout rules + hollow-master FP fix + deferred-token carve-out
Why
Multi-round agent evals on /website surface the same recurring composition bugs across LLM tiers: absolute child widths collapsing inside max-width-only parents (renders correctly in Studio but breaks at engine seek), translate-less left:50%/top:50% centering, GSAP/CSS transition fighting on the same property, word-stagger spans with display:block, nowrap text without bounding width, etc. The existing linter caught structural issues (missing data-composition-id, wrong file paths) but not these "agent visually shipped it green" classes.
A separate bug: master_timeline_orchestrates_sub_compositions was firing as a false positive on agent-authored work that wraps tl.to in helpers like xfade("#beat-1-host", "#beat-2-host", 4.15) — the actual tl.to args are variables so the original regex missed them. And audio_src_not_found was firing on <<tts_*>> / <<music_*>> deferred-token placeholders, breaking the SHIP GATE check on every run because those tokens are resolved post-finish_execution.
What
packages/core/src/lint/rules/layout.ts(new): ~22 layout/style rules. Highlights:absolute_width_collapse,absolute_center_missing_translate,hero_absolute_center_maxwidth_only,word_stagger_block_display,nowrap_missing_max_width,gsap_css_transition_conflict.packages/core/src/lint/rules/composition.ts: FP guard for thexfade()helper pattern + FP guard for HyperFrames-nativedata-track-indexscheduling.packages/cli/src/utils/lintProject.ts: deferred-token carve-out foraudio_src_not_foundcovering<<tts_*>>,<<music_*>>,<<audio_*>>,<<sfx_*>>,<<sound_*>>,<<narration_*>>.- 72 layout tests + 16 new composition tests + 4 new lintProject tests + async migration to match main's updated
lintHyperframeHtml/lintProjectsignatures.
How
- One rule per real failure mode — each layout rule corresponds to a specific bug class observed in agent output, with a positive baseline test ("fires when broken") and an FP-guard test ("doesn't fire on the legitimate variant"). Rules are intentionally narrow; broad heuristics cause noise.
- Pattern-matching helpers, not metric-driven splits — layout.ts has long pattern matchers (CSS selector parsing, tag-tree walks). Splitting them across helpers purely to lower CRAP score would harm readability without changing behavior. Added
// fallow-ignore-file complexitywith explanation, matching the precedent inpackages/engine/src/services/frameCapture.ts. xfade()helper FP guard: for each sub-comp not yet marked orchestrated, check if itsdata-composition-idOR wrapperid=is mentioned as a#<id>string literal anywhere in the script blob. Catches helper-call arguments without false positives on adjacent ids like#beat-1inside#beat-12(escaped regex with proper meta-char handling — addresses the CodeQL escape finding).data-track-indexFP guard: when every sub-comp host hasdata-track-index, treat them as runtime-native track placement (parallel layers) rather than GSAP-seek orchestration. The hollow-master agent bug uses sequential timelines without track indexes; that path still fires. (This unblocked the bundledwarm-grainsmoke test which uses native track placement.)
Test plan
- [x]
bun run --cwd packages/core test src/lint→ 262/262 pass - [x]
bun run --cwd packages/cli test src/utils/lintProject.test.ts→ 55/55 pass - [x]
bunx oxlint+bunx oxfmt --check→ clean - [x] CLI smoke (
hyperframes init warm-grain → lint) → 0 errors locally (was firing master-tl FP before thedata-track-indexguard) - [x] CodeQL escape finding resolved (proper regex meta-char escape)
honestly, I don't even remember this one, will take a look later, but probably close it