feat: v2.0 iteration — test coverage, reliability, observability

M0: Test coverage expansion (151 → 321 tests, 61% → 66% lines)
  - normalizeKnowledge CRLF/LF normalization fix
  - gooseReviewer: 11 tests, 97.35% coverage
  - r2 storage: 22 tests, 100% coverage
  - triage processor: 11 tests, exported buildTriagePrompt/labelName
  - webhook processor: 35 tests, 72.39% coverage
  - conflict resolver: 12 tests
  - review processor: 7 tests

M1: Reliability hardening
  - Smart retry with jitter, maxTotalTimeoutMs, custom retryable predicate
  - MergeGuard: in-memory merge dedup tracker (100% coverage)
  - failureMessages: 7-category failure classifier (100% coverage)

M2: Observability
  - MetricsCollector: Actions-run metrics with snapshot/markdown/reset
  - 11 tests, 100% coverage

New files: 12 test files, 3 source modules
All gates: typecheck ✓ lint ✓ format ✓ 321/321 tests ✓ build ✓
This commit is contained in:
ghbot committed 2026-08-24 17:34:04 +08:00
1 parent db53296d78
commit 78bf8e9e41
87 files changed
+6003 -2587

No files matched your search

+4
View File
@@ -16,11 +16,13 @@
## 技术原则
### 架构
- 单一职责:一个模块只回答一个问题(谁调用它、它调用谁、失败时谁兜底)。
- 共享清单单一来源:安全排除/脱敏/路径策略只允许一份实现(src/security/, src/runtimePaths.ts)。
- 行为不变的重构必须与功能变更分开提交,且全量测试保护。
### 质量门禁(提交前全部通过)
1. `npm run typecheck` — 0 错误
2. `npm run lint` — 0 error
3. `npm run format:check` — 通过
@@ -29,6 +31,7 @@
6. `npm audit --omit=dev` — 无 high 以上
### 安全红线(继承 CLAUDE.md,不可协商)
- AUTO_MERGE=false 默认值不可改
- 恢复缓存审查结果必须重新完整审查,不得直接复用旧决策
- fork 推送必须 SHA 钉住 --force-with-lease
@@ -37,6 +40,7 @@
## 决策框架
技术选型按序评估:
1. 是否触碰安全红线?(触碰 → 拒绝)
2. 是否可用现有轮子解决?(可以 → 不写新代码)
3. 失败时的降级行为是否清晰?(不清晰 → 先设计降级)