From 197cae8bddf497e2ab217d552e8b70058c4e8403 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Wed, 22 Jul 2026 18:01:54 +0800 Subject: [PATCH] fix: expose the manual gate set without changing hooks --- .../process/2026-07-22-fast-local-git-hooks.i18n.yaml | 4 ++-- .../implemented/process/2026-07-22-fast-local-git-hooks.md | 4 ++-- .../process/2026-07-22-fast-local-git-hooks.zh.md | 4 ++-- docs/development.i18n.yaml | 4 ++-- docs/development.md | 4 ++-- docs/development.zh.md | 4 ++-- scripts/run-gates.ts | 7 +++++-- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.i18n.yaml b/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.i18n.yaml index e750752cdc..fd7a1b2352 100644 --- a/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.i18n.yaml +++ b/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write -2026-07-22-fast-local-git-hooks.md: 629f50c18ee557cb025fc9a68f381e7c8517eb97 -2026-07-22-fast-local-git-hooks.zh.md: 905bc67f2cd57f9da747ebafb0e39e2354b23cee +2026-07-22-fast-local-git-hooks.md: a2629112a5c7dcabb0c6751d01cbc5fc49bf8f00 +2026-07-22-fast-local-git-hooks.zh.md: ba93989d69694f858d900e53cf19020d553a8c09 diff --git a/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.md b/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.md index 629f50c18e..a2629112a5 100644 --- a/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.md +++ b/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.md @@ -14,7 +14,7 @@ Fast hooks still need to reject cheap, high-confidence defects before work leave [lefthook.yml](../../../../lefthook.yml) keeps both hooks as bounded local checkpoints. Pre-commit runs sequentially: ESLint fixes and re-stages changed JavaScript and TypeScript, `git diff --cached --check` rejects staged whitespace errors, and the vendor manifest guard checks vendored-source metadata. Pre-push invokes the repository TypeScript binary directly in incremental build mode. -Neither hook runs tests, snapshots, documentation checks, builds, hygiene, or the gate scheduler. The opt-in `check:all` package script selects the complete primary-host keyless Node gate set from [scripts/run-gates.ts](../../../../scripts/run-gates.ts) independently of the hooks. +Neither hook runs tests, snapshots, documentation checks, builds, hygiene, or the gate scheduler. The opt-in `check:all` package script exposes the existing `manual-push` scheduler inventory from [scripts/run-gates.ts](../../../../scripts/run-gates.ts) independently of the hooks; it is a contributor command, not an agent instruction. Agents inspect the outgoing diff and run the narrowest tests and checks that cover its behavior once. CI owns exhaustive coverage, built-artifact checks, and the platform matrix. A complete local rehearsal is reserved for an explicit request, CI diagnosis, or a repository-wide change that cannot be validated credibly by narrower evidence. @@ -31,6 +31,6 @@ This decision supersedes the local-hook portion of [Parallel pre-push gates](202 ## Consequences -Normal commits take the staged-file lint critical path, and warm pushes take the incremental typecheck critical path. Contributors retain a one-command complete local rehearsal whose cost is paid only when they select it. Hook latency is observed in development and PR evidence rather than enforced by a timing test whose result would depend on host load and cache state. +Normal commits take the staged-file lint critical path, and warm pushes take the incremental typecheck critical path. Contributors retain a one-command manual rehearsal without widening the hook critical paths or the agent-required validation set. Hook latency is observed in development and PR evidence rather than enforced by a timing test whose result would depend on host load and cache state. Local publication no longer proves the exhaustive repository matrix. Agents must select relevant behavioral evidence, reviewers must evaluate whether that selection matches the diff, and CI supplies the comprehensive signal once per pushed revision. diff --git a/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.zh.md b/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.zh.md index 905bc67f2c..ba93989d69 100644 --- a/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.zh.md +++ b/.agents/notes/implemented/process/2026-07-22-fast-local-git-hooks.zh.md @@ -14,7 +14,7 @@ agent(智能体)已经会运行能够覆盖自身改动的测试和检查, [lefthook.yml](../../../../lefthook.yml) 将两个钩子都保留为有界的本地检查点。Pre-commit 按顺序运行:ESLint 修复改动过的 JavaScript 和 TypeScript 文件并重新暂存,`git diff --cached --check` 拒绝暂存 diff 中的空白错误,vendor manifest(元数据清单)守卫检查 vendor 源码元数据。Pre-push 直接调用仓库内的 TypeScript 二进制,并启用增量构建模式。 -两个钩子都不运行测试、快照、文档检查、构建、`hygiene` 或门禁调度器。可选运行的 `check:all` 包脚本从 [scripts/run-gates.ts](../../../../scripts/run-gates.ts) 中选择当前主机上的完整 keyless Node 门禁集,且独立于这些钩子。 +两个钩子都不运行测试、快照、文档检查、构建、`hygiene` 或门禁调度器。可选运行的 `check:all` 包脚本独立于这些钩子,将 [scripts/run-gates.ts](../../../../scripts/run-gates.ts) 现有的 `manual-push` 调度器清单提供给贡献者使用;它是贡献者命令,而非对 agent 的指令。 agent 检查待推送的 diff,并仅运行一次能够覆盖其行为的最小范围测试和检查。CI 负责全量覆盖率门禁、构建产物检查与平台矩阵。只有在明确要求、诊断 CI,或涉及全仓库的改动无法由范围更窄的证据得到可信验证时,才完整运行一遍本地检查矩阵。 @@ -31,6 +31,6 @@ agent 检查待推送的 diff,并仅运行一次能够覆盖其行为的最小 ## 结果 -普通提交的关键路径是暂存文件 lint,缓存已预热时推送的关键路径是增量类型检查。贡献者仍可用一条命令完整运行一遍本地检查,只有选择执行时才承担其开销。钩子耗时只作为开发观察数据和 PR(Pull Request)证据记录,不设置会受主机负载与缓存状态影响的计时测试。 +普通提交的关键路径是暂存文件 lint,缓存已预热时推送的关键路径是增量类型检查。贡献者仍保留用一条命令手动完整演练的途径,且不会扩展钩子关键路径或 agent 必须运行的验证集合。钩子耗时只作为开发观察数据和 PR(Pull Request)证据记录,不设置会受主机负载与缓存状态影响的计时测试。 从本地推送成功不再能证明仓库完整矩阵已通过。agent 必须选择相关的行为证据,评审人必须判断该选择是否与 diff 相符,CI 则对每个推送版本提供一次全面信号。 diff --git a/docs/development.i18n.yaml b/docs/development.i18n.yaml index 7d1bb4c25d..c9b17743d2 100644 --- a/docs/development.i18n.yaml +++ b/docs/development.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write -development.md: b82ef2343313ecc129c8d3aac1efb651d77bbcce -development.zh.md: 8a9e953104edae7aa2d16978a790ab5f713080d1 +development.md: 4661c6277b2bb859ec36b0ad44301e3cdd653794 +development.zh.md: 92c050d45594536c92301dfb85b3d507dd521a4e diff --git a/docs/development.md b/docs/development.md index b82ef23433..4661c6277b 100644 --- a/docs/development.md +++ b/docs/development.md @@ -65,7 +65,7 @@ The vendor manifest guard checks that changes under `vendor/*/src` are staged wi The hooks intentionally do not run tests, snapshots, documentation checks, builds, or hygiene. Contributors run the [checks relevant to the changed behavior](../AGENTS.md#run-relevant-checks-locally) once; CI owns exhaustive coverage, built-artifact smokes, and the Node 22.19, 24, and 26 compatibility matrix. -Contributors can opt into the complete primary-host keyless Node gate set with `pnpm run check:all`. The command is independent of both Git hooks. +Contributors can opt into the comprehensive manual gate set with `pnpm run check:all`. The command is independent of both Git hooks and is not an agent instruction. ## CI gates @@ -79,7 +79,7 @@ Use these from the repo root: pnpm run test # unit tests pnpm run test:coverage # unit tests with per-file coverage gates pnpm run test:e2e # real-API tests; self-skips without DEEPSEEK_API_KEY -pnpm run check:all # complete keyless Node gate set for the current host; not wired to Git hooks +pnpm run check:all # comprehensive manual gate set; not wired to Git hooks pnpm run typecheck # build package/vendor outputs, then typecheck examples, tests, and scripts pnpm run lint # eslint . pnpm run lint:fix # eslint . --fix diff --git a/docs/development.zh.md b/docs/development.zh.md index 8a9e953104..92c050d455 100644 --- a/docs/development.zh.md +++ b/docs/development.zh.md @@ -65,7 +65,7 @@ vendor manifest 守卫检查 `vendor/*/src` 下的改动是否连同对应的 `v 这些钩子有意不运行测试、快照、文档检查、构建或 `hygiene`。贡献者只运行一次[与改动行为相关的检查](../AGENTS.md#run-relevant-checks-locally);CI 负责全量覆盖率门禁、构建产物冒烟测试,以及 Node 22.19、24 和 26 兼容性矩阵。 -贡献者可以选择运行 `pnpm run check:all`,执行当前主机上的完整 keyless Node 门禁集。该命令独立于两个 Git 钩子。 +贡献者可以选择运行 `pnpm run check:all`,执行全面的手动门禁集。该命令独立于两个 Git 钩子,也不是对 agent 的指令。 ## CI 门禁 @@ -79,7 +79,7 @@ keyless [CI 工作流](../.github/workflows/ci.yml) 将独立门禁分组到若 pnpm run test # unit tests pnpm run test:coverage # unit tests with per-file coverage gates pnpm run test:e2e # real-API tests; self-skips without DEEPSEEK_API_KEY -pnpm run check:all # complete keyless Node gate set for the current host; not wired to Git hooks +pnpm run check:all # comprehensive manual gate set; not wired to Git hooks pnpm run typecheck # build package/vendor outputs, then typecheck examples, tests, and scripts pnpm run lint # eslint . pnpm run lint:fix # eslint . --fix diff --git a/scripts/run-gates.ts b/scripts/run-gates.ts index faeed3dfe1..22550a456b 100644 --- a/scripts/run-gates.ts +++ b/scripts/run-gates.ts @@ -17,6 +17,7 @@ type Mode = | 'ci-snapshot' | 'ci-artifacts' | 'node-compat' + | 'pre-push' | 'manual-push' | 'doc-sync' type GateStatus = 'pending' | 'running' | 'passed' | 'failed' | 'skipped' @@ -87,12 +88,13 @@ function parseMode(raw: string | undefined): Mode { case 'ci-snapshot': case 'ci-artifacts': case 'node-compat': + case 'pre-push': case 'manual-push': case 'doc-sync': return raw default: throw new Error( - `run-gates: expected mode ci-primary | ci-static | ci-lint | ci-coverage | ci-snapshot | ci-artifacts | node-compat | manual-push | doc-sync, got ${JSON.stringify(raw)}.`, + `run-gates: expected mode ci-primary | ci-static | ci-lint | ci-coverage | ci-snapshot | ci-artifacts | node-compat | pre-push | manual-push | doc-sync, got ${JSON.stringify(raw)}.`, ) } } @@ -101,7 +103,7 @@ function defaultConcurrency(selectedMode: Mode, total: number): ConcurrencyDefau const available = availableParallelism() // Local modes cap workers: several doc gates each build a full ts.Program, // so an uncapped default on a large host trades wall clock for memory blowups. - const localCap = selectedMode === 'manual-push' || selectedMode === 'doc-sync' + const localCap = selectedMode === 'pre-push' || selectedMode === 'manual-push' || selectedMode === 'doc-sync' const modeLimit = localCap ? Math.min(4, available) : available return { workers: Math.min(total, modeLimit), @@ -191,6 +193,7 @@ function gatesForMode(selected: Mode): Gate[] { 'packages/session-persistence/session-persistence-jsonl/tests/zstd.compat.spec.ts', ], { label: 'JSONL Zstandard smoke' }), ] + case 'pre-push': return [] case 'manual-push': return [ pnpmScript('runtime-closure', 'verify-runtime-closure', { label: 'runtime closure' }),