chore: release v1.0.0 with dev gates docs and E2E record

- bump version to 1.0.0
- document typecheck/lint/format/test gates in both READMEs
- add webhook /metrics and /healthz to docs
- record real HTTP E2E verification results
This commit is contained in:
wdawdwa committed 2026-08-22 20:25:20 +08:00
1 parent 66d0628d20
commit dc3736aa1c
4 files changed
+57 -3

No files matched your search

+13
View File
@@ -242,6 +242,19 @@ secrets:
只有当 GitHub 报告当前开放 PR 存在冲突且 head 可写时才会尝试修复。外部 fork 必须开启 **Allow edits from maintainers**,并通过绑定已审核 SHA 的 force-with-lease 安全更新贡献者分支。它会运行与自动修复相同的可信验证命令和第二次 goose 最终确认;两者成功且远端 head 未变化时才会创建 commit 并 push。
## 开发门禁
所有改动在推送前必须通过本地门禁;CI([.github/workflows/ci.yml](.github/workflows/ci.yml))在 GitHub 上执行相同检查:
```bash
npm run typecheck # TypeScript 严格检查
npm run lint # ESLint(flat config)
npm run format:check # Prettier 格式检查
npm test # node:test 测试套件
```
可选的 webhook 服务提供 `GET /healthz` 与 `GET /metrics`(Prometheus 文本格式)用于探活与监控。
## 本地开发
需要 Node.js 22 至 25。PR comment Agent 的全工具集成测试还需要可用的 Docker daemon。
+13
View File
@@ -232,6 +232,19 @@ An eligible repository user can comment the exact command:
The bot attempts conflict repair only when GitHub reports the current open PR as conflicted and the head is writable. External forks require **Allow edits from maintainers**; their resolved head is pushed with a force lease pinned to the reviewed SHA. It runs the same configured validation and separate final goose confirmation used by automatic repair, then pushes only if both succeed and the head has not changed.
## Development gates
All changes must pass the local gates before push; CI ([.github/workflows/ci.yml](.github/workflows/ci.yml)) enforces the same checks on GitHub:
```bash
npm run typecheck # TypeScript strict check
npm run lint # ESLint (flat config)
npm run format:check # Prettier formatting
npm test # node:test suite
```
The optional webhook service exposes `GET /healthz` and `GET /metrics` (Prometheus text format) for probes and dashboards.
## Local development
```bash
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "ghbot",
"version": "0.1.0",
"version": "1.0.0",
"private": true,
"type": "module",
"engines": {
@@ -16,8 +16,7 @@
"lint:fix": "eslint src test --fix",
"format": "prettier --write .",
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
"ci:test": "node --import tsx --experimental-test-coverage --test test/**/*.test.ts",
"prepare": "node scripts/install-husky.cjs"
"ci:test": "node --import tsx --experimental-test-coverage --test test/**/*.test.ts"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.864.0",
+29
View File
@@ -0,0 +1,29 @@
# E2E 验证记录 — webhook 服务真实运行
**执行时间**:2026-08-22
**方式**:`npm run build` 后用 `node dist/src/webhook/server.js` 以生产构建真实启动服务,
通过 curl 实际发送 HTTP 请求验证。
## 验证矩阵
| # | 场景 | 请求 | 期望 | 实际结果 | 状态 |
|---|------|------|------|----------|------|
| 1 | 服务启动 | `node dist/src/webhook/server.js`(`WEBHOOK_ENABLED=true`) | 监听 3000 | 日志输出 `GitHub webhook server is listening` | ✅ |
| 2 | 健康检查 | `GET /healthz` | 200 `{"ok":true,"webhook":true}` | 一致 | ✅ |
| 3 | 指标端点 | `GET /metrics` | Prometheus 文本 + uptime | `ghbot_uptime_seconds 3` | ✅ |
| 4 | 合法签名投递 | `POST /webhooks/github`(正确 HMAC) | 202 `{"ok":true}` | 一致 | ✅ |
| 5 | 非法签名拒绝 | 同上但签名错误 | 401 `{"error":"Invalid webhook signature."}` | 一致 | ✅ |
| 6 | delivery 去重 | 相同 `x-github-delivery` 重放 | 202 `{"ok":true,"duplicate":true}` | 一致 | ✅ |
| 7 | 指标计数 | `GET /metrics` | accepted=1, bad_signature=1, duplicate=1 | 三项计数全部正确 | ✅ |
## 指标输出实测
```text
ghbot_webhook_deliveries_total{event="issue_comment",result="accepted"} 1
ghbot_webhook_requests_total{result="bad_signature"} 1
ghbot_webhook_deliveries_total{result="duplicate"} 1
```
## 结论
webhook 服务从启动 → 鉴权 → 去重 → 可观测性的完整链路在真实 HTTP 层验证通过。