@jesdi/skills 0.0.67 → 0.0.69
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/implement-spec/ARCHITECTURE.md +5 -5
- package/skills/implement-spec/README.md +12 -12
- package/skills/implement-spec/SKILL.md +1 -1
- package/skills/implement-spec/driver_agents.py +3 -1
- package/skills/implement-spec/driver_final.py +38 -10
- package/skills/implement-spec/driver_fixloop.py +91 -17
- package/skills/implement-spec/driver_report.py +9 -1
- package/skills/implement-spec/driver_review.py +1 -0
- package/skills/implement-spec/driver_state.py +1 -1
- package/skills/implement-spec/driver_tickets.py +2 -0
- package/skills/implement-spec/models.json +1 -1
- package/skills/implement-spec/prompts/correctness.md +4 -2
- package/skills/implement-spec/prompts/final-fixer.md +4 -1
- package/skills/implement-spec/prompts/final-reviewer.md +7 -4
- package/skills/implement-spec/prompts/final-scoped.md +1 -1
- package/skills/implement-spec/prompts/rereview.md +1 -1
- package/skills/implement-spec/prompts/reviewer.md +5 -3
- package/skills/implement-spec/tests/test_cli.py +44 -0
- package/skills/implement-spec/tests/test_decisions.py +1 -39
- package/skills/implement-spec/tests/test_driver.py +2 -0
- package/skills/implement-spec/tests/test_final.py +54 -1
- package/skills/implement-spec/tests/test_fixloop.py +57 -39
- package/skills/implement-spec/tests/test_models.py +1 -1
- package/skills/implement-spec/tests/test_review.py +104 -20
- package/skills/implement-spec/tests/test_stops.py +10 -39
- package/skills/implement-spec/tests/test_walk.py +4 -4
- package/skills-manifest.json +3 -3
|
@@ -7,11 +7,11 @@ Range: {pr_branch}...{branch}, with the ticket tip at {start_sha}
|
|
|
7
7
|
Locked files: {locked}
|
|
8
8
|
Test-writer report, when the ticket has a test-writer: {writer_report}
|
|
9
9
|
|
|
10
|
-
Check the diff against the ticket and the spec
|
|
10
|
+
Check the diff against the ticket and the spec. Put only an unmet ticket criterion or a regression of a merged ticket's behavior in `findings`; set `basis` to `criterion` or `regression` accordingly; put every other observation in `observations` for final review. A red gate is a finding made by the driver. Check that each criterion has a locked test. Test each suspicion that the ticket names in its Suspicions line.
|
|
11
11
|
To make a mutation proof for a locked test, break the production line the test protects, run the test, print its failing output, then revert the edit. The end of this prompt names the proofs that this review needs. A test that stays green is a critical finding. Run again each mutation that the test-writer report names in `concerns`.
|
|
12
12
|
A mutation proof is keyed to its test and its production line: a later round repeats it only when that line changed.
|
|
13
13
|
In `mutations`, give for each proof the test as `<locked file>::<test name>`, the production file and line, and one failure line copied exactly from the output you printed.
|
|
14
|
-
Give each finding a severity (critical, important or minor), the file and line, a title, the evidence, and a kind: `fixture` when a locked test encodes a stale path, format or setup detail; `test` when a test is weak or missing, as a locked test that stays green when you break the line it protects; `code` for anything else. The test-writer corrects each `fixture` finding and each critical or important `test` finding on a locked file, and the fixer gets the rest.
|
|
14
|
+
Give each finding and observation a severity (critical, important or minor), the file and line, a title, the evidence, and a kind: `fixture` when a locked test encodes a stale path, format or setup detail; `test` when a test is weak or missing, as a locked test that stays green when you break the line it protects; `code` for anything else. The test-writer corrects each `fixture` finding and each critical or important `test` finding on a locked file, and the fixer gets the rest.
|
|
15
15
|
Do not commit and do not dispatch subagents. Leave the tree as you found it.
|
|
16
16
|
|
|
17
17
|
Write one JSON report at {report}. When your sandbox is read-only, give the JSON as your whole final message and the driver saves it there. The report matches this schema:
|
|
@@ -24,7 +24,9 @@ Write one JSON report at {report}. When your sandbox is read-only, give the JSON
|
|
|
24
24
|
"status": {"enum": ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"]},
|
|
25
25
|
"files": {"type": "array", "items": {"type": "string"}},
|
|
26
26
|
"concerns": {"type": "array", "items": {"type": "string"}},
|
|
27
|
-
"findings": {"type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}}}},
|
|
27
|
+
"findings": {"type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}, "basis": {"enum": ["criterion", "regression"]}}}},
|
|
28
|
+
"observations": {"type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}}}},
|
|
29
|
+
"regressions": {"description": "After a fix: new regressions introduced by that fix. Set basis to criterion when a ticket criterion fails, or regression when merged-ticket behavior fails.", "type": "array", "items": {"type": "object", "required": ["severity", "file", "line", "title", "evidence", "kind"], "properties": {"severity": {"enum": ["critical", "important", "minor"]}, "file": {"type": "string"}, "line": {"type": "integer"}, "title": {"type": "string", "minLength": 1}, "evidence": {"type": "string", "minLength": 1}, "kind": {"enum": ["code", "fixture", "test"]}, "basis": {"enum": ["criterion", "regression"]}}}},
|
|
28
30
|
"mutations": {"description": "Required in a full review: one proof or more for each locked test file that the end of this prompt names (a locked fixture holds no test and needs none), with `test` as `<locked file>::<test name>`. A review scoped to a fix gives the proofs that it names.", "type": "array", "items": {"type": "object", "required": ["test", "file", "line", "red"], "properties": {"test": {"type": "string", "minLength": 1}, "file": {"type": "string", "minLength": 1}, "line": {"type": "integer"}, "red": {"type": "string", "minLength": 1}}}}
|
|
29
31
|
}
|
|
30
32
|
}
|
|
@@ -87,6 +87,10 @@ def models_file(tmp_path, **overrides):
|
|
|
87
87
|
entries = {role: ["anthropic/claude-opus-5@medium"] for role in ROLES}
|
|
88
88
|
entries["correctness"] = ["openai/gpt-sol@medium"]
|
|
89
89
|
entries.update(overrides)
|
|
90
|
+
if len(entries["implementer"]) == 1:
|
|
91
|
+
first = entries["implementer"][0]
|
|
92
|
+
next_entry = "anthropic/claude-opus-5@medium" if first.startswith("openai/") else "openai/gpt-sol@medium"
|
|
93
|
+
entries["implementer"] = [first, next_entry]
|
|
90
94
|
path = tmp_path / "models.json"
|
|
91
95
|
path.write_text(json.dumps(entries))
|
|
92
96
|
return path
|
|
@@ -160,6 +164,30 @@ def test_blocked_by_unknown_number_names_file_and_number(env, tmp_path):
|
|
|
160
164
|
assert any("02-quote-fields.md" in l and "07" in l for l in proc.stdout.splitlines())
|
|
161
165
|
|
|
162
166
|
|
|
167
|
+
def test_six_tickets_are_refused_before_any_work_starts(env, tmp_path):
|
|
168
|
+
files = {f"{n:02d}-ticket-{n}.md": ticket(f"{n:02d}", f"Ticket {n}") for n in range(1, 7)}
|
|
169
|
+
repo = make_repo(tmp_path / "demo", files)
|
|
170
|
+
before = snapshot(repo)
|
|
171
|
+
|
|
172
|
+
proc = drive(env, repo)
|
|
173
|
+
|
|
174
|
+
assert proc.returncode == 3, proc.stdout + proc.stderr
|
|
175
|
+
assert "split into increments" in proc.stdout
|
|
176
|
+
assert_untouched(proc, repo, before, tmp_path)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def test_five_tickets_remain_valid_input(env, tmp_path):
|
|
180
|
+
files = {f"{n:02d}-ticket-{n}.md": ticket(f"{n:02d}", f"Ticket {n}") for n in range(1, 6)}
|
|
181
|
+
repo = make_repo(tmp_path / "demo", files)
|
|
182
|
+
before = snapshot(repo)
|
|
183
|
+
|
|
184
|
+
proc = drive(env, repo)
|
|
185
|
+
|
|
186
|
+
assert proc.returncode == 0, proc.stdout + proc.stderr
|
|
187
|
+
assert "max frontier width: 5" in proc.stdout
|
|
188
|
+
assert_untouched(proc, repo, before, tmp_path)
|
|
189
|
+
|
|
190
|
+
|
|
163
191
|
@pytest.mark.parametrize("files, code", [
|
|
164
192
|
(three(**{"02-quote-fields.md": ticket("02", "Quote fields", "07")}), 3),
|
|
165
193
|
(three(), 0),
|
|
@@ -204,6 +232,22 @@ def test_models_file_naming_a_provider_without_its_cli_exits_3(env, tmp_path):
|
|
|
204
232
|
assert any("implementer" in l and "codex" in l for l in proc.stdout.splitlines())
|
|
205
233
|
|
|
206
234
|
|
|
235
|
+
def test_one_implementer_model_is_rejected_before_any_agent(env, tmp_path):
|
|
236
|
+
repo = make_repo(tmp_path / "demo", three())
|
|
237
|
+
models = models_file(tmp_path)
|
|
238
|
+
entries = json.loads(models.read_text())
|
|
239
|
+
entries["implementer"] = ["anthropic/claude-opus-5@medium"]
|
|
240
|
+
models.write_text(json.dumps(entries))
|
|
241
|
+
before = snapshot(repo)
|
|
242
|
+
|
|
243
|
+
proc = drive(env, repo, "--tickets", ".agent/tickets", "--gate", "make check", "--models", str(models),
|
|
244
|
+
"--dry-run")
|
|
245
|
+
|
|
246
|
+
assert proc.returncode == 3, proc.stdout + proc.stderr
|
|
247
|
+
assert "second implementer" in proc.stdout
|
|
248
|
+
assert_untouched(proc, repo, before, tmp_path)
|
|
249
|
+
|
|
250
|
+
|
|
207
251
|
@pytest.mark.parametrize("link", ["directory", "file"])
|
|
208
252
|
def test_valid_set_prints_frontier_width_and_dry_run_creates_nothing(env, tmp_path, link):
|
|
209
253
|
repo = make_repo(tmp_path / "demo", three())
|
|
@@ -341,45 +341,7 @@ def test_a_locked_file_keeps_its_old_reference_until_a_test_writer_lists_it(repo
|
|
|
341
341
|
assert [f["title"].split(":")[0] for f in driver_review.locked_findings(".", lost)] == ["locked file check failed"]
|
|
342
342
|
|
|
343
343
|
|
|
344
|
-
# ----------------------------------------------------------------
|
|
345
|
-
|
|
346
|
-
def test_round_4_findings_wait_for_every_answer_before_the_ticket_merges(tmp_path, capsys):
|
|
347
|
-
rig = Inside(tmp_path, ONE)
|
|
348
|
-
bad = review("01", [finding("STUCK-A", line=98), finding("STUCK-B", line=99)])
|
|
349
|
-
rig.run(plan(**{"01/reviewer": [bad] * 5, "01/fixer": [fix("01", n) for n in (1, 2, 3, 4)]}))
|
|
350
|
-
out = capsys.readouterr().out
|
|
351
|
-
one, two = rig.state()["run"]["questions"]
|
|
352
|
-
assert rig.code == 1 and (one["id"], two["id"]) == ("01-finding-1", "01-finding-2") and one["stop"] == two["stop"]
|
|
353
|
-
assert one["subject"] == "STUCK-A (demo/export.py:98)" and one["evidence"][0] == ".agent/implement/01/findings-4.json"
|
|
354
|
-
assert (rig.repo / one["evidence"][0]).exists() and "Question 01-finding-2: " in out and "split (recommended)" in out
|
|
355
|
-
|
|
356
|
-
write_answers(rig, {"01-finding-1": "accept", "01-finding-1.note": "known limit", "01-finding-2.note": "?"})
|
|
357
|
-
rig.run({})
|
|
358
|
-
assert rig.code == 1 and rig.state()["tickets"]["01"]["phase"] == "blocked"
|
|
359
|
-
assert rig.led("Ruling: 01 finding closed as it is (accept): STUCK-A (demo/export.py:98). Note of the operator: known limit")
|
|
360
|
-
assert [q["id"] for q in decisions(rig)["questions"]] == ["01-finding-2"]
|
|
361
|
-
# The file was written for the two questions: for the one that is left it is stale.
|
|
362
|
-
rig.run({})
|
|
363
|
-
assert rig.code == 1 and len(rig.led("Ruling")) == 1 and rig.led("is ignored: its revision")
|
|
364
|
-
rig.run({}, "--answer", "01-finding-2=accept")
|
|
365
|
-
assert rig.code == 0 and rig.state()["tickets"]["01"]["phase"] == "merged" and len(rig.calls("01", "fixer")) == 4
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
def test_a_test_finding_after_round_4_is_a_question_and_accepting_every_question_merges(tmp_path):
|
|
369
|
-
"""Issue 84: after round 4 no test-writer correction runs. Its red locked tests would make `accept` a lie."""
|
|
370
|
-
locks = {**tw("01"), "files": {"tests/test_01.py": "# red lock\n"}, "commit": "test: 01 lock"}
|
|
371
|
-
rig = Inside(tmp_path, ONE, gate={"subjects": ["test: 01 lock"]})
|
|
372
|
-
vacuous = finding("VACUOUS", "critical", kind="test", file="tests/test_01.py", line=1)
|
|
373
|
-
last = review("01", [finding("STUCK"), vacuous])
|
|
374
|
-
rig.run(plan(**{"01/test-writer": [tw("01"), locks], "01/reviewer": [review("01", [finding("STUCK")])] * 4 + [last],
|
|
375
|
-
"01/fixer": [fix("01", n) for n in (1, 2, 3, 4)]}))
|
|
376
|
-
assert rig.code == 1 and len(rig.calls("01", "test-writer")) == 1
|
|
377
|
-
assert [q["subject"] for q in rig.state()["run"]["questions"]] == ["STUCK (demo/export.py:99)",
|
|
378
|
-
"VACUOUS (tests/test_01.py:1)"]
|
|
379
|
-
rig.run({}, "--answer", "01-finding-1=accept", "--answer", "01-finding-2=accept")
|
|
380
|
-
assert rig.code == 0, rig.ledger()
|
|
381
|
-
assert rig.state()["tickets"]["01"]["phase"] == "merged"
|
|
382
|
-
|
|
344
|
+
# ---------------------------------------------------------------- legacy finding-question decisions
|
|
383
345
|
|
|
384
346
|
def test_one_answer_that_keeps_the_ticket_blocked_wins_over_an_accept():
|
|
385
347
|
one = asked("finding", subject="A")
|
|
@@ -82,6 +82,7 @@ def test_models_file_checks_the_first_entry_of_each_role(repo, capsys, tmp_path,
|
|
|
82
82
|
assert run(capsys, "--models", str(models)) == (
|
|
83
83
|
3, "implementer: codex is not on PATH (model entry openai/gpt-sol@medium)\n"
|
|
84
84
|
"fixer: model entry other/x@low names an unknown provider (known: anthropic, openai)\n"
|
|
85
|
+
"implementer: a second implementer model entry is required for fix round 2\n"
|
|
85
86
|
"correctness: no entry of its list (openai/gpt-sol@medium) is on another provider than the implementer's "
|
|
86
87
|
"first entry openai/gpt-sol@medium; the correctness pass never runs on the implementer's provider\n")
|
|
87
88
|
# Requirement 2 names the first entry only: a later implementer entry whose CLI is missing is no error. For the
|
|
@@ -961,6 +962,7 @@ def test_the_preflight_asks_each_used_entry_once_and_names_each_cli_that_fails(t
|
|
|
961
962
|
monkeypatch.setenv("PATH", f"{bin_dir}{os.pathsep}{os.environ['PATH']}")
|
|
962
963
|
monkeypatch.setattr(driver_agents, "PREFLIGHT_MINUTES", 0.02)
|
|
963
964
|
models, _ = driver_agents.load_models(None)
|
|
965
|
+
models["implementer"][1] = "openai/gpt-6.1-sol@medium"
|
|
964
966
|
models["reviewer"] = ["openai/gpt-astra@medium"]
|
|
965
967
|
assert driver_agents.used_entries(models) == ["claude-opus-5-5@medium", "claude-sonnet-5-5@medium",
|
|
966
968
|
"openai/gpt-6-astra@medium", "openai/gpt-6.1-sol@medium",
|
|
@@ -34,7 +34,7 @@ import pytest
|
|
|
34
34
|
from test_cli import SKILL, git, ticket
|
|
35
35
|
from test_review import FABLE, HOOKED, ONE, OPUS, Review, finding, gate_rule, review
|
|
36
36
|
from test_stops import UNATTENDED, decisions, stage
|
|
37
|
-
from test_walk import impl, plan, tw
|
|
37
|
+
from test_walk import fix, impl, plan, tw
|
|
38
38
|
|
|
39
39
|
SCOPED = HOOKED.replace('("reviewer", "correctness")', '("reviewer", "correctness", "final-reviewer")')
|
|
40
40
|
RUNNER = SCOPED.replace(
|
|
@@ -297,6 +297,59 @@ def test_two_findings_make_one_fixer_batch_of_fix_commits_on_top_of_the_unchange
|
|
|
297
297
|
assert ref(fixed.repo, "feat/csv~2") == reviewed
|
|
298
298
|
|
|
299
299
|
|
|
300
|
+
def test_green_ticket_carries_cap_finding_into_required_final_fix(tmp_path):
|
|
301
|
+
rig = Final(tmp_path, THREE, {"implementer": [OPUS, FABLE]})
|
|
302
|
+
recurring = review("02", [{**finding("MERGED-QUOTING-REGRESSION"), "basis": "regression"}])
|
|
303
|
+
scoped = final()
|
|
304
|
+
scoped["report"]["resolved_must_fix"] = ["MERGED-QUOTING-REGRESSION (demo/export.py:99)"]
|
|
305
|
+
batch = fixer(fn("02"), "restore quoting", ticket_of="02")
|
|
306
|
+
batch["report"]["addressed_must_fix"] = ["MERGED-QUOTING-REGRESSION (demo/export.py:99)"]
|
|
307
|
+
steps = plan(**{"02/reviewer": [recurring] * 3, "02/fixer": [fix("02", 1), fix("02", 2)],
|
|
308
|
+
"final/final-reviewer": [final(), scoped], "final/fixer": [batch]})
|
|
309
|
+
|
|
310
|
+
rig.run(steps)
|
|
311
|
+
|
|
312
|
+
assert rig.code == 0, rig.output()
|
|
313
|
+
assert rig.state()["tickets"]["02"]["phase"] == "merged"
|
|
314
|
+
assert not rig.state()["run"]["questions"]
|
|
315
|
+
assert "MERGED-QUOTING-REGRESSION" in rig.final_calls("fixer")[0]["prompt"]
|
|
316
|
+
assert len(rig.final_calls("fixer")) == 1
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def test_unresolved_must_fix_cannot_be_accepted_or_published(tmp_path):
|
|
320
|
+
rig = Final(tmp_path, THREE, {"implementer": [OPUS, FABLE]})
|
|
321
|
+
recurring = review("02", [{**finding("MERGED-QUOTING-REGRESSION"), "basis": "regression"}])
|
|
322
|
+
batch = fixer(fn("02"), "attempt quoting fix", ticket_of="02")
|
|
323
|
+
batch["report"]["addressed_must_fix"] = ["MERGED-QUOTING-REGRESSION (demo/export.py:99)"]
|
|
324
|
+
steps = plan(**{"02/reviewer": [recurring] * 3, "02/fixer": [fix("02", 1), fix("02", 2)],
|
|
325
|
+
"final/final-reviewer": [final(), final(finding("MERGED-QUOTING-REGRESSION"))],
|
|
326
|
+
"final/fixer": [batch]})
|
|
327
|
+
|
|
328
|
+
rig.run(steps)
|
|
329
|
+
|
|
330
|
+
assert rig.code == 1, rig.output()
|
|
331
|
+
assert not rig.state()["run"]["questions"]
|
|
332
|
+
assert [item["title"] for item in rig.state()["run"]["final"]["open"]] == ["MERGED-QUOTING-REGRESSION"]
|
|
333
|
+
assert not rig.pushes() and not rig.prs()
|
|
334
|
+
rig.run(steps)
|
|
335
|
+
assert rig.code == 1 and len(rig.final_calls("fixer")) == 1
|
|
336
|
+
assert not rig.pushes() and not rig.prs()
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def test_final_fix_batch_rejects_an_unaddressed_must_fix(tmp_path):
|
|
340
|
+
rig = Final(tmp_path, THREE, {"implementer": [OPUS, FABLE]})
|
|
341
|
+
recurring = review("02", [{**finding("MERGED-QUOTING-REGRESSION"), "basis": "regression"}])
|
|
342
|
+
steps = plan(**{"02/reviewer": [recurring] * 3, "02/fixer": [fix("02", 1), fix("02", 2)],
|
|
343
|
+
"final/final-reviewer": [final()],
|
|
344
|
+
"final/fixer": [fixer(fn("02"), "attempt quoting fix", ticket_of="02")]})
|
|
345
|
+
|
|
346
|
+
rig.run(steps)
|
|
347
|
+
|
|
348
|
+
assert rig.code == 1, rig.output()
|
|
349
|
+
assert not rig.pushes() and not rig.prs()
|
|
350
|
+
assert any("addressed_must_fix: missing MERGED-QUOTING-REGRESSION (demo/export.py:99)" in line for line in rig.ledger())
|
|
351
|
+
|
|
352
|
+
|
|
300
353
|
def test_the_fixer_of_the_final_review_gets_the_gate_command_and_runs_it_before_it_reports(fixed):
|
|
301
354
|
(batch,) = fixed.final_calls("fixer")
|
|
302
355
|
gate_rule(batch["prompt"], str(fixed.rig / "gate"))
|
|
@@ -18,6 +18,7 @@ import driver_review
|
|
|
18
18
|
import test_review
|
|
19
19
|
from conftest import GIT
|
|
20
20
|
from test_cli import three
|
|
21
|
+
from test_final import RUNNER, final, fixer, fn
|
|
21
22
|
from test_review import FABLE, ONE, OPUS, RISKY, SOL, STUCK, correct, finding, fix, review
|
|
22
23
|
from test_walk import impl, plan, tw
|
|
23
24
|
|
|
@@ -89,6 +90,24 @@ def test_a_risky_ticket_gets_both_agents_and_one_merged_findings_file(tmp_path):
|
|
|
89
90
|
assert json.loads((rig.folder("02") / "findings-1.json").read_text()) == []
|
|
90
91
|
|
|
91
92
|
|
|
93
|
+
def test_capped_regression_is_carried_through_the_final_fix_batch(tmp_path):
|
|
94
|
+
rig = Inside(tmp_path, RISKY)
|
|
95
|
+
(rig.rig / "run-agent").write_text(RUNNER)
|
|
96
|
+
regression = {**finding("QUOTING-REGRESSION"), "basis": "regression"}
|
|
97
|
+
scoped = final()
|
|
98
|
+
scoped["report"]["resolved_must_fix"] = ["QUOTING-REGRESSION (demo/export.py:99)"]
|
|
99
|
+
batch = fixer(fn("02"), "restore quoted fields", ticket_of="02")
|
|
100
|
+
batch["report"]["addressed_must_fix"] = ["QUOTING-REGRESSION (demo/export.py:99)"]
|
|
101
|
+
|
|
102
|
+
rig.run(plan(**{"02/reviewer": [review("02", [regression])] * 3,
|
|
103
|
+
"02/fixer": [fix("02", 1), fix("02", 2)],
|
|
104
|
+
"final/final-reviewer": [final(), scoped], "final/fixer": [batch]}))
|
|
105
|
+
|
|
106
|
+
assert rig.code == 0, rig.ledger()
|
|
107
|
+
assert [item["title"] for item in rig.state()["run"]["final"]["must_fix"]] == ["QUOTING-REGRESSION"]
|
|
108
|
+
assert "QUOTING-REGRESSION" in rig.prompt("fixer-1", "final")
|
|
109
|
+
|
|
110
|
+
|
|
92
111
|
def test_correctness_entry_is_the_first_of_another_provider_than_the_implementers():
|
|
93
112
|
models = {"implementer": ["opus@medium"], "correctness": ["opus@high", "openai/a@low", "openai/b@low"]}
|
|
94
113
|
assert driver_agents.correctness_entry(models) == "openai/a@low"
|
|
@@ -113,7 +132,7 @@ def test_a_changed_locked_file_is_fixed_before_a_fixture_finding_is_corrected(tm
|
|
|
113
132
|
rig = Inside(tmp_path)
|
|
114
133
|
locked = tw("01")["files"]
|
|
115
134
|
cheat = impl("01", files={"demo/export.py": "def fn_01():\n return '01'\n", "tests/test_01.py": "# edited\n"})
|
|
116
|
-
stale = finding("STALE", "
|
|
135
|
+
stale = finding("STALE", "important", kind="fixture", file="tests/test_01.py")
|
|
117
136
|
correction = {**tw("01"), "files": {"tests/test_01.py": "# corrected\n"}, "commit": "test: 01 fixture fix"}
|
|
118
137
|
rig.run(plan(**{"01/implementer": [cheat], "01/test-writer": [tw("01"), correction],
|
|
119
138
|
"01/reviewer": [review("01", [stale]), review("01", [stale]), review("01")],
|
|
@@ -330,15 +349,15 @@ def test_a_fixer_that_reports_a_wrong_locked_test_opens_the_locked_test_question
|
|
|
330
349
|
|
|
331
350
|
def test_the_fix_rounds_count_from_0_after_an_overruled_test(tmp_path):
|
|
332
351
|
stuck = review("01", [STUCK])
|
|
333
|
-
steps = plan(**{"01/reviewer": [stuck
|
|
334
|
-
"01/fixer": [
|
|
352
|
+
steps = plan(**{"01/reviewer": [stuck, stuck, review("01")],
|
|
353
|
+
"01/fixer": [fixer_stops(), fix("01", 1)],
|
|
335
354
|
"01/test-writer": [tw("01"), OVERRULED], "01/implementer": [impl("01"), AGAIN]})
|
|
336
355
|
rig = Inside(tmp_path).run(steps)
|
|
337
|
-
assert rig.code == 2 and rig.state()["tickets"]["01"]["round"] ==
|
|
356
|
+
assert rig.code == 2 and rig.state()["tickets"]["01"]["round"] == 1, rig.ledger()
|
|
338
357
|
rig.run(steps, "--answer", "01-locked-test-1=overrule-test")
|
|
339
|
-
# The corrected tests are a new contract: the first finding on them gets a fix round
|
|
358
|
+
# The corrected tests are a new contract: the first finding on them gets a fresh fix round.
|
|
340
359
|
assert rig.code == 0, rig.ledger()
|
|
341
|
-
assert rig.state()["tickets"]["01"]["round"] == 1 and not rig.led("after round
|
|
360
|
+
assert rig.state()["tickets"]["01"]["round"] == 1 and not rig.led("after round 2")
|
|
342
361
|
|
|
343
362
|
|
|
344
363
|
def test_a_fixture_correction_that_is_rejected_asks_the_operator(tmp_path):
|
|
@@ -583,21 +602,20 @@ def touches_01(n):
|
|
|
583
602
|
"tests/test_01.py": LOCKED_01 + f"# fix {n}\n"})
|
|
584
603
|
|
|
585
604
|
|
|
586
|
-
def
|
|
587
|
-
"""Ticket 02
|
|
588
|
-
|
|
589
|
-
steps = plan(**{"02/reviewer": [review("02", [STUCK])] *
|
|
590
|
-
"02/fixer": [fix("02", 1),
|
|
605
|
+
def changed_at_cap(tmp_path, name, files=None, gate=None):
|
|
606
|
+
"""Ticket 02 changes a merged ticket's locked file in its second fix. The finding is carried to the final
|
|
607
|
+
must-fix list, while the landing still requires a ruling about that file."""
|
|
608
|
+
steps = plan(**{"02/reviewer": [review("02", [STUCK])] * 2 + [review("02")],
|
|
609
|
+
"02/fixer": [fix("02", 1), touches_01(2)]})
|
|
591
610
|
rig = Inside(under(tmp_path, name), files or three(), gate=gate).run(steps, parallel="1")
|
|
592
|
-
assert rig.code ==
|
|
593
|
-
|
|
594
|
-
return rig.run(steps, "--answer", "02-finding-1=accept", parallel="1"), steps
|
|
611
|
+
assert rig.code == 2 and asked(rig) == {f"{MERGED_LOCKED}-1": ["restore", "adopt", "redesign"]}, rig.ledger()
|
|
612
|
+
return rig, steps
|
|
595
613
|
|
|
596
614
|
|
|
597
615
|
def test_an_accepted_change_to_a_merged_ticket_locked_file_asks_at_the_landing_and_restore_lands_it(tmp_path):
|
|
598
616
|
"""Issue #116, comment 1: `accept` sent the ticket to its landing, which the landing check refused with no
|
|
599
617
|
question, so no answer could merge it."""
|
|
600
|
-
rig, steps =
|
|
618
|
+
rig, steps = changed_at_cap(tmp_path, "restore")
|
|
601
619
|
assert rig.code == 2 and rig.state()["tickets"]["02"]["phase"] == "blocked", rig.ledger()
|
|
602
620
|
assert rig.led("Ticket 02: BLOCKED at the merge: locked file changed: tests/test_01.py.")
|
|
603
621
|
assert asked(rig) == {f"{MERGED_LOCKED}-1": ["restore", "adopt", "redesign"]}
|
|
@@ -611,15 +629,15 @@ def test_an_accepted_change_to_a_merged_ticket_locked_file_asks_at_the_landing_a
|
|
|
611
629
|
|
|
612
630
|
|
|
613
631
|
def test_adopt_lands_the_change_to_the_merged_ticket_locked_file_and_the_ticket_locks_it(tmp_path):
|
|
614
|
-
rig, steps =
|
|
632
|
+
rig, steps = changed_at_cap(tmp_path, "adopt")
|
|
615
633
|
rig.run(steps, "--answer", f"{MERGED_LOCKED}-1=adopt", parallel="1")
|
|
616
634
|
assert rig.code == 0, rig.ledger()
|
|
617
|
-
assert on_pr(rig, "tests/test_01.py") == LOCKED_01 + "# fix
|
|
635
|
+
assert on_pr(rig, "tests/test_01.py") == LOCKED_01 + "# fix 2\n"
|
|
618
636
|
assert "tests/test_01.py" in rig.state()["tickets"]["02"]["locked"] and rig.led("by the ruling (adopt)")
|
|
619
637
|
|
|
620
638
|
|
|
621
639
|
def test_redesign_keeps_the_ticket_blocked_at_its_landing(tmp_path):
|
|
622
|
-
rig, steps =
|
|
640
|
+
rig, steps = changed_at_cap(tmp_path, "redesign")
|
|
623
641
|
rig.run(steps, "--answer", f"{MERGED_LOCKED}-1=redesign", parallel="1")
|
|
624
642
|
assert rig.code == 1 and rig.state()["tickets"]["02"]["phase"] == "blocked", rig.ledger()
|
|
625
643
|
assert on_pr(rig, "tests/test_01.py") == LOCKED_01 and not asked(rig)
|
|
@@ -629,7 +647,7 @@ def test_a_restore_that_turns_the_merge_gate_red_is_taken_back_and_asks_again_wi
|
|
|
629
647
|
"""The ticket's code needs its change to the file: the restore commit leaves the ticket branch and the question
|
|
630
648
|
comes back with the options left, so the stop still has an answer."""
|
|
631
649
|
two = {name: text for name, text in three().items() if not name.startswith("03")} # 02 lands as a fast-forward
|
|
632
|
-
rig, steps =
|
|
650
|
+
rig, steps = changed_at_cap(tmp_path, "red", files=two, gate={"subjects": [LANDING_RESTORE]})
|
|
633
651
|
rig.run(steps, "--answer", f"{MERGED_LOCKED}-1=restore", parallel="1")
|
|
634
652
|
assert rig.code == 2 and rig.led("Ticket 02: BLOCKED at the merge: the gate is red on"), rig.ledger()
|
|
635
653
|
assert asked(rig) == {f"{MERGED_LOCKED}-2": ["adopt", "redesign"]}
|
|
@@ -638,18 +656,18 @@ def test_a_restore_that_turns_the_merge_gate_red_is_taken_back_and_asks_again_wi
|
|
|
638
656
|
fixer = rig.calls("02", "fixer")[-1]["sha"]
|
|
639
657
|
assert rig.state()["tickets"]["02"]["tip"] == fixer and on_pr(rig, "tests/test_01.py") == LOCKED_01
|
|
640
658
|
rig.run(steps, "--answer", f"{MERGED_LOCKED}-2=adopt", parallel="1")
|
|
641
|
-
assert rig.code == 0 and on_pr(rig, "tests/test_01.py") == LOCKED_01 + "# fix
|
|
659
|
+
assert rig.code == 0 and on_pr(rig, "tests/test_01.py") == LOCKED_01 + "# fix 2\n", rig.ledger()
|
|
642
660
|
|
|
643
661
|
|
|
644
662
|
# ---------------------------------------------------------------- the rounds
|
|
645
663
|
|
|
646
|
-
def
|
|
664
|
+
def test_two_rounds_then_blocked_with_the_escalation_at_round_2(tmp_path):
|
|
647
665
|
rig = Inside(tmp_path, three(), {"implementer": [OPUS, FABLE]})
|
|
648
|
-
rig.run(plan(**{"01/reviewer": [review("01", [STUCK])] *
|
|
649
|
-
assert rig.code == 1 and rig.state()["tickets"]["01"]["round"] ==
|
|
650
|
-
assert rig.led("BLOCKED at the review: after round
|
|
651
|
-
assert rig.ledger().count(f"Ticket 01 round
|
|
652
|
-
assert [len(rig.led("fixer ran on", entry)) for entry in (OPUS, FABLE)] == [
|
|
666
|
+
rig.run(plan(**{"01/reviewer": [review("01", [STUCK])] * 3, "01/fixer": [fix("01", n) for n in (1, 2)]}))
|
|
667
|
+
assert rig.code == 1 and rig.state()["tickets"]["01"]["round"] == 2
|
|
668
|
+
assert rig.led("BLOCKED at the review: after round 2 these findings are open: STUCK (demo/export.py:99).")
|
|
669
|
+
assert rig.ledger().count(f"Ticket 01 round 2: escalated to {FABLE}.") == 1
|
|
670
|
+
assert [len(rig.led("fixer ran on", entry)) for entry in (OPUS, FABLE)] == [1, 1]
|
|
653
671
|
tips = [rig.sha("01", "implementer")] + [call["sha"] for call in rig.calls("01", "fixer")]
|
|
654
672
|
assert [gate["commit"] for gate in rig.gates() if gate["branch"] == "ticket/feat%2Fcsv/01"] == tips
|
|
655
673
|
assert rig.state()["tickets"]["01"]["tip"] == tips[-1] and not rig.calls("02")
|
|
@@ -779,26 +797,24 @@ def test_a_gate_that_exits_with_any_other_code_is_red_without_running_again(tmp_
|
|
|
779
797
|
assert record.count("exit: ") == 1 and f"\nexit: {exit}\nafter: clean\n" in record
|
|
780
798
|
|
|
781
799
|
|
|
782
|
-
def
|
|
783
|
-
rig = Inside(tmp_path, gate={"subjects": ["fix: 01 round
|
|
784
|
-
rig.run(plan(**{"01/reviewer": [review("01", [STUCK])] *
|
|
800
|
+
def test_a_red_gate_on_the_fixer_commit_of_round_2_blocks_the_ticket(tmp_path):
|
|
801
|
+
rig = Inside(tmp_path, gate={"subjects": ["fix: 01 round 2"]})
|
|
802
|
+
rig.run(plan(**{"01/reviewer": [review("01", [STUCK])] * 2, "01/fixer": [fix("01", n) for n in (1, 2)]}))
|
|
785
803
|
last = rig.calls("01", "fixer")[-1]["sha"]
|
|
786
804
|
assert f"BLOCKED at the gate: the gate is red on {last[:7]}" in blocked(rig)
|
|
787
|
-
assert len(rig.calls("01", "reviewer")) ==
|
|
805
|
+
assert len(rig.calls("01", "reviewer")) == 2 and not (rig.folder() / "findings-2.json").exists()
|
|
788
806
|
|
|
789
807
|
|
|
790
|
-
def
|
|
808
|
+
def test_one_implementer_entry_is_invalid_before_agents_start(tmp_path):
|
|
791
809
|
rig = Inside(tmp_path, ONE, {"implementer": [OPUS]})
|
|
792
|
-
rig.
|
|
793
|
-
|
|
794
|
-
assert rig.
|
|
795
|
-
assert len(rig.led("fixer ran on", OPUS)) == 3
|
|
810
|
+
rig.models.write_text(json.dumps({**json.loads(rig.models.read_text()), "implementer": [OPUS]}))
|
|
811
|
+
rig.run(plan())
|
|
812
|
+
assert rig.code == 3 and not rig.calls()
|
|
796
813
|
|
|
797
814
|
|
|
798
815
|
def test_the_escalation_takes_the_next_entry_of_the_list():
|
|
799
816
|
models = {"implementer": ["a@low", "openai/b@low", "c@low"]}
|
|
800
|
-
assert [driver_fixloop.entry(models, n) for n in (1, 2
|
|
801
|
-
assert driver_fixloop.entry({"implementer": ["a@low"]}, 3) == "a@low"
|
|
817
|
+
assert [driver_fixloop.entry(models, n) for n in (1, 2)] == ["a@low", "openai/b@low"]
|
|
802
818
|
|
|
803
819
|
|
|
804
820
|
def test_a_fixer_that_does_not_finish_blocks_the_ticket_in_its_round(tmp_path):
|
|
@@ -831,8 +847,10 @@ def test_a_full_review_after_a_correction_names_each_locked_file_that_needs_a_pr
|
|
|
831
847
|
vacuous = finding("VACUOUS", "critical", kind="test", file="tests/test_01.py")
|
|
832
848
|
correction = {**first, "files": {"tests/test_01.py": "# stronger\n"}, "commit": "test: 01 stronger test"}
|
|
833
849
|
correction["report"] = {**first["report"], "files": ["tests/test_01.py"], "locked": ["tests/test_01.py"]}
|
|
850
|
+
regression = review("01", lines=())
|
|
851
|
+
regression["report"]["regressions"] = [vacuous]
|
|
834
852
|
rig = Inside(tmp_path).run(plan(**{"01/test-writer": [first, correction], "01/fixer": [fix("01", 1)],
|
|
835
|
-
"01/reviewer": [both([STUCK]),
|
|
853
|
+
"01/reviewer": [both([STUCK]), regression, both()]}))
|
|
836
854
|
assert rig.code == 0, rig.ledger()
|
|
837
855
|
order = [call["role"] for call in rig.calls("01")]
|
|
838
856
|
assert order == ["test-writer", "implementer", "reviewer", "fixer", "reviewer", "test-writer", "reviewer"]
|
|
@@ -1072,7 +1090,7 @@ def test_a_re_review_names_only_the_proofs_the_fix_made_due(tmp_path):
|
|
|
1072
1090
|
assert "no proof is due): demo/export.py:12 demo/export.py:30\n" in rig.prompt("reviewer-1")
|
|
1073
1091
|
assert "no proof is due): demo/export.py:30\n" in rig.prompt("reviewer-2")
|
|
1074
1092
|
old, new = rig.sha("01", "implementer"), rig.calls("01", "fixer")[0]["sha"]
|
|
1075
|
-
assert f"The fix is {old}..{new}:
|
|
1093
|
+
assert f"The fix is {old}..{new}: check only whether your own critical or important findings" in rig.prompt("reviewer-1")
|
|
1076
1094
|
|
|
1077
1095
|
|
|
1078
1096
|
def test_a_proof_follows_its_line_through_inserts_and_deletes(tmp_path):
|
|
@@ -8,7 +8,7 @@ import pytest
|
|
|
8
8
|
from test_cli import RUN, SKILL, drive, env, make_repo, three # noqa: F401 (env is a fixture)
|
|
9
9
|
|
|
10
10
|
STANDARD = {
|
|
11
|
-
"implementer": ["claude-sonnet-5-5@medium", "
|
|
11
|
+
"implementer": ["claude-sonnet-5-5@medium", "claude-opus-5-5@medium"],
|
|
12
12
|
"test-writer": ["claude-sonnet-5-5@medium", "openai/gpt-6.1-sol@medium"],
|
|
13
13
|
"reviewer": ["openai/gpt-6-astra@medium", "claude-opus-5-5@medium"],
|
|
14
14
|
"final-reviewer": ["openai/gpt-6-astra@medium", "claude-opus-5-5@medium"],
|