@jesdi/skills 0.0.87 → 0.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/babysit-pr/SKILL.md +1 -1
- package/skills/babysit-pr/babysit.py +21 -10
- package/skills/babysit-pr/fixtures/gh +2 -1
- package/skills/babysit-pr/judge-prompt.md +7 -3
- package/skills/babysit-pr/test_babysit_judge.py +16 -10
- package/skills/babysit-pr/test_babysit_judge_isolation.py +1 -1
- package/skills/babysit-pr/test_handoff_takeover.py +1 -1
- package/skills/babysit-pr/test_merge_and_handoff.py +17 -16
- package/skills/babysit-pr/test_merge_base_pin.py +1 -1
- package/skills/babysit-pr/test_merge_gate.py +49 -14
- package/skills/babysit-pr/test_merge_session_safety.py +3 -3
- package/skills/babysit-pr/test_merged_pr_labels.py +1 -1
- package/skills/babysit-pr/test_terminal_label_regressions.py +1 -1
- package/skills/babysit-pr/test_trusted_merge_risk.py +1 -1
- package/skills/implement-spec/ARCHITECTURE.md +20 -8
- package/skills/implement-spec/README.md +7 -4
- package/skills/implement-spec/driver_decisions.py +3 -2
- package/skills/implement-spec/driver_dispute.py +82 -57
- package/skills/implement-spec/driver_fixloop.py +18 -21
- package/skills/implement-spec/driver_legacy.py +31 -2
- package/skills/implement-spec/driver_report.py +13 -3
- package/skills/implement-spec/driver_state.py +8 -7
- package/skills/implement-spec/prompts/correction.md +1 -0
- package/skills/implement-spec/prompts/reviewer.md +3 -3
- package/skills/implement-spec/prompts/ruled.md +1 -1
- package/skills/implement-spec/tests/test_arbitration.py +101 -10
- package/skills/implement-spec/tests/test_decisions.py +7 -5
- package/skills/implement-spec/tests/test_final.py +1 -1
- package/skills/implement-spec/tests/test_fixloop.py +3 -3
- package/skills/implement-spec/tests/test_legacy.py +27 -0
- package/skills/implement-spec/tests/test_state.py +1 -1
- package/skills/implement-spec/tests/test_walk.py +1 -1
- package/skills/pr-risk/SKILL.md +18 -3
- package/skills/pr-risk/merge_policy.py +29 -9
- package/skills/pr-risk/merge_risk.py +57 -14
- package/skills/pr-risk/test_hooks.py +2 -2
- package/skills/pr-risk/test_merge_risk.py +2 -2
- package/skills/pr-risk/test_merge_risk_gate.py +128 -43
- package/skills/pr-risk/test_merge_risk_regressions.py +5 -5
- package/skills/pr-risk/test_merge_risk_structure.py +5 -4
- package/skills/test-weigh-in/dashboard.html +70 -17
- package/skills/test-weigh-in/tests/browser_driver.py +46 -5
- package/skills/test-weigh-in/tests/layout_page.py +7 -3
- package/skills/test-weigh-in/tests/overlap_page.py +3 -0
- package/skills/test-weigh-in/tests/rules_fixture.py +1 -1
- package/skills/test-weigh-in/tests/test_coverage_run.py +5 -1
- package/skills/test-weigh-in/tests/test_dashboard_layout.py +50 -9
- package/skills/test-weigh-in/tests/test_score.py +53 -2
- package/skills/test-weigh-in/weigh.py +2 -2
- package/skills/test-weigh-in/weigh_coverage.py +22 -2
- package/skills/test-weigh-in/weigh_dashboard.py +51 -10
- package/skills/test-weigh-in/weigh_score.py +6 -3
- package/skills/test-weigh-in/weigh_smells.py +3 -2
- package/skills-manifest.json +9 -9
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ Run with `/babysit-pr <pr-url>`. The PostToolUse hook in `hooks/post-pr-create.s
|
|
|
21
21
|
2. `update-plan --base <base>` when the base moved; follow its plan (see Base moved). Every step uses `origin/<base>` of the PR (a stacked PR's parent), never `main`.
|
|
22
22
|
3. `checks --wait-minutes <waitMinutes>` until the head is green, red, stalled (`CI stalled`) or empty (`no checks`). Green means every check passed.
|
|
23
23
|
4. Red: `round start --op <id>` (keep the id), then the fix round below. Renew the lease each round and `lease check` before each push.
|
|
24
|
-
5. Green: run the gate (`pr-risk` `merge_risk.py gate`), then `judge`, then `merge-method` and `merge`. Pass the judge's
|
|
24
|
+
5. Green: run the gate (`pr-risk` `merge_risk.py gate`), then `judge`, then `merge-method` and `merge`. Pass the judge's label and risk to `merge --judge agree --judge-risk <risk>` (or `--judge 'same-model agree'` for fallback), never an output file path. The merge pins the head SHA the gate and judge saw, and hands off when the gate's or the judge's risk is above the repo's limit.
|
|
25
25
|
|
|
26
26
|
## A fix round
|
|
27
27
|
|
|
@@ -659,7 +659,7 @@ def load_merge_risk(base=None):
|
|
|
659
659
|
|
|
660
660
|
|
|
661
661
|
JUDGE_NEEDS = ("base_policy", "classify_diff", "diff_stats", "FENCE")
|
|
662
|
-
GATE_NEEDS = ("gate", "base_policy", "classify_diff", "diff_stats", "parse")
|
|
662
|
+
GATE_NEEDS = ("gate", "base_policy", "classify_diff", "diff_stats", "parse", "risk_floor")
|
|
663
663
|
|
|
664
664
|
|
|
665
665
|
def missing_functions(mr, *names):
|
|
@@ -736,13 +736,15 @@ def judge(base, head, body_file, agent):
|
|
|
736
736
|
return {"verdict": "disagree", "reason": "judge timeout", "sameModel": same_model}
|
|
737
737
|
try:
|
|
738
738
|
data = json.loads(answer)
|
|
739
|
-
verdict, reason = data["verdict"], data.get("reason")
|
|
739
|
+
verdict, reason, risk = data["verdict"], data.get("reason"), data.get("risk")
|
|
740
740
|
except (TypeError, ValueError, KeyError, AttributeError):
|
|
741
|
-
verdict, reason = None, None
|
|
741
|
+
verdict, reason, risk = None, None, None
|
|
742
742
|
if verdict == "agree" and not (isinstance(reason, str) and reason.strip()):
|
|
743
743
|
verdict = None
|
|
744
|
+
if verdict == "agree" and not (type(risk) is int and 1 <= risk <= 10):
|
|
745
|
+
verdict = None
|
|
744
746
|
if verdict == "agree":
|
|
745
|
-
return {"verdict": "agree", "sameModel": same_model,
|
|
747
|
+
return {"verdict": "agree", "risk": risk, "sameModel": same_model,
|
|
746
748
|
"label": "same-model agree" if same_model else "agree"}
|
|
747
749
|
if verdict != "disagree":
|
|
748
750
|
reason = "invalid answer"
|
|
@@ -839,7 +841,8 @@ def handoff(repo, number, reason, ci, rounds, gate, judge_line, fix_log, extra="
|
|
|
839
841
|
"next": "In Claude Code send PushNotification, then end the turn. Otherwise end the turn now."}))
|
|
840
842
|
|
|
841
843
|
|
|
842
|
-
def merge_cmd(repo, number, sha, body_file, policy, judge_label, approved, session=None, base=None
|
|
844
|
+
def merge_cmd(repo, number, sha, body_file, policy, judge_label, approved, session=None, base=None,
|
|
845
|
+
judge_risk=None):
|
|
843
846
|
pr = json.loads(gh("api", f"repos/{repo}/pulls/{number}"))
|
|
844
847
|
if base not in (None, pr["base"]["ref"]):
|
|
845
848
|
fail(f"--base {base} is not the PR's base {pr['base']['ref']}")
|
|
@@ -870,10 +873,17 @@ def merge_cmd(repo, number, sha, body_file, policy, judge_label, approved, sessi
|
|
|
870
873
|
mr = load_merge_risk(base)
|
|
871
874
|
if old := missing_functions(mr, *GATE_NEEDS):
|
|
872
875
|
stop(f"pr-risk is too old: {', '.join(old)}")
|
|
873
|
-
|
|
876
|
+
public = pr["base"].get("repo", {}).get("private") is not True # unknown counts as public
|
|
877
|
+
result = mr.gate(body, base, sha, public) # trusted policy, recomputed for this sha
|
|
874
878
|
if result["verdict"] != "auto":
|
|
875
|
-
gate = "gate: human"
|
|
879
|
+
gate = f"gate: human, risk {result['risk']}/10"
|
|
876
880
|
stop(f"gate is human: {'; '.join(result['reasons'])}")
|
|
881
|
+
gate = f"gate: passed, risk {result['risk']}/10"
|
|
882
|
+
if judge_risk is None:
|
|
883
|
+
stop("judge risk missing: pass --judge-risk")
|
|
884
|
+
if judge_risk > result["maxAutoRisk"]:
|
|
885
|
+
stop(f"judge risk {judge_risk} > max auto risk {result['maxAutoRisk']}")
|
|
886
|
+
risk_line = f"risk {max(result['risk'], judge_risk)}/10 (auto up to {result['maxAutoRisk']}), "
|
|
877
887
|
else:
|
|
878
888
|
judge_line = f"owner approved {approved}"
|
|
879
889
|
commits = pr_commits(repo, number)
|
|
@@ -924,8 +934,8 @@ def merge_cmd(repo, number, sha, body_file, policy, judge_label, approved, sessi
|
|
|
924
934
|
fail(f"head moved since the gate saw {sha}: gate again")
|
|
925
935
|
stop(f"merge blocked: {'approval required' if 'approv' in err.lower() else err}")
|
|
926
936
|
pr = Pr(repo, number)
|
|
927
|
-
pr.post("🤖 Merged by babysit-pr:
|
|
928
|
-
f"judge {judge_label}" if approved is None else f"owner approved {approved}"))
|
|
937
|
+
pr.post("🤖 Merged by babysit-pr: " + (
|
|
938
|
+
f"{risk_line}gate passed, judge {judge_label}" if approved is None else f"owner approved {approved}"))
|
|
929
939
|
if session:
|
|
930
940
|
release(pr, session)
|
|
931
941
|
|
|
@@ -968,6 +978,7 @@ def main():
|
|
|
968
978
|
mg.add_argument("--sha", required=True)
|
|
969
979
|
mg.add_argument("--body", required=True)
|
|
970
980
|
mg.add_argument("--judge")
|
|
981
|
+
mg.add_argument("--judge-risk", type=int, choices=range(1, 11), metavar="1-10")
|
|
971
982
|
mg.add_argument("--approved-sha")
|
|
972
983
|
mg.add_argument("--base")
|
|
973
984
|
for p in (mg, hp):
|
|
@@ -991,7 +1002,7 @@ def main():
|
|
|
991
1002
|
elif a.cmd == "merge":
|
|
992
1003
|
if not (a.judge or a.approved_sha):
|
|
993
1004
|
ap.error("merge needs --judge or --approved-sha")
|
|
994
|
-
merge_cmd(a.repo, a.pr, a.sha, a.body, a.policy, a.judge, a.approved_sha, a.session, a.base)
|
|
1005
|
+
merge_cmd(a.repo, a.pr, a.sha, a.body, a.policy, a.judge, a.approved_sha, a.session, a.base, a.judge_risk)
|
|
995
1006
|
elif a.cmd == "handoff":
|
|
996
1007
|
handoff(a.repo, a.pr, a.reason, a.ci, a.rounds, a.gate, a.judge, Path(a.fix_log).read_text(), session=a.session)
|
|
997
1008
|
elif a.cmd == "update-plan":
|
|
@@ -155,7 +155,8 @@ def api(args):
|
|
|
155
155
|
"user": {"login": st["user"]},
|
|
156
156
|
"title": st.get("title", ""), "body": st.get("body", ""),
|
|
157
157
|
"head": {"sha": st.get("head_sha", "head1"), "ref": st.get("head_ref", "feature")},
|
|
158
|
-
"base": {"ref": st.get("base_ref", "main"),
|
|
158
|
+
"base": {"ref": st.get("base_ref", "main"), "repo": {"private": st.get("private", False)},
|
|
159
|
+
**({"sha": st["base_sha"]} if "base_sha" in st else {})}}, jq, include)
|
|
159
160
|
if path == "pulls" and method == "GET" and fields.get("state") == "open":
|
|
160
161
|
log(False)
|
|
161
162
|
return emit([{"number": p["number"], "base": {"ref": p["base"]}} for p in st.get("open_prs", [])
|
|
@@ -2,8 +2,12 @@ You are an independent judge of merge risk. You see only the input below: the di
|
|
|
2
2
|
files, the names and line counts of the other files, the PR's merge-risk block and the categories
|
|
3
3
|
of the diff. You have no other context, and you must not assume any.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Score the risk of merging this change from 1 to 10: 1 is a typo fix nobody can break, 10 is a
|
|
6
|
+
change that can lose data, money or access, or cannot be undone. Weigh public interfaces, auth,
|
|
7
|
+
money, data loss, anything hard to revert, and a block that understates the diff. Any doubt raises
|
|
8
|
+
the score.
|
|
9
|
+
|
|
10
|
+
Then decide whether an agent may merge it without a human. Any doubt is `disagree`.
|
|
7
11
|
|
|
8
12
|
Answer with one JSON object and nothing else:
|
|
9
|
-
{"verdict": "agree" | "disagree", "reason": "<one short sentence>"}
|
|
13
|
+
{"verdict": "agree" | "disagree", "risk": <whole number 1-10>, "reason": "<one short sentence>"}
|
|
@@ -8,6 +8,7 @@ file is the PR body (summary + merge-risk block). Exit 0, one JSON object on std
|
|
|
8
8
|
reason the handoff reason when disagree: "judge: <judge reason>", or "judge timeout"
|
|
9
9
|
sameModel true when the other vendor's CLI was missing and a fresh agent of the same vendor judged
|
|
10
10
|
label what the merge comment shows after "judge ": "agree" | "same-model agree" (agree only)
|
|
11
|
+
risk the judge's risk, 1-10 (agree only); an agree without a whole risk from 1 to 10 is disagree
|
|
11
12
|
Env BABYSIT_JUDGE_TIMEOUT overrides the 10 minute limit, in seconds.
|
|
12
13
|
|
|
13
14
|
The judge CLIs are fakes on PATH (`codex`, `claude`). A fake logs {name, argv, stdin} to
|
|
@@ -40,7 +41,7 @@ print(ans)
|
|
|
40
41
|
sys.exit(int(os.environ.get("FAKE_EXIT_{NAME}", "0")))
|
|
41
42
|
"""
|
|
42
43
|
|
|
43
|
-
AGREE = '{"verdict": "agree", "reason": "small and reversible"}'
|
|
44
|
+
AGREE = '{"verdict": "agree", "risk": 2, "reason": "small and reversible"}'
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
def git(repo, *args):
|
|
@@ -69,7 +70,7 @@ door: two-way
|
|
|
69
70
|
blast_radius: isolated
|
|
70
71
|
touches: [logic]
|
|
71
72
|
rollback: revert
|
|
72
|
-
|
|
73
|
+
risk: 1
|
|
73
74
|
reasons:
|
|
74
75
|
- "BLOCK-REASON-TEXT small and reversible"
|
|
75
76
|
```
|
|
@@ -82,7 +83,7 @@ class Judge:
|
|
|
82
83
|
self.repo = tmp_path / "repo"
|
|
83
84
|
self.repo.mkdir()
|
|
84
85
|
git(self.repo, "init", "-q", "-b", "work")
|
|
85
|
-
base = commit(self.repo, {"README.md": "hi\n", ".merge-risk.json": '{"
|
|
86
|
+
base = commit(self.repo, {"README.md": "hi\n", ".merge-risk.json": '{"maxAutoRisk": 5}'},
|
|
86
87
|
"base")
|
|
87
88
|
git(self.repo, "update-ref", "refs/remotes/origin/main", base)
|
|
88
89
|
self.head = commit(self.repo, {
|
|
@@ -231,7 +232,12 @@ def test_only_a_plain_reasoned_agree_is_agree(tmp_path):
|
|
|
231
232
|
for answer in ('{"verdict": "auto", "reason": "ok"}', '{"verdict": "human", "reason": "ok"}',
|
|
232
233
|
'{"verdict": "approve", "reason": "ok"}', '{"verdict": "AGREE", "reason": "ok"}',
|
|
233
234
|
'{"verdict": true, "reason": "ok"}', '{"verdict": "agree"}',
|
|
234
|
-
'{"verdict": "agree", "reason": ""}', '["agree"]', 'null'
|
|
235
|
+
'{"verdict": "agree", "reason": ""}', '["agree"]', 'null',
|
|
236
|
+
'{"verdict": "agree", "reason": "ok"}', '{"verdict": "agree", "risk": 0, "reason": "ok"}',
|
|
237
|
+
'{"verdict": "agree", "risk": 11, "reason": "ok"}',
|
|
238
|
+
'{"verdict": "agree", "risk": "2", "reason": "ok"}',
|
|
239
|
+
'{"verdict": "agree", "risk": 2.5, "reason": "ok"}',
|
|
240
|
+
'{"verdict": "agree", "risk": true, "reason": "ok"}'):
|
|
235
241
|
sub = tmp_path / f"case{len(list(tmp_path.iterdir()))}"
|
|
236
242
|
sub.mkdir()
|
|
237
243
|
out = Judge(sub).run(answer)
|
|
@@ -240,16 +246,16 @@ def test_only_a_plain_reasoned_agree_is_agree(tmp_path):
|
|
|
240
246
|
|
|
241
247
|
|
|
242
248
|
def test_agree_on_a_human_gate_block_never_becomes_auto(tmp_path):
|
|
243
|
-
"""The gate said human (block
|
|
249
|
+
"""The gate said human (block risk: 8); the judge agreeing must not turn that into an
|
|
244
250
|
auto: the result is only agree/disagree with the known keys, never an auto or human verdict."""
|
|
245
251
|
j = Judge(tmp_path)
|
|
246
|
-
j.body.write_text(BODY.replace("
|
|
252
|
+
j.body.write_text(BODY.replace("risk: 1", "risk: 8"))
|
|
247
253
|
out = j.run(AGREE)
|
|
248
254
|
assert out["verdict"] == "agree"
|
|
249
|
-
assert set(out) <= {"verdict", "sameModel", "label"}, out
|
|
255
|
+
assert set(out) <= {"verdict", "risk", "sameModel", "label"}, out
|
|
250
256
|
assert "auto" not in json.dumps(out) and "human" not in json.dumps(out)
|
|
251
257
|
c = j.calls()[0]
|
|
252
|
-
assert "
|
|
258
|
+
assert "risk: 8" in json.dumps(c["argv"]) + c["stdin"]
|
|
253
259
|
|
|
254
260
|
|
|
255
261
|
def test_a_judge_that_agrees_but_exits_nonzero_falls_back(tmp_path):
|
|
@@ -270,7 +276,7 @@ def test_a_judge_that_agrees_but_exits_nonzero_falls_back(tmp_path):
|
|
|
270
276
|
|
|
271
277
|
|
|
272
278
|
def test_a_gate_human_stays_human_whatever_the_judge_says(tmp_path):
|
|
273
|
-
"""The block's advisory `
|
|
279
|
+
"""The block's advisory `risk: 1` is ignored by the gate. With a one-way door the gate
|
|
274
280
|
says human; a judge agree on that same input is only agree and carries nothing that could
|
|
275
281
|
turn the gate's human into auto."""
|
|
276
282
|
j = Judge(tmp_path)
|
|
@@ -282,5 +288,5 @@ def test_a_gate_human_stays_human_whatever_the_judge_says(tmp_path):
|
|
|
282
288
|
assert json.loads(gate.stdout)["verdict"] == "human", gate.stdout + gate.stderr
|
|
283
289
|
out = j.run(AGREE)
|
|
284
290
|
assert out["verdict"] == "agree"
|
|
285
|
-
assert set(out) <= {"verdict", "sameModel", "label"}, out
|
|
291
|
+
assert set(out) <= {"verdict", "risk", "sameModel", "label"}, out
|
|
286
292
|
assert "auto" not in json.dumps(out) and "human" not in json.dumps(out)
|
|
@@ -30,7 +30,7 @@ with open(os.environ["FAKE_LOG"], "a") as log:
|
|
|
30
30
|
"session": {k: os.environ.get(k) for k in
|
|
31
31
|
("GIT_DIR", "CLAUDE_PROJECT_DIR", "CODEX_THREAD_ID", "CLAUDECODE")},
|
|
32
32
|
"stdin": sys.stdin.read()}) + "\\n")
|
|
33
|
-
print(json.dumps({"verdict": "disagree" if leaked else "agree",
|
|
33
|
+
print(json.dumps({"verdict": "disagree" if leaked else "agree", "risk": 1,
|
|
34
34
|
"reason": "checkout instructions loaded" if leaked else "isolated"}))
|
|
35
35
|
''')
|
|
36
36
|
result = j.run(agent=agent, TMPDIR=j.repo, GIT_DIR=j.repo / ".git",
|
|
@@ -94,7 +94,7 @@ def test_merge_after_takeover_leaves_the_new_holders_labels_and_reports_it(tmp_p
|
|
|
94
94
|
w = world(tmp_path, repo_labels=["babysitting", "needs-human"])
|
|
95
95
|
assert w.run("acquire", "s1").returncode == 0
|
|
96
96
|
takeover_before_label_write(w)
|
|
97
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--session", "s1")
|
|
97
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1", "--session", "s1")
|
|
98
98
|
assert w.github().get("taken"), "the takeover never fired"
|
|
99
99
|
assert len(w.github()["merges"]) == 1
|
|
100
100
|
assert holder(w) == ["s2"]
|
|
@@ -10,7 +10,8 @@ Interface under test (defined here):
|
|
|
10
10
|
is recomputed for SHA with the trusted merge_risk and the policy committed on origin/<base>.
|
|
11
11
|
--judge agree merges only when that gate is auto; else it hands off with the gate's reasons.
|
|
12
12
|
Merges with `gh pr merge N --<method> --match-head-commit SHA`, never `--auto`, then posts
|
|
13
|
-
`🤖 Merged by babysit-pr: gate passed, judge <label>` and
|
|
13
|
+
`🤖 Merged by babysit-pr: risk <n>/10 (auto up to <limit>), gate passed, judge <label>` and
|
|
14
|
+
exits 0. <n> is the higher of the gate's risk and --judge-risk.
|
|
14
15
|
--approved-sha is the owner's `@babysitter merge <sha>` approval (instead of --judge): it
|
|
15
16
|
needs an owner comment `@babysitter merge <sha>` for it (else nothing merges and it hands
|
|
16
17
|
off with "merge approval must name a commit: @babysitter merge <sha>"), and is honoured only
|
|
@@ -44,7 +45,7 @@ door: two-way
|
|
|
44
45
|
blast_radius: isolated
|
|
45
46
|
touches: [logic, tests]
|
|
46
47
|
rollback: revert
|
|
47
|
-
|
|
48
|
+
risk: 1
|
|
48
49
|
reasons:
|
|
49
50
|
- "small and reversible"
|
|
50
51
|
```
|
|
@@ -82,10 +83,10 @@ def world(tmp_path, head="a1b2c3d", commits=None, body=BLOCK, policy=None, appro
|
|
|
82
83
|
green = [{"name": "ci", "status": "completed", "conclusion": "success",
|
|
83
84
|
"created_at": iso(T), "started_at": iso(T)}]
|
|
84
85
|
st.update(head_sha=head, title="feat: parse empty rows", body=body, # the live PR body is the gated one
|
|
85
|
-
commits=commits or [commit(head)], **{"check_runs": {head: green}, **state})
|
|
86
|
+
commits=commits or [commit(head)], **{"check_runs": {head: green}, "private": True, **state})
|
|
86
87
|
w.state.write_text(json.dumps(st))
|
|
87
88
|
(tmp_path / "body.md").write_text(body)
|
|
88
|
-
checkout(w, [c["sha"] for c in st["commits"]], policy or {"
|
|
89
|
+
checkout(w, [c["sha"] for c in st["commits"]], policy or {"maxAutoRisk": 5})
|
|
89
90
|
if policy: # the same policy also feeds `--policy`, the merge method
|
|
90
91
|
w.policy_file = tmp_path / "policy.json"
|
|
91
92
|
w.policy_file.write_text(json.dumps(policy))
|
|
@@ -117,14 +118,14 @@ def handoffs(w):
|
|
|
117
118
|
|
|
118
119
|
def test_stale_gate_sha_fails_and_nothing_merges(tmp_path):
|
|
119
120
|
w = world(tmp_path, head="f0e1d2c", commits=[commit("a1b2c3d"), commit("f0e1d2c", author="alice")])
|
|
120
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
121
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
121
122
|
assert p.returncode != 0
|
|
122
123
|
assert "gate again" in p.output
|
|
123
124
|
assert w.github().get("merges", []) == []
|
|
124
125
|
assert not any("Merged by babysit-pr" in b for b in comments(w))
|
|
125
126
|
|
|
126
127
|
|
|
127
|
-
@pytest.mark.parametrize("extra", [("--judge", "agree"), ("--approved-sha", "a1b2c3d")])
|
|
128
|
+
@pytest.mark.parametrize("extra", [("--judge", "agree", "--judge-risk", "1"), ("--approved-sha", "a1b2c3d")])
|
|
128
129
|
def test_head_with_no_checks_hands_off_and_nothing_merges(tmp_path, extra):
|
|
129
130
|
w = world(tmp_path, check_runs={}, approvals=("a1b2c3d",))
|
|
130
131
|
p = merge(w, tmp_path, "a1b2c3d", *extra)
|
|
@@ -136,18 +137,18 @@ def test_head_with_no_checks_hands_off_and_nothing_merges(tmp_path, extra):
|
|
|
136
137
|
|
|
137
138
|
def test_default_method_is_rebase_pinned_to_the_gated_sha_and_commented(tmp_path):
|
|
138
139
|
w = world(tmp_path)
|
|
139
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
140
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
140
141
|
assert p.returncode == 0, p.output
|
|
141
142
|
[m] = w.github()["merges"]
|
|
142
143
|
assert (m["number"], m["method"], m["match"], m["auto"]) == ("58", "rebase", "a1b2c3d", False)
|
|
143
|
-
assert "🤖 Merged by babysit-pr: gate passed, judge agree" in comments(w)
|
|
144
|
+
assert "🤖 Merged by babysit-pr: risk 4/10 (auto up to 5), gate passed, judge agree" in comments(w)
|
|
144
145
|
|
|
145
146
|
|
|
146
147
|
def test_same_model_judge_shows_in_the_merge_comment(tmp_path):
|
|
147
148
|
w = world(tmp_path)
|
|
148
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "same-model agree")
|
|
149
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "same-model agree", "--judge-risk", "1")
|
|
149
150
|
assert p.returncode == 0, p.output
|
|
150
|
-
assert "🤖 Merged by babysit-pr: gate passed, judge same-model agree" in comments(w)
|
|
151
|
+
assert "🤖 Merged by babysit-pr: risk 4/10 (auto up to 5), gate passed, judge same-model agree" in comments(w)
|
|
151
152
|
|
|
152
153
|
|
|
153
154
|
def test_merge_method_is_merge_when_the_branch_has_a_merge_commit(tmp_path):
|
|
@@ -155,7 +156,7 @@ def test_merge_method_is_merge_when_the_branch_has_a_merge_commit(tmp_path):
|
|
|
155
156
|
p = cli(w, "merge-method", "--repo", "jesdi/demo", "--pr", "58")
|
|
156
157
|
assert p.returncode == 0, p.output
|
|
157
158
|
assert json.loads(p.stdout) == {"method": "merge"}
|
|
158
|
-
assert merge(w, tmp_path, "a1b2c3d", "--judge", "agree").returncode == 0
|
|
159
|
+
assert merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1").returncode == 0
|
|
159
160
|
assert w.github()["merges"][0]["method"] == "merge"
|
|
160
161
|
|
|
161
162
|
|
|
@@ -166,8 +167,8 @@ def test_merge_method_is_rebase_for_a_linear_branch(tmp_path):
|
|
|
166
167
|
|
|
167
168
|
|
|
168
169
|
def test_squash_policy_keeps_the_title_summary_and_block_digest(tmp_path):
|
|
169
|
-
w = world(tmp_path, policy={"
|
|
170
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
170
|
+
w = world(tmp_path, policy={"maxAutoRisk": 5, "mergeMethod": "squash"})
|
|
171
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
171
172
|
assert p.returncode == 0, p.output
|
|
172
173
|
[m] = w.github()["merges"]
|
|
173
174
|
assert m["method"] == "squash"
|
|
@@ -180,7 +181,7 @@ def test_squash_policy_keeps_the_title_summary_and_block_digest(tmp_path):
|
|
|
180
181
|
def test_required_approval_failure_hands_off(tmp_path):
|
|
181
182
|
w = world(tmp_path, merge_error="At least 1 approving review is required by reviewers "
|
|
182
183
|
"with write access.")
|
|
183
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
184
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
184
185
|
assert p.returncode != 0
|
|
185
186
|
[h] = handoffs(w)
|
|
186
187
|
assert h.startswith("## 🧑 Needs human: merge blocked: approval required")
|
|
@@ -249,9 +250,9 @@ def test_approval_voided_by_a_rebase_hands_off(tmp_path):
|
|
|
249
250
|
|
|
250
251
|
|
|
251
252
|
@pytest.mark.parametrize("method", [None, "squash", "merge", "rebase"])
|
|
252
|
-
@pytest.mark.parametrize("extra", [("--judge", "agree"), ("--approved-sha", "a1b2c3d")])
|
|
253
|
+
@pytest.mark.parametrize("extra", [("--judge", "agree", "--judge-risk", "1"), ("--approved-sha", "a1b2c3d")])
|
|
253
254
|
def test_auto_merge_is_never_requested(tmp_path, extra, method):
|
|
254
|
-
policy = {"
|
|
255
|
+
policy = {"maxAutoRisk": 5, "mergeMethod": method} if method else None
|
|
255
256
|
w = world(tmp_path, policy=policy, approvals=("a1b2c3d",))
|
|
256
257
|
assert merge(w, tmp_path, "a1b2c3d", *extra).returncode == 0
|
|
257
258
|
[m] = w.github()["merges"]
|
|
@@ -4,7 +4,7 @@ from test_merge_and_handoff import merge, world
|
|
|
4
4
|
|
|
5
5
|
def test_remote_base_ahead_of_the_local_ref_merges_nothing(tmp_path):
|
|
6
6
|
w = world(tmp_path, base_sha="f" * 40) # origin/main locally is another commit
|
|
7
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
7
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
8
8
|
assert p.returncode != 0
|
|
9
9
|
assert "gate again" in p.output
|
|
10
10
|
assert w.github().get("merges", []) == []
|
|
@@ -17,26 +17,61 @@ def merged(w):
|
|
|
17
17
|
return w.github().get("merges", [])
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def
|
|
21
|
-
w = world(tmp_path, policy={"
|
|
22
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
20
|
+
def test_max_auto_risk_0_hands_off_with_the_policy_as_the_reason(tmp_path):
|
|
21
|
+
w = world(tmp_path, policy={"maxAutoRisk": 0})
|
|
22
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
23
23
|
assert p.returncode != 0
|
|
24
24
|
assert merged(w) == []
|
|
25
25
|
[h] = handoffs(w)
|
|
26
|
-
assert "
|
|
26
|
+
assert "max auto risk 0" in h.splitlines()[0]
|
|
27
27
|
assert not any("Merged by babysit-pr" in c["body"] for c in w.github()["comments"])
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def test_one_way_door_hands_off_although_the_block_says_auto(tmp_path):
|
|
31
|
-
assert "
|
|
31
|
+
assert "risk: 1" in BLOCK
|
|
32
32
|
w = world(tmp_path, body=BLOCK.replace("door: two-way", "door: one-way"))
|
|
33
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
33
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
34
34
|
assert p.returncode != 0
|
|
35
35
|
assert merged(w) == []
|
|
36
36
|
[h] = handoffs(w)
|
|
37
37
|
assert "door one-way" in h.splitlines()[0]
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
def test_judge_risk_above_the_limit_hands_off(tmp_path):
|
|
41
|
+
w = world(tmp_path)
|
|
42
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "6")
|
|
43
|
+
assert p.returncode != 0
|
|
44
|
+
assert merged(w) == []
|
|
45
|
+
[h] = handoffs(w)
|
|
46
|
+
assert h.startswith("## 🧑 Needs human: judge risk 6 > max auto risk 5")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_agree_without_a_judge_risk_hands_off(tmp_path):
|
|
50
|
+
w = world(tmp_path)
|
|
51
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
52
|
+
assert p.returncode != 0
|
|
53
|
+
assert merged(w) == []
|
|
54
|
+
[h] = handoffs(w)
|
|
55
|
+
assert h.startswith("## 🧑 Needs human: judge risk missing")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_public_repo_caps_the_limit_at_3(tmp_path):
|
|
59
|
+
w = world(tmp_path, private=False) # the policy allows 5; the diff is logic, risk 4
|
|
60
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
61
|
+
assert p.returncode != 0
|
|
62
|
+
assert merged(w) == []
|
|
63
|
+
[h] = handoffs(w)
|
|
64
|
+
assert "risk 4 > max auto risk 3 (public repo)" in h.splitlines()[0]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_owner_approval_merges_a_one_way_door(tmp_path):
|
|
68
|
+
body = BLOCK.replace("door: two-way", "door: one-way")
|
|
69
|
+
w = world(tmp_path, head=HEAD, body=body, approvals=(HEAD,))
|
|
70
|
+
p = merge(w, tmp_path, HEAD, "--approved-sha", HEAD)
|
|
71
|
+
assert p.returncode == 0, p.output
|
|
72
|
+
assert len(merged(w)) == 1
|
|
73
|
+
|
|
74
|
+
|
|
40
75
|
def test_approved_sha_without_an_owner_comment_approves_nothing(tmp_path):
|
|
41
76
|
w = world(tmp_path)
|
|
42
77
|
p = merge(w, tmp_path, "a1b2c3d", "--approved-sha", "a1b2c3d")
|
|
@@ -48,7 +83,7 @@ def test_approved_sha_without_an_owner_comment_approves_nothing(tmp_path):
|
|
|
48
83
|
|
|
49
84
|
def test_owner_comment_with_a_sha_prefix_merges_a_human_verdict_pinned_to_the_head(tmp_path):
|
|
50
85
|
# the policy gives human, so only the owner's comment can merge; the caller passes the full SHA
|
|
51
|
-
w = world(tmp_path, head=HEAD, policy={"
|
|
86
|
+
w = world(tmp_path, head=HEAD, policy={"maxAutoRisk": 0}, approvals=(HEAD[:7],))
|
|
52
87
|
p = merge(w, tmp_path, HEAD, "--approved-sha", HEAD)
|
|
53
88
|
assert p.returncode == 0, p.output
|
|
54
89
|
[m] = merged(w)
|
|
@@ -83,7 +118,7 @@ def test_judge_with_a_trusted_pr_risk_lacking_classify_diff_hands_off(tmp_path):
|
|
|
83
118
|
def test_merge_with_a_trusted_pr_risk_lacking_classify_diff_hands_off(tmp_path):
|
|
84
119
|
w = world(tmp_path, pr_risk=False)
|
|
85
120
|
old_install(w.home / ".claude" / "skills" / "pr-risk", ["classify_diff"])
|
|
86
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
121
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
87
122
|
assert p.returncode != 0
|
|
88
123
|
assert "AttributeError" not in p.output
|
|
89
124
|
assert merged(w) == []
|
|
@@ -93,8 +128,8 @@ def test_merge_with_a_trusted_pr_risk_lacking_classify_diff_hands_off(tmp_path):
|
|
|
93
128
|
|
|
94
129
|
def test_gate_reads_the_diff_of_the_sha_it_merges_not_the_checked_out_head(tmp_path):
|
|
95
130
|
# the checkout sits on `work` (= origin/main, an empty diff); only HEAD's own commit adds a counted line
|
|
96
|
-
w = world(tmp_path, policy={"
|
|
97
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
131
|
+
w = world(tmp_path, policy={"maxAutoRisk": 5, "judgeMaxLines": 0})
|
|
132
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
98
133
|
assert p.returncode != 0
|
|
99
134
|
assert merged(w) == []
|
|
100
135
|
[h] = handoffs(w)
|
|
@@ -111,14 +146,14 @@ def live_body_differs(tmp_path, live, *extra):
|
|
|
111
146
|
|
|
112
147
|
|
|
113
148
|
def test_saved_body_does_not_stand_in_for_a_one_way_live_body(tmp_path):
|
|
114
|
-
w, p = live_body_differs(tmp_path, BLOCK.replace("door: two-way", "door: one-way"), "--judge", "agree")
|
|
149
|
+
w, p = live_body_differs(tmp_path, BLOCK.replace("door: two-way", "door: one-way"), "--judge", "agree", "--judge-risk", "1")
|
|
115
150
|
assert p.returncode != 0
|
|
116
151
|
assert merged(w) == []
|
|
117
152
|
assert not any("Merged by babysit-pr" in c["body"] for c in w.github()["comments"])
|
|
118
153
|
|
|
119
154
|
|
|
120
155
|
def test_saved_body_does_not_stand_in_for_an_empty_live_body(tmp_path):
|
|
121
|
-
w, p = live_body_differs(tmp_path, "", "--judge", "agree")
|
|
156
|
+
w, p = live_body_differs(tmp_path, "", "--judge", "agree", "--judge-risk", "1")
|
|
122
157
|
assert p.returncode != 0
|
|
123
158
|
assert merged(w) == []
|
|
124
159
|
assert not any("Merged by babysit-pr" in c["body"] for c in w.github()["comments"])
|
|
@@ -129,7 +164,7 @@ def test_open_prs_into_the_head_branch_hand_off_and_nothing_merges(tmp_path):
|
|
|
129
164
|
w = world(tmp_path, head_ref="feat/new-cart",
|
|
130
165
|
open_prs=[{"number": 57, "base": "feat/new-cart"}, {"number": 60, "base": "main"},
|
|
131
166
|
{"number": 61, "base": "feat/new-cart"}])
|
|
132
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
167
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
133
168
|
assert p.returncode != 0
|
|
134
169
|
assert merged(w) == []
|
|
135
170
|
[h] = handoffs(w)
|
|
@@ -138,6 +173,6 @@ def test_open_prs_into_the_head_branch_hand_off_and_nothing_merges(tmp_path):
|
|
|
138
173
|
|
|
139
174
|
def test_open_prs_into_other_branches_do_not_block_the_merge(tmp_path):
|
|
140
175
|
w = world(tmp_path, head_ref="feat/new-cart", open_prs=[{"number": 60, "base": "main"}])
|
|
141
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
176
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
142
177
|
assert p.returncode == 0, p.output
|
|
143
178
|
assert len(merged(w)) == 1
|
|
@@ -41,7 +41,7 @@ def test_handoff_retry_cannot_end_resumed_session(tmp_path):
|
|
|
41
41
|
def test_stale_session_cannot_merge_or_release_new_holder(tmp_path):
|
|
42
42
|
w = world(tmp_path)
|
|
43
43
|
assert w.run("acquire", "s2").returncode == 0
|
|
44
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--session", "s1")
|
|
44
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1", "--session", "s1")
|
|
45
45
|
assert p.returncode != 0, p.output
|
|
46
46
|
assert w.github().get("merges", []) == []
|
|
47
47
|
assert handoffs(w) == []
|
|
@@ -52,7 +52,7 @@ def test_sessionless_merge_cannot_adopt_a_lease(tmp_path):
|
|
|
52
52
|
w = world(tmp_path)
|
|
53
53
|
assert w.run("acquire", "s2").returncode == 0
|
|
54
54
|
before = w.github()
|
|
55
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree")
|
|
55
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1")
|
|
56
56
|
assert p.returncode != 0, p.output
|
|
57
57
|
assert "--session" in p.output
|
|
58
58
|
assert w.github() == before
|
|
@@ -110,7 +110,7 @@ def test_handoff_rechecks_ownership_after_posting_comment(tmp_path):
|
|
|
110
110
|
def test_merge_with_own_session_ends_only_its_lease(tmp_path):
|
|
111
111
|
w = world(tmp_path)
|
|
112
112
|
assert w.run("acquire", "s1").returncode == 0
|
|
113
|
-
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--session", "s1")
|
|
113
|
+
p = merge(w, tmp_path, "a1b2c3d", "--judge", "agree", "--judge-risk", "1", "--session", "s1")
|
|
114
114
|
assert p.returncode == 0, p.output
|
|
115
115
|
assert len(w.github()["merges"]) == 1
|
|
116
116
|
assert w.active_leases() == []
|
|
@@ -51,7 +51,7 @@ if fire:
|
|
|
51
51
|
check=True, stdout=subprocess.DEVNULL)
|
|
52
52
|
if kind == "successor":
|
|
53
53
|
subprocess.run([*base, "merge", *where, "--sha", "a1b2c3d", "--body", {body!r},
|
|
54
|
-
"--judge", "agree", "--session", "s2"], check=True, stdout=subprocess.DEVNULL)
|
|
54
|
+
"--judge", "agree", "--judge-risk", "1", "--session", "s2"], check=True, stdout=subprocess.DEVNULL)
|
|
55
55
|
subprocess.run([*base, "lease", "release", *where, "--session", "s2"], stdout=subprocess.DEVNULL)
|
|
56
56
|
st = json.loads(state.read_text())
|
|
57
57
|
st["taken"] = True
|
|
@@ -87,7 +87,7 @@ def test_completed_successor_merge_clears_stale_handoff(tmp_path, finish_at):
|
|
|
87
87
|
st["s2merged"] = True
|
|
88
88
|
state.write_text(json.dumps(st))
|
|
89
89
|
subprocess.run([sys.executable, SCRIPT, "merge", "--repo", "jesdi/demo", "--pr", "58",
|
|
90
|
-
"--sha", "a1b2c3d", "--body", BODY, "--judge", "agree", "--session", "s2"],
|
|
90
|
+
"--sha", "a1b2c3d", "--body", BODY, "--judge", "agree", "--judge-risk", "1", "--session", "s2"],
|
|
91
91
|
check=True, stdout=subprocess.DEVNULL)
|
|
92
92
|
st = json.loads(state.read_text())
|
|
93
93
|
'''.replace("TRIGGER", trigger)
|
|
@@ -56,7 +56,7 @@ def run_judge(j, script, home):
|
|
|
56
56
|
|
|
57
57
|
def judge_world(tmp_path):
|
|
58
58
|
j = Judge(tmp_path)
|
|
59
|
-
j.answer.write_text('{"verdict": "agree", "reason": "ok"}')
|
|
59
|
+
j.answer.write_text('{"verdict": "agree", "risk": 1, "reason": "ok"}')
|
|
60
60
|
home = tmp_path / "home"
|
|
61
61
|
home.mkdir()
|
|
62
62
|
return j, home, stage_script(tmp_path)
|
|
@@ -13,7 +13,7 @@ A comment in the code is for a line that looks wrong or removable without it.
|
|
|
13
13
|
| `driver.py` | The command line, the checks before the first agent, the walk of the ticket graph, one ticket from its phase to merged or blocked, the landing on the PR branch, the exit code |
|
|
14
14
|
| `driver_run.py` | `Run` (what all ticket threads share), one agent with its one rerun, the gate call, the ledger, `Blocked` |
|
|
15
15
|
| `driver_fixloop.py` | A gated ticket tip in, a reviewed tip out: review, test-writer correction, fix rounds |
|
|
16
|
-
| `driver_dispute.py` | A disputed locked test: the arbitration, its correction, the once-per-
|
|
16
|
+
| `driver_dispute.py` | A disputed locked test: the arbitration, its correction, the once-per-test record, `spec-ambiguous` |
|
|
17
17
|
| `driver_final.py` | The end of run: tidy, rebase, gate, final review, one fix batch, push |
|
|
18
18
|
| `driver_tickets.py`, `driver_graph.py` | Ticket files in, tickets or errors out; which tickets can start now |
|
|
19
19
|
| `driver_agents.py` | Model entries, the CLI command of each provider, prompt templates, the blocking launch |
|
|
@@ -187,18 +187,30 @@ and do not know about the run, except `driver_run.py`, which the deciding module
|
|
|
187
187
|
second correction could not close it.
|
|
188
188
|
- Every test-writer correction, after a `test-wrong` ruling, a review finding or a `correct-test` answer, is one
|
|
189
189
|
`driver_dispute.correct`: it runs the test-writer on the findings it is given, makes its commit the baseline,
|
|
190
|
-
keeps the reading of each
|
|
190
|
+
keeps the reading of each locked test it corrected in `corrected` (none after an answer) and logs one line per
|
|
191
|
+
finding.
|
|
191
192
|
The callers differ only by the findings and the readings they pass.
|
|
192
193
|
- No test-writer correction runs after round 2 (`driver_fixloop._act_on`): a red gate or an unmet criterion blocks
|
|
193
194
|
the ticket. Other open findings go to the final must-fix list when the gate is green. A correction at the cap
|
|
194
195
|
would add locked tests that no fix round could make green.
|
|
195
|
-
- A locked
|
|
196
|
-
`corrected`,
|
|
197
|
-
`driver_report.
|
|
198
|
-
|
|
196
|
+
- A locked test is arbitrated once and corrected once per ticket. The ticket record keeps them in `disputes` and
|
|
197
|
+
`corrected`, by the `key` of each `driver_report.Dispute`, worked out once where it comes in. A dispute's key is
|
|
198
|
+
`driver_report.test_key`: `<locked file>::<test>`, the file resolved against the ticket's `locked` by
|
|
199
|
+
`driver_report._locked_file`, a parametrized case as its test. A review finding's key is
|
|
200
|
+
`driver_dispute.requested`: the test it names in `test`; the file for a `fixture` finding that names none; else
|
|
201
|
+
`<file>::+<title>`, a test to add. A per-file key made the operator rule on every second test of a file, and on
|
|
202
|
+
every missing test a review asked for, and answer `correct-test` each time. Only `driver_dispute._settle` and
|
|
203
|
+
`driver_dispute.correct` write them; no answer does, so no answer resets them. A second dispute or a second
|
|
199
204
|
correction asks `spec-ambiguous` (`driver_dispute.ambiguous`); its evidence file is the findings file a
|
|
200
|
-
`correct-test` correction reads (`driver_dispute.correct_as_answered`), and its
|
|
201
|
-
reviews (`driver_dispute.
|
|
205
|
+
`correct-test` correction reads (`driver_dispute.correct_as_answered`), and its `key`s are the ones `keep-test`
|
|
206
|
+
closes for later reviews (`driver_dispute.kept`, `driver_fixloop._still_to_correct`).
|
|
207
|
+
- A renamed or added test has a new key, so the per-key rule alone does not bound the arbitrations and the review
|
|
208
|
+
corrections of a ticket, and a review correction does not advance the round. The ticket's `settled` counts them,
|
|
209
|
+
in the same `state.json` write as the record it counts (`_settle`'s `settle`, `correct`'s `settles`), so a resume
|
|
210
|
+
neither counts one twice nor drops one. `driver_dispute.admit` is the one gate before a settlement: a key already
|
|
211
|
+
in the record, or `settled` at `driver_dispute.SETTLEMENTS` (3), asks `spec-ambiguous`, so each further one costs
|
|
212
|
+
an answer. `driver_legacy._per_test` moves a schema 4 record, and the evidence of the ticket's questions, to the
|
|
213
|
+
new keys and seeds `settled`, so the live code knows one key shape.
|
|
202
214
|
- `driver_run._attempts` treats a stop (BLOCKED or NEEDS_CONTEXT, not a dispute of a locked test) of any agent
|
|
203
215
|
as a rejected attempt: the rerun runs on the next entry of the role's list (`_rerun_entry`; the ticket fixer's list
|
|
204
216
|
is the implementer's), with the concerns or the driver's error in its prompt. A second stop or rejection asks a
|