-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqa-loop.yaml
More file actions
197 lines (180 loc) · 9.68 KB
/
Copy pathqa-loop.yaml
File metadata and controls
197 lines (180 loc) · 9.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# LoopEngine 研发闭环提效流水线配置
# 平台级通用配置 - 可按项目覆盖(project_overrides)
#
# 复用 skillforge: loop/gates/escalation/agents 段保持与原 qa-loop.yaml 兼容;
# 新增: scope / confidence / checklist / agent_models 段
# ========== 循环控制 ==========
loop:
max_iterations: 5 # 最大循环次数 (防失控)
converge_threshold: 0 # 收敛阈值: 每轮 issue 减少多少才算收敛 (0=只要有减少)
escalate_on_new_critical: 2 # 连续N轮出现新Critical → 升级人工 (经 AskUserQuestion)
# ========== 6 阶段调度 ==========
phases:
- scope # [0] 修改范围分析 + 方案草案 (仅首轮)
- review # [1] 多视角审查 → Finding[]
- fix # [2] 修复 open findings, 更新 solution
- test-data # [3] 准备测试数据 (fixtures/seeds/cassette/anonymize)
- test # [4] 跑测试 + 补缺失, 输出 TestStatus
- confidence # [5] 每条修复打置信度 + checklist 核对
- gate # [6] 门禁评估 → pass / continue / escalate
# ========== TestData 阶段配置 (测试数据来源管理) ==========
# 把"测试数据从哪来"显式化, 而非硬编码在测试里。
# 策略: synthetic(合成) / fixture(固定样本) / sample(采样真实) /
# anonymize(真实脱敏) / replay(录制回放)
test_data:
default_strategy: synthetic # 默认合成 (隐私安全、可复现)
data_sources:
db:
strategy: anonymize # DB 用脱敏真实数据
dsn: "${TEST_DB_DSN}"
anonymize: true
api:
strategy: replay # 外部 API 录制回放 (确定性, 无需在线)
cassette_dir: "tests/cassettes"
fixtures:
strategy: synthetic # 单元 fixture 合成
cover_boundary: true # 覆盖边界值 (对接 edge-case-hunting)
mq: # 消息队列 (Kafka/RabbitMQ/RocketMQ)
broker: kafka # kafka / rabbitmq / rocketmq
strategy: real # real(testcontainers真broker) / replay(录制回放) / embedded(内嵌)
# 铁律: 优先 real; mock/embedded 会漏序列化+partition+消费者组重平衡问题
bootstrap: "${TEST_KAFKA}" # real=testcontainers地址; 留空=testcontainers自动起
topics: # 测试用 topic (生产→消费)
- { name: "order-events", role: "produce" }
- { name: "payment-results", role: "consume" }
- { name: "order-events.test-sink", role: "test_sink" } # 断言专用sink
schema:
format: avro # avro / protobuf / json-schema — 契约测试用
registry: "${SCHEMA_REGISTRY}"
consumers:
group_isolation: per_test # 每测试独立 group-id (防 offset 串扰)
offset_reset: earliest # 测试从头消费确定状态
assertions:
async: true # 异步断言 (轮询副作用, 不 sleep)
timeout_ms: 10000 # 等待消息副作用的最长时间
anonymization: # PII 脱敏规则 (DB + MQ 消息体)
- { field: "email", rule: "hash" }
- { field: "phone", rule: "mask" }
- { field: "id_card", rule: "mask" }
- { field: "payload.user.mobile", rule: "mask", scope: "mq" } # MQ 消息体嵌套字段
lifecycle: # 数据生命周期
per_test_isolation: true # 每个测试独立数据, 用后清理 (无共享可变状态)
mq_cleanup: purge_after_test # MQ: 测试后 purge topic (防跨测试污染)
# ========== Scope 阶段配置 ==========
scope:
diff_strategy: auto # auto=git diff / explicit=手动指定文件
include_context_files: true # 范围清单是否列出受影响上下文文件
# ========== 质量门禁 (gate) ==========
gates:
no_critical_issues: true # 无 Critical 级别 issue
no_major_issues: false # 无 Major 级别 issue (可放宽)
tests_pass: true # 所有测试通过
coverage:
enabled: true
line_pct_min: 80 # 行覆盖率最低 80%
branch_pct_min: 70 # 分支覆盖率最低 70%
# ========== Confidence 阶段配置 ==========
confidence:
enabled: false # 是否启用置信度门禁 (启用后所有 fixed 修复须达阈值)
min_threshold: 0.8 # 最低置信度阈值 (0-1)
checklist: # confidence-evaluator 核对项
- "根因已定位 (非仅修症状)"
- "修复最小化 (无 scope creep)"
- "覆盖该路径的测试已通过"
- "无回归风险 (相关调用方已检查)"
# ========== Agent 调度策略 ==========
agents:
review_first: true # 先 review 找问题再 fix
parallel:
review_and_hunt: true # review 和 bug-hunt 并行 (独立分析)
worktree_isolation: true # 多 agent 写操作走 git worktree 隔离 (防并行冲突)
order:
- scope-analyzer
- code-reviewer
- bug-fixer
- test-runner
- confidence-evaluator
# ========== Review 阶段配置 (精度优化 ②③④, 默认关闭, 向后兼容) ==========
# 一键预设 (review.precision_preset): 套用 ②③④ 杠杆组合, 显式配置优先。
# low : 全关 (recall-first, ~71% precision / 100% recall, 默认行为)
# balanced : ② loose + ③ verify (砍既有问题+投射性假阳性, 保 recall)
# strict : ② strict + ③ + ④ consensus (precision-max, 让 recall; 适合自审非门禁)
# 也可不设 preset, 单独开下面任意字段。详见 docs/PRECISION-TUNING.md
# review:
# precision_preset: balanced
#
# perspectives: [correctness, security, quality, tests] # 审查视角, 可自定义
# # ④ 杀手视角 + 共识: 抬 precision (让 recall, 当前100%有余量)
# skeptic: true # 加一个 generalist 杀手视角 (全视角+反驳优先)
# consensus_min: 2 # finding 需被≥N视角报告才存活 (1=并集默认; 2=共识)
# # ③ finding 二次验证器 (review 后 fix 前): 独立 agent 反驳, 丢弃假阳性
# verify_findings: true # 启用后需在 agent_models 配 finding-verifier 模型
# # (可复用 confidence-evaluator 的模型配置)
# # ② diff 锚定 (真实 PR 精度头号杠杆): 丢弃锚不到变更行的 finding,
# # 砍"既有问题被当新 bug"类假阳性。需在 git 仓库内跑 (git diff 取变更行)。
# diff_anchor: true # 启用后 review 后自动 git diff + 锚定过滤
# anchor_mode: loose # loose (默认, 变更行±context 内即留) / strict (必须落在变更行)
# anchor_context: 3 # loose 模式的相邻行容忍度
# ========== Agent → 模型映射 (核心: 中转代理或直连) ==========
# 每个 agent 声明 ModelConfig: provider/base_url/api_key/model
# - base_url 指向中转代理 = 走中转 (如内部网关 / one-api / litellm)
# - 不填 base_url = 按 provider 直连 (anthropic/openai/...)
# 严禁硬编码模型; 改这里即可切换, 无需改代码。
agent_models:
scope-analyzer:
provider: openai # 中转代理通常走 openai 兼容协议
base_url: "https://relay.example.com/v1" # ← 改成你的中转代理地址
api_key: "${RELAY_API_KEY}" # ← 从环境变量读, 勿明文
model: "gpt-4o-mini" # 范围分析用快模型省成本
fallbacks:
- { provider: anthropic, model: "claude-haiku-4-5" }
code-reviewer:
provider: anthropic
base_url: "https://relay.example.com" # 中转代理 (无 /v1 时 anthropic 格式)
api_key: "${RELAY_API_KEY}"
model: "claude-sonnet-4-6" # 审查用强模型
fallbacks:
- { provider: openai, base_url: "https://relay.example.com/v1", model: "gpt-4o" }
bug-fixer:
provider: anthropic
base_url: "https://relay.example.com"
api_key: "${RELAY_API_KEY}"
model: "claude-sonnet-4-6"
fallbacks:
- { provider: openai, base_url: "https://relay.example.com/v1", model: "gpt-4o" }
test-data-preparer:
provider: openai
base_url: "https://relay.example.com/v1"
api_key: "${RELAY_API_KEY}"
model: "gpt-4o-mini" # 数据准备用快模型 (需写文件, 非深度推理)
fallbacks:
- { provider: anthropic, model: "claude-haiku-4-5" }
test-runner:
provider: openai
base_url: "https://relay.example.com/v1"
api_key: "${RELAY_API_KEY}"
model: "gpt-4o-mini" # 测试规划用快模型
fallbacks:
- { provider: anthropic, model: "claude-haiku-4-5" }
confidence-evaluator:
provider: anthropic
base_url: "https://relay.example.com"
api_key: "${RELAY_API_KEY}"
model: "claude-sonnet-4-6" # 置信度评估需深度推理
fallbacks:
- { provider: openai, base_url: "https://relay.example.com/v1", model: "gpt-4o" }
# ========== 上下文管理 ==========
context:
compaction_threshold: 0.8 # 上下文使用率 > 80% 触发压缩 (复用 skillforge CompactionEngine)
checkpoint: true # 每轮落盘 summary 便于断点续跑
# ========== 升级策略 (loop 无法收敛时) ==========
escalation:
on_repeated_critical: true # 连续 escalate_on_new_critical 轮新 Critical → 升级
on_max_iterations: true # 达 max_iterations 未收敛 → 升级
ask_user: true # 升级时用 AskUserQuestion 征求决策 (不静默失败)
# ========== 项目特定覆盖示例 (取消注释按项目调整) ==========
# project_overrides:
# coverage:
# line_pct_min: 90 # 关键系统要求 90%
# confidence:
# enabled: true # 关键系统强制置信度门禁