hyperframes icon indicating copy to clipboard operation
hyperframes copied to clipboard

feat(lint): layout rules + hollow-master FP fix + deferred-token carve-out

Open ukimsanov opened this issue 5 months ago • 1 comments

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 the xfade() helper pattern + FP guard for HyperFrames-native data-track-index scheduling.
  • packages/cli/src/utils/lintProject.ts: deferred-token carve-out for audio_src_not_found covering <<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 / lintProject signatures.

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 complexity with explanation, matching the precedent in packages/engine/src/services/frameCapture.ts.
  • xfade() helper FP guard: for each sub-comp not yet marked orchestrated, check if its data-composition-id OR wrapper id= is mentioned as a #<id> string literal anywhere in the script blob. Catches helper-call arguments without false positives on adjacent ids like #beat-1 inside #beat-12 (escaped regex with proper meta-char handling — addresses the CodeQL escape finding).
  • data-track-index FP guard: when every sub-comp host has data-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 bundled warm-grain smoke 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 the data-track-index guard)
  • [x] CodeQL escape finding resolved (proper regex meta-char escape)

ukimsanov avatar Jun 05 '26 20:06 ukimsanov

honestly, I don't even remember this one, will take a look later, but probably close it

ukimsanov avatar Jun 12 '26 23:06 ukimsanov