← Back to Pull requests

fix(stream-monitor): CSS Module 关键帧名统一走变量转发,19 处动画恢复播放(BLF-1433) #180

Open
unknown opened this pull request with 304 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 22, 2026 04:20 UTC
Author

做了什么

CSS Modules 会把 animation 里的帧名一起本地化成 <模块>_<名字>__hash,而 app/globals.css 的 @keyframes av 是全局作用域。名字对不上时浏览器不报错,动画静默停在首帧。本 PR 把动效层里 19 处裸帧名统一改成 var(--av-kf-):

  • AvUI.module.css(3 处):一级告警呼吸、空态上浮、状态徽标弹入

  • AvPages.module.css(12 处):时间范围切换、热力脉冲、抽屉/遮罩开合、event 时间线、capability 卡片、audio 频谱擦除

  • AvShell.module.css(1 处):窄屏侧栏遮罩

  • motion/AvMotion.module.css(3 处):骨架屏高光、骨架交叉淡入、顶栏时钟秒跳

  • globals.css:--av-kf- 段补齐 12 个转发变量(fade-in / fade-out / rise-in / breathe / dot-pop / grow-y / wipe-up / drawer-in / drawer-out / range-swap / heat-pulse / skeleton)
  • AvMotion.module.css 里 pageInFrames / riseInFrames 的模块内副本保留(当初修「面板整块空白」的应急例外,理由已写在文件注释里)。

    新增两道防线:

    1. 源码守卫 web/lib/av/avKeyframes.vitest.test.ts:扫 5 个 CSS 模块的全部 animation / animation-name,帧名只允许 var(--av-kf-) 或本文件 @keyframes;反向校验每个 --av-kf-x 指向的帧名在 globals.css 里真的有 @keyframes。带负向自检(裸帧名 / 拼错令牌必须报错)。
    2. 运行时审计 scripts/av-keyframes-audit.mjs:打开 7 页 × 1440/390,遍历所有元素及 ::before / ::after / ::backdrop,把 getComputedStyle().animationName 与 CSSKeyframesRule.name 集合比对;带负向自检(插入一个不存在的帧名必须报出 1 条);同时校验 ?static=1 三连拍 MD5、prefers-reduced-motion: reduce 冻结、半透明面板。

    逐帧证据脚本 scripts/av-keyframes-evidence.mjs 产出 artifacts/blf1433/:8 组动画的 animationstart 事件、currentTime 轨迹与逐帧截图(overview 切范围、一级告警呼吸、骨架屏高光、event 时间线、audio 频谱、capability 卡片、抽屉开合、顶栏时钟)。

    验证结果

    | 检查 | 结果 |
    | --- | --- |
    | npm test | 74 files / 626 tests 全绿(含新守卫 9 条) |
    | npm run lint | 0 error(仅存量 warning) |
    | npm run build | 通过 |
    | node scripts/av-keyframes-audit.mjs | pass: true,未解析帧名 0 条;719 个动画节点、428 条 currentTime 在推进;负向自检捕获 1 条;?static=1 14/14 三连拍 MD5 一致;reduced-motion 14/14 在跑动画为 0、半透明面板为 0;16 条期望全部命中 |
    | node scripts/av-layout-overflow.mjs | 无溢出 / 裁切 / 横向滚动 |
    | 8 组证据 | 每组 ≥3 帧且 MD5 不同;旧版时间线此前整块不可见,现在 settled.minOpacity = 1 |

    重点回归过的「修好之后真的开始播」风险点:

  • 时间线 backwards + --av-i 延迟:EventView.tsx 的 --av-i 有 Math.min(index, 10) 上限,5 个节点全部结束后 minOpacity = 1;

  • 抽屉 ::backdrop 的 both 填充:data-closing 摘除后 dialog[open] 消失,遮罩无残留;

  • ?static=1 / reduced-motion:14 页次全部冻结,无半透明面板。
  • 影响面与风险

  • 低风险:只改动效层(4 个 CSS 模块的 19 条 animation 声明 + globals.css 的 --av-kf- 变量段),不碰业务逻辑、文案、间距 / 字号 / 行高 / 图表高度令牌;animation 时长仍全部取 var(--av-dur-)。

  • 无 TSX 改动(EventView.tsx 的 Math.min 上限是既有实现)。

  • 新增两个验收脚本,不进入 CI,按 TESTING.md 属「人工按需」的浏览器验收。
  • 关联

    Closes BLF-1433。父 issue 的收尾项,需在 Stage 8 最终截图之前合入。

    Diff: 304 lines (+228 / -76) across 3 files Reviewer: chatgpt-codex-connector[bot] Review duration: 3m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.40) × (1 − Review Confidence (0.26)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 304 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 51% · Reviewer familiarity: 35%
    26%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.342
    Real PR Conversation Timeline
    1 comments
    "Review active on #180"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 26.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.1% (MEDIUM) · Higher = larger blast radius
    40.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 26.4% · Lower = rushed or shallow review
    26.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.5% · Safe to merge
    29.5%