Skip to content

ci: add deterministic PR gate (typecheck + unit tests + secret scan) - #12

Merged
helsome merged 1 commit into
helsome:mainfrom
kbkb628:ci/pr-checks
Sep 11, 2026
Merged

ci: add deterministic PR gate (typecheck + unit tests + secret scan)#12
helsome merged 1 commit into
helsome:mainfrom
kbkb628:ci/pr-checks

Conversation

@kbkb628

@kbkb628 kbkb628 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

问题

当前仓库对 PR 和 push 没有任何自动检查release.yml 只在 v* tag 触发,eval-smoke.yml / eval-nightly.yml 都是 workflow_dispatch 手动触发(旧的 eval PR 门禁因不稳定被移除)。PR 完全靠人工 review,类型错误、测试回归和意外提交的密钥都没有机器兜底。

改动

新增 .github/workflows/pr.ymlpull_request + main push 触发,只包含确定性检查(无 API 额度、无行情数据、无 Electron E2E):

  1. Typecheckbun run typecheck
  2. Unit testsbun test --isolate
  3. Secret scan:grep 扫描高信号模式(ghp_github_pat_sk-AKIA、PEM 私钥头),排除测试 fixture、docs 散文和 lockfile,命中即失败

复用了 release.ymloven-sh/setup-bun@v2bun install --frozen-lockfile 惯例,并按仓库风格加了 concurrency 取消旧运行。

验证

  • YAML 语法已校验
  • 密钥扫描模式已在当前代码树上本地实测:排除测试/docs/lockfile 后 0 命中(测试 fixture 中的假值、docs 引用的 AWS 规范示例假值如 AKIAIOSFODNN7EXAMPLE 均正确豁免)

注意(合并顺序)

#10(fixture 测试跳过)合并之前,unit-tests job 会在干净环境报告那 7 个已知的 account-fixture 失败。建议先合 #10 再合本 PR,这样新 CI 从第一分钟起就是绿的。

Folio currently runs no automated checks on pull requests or pushes:
release.yml only triggers on v* tags and both eval workflows are
workflow_dispatch-only (the old eval PR gate was removed for flakiness).
PRs therefore land unreviewed by any machine check.

Add a pr.yml gate limited to deterministic checks with no API credits,
market data or Electron E2E:

- typecheck: bun run typecheck
- unit tests: bun test --isolate
- secret scan: grep-based scan for high-signal patterns, excluding test
  fixtures, docs prose and lockfiles

Note: until helsome#10 (fixture test skips) merges, the unit-tests job reports
the 7 known account-fixture failures on a clean checkout; merge helsome#10 first
for a green gate.
@kbkb628

kbkb628 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

@helsome 你好,把手上这几条 PR 一起复核了一遍,现在都处于「随时可评审」状态;另外 #12 有一条需要你操作的点,放在下面。

我这 5 条 PR 的现状

PR 内容 状态
#8 shared 缺失 @finagent/skill-hub workspace 依赖 MERGEABLE · CLEAN
#9 清理内部痕迹 + 移除硬编码 vendor 端点 MERGEABLE · CLEAN
#10 无 fixture 时跳过账户测试(修全新 clone 上 7 个失败) MERGEABLE · CLEAN
#11 calendar 事件参数执行前校验(补 CLAUDE.md 要求的符号校验) MERGEABLE · CLEAN
#12 新增确定性 PR 门禁(typecheck + 单测 + secret scan) MERGEABLE · UNSTABLE(见下)

共同点:

#12 需要你点一下(不是代码问题)

PR checks 的运行停在 completed / action_required(2026-09-08 06:50,分支 ci/pr-checks):GitHub 对首次贡献者的 workflow 要求维护者手动批准,所以它不会自己跑,mergeStateStatus 因此是 UNSTABLE,而不是检查失败。

两个选项:

  1. 在 Actions 页面点一次 Approve and run workflows,我这边就能拿到真实运行结果(typecheck / 单测 / secret scan);
  2. 或者先合并 fix(shared): declare missing @finagent/skill-hub workspace dependency #8fix(longbridge-tools): validate calendar event args before exec #11 中任意一条 —— 首次贡献者限制对后续 PR 会自动解除,这个 workflow 就会正常触发。

如果你近期不打算给 PR 加自动门禁,我也可以直接关掉 #12,不在仓库里留一个不会运行的 workflow。

想请你定一下评审方式

5 条一起看可能偏长,你偏好哪种我就怎么配合:逐条合并 / 合成更少的 PR / 先看其中某几条。另外如果这几条里哪一条跟你接下来 #13#39 那批方向不一致,直接说,我按你的方向调整或撤回。

谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants