Repository navigation
质量化更新:zod 输入严格校验、修复失效的压缩基准脚本与工具链清理 - #33
Merged
Merged
Conversation
- 删除 coverage 脚本、make-coverage-badge 依赖与 README 覆盖率徽章 - 删除无任何工作流引用的 .checkov.yml、.licensed.yml、.licenses/、actionlint.yml - 删除脱离实际环境(node20 + prettier)的 .devcontainer/ - 删除已被 sync-version-tag.yml 取代的手动发布脚本 script/release
全部 Action 输入收敛到统一的 zod schema: - 数字输入必须整体解析为有限数字并附加范围约束(尺寸/倍速 > 0,系数 >= 0),空白输入维持未填写语义 - shape、compression-algorithm 改为枚举校验,css 只接受 true/false 字面量 - username 必填非空白,校验失败逐项输出可读错误并使 Action 失败
- 工具链改为 bun + mise + biome + bun test,移除 jest/eslint/prettier 等过时描述 - 仓库结构表对齐真实文件,删除已不存在的配置条目 - 补充 dist 无 sourcemap、zod 输入校验、网页版构建与自动打 tag 说明
catch 原先只处理 Error 实例,字符串、undefined 等异常会绕过 setFailed 静默成功;现在统一转为失败消息,Error 的栈信息输出到 debug 日志便于排障
- 删除生产路径上的 console.log(contributionDay) 调试输出 - createWord 重命名为 createWorld
channel-trajectory 重构后引擎返回逐帧关键帧({value, span}),脚本仍按
number[] 语义做数值运算,对象减法全为 NaN 且校验恒通过,输出为垃圾数据;
现从禁用压缩的无损关键帧解包回原始采样序列再压缩。本地 SCALE 硬编码 3
改为引用 src/const 共享常量,消除与默认容差 3 倍口径的漂移
scripts、本地开发服务器与浏览器端运行时经 overrides 放行,防止调试 console.log 再次进入生产路径
compression-tolerance 的实际单位是 SVG 坐标单位(user units,屏幕上 一个单位占 scale 像素),原文案写的 SVG pixels 不准确;基准表重新以 默认容差 0.5 实测(362 条真实轨迹、每条约 860 点),替换旧口径数据
biome 与 bun test 均不做类型检查,rollup 的类型诊断也不阻断构建, 类型错误此前可以绿灯进入 main;ci.yml 在 lint 后新增 npx tsc --noEmit, tsconfig include 补上 scripts 使旁路脚本进入检查范围
新增 simulateRaw 返回未经压缩的原始采样轨迹(RawSimulationResult), startSimulation 改为其上的压缩包装层,对外行为与选项保持不变; 压缩测试不再需要经 disableCompression 绕行解包关键帧
轨迹类型由 RawTrajectory 声明并经 CI 的 tsc 检查保证,运行时再断言 typeof 属于重复保险
RenderedContribution 由 Omit<ContributionJson, 'trajectory'> 构造, RawSimulationResult 由 Omit<SimulationResult, 'contributions'> 构造, 公共字段组不再重复维护
删除生产侧注释中对消费端行为(SMIL 消费 joint、按帧序均分时间、 span 时间守恒)的分散描述——这些关联只写在发生地:joint 的取舍在 gensvg 的接线处,均分处理在渲染的 null 分支,时间守恒在 sumSpans 校验处;字段注释只保留自身语义,不再有"含义同 X"式引用
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.
质量化更新:zod 输入严格校验、修复失效的压缩基准脚本与工具链清理
摘要
一轮质量化更新:输入参数改用 zod 严格校验、修复压缩基准脚本的隐藏故障、修正文档与实现漂移、清理未使用的配置,并补上 CI 的类型检查缺口。
变更
Action 行为
src/main.ts):数字输入必须整体解析为有限数字并附加范围约束(尺寸/缩放/倍速 > 0,摩擦/弹性/容差 >= 0);shape、compression-algorithm枚举校验;css仅接受true/false字面量;username必填非空白;校验失败逐项输出可读错误。css: TRUE被当作 false、shape: hexagon直传渲染、font-size: abc把 NaN 送进物理模拟、width: -1)现在会显式失败并指明字段catch不再吞掉非 Error 抛出:字符串/undefined等异常此前会绕过setFailed导致 Action 绿色通过但无产物;Error 栈现输出到 debug 日志修复
scripts/compare.ts在 channel-trajectory 重构(feat: 轨迹压缩通道化,x/y/自转独立分段(CSS 产物体积 -16~27%) #32)后已失效:仍按number[]语义消费关键帧对象,数值运算全为 NaN 且误差校验恒通过,输出垃圾数据;改为直接使用新的simulateRaw入口获取原始采样。README 基准表以默认容差 0.5 重新实测(362 条真实轨迹、约 860 点/条)替换旧口径数据physics.ts移除生产路径的调试console.log,createWord→createWorldcompression-tolerance单位由"SVG pixels"修正为 SVG 坐标单位(user units,屏幕上一个单位占scale像素)重构
simulateRaw(纯物理模拟,零压缩,返回原始采样轨迹)与startSimulation(其上的压缩包装层,对外行为与选项不变),压缩测试不再需要disableCompression绕行解包Omit工具类型派生(RenderedContribution、RawSimulationResult)工具链与 CI
npx tsc --noEmit类型检查——此前 biome、bun test、rollup 均不拦截类型错误;scripts/并入 tsconfig 检查范围noConsole收紧为 error(scripts、本地开发服务器、浏览器端经 overrides 放行),防止调试输出再次进入生产路径.checkov.yml、.licensed.yml+.licenses/、actionlint.yml、.devcontainer/、script/release(手动打 tag 已被 sync-version-tag.yml 取代)dist/index.js.map.github/copilot-instructions.md重写为实际开发流程(bun + mise + biome + bun test)依赖变更
zod@4.6.7(dependencies,随 dist 打包)make-coverage-badge(devDependencies)测试
bun biome check .、npx tsc --noEmit(含 scripts)、bun test(112 通过)