Files
ghbot/.specify/specs/001-production-hardening/spec.md
T
lezi-fun 9e47ab339e feat: sync ghbot-Nodeloc v1.2.0 capabilities into upstream
Merges all 33 commits from lza6/ghbot-Nodeloc (v1.0.0 through v1.2.0)
while keeping both sides' features in every conflicted file:

- EventRouter dispatch extracted from runReview.ts (7.1), with the
  runtime environment block preserved on the review-start comment
- Unified command ack messages (6.3) combined with the collapsed
  runtime environment block and bot signature on /recheck replies
- Status banner and collapsible unposted findings in review bodies (6.1)
- Centralized runtime directories behind GHBOT_RUNTIME_DIR (D-13);
  webhook knowledge cache now lives under tempRootDirectory()
- Production hardening for merge races, timeouts, webhook ops;
  atomic temp-file rename for R2 cache restores kept from upstream
- Webhook parity retained: triage events gated by WEBHOOK_TRIAGE_ENABLED,
  read-only command guidance, repository knowledge injection,
  runtime environment block on webhook chat replies
- Sanitization/secret redaction centralization, error-aware retry,
  duplicate merge prevention, in-process webhook retries, /metrics
- Infra: eslint/prettier gates with CI verify workflow, docs archives

typecheck, eslint, prettier format:check, and 164 tests all pass.
2026-08-24 11:47:28 +08:00

Raw Blame History

Feature Specification: 001-production-hardening(生产硬化总审计)

问题陈述

ghbot 已在生产仓库运行(自动审查/分类/合并/冲突修复)。用户要求以"终局闭环总审计"标准, 对全部功能做查漏补缺:功能完整性、前后端衔接(此处为 workflow↔代码↔GitHub API 契约)、 调用体验、部署体验、文档一致性,并补齐指南中剩余未落地项。

用户故事

US-1: 部署者首次接入

作为部署者,我希望按 README 从零配置后一次跑通,无需口口相传的隐性前提。 验收:

  • .env.example 覆盖全部 config schema 字段且默认值一致
  • README 步骤与实际命令一一对应
  • 新增配置项有文档说明

US-2: 事件全链路

作为仓库维护者,任何支持的事件触发后都有确定行为与反馈。 验收:

  • workflow 触发的事件类型 ⊆ runReview.ts 处理集合(无静默吞事件)
  • issue_comment 三链路互不阻断
  • 每条失败路径都有可见反馈或日志

US-3: 审查结果可信

作为 PR 作者,审查评论必须准确、可定位、不误导。 验收:

  • finding 的 path/line 经净化后才提交
  • 无法 inline 的 findings 折叠展示不丢失
  • 状态横幅与 disposition 一致

US-4: webhook 服务可运维

作为运维者,服务健康可探活、指标可观测、异常可恢复。 验收:

  • /healthz 与 /metrics 真实可用
  • 队列满/签名错/超大包均有明确响应码
  • 失败投递进程内重试后仍可被 GitHub 重投

US-5: 剩余指南项落地

指南 7.1 / 6.4 / 8.5 / 4.4 不再是"候选",全部实现或有明确的不适用结论。 验收:

  • 每项有代码证据或书面不适用理由
  • 全部门禁通过

非功能性需求

  • 兼容性:Node >=22 <26;Windows/Linux 双平台测试通过
  • 可观测性:关键路径日志含 owner/repo/pullNumber/eventName 四元组
  • 安全性:宪法红线零违反
  • 可维护性:无重复实现的安全清单;文件 <800 行

Out of Scope

  • 真实付费 LLM 调用的 E2E(预算 0)
  • 前端 UI(本项目无前端)

成功指标

  • 门禁六项全绿
  • E2E:webhook 生产构建真实 HTTP 验收通过
  • 需求追踪矩阵无"未闭环"项