Repository navigation
chore: engineering & packaging batch — test runner, lint, CI gates, dep pin, entitlements (audit E1-E5) - #316
Merged
Merged
Conversation
审计 2026-09-26 E4:devDependency 用 "latest" 意味着任何重新解析(删 lockfile、npm update、新环境安装)都会拉入未验证的大版本,构建工具链 不可复现。固定为 lockfile 已解析的 5.0.0 语义化范围。
审计 2026-09-26 整改(2026-09-26 误删事件复盘):build/ 是 electron-builder 的 buildResources 目录(源码配置),但名字极易被当成构建临时目录清理, entitlements 曾被误删导致 dist:mac 损坏。 - entitlements.mac.plist / entitlements.mac.inherit.plist 迁至 packaging/ - electron-builder.yml 引用同步更新并在注释标注缘由 - electron-builder --dir 打包冒烟验证配置可解析
审计 2026-09-26 E5: - publish.yml 新增 preflight job(typecheck + 全量测试),publish 依赖 其通过——tag 可以从任意 commit 打出,此前发布无任何门禁 - ci.yml / build.yml 增加 concurrency 取消:同分支连续 push 不再排队 跑完过时的旧检查
审计 2026-09-26 E1/E2:根 test 脚本手工枚举 48 个 tsx 调用,而 tests/ 下有 54 个测试文件——scheduler-engine、scheduler-fingerprint、 data-sync-health、competitor-intel、competitor-advantage、 store-product-scope 6 个测试从未被 CI 执行(孤儿测试)。 - 新增 scripts/run-tests.mjs:自动发现 tests/*.test.ts 顺序执行, 结尾汇总通过/失败清单,任一失败退出码 1;支持子串过滤便于本地调试 - 根 test 脚本的手工枚举段替换为 runner 调用(workspace 测试链保留) - 此后新增测试文件零登记、零遗漏
…remove) 审计 2026-09-26 H6(上轮审计 H-2 未修项):KeywordsPage 的空项目守卫 位于派生 useMemo 链之前——早退分支与就绪分支 hook 数量不一致,真实崩 溃路径:停在 /keywords 且无项目时通过侧栏添加项目(不跳转路由),或就 绪状态下删除当前项目,React 抛 hooks 数量不一致错误。 - 早退守卫移到全部 23 个派生 hook(compareChart 为最后一个)之后、所有 handler 与 JSX 之前;守卫后 project/product 类型收窄,handler 无需判空 - 派生 memo 对 project/product 空安全(?. 与空数组兜底),空态渲染时 memo 结果为空集,hook 数量跨渲染恒定 - rankBudget(普通派生值,非 hook)随守卫下移,保持非空类型 组件级回归依赖组件测试基建(工程化轮次引入),本提交以结构断言(守卫 后 0 个 hook 调用)+ 类型检查为验证。
审计 2026-09-26 E3:仓库此前无任何 lint 工具链(仅 tsc strict), react-hooks 违规(条件 return 后调用 hooks,见 H6)正是缺口的直接后果。 - ESLint 9 平面配置:typescript-eslint recommended + react-hooks v5 (rules-of-hooks=error 防 H6 类地雷回归);存量问题(no-explicit-any 等 ~1800 处)以 warn 起步不阻塞 CI,后续逐步清零 - eslint.config.mjs:忽略 dist/out/产物/本地会话目录;node+browser globals;CJS 入口的 require 豁免;文件名清洗正则的控制字符匹配降 warn - package.json 新增 lint 脚本;ci.yml typecheck job 增加 lint 步骤 - 顺手清理 4 处存量 lint error:keynote 正则多余转义、测试 let→const、 脚本未用变量与逗号表达式 - 基线:0 errors / ~1835 warnings
整仓审查报告(5 区域并行深审 + 横切工程审查):9 High / 32 Medium / 46 Low,含上轮审计修复核验、运行验证记录与修复优先级清单。 本 PR 系列即其 Top-10 优先级整改的落地。
|
Appilot CLA v1.0 accepted. Thank you for contributing. / Appilot CLA 1.0 已接受,感谢贡献。 |
ci: run lint in master and publish preflight
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What changed · 改动内容
落实 docs/code-audit-2026-09-26.md 工程化与打包批次,7 个 commit:
chore(deps): pin electron-vite to ^5.0.0— 移除 "latest",构建工具链可复现。chore(packaging): move mac entitlements out of build/— entitlements 迁至packaging/(build/ 是 electron-builder 的 buildResources 源码目录,曾被当临时文件误删导致 dist:mac 损坏);electron-builder --dir 打包冒烟验证。ci: gate npm publish on typecheck+test and add concurrency cancels— publish 前强制 typecheck+全量测试(此前 tag 发布零门禁);ci/build 增加 concurrency 取消。test: auto-discover root tests via unified runner— 新增 scripts/run-tests.mjs 自动发现 tests/*.test.ts,根 test 脚本手工枚举段(48 个 tsx 调用,遗漏 6 个孤儿测试)替换为 runner;此后新增测试零登记零遗漏。fix(keywords): move early-return guard below all hooks— 来自 fix: data-correctness batch — AI stream concat, release frontier leak, PR window, stale responses, hooks crash #314 的同补丁;lint 门禁(rules-of-hooks=error)需要该修复在场,fix: data-correctness batch — AI stream concat, release frontier leak, PR window, stale responses, hooks crash #314 先合并则本 PR 中该提交自动变空。chore(lint): introduce ESLint toolchain with react-hooks rules— ESLint 9 + typescript-eslint + react-hooks v5(rules-of-hooks=error);存量 ~1800 处 no-explicit-any 以 warn 起步不阻塞 CI,逐步清零;lint 脚本 + CI 步骤;顺手清理 4 处存量 error。基线 0 errors。docs: add 2026-09-26 full-repo audit report— 本系列整改的源头报告入库。Verification · 验证
ls完全一致)npm run typecheck通过;根npm test全链通过(2026-09-26,含 CLI/MCP 端到端)Contributor agreement · 贡献者协议