12 模块多 agent 并行开发(dev+test+fix 每,两层 + barrier):
- T06 PbaSession 事件溯源 + deriveMessages + logged 不变量
- T07 PbaEventBus typed event bus + waterfall + ScopeKey 隔离
- T08 能力接缝三角色(board-link + flash Provider/Registry/consumer)
- T09 compaction 完整工程(token-meter/pruner/summarizer/spill)
- T10 CI 质量门 + snapshot + doc-sync
- T11 类型镜像漂移检测(tsconfig.realpi + type-drift-check)
- T12 子代理 + 工作流编排(parallel/pipeline/InlineSubagentProvider)
- T13 上下文注入三段(inject/steer/followup)
- T14 plan/goal/todo checkpoint logged state(look-ahead 状态机)
- T15 profile/bundle 分层(维修诊断 vs 嵌入式开发,共享 base)
- T16 多 LLM provider 适配(ProviderRegistry + glm-5.2/deepseek)
- T17 审批接缝(fail-closed auto-deny)+ credentials/settings/lsp
集成(串行):
- src/index.ts 公共 re-export(board-link/flash 具名避 shared/types 重名)
- tests/system-integration.test.ts 跨模块 10 闭环(事件溯源→compaction→bus→
接缝→checkpoint→inject→workflow→approval→provider→profile)
- 全量 tsc=0;vitest 39 文件 2449 passed/5 skipped(1044 baseline +~1400 模块 + 10 系统)
- 密钥铁律:\${DROBOTICS_LLM_KEY} 占位,grep sk- 明文 0
68 workflow agent / 0 error / ~3M token;mutation 测试每模块 3-9 seeded bug 全杀。
Co-Authored-By: Claude <noreply@anthropic.com>
124 lines
4.5 KiB
YAML
124 lines
4.5 KiB
YAML
# CI 质量门(T10)—— per-file 覆盖门 + doc-sync + type-drift-check
|
||
# 见架构设计文档_v3.md §5.9
|
||
#
|
||
# 两个 Job:
|
||
# quality-gate —— 每次 push/PR 跑:vitest per-file 100% 覆盖门 + tsc 类型检查
|
||
# + doc-sync 锚点对齐(调本仓 scripts/doc-sync.ts)
|
||
# type-drift —— 周期(schedule)+ 手动触发跑:类型镜像漂移检测
|
||
# (调 T11 的 scripts/type-drift-check.ts,需 ../pi/packages 源码)
|
||
# 非「每次提交」跑,因 type-drift 需真 pi 源码树且属升版级检查。
|
||
|
||
name: CI
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
pull_request:
|
||
branches: [main]
|
||
schedule:
|
||
# 每周二 03:17 UTC 跑 type-drift(错峰,避开 :00)
|
||
- cron: "17 3 * * 2"
|
||
workflow_dispatch:
|
||
|
||
permissions:
|
||
contents: read
|
||
|
||
jobs:
|
||
# ==========================================================================
|
||
# quality-gate:per-file 100% 覆盖 + 类型检查 + doc-sync
|
||
# ==========================================================================
|
||
quality-gate:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "20"
|
||
cache: "npm"
|
||
|
||
- name: Install deps
|
||
run: npm ci
|
||
|
||
- name: Typecheck (tsc --noEmit)
|
||
run: npm run typecheck
|
||
|
||
# per-file 100% 覆盖门:v8 istanbul,thresholds.perFile 对 src/**/*.ts 逐文件
|
||
- name: Test + per-file 100% coverage gate
|
||
run: |
|
||
npx vitest run \
|
||
--coverage.enabled \
|
||
--coverage.provider=v8 \
|
||
--coverage.include='src/**/*.ts' \
|
||
--coverage.thresholds.perFile=true \
|
||
--coverage.thresholds.lines=100 \
|
||
--coverage.thresholds.branches=100 \
|
||
--coverage.thresholds.functions=100 \
|
||
--coverage.thresholds.statements=100
|
||
|
||
# doc-sync:校验架构文档锚点 file:line 与代码对齐,不符即红。
|
||
# 用 stdin ESM + 动态 import(process.cwd() 可移植),规避 tsx -e 的
|
||
# eval-CJS 上下文无法解析 .js→.ts 相对路径的问题。
|
||
- name: doc-sync
|
||
run: |
|
||
cat <<'EOF' | npx tsx --input-type=module
|
||
const cwd = process.cwd();
|
||
const m = await import(cwd + "/scripts/doc-sync.js");
|
||
const r = m.checkDocSync({
|
||
readFile: m.defaultReadFile,
|
||
grepSymbol: m.defaultGrepSymbol,
|
||
anchors: m.DEFAULT_DOC_ANCHORS,
|
||
});
|
||
if (!r.ok) {
|
||
console.error("doc-sync mismatches:\n" + r.mismatches
|
||
.map(x => ` - ${x.anchor.docFile}:${x.anchor.docLine} -> ${x.reason}`)
|
||
.join("\n"));
|
||
process.exit(1);
|
||
}
|
||
console.log("doc-sync: all anchors aligned");
|
||
EOF
|
||
|
||
# ==========================================================================
|
||
# type-drift:类型镜像漂移检测(周期 + 手动,需真 pi 源码树)
|
||
# ==========================================================================
|
||
type-drift:
|
||
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "20"
|
||
cache: "npm"
|
||
|
||
- name: Install deps
|
||
run: npm ci
|
||
|
||
# type-drift-check 需 ../pi/packages 真源码(tsconfig.realpi.json paths 指向)
|
||
# 源码树不在本仓(gitignore 的 pi 符号链接/目录);缺源码则无法验证,跳过并告警
|
||
- name: Verify pi source tree present
|
||
id: pi-src
|
||
run: |
|
||
if [ -d "../pi/packages" ]; then
|
||
echo "present=true" >> "$GITHUB_OUTPUT"
|
||
else
|
||
echo "::warning::../pi/packages not present; type-drift-check skipped (no source to verify against)"
|
||
echo "present=false" >> "$GITHUB_OUTPUT"
|
||
fi
|
||
|
||
- name: type-drift-check
|
||
if: steps.pi-src.outputs.present == 'true'
|
||
run: |
|
||
cat <<'EOF' | npx tsx --input-type=module
|
||
const cwd = process.cwd();
|
||
const m = await import(cwd + "/scripts/type-drift-check.js");
|
||
const r = m.checkTypeDrift({});
|
||
if (r.driftDetected) {
|
||
console.error("type drift detected (pba src mirror stale):\n" + r.pbaErrors.join("\n"));
|
||
process.exit(1);
|
||
}
|
||
console.log("type-drift: no drift");
|
||
console.log("pi-internal errors (ignored): " + r.piInternalErrors.length);
|
||
EOF
|