@jesdi/skills 0.0.94 → 0.0.96
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 +1 -1
- package/skills/implement-spec/README.md +10 -9
- package/skills/implement-spec/SKILL.md +1 -1
- package/skills/implement-spec/driver.py +31 -28
- package/skills/implement-spec/driver_agents.py +5 -2
- package/skills/implement-spec/driver_decisions.py +12 -7
- package/skills/implement-spec/driver_final.py +64 -34
- package/skills/implement-spec/driver_final_gate.py +41 -0
- package/skills/implement-spec/driver_fixloop.py +0 -27
- package/skills/implement-spec/driver_merge.py +34 -10
- package/skills/implement-spec/driver_report.py +1 -1
- package/skills/implement-spec/driver_run.py +1 -1
- package/skills/implement-spec/driver_state.py +2 -2
- package/skills/implement-spec/driver_tidy.py +1 -1
- package/skills/implement-spec/prompts/final-gate-fixer.md +33 -0
- package/skills/implement-spec/prompts/landing-red.md +1 -1
- package/skills/implement-spec/prompts/pr-body.md +2 -2
- package/skills/implement-spec/tests/test_arbitration.py +1 -1
- package/skills/implement-spec/tests/test_driver.py +60 -62
- package/skills/implement-spec/tests/test_final.py +57 -1
- package/skills/implement-spec/tests/test_final_gate.py +155 -0
- package/skills/implement-spec/tests/test_fixloop.py +26 -79
- package/skills/implement-spec/tests/test_merge.py +27 -3
- package/skills/implement-spec/tests/test_review.py +16 -3
- package/skills/implement-spec/tests/test_tidy.py +40 -16
- package/skills/implement-spec/tests/test_walk.py +9 -10
- package/skills-manifest.json +3 -3
|
@@ -656,89 +656,35 @@ def test_a_red_gate_on_the_implementer_commit_starts_fix_round_1_with_the_record
|
|
|
656
656
|
assert [gate["commit"] for gate in rig.gates()].count(tip) == 1 and not rig.led("killed by signal")
|
|
657
657
|
|
|
658
658
|
|
|
659
|
-
#
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
# The PR branch did not move to the red tip: the fixer started with the PR branch at the spec commit.
|
|
676
|
-
fixer_call = rig.calls("01", "fixer")[0]
|
|
677
|
-
assert "feat: 01 rows" not in fixer_call["pr_log"] and fixer_call["branch"] == "ticket/feat%2Fcsv/01"
|
|
678
|
-
*review_findings, gate = json.loads((rig.folder() / "findings-0.json").read_text())
|
|
679
|
-
assert (gate["source"], gate["severity"], gate["kind"], gate["file"]) == ("gate", "critical", "code", record)
|
|
680
|
-
assert gate["title"] == f"the full gate is red on {tip[:7]}"
|
|
681
|
-
assert rig.led(f"Ticket 01: the full gate is red on {tip[:7]} at the landing, so feat/csv does not move and fix "
|
|
682
|
-
"round 1 starts.")
|
|
683
|
-
prompt = rig.prompt("fixer-1")
|
|
684
|
-
assert "findings-0.json" in prompt and record in prompt and "not on ticket/feat%2Fcsv/01" not in prompt
|
|
685
|
-
assert f"The fix is {tip}..{fixed}" in rig.prompt("reviewer-1")
|
|
686
|
-
entry = rig.state()["tickets"]["01"]
|
|
687
|
-
assert (entry["round"], entry["phase"], entry["landing"]) == (1, "merged", None)
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
def test_a_red_full_gate_on_a_merge_commit_sends_the_fixer_to_the_ticket_branch_with_the_merge_commit(tmp_path):
|
|
691
|
-
files = {"01-export-rows.md": ticket("01", "Export rows"),
|
|
692
|
-
"02-quote-fields.md": ticket("02", "Quote fields", touches="`demo/other.py: g`")}
|
|
693
|
-
rig = Inside(tmp_path, files, gate={"full": {"subjects": ["feat: 02 rows"]}})
|
|
694
|
-
rig.run(plan(**{"02/implementer": [impl("02", "demo/other.py", wait_pr_moves=True)],
|
|
695
|
-
"02/fixer": [fix("02", 1, files={"demo/other.py": "x = 1\n"})]}))
|
|
696
|
-
assert rig.code == 0, "\n".join(rig.ledger())
|
|
697
|
-
tip = rig.sha("02", "implementer")
|
|
698
|
-
(merge,) = [gate["commit"] for gate in rig.gates("full") if gate["exit"]]
|
|
699
|
-
assert merge != tip and tip not in [gate["commit"] for gate in rig.gates("full")]
|
|
700
|
-
fixer_call = rig.calls("02", "fixer")[0]
|
|
701
|
-
assert (fixer_call["branch"], fixer_call["head"]) == ("ticket/feat%2Fcsv/02", tip)
|
|
702
|
-
prompt = rig.prompt("fixer-1", "02")
|
|
703
|
-
assert f"{merge[:7]} is not on ticket/feat%2Fcsv/02: it is the merge commit" in prompt
|
|
704
|
-
assert f"implement/02/gate-full-{merge[:7]}.log" in prompt and "git merge --no-commit --no-ff feat/csv" in prompt
|
|
705
|
-
assert rig.state()["tickets"]["02"]["phase"] == "merged"
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
def test_a_red_full_gate_at_landing_after_round_2_blocks_the_ticket_and_its_dependent(tmp_path):
|
|
709
|
-
rig = Inside(tmp_path, three(), gate={"full": {"subjects": ["fix: 01 round 2"]}})
|
|
710
|
-
rig.run(plan(**{"01/reviewer": [review("01", [STUCK]), review("01", [STUCK]), review("01")],
|
|
711
|
-
"01/fixer": [fix("01", n) for n in (1, 2)]}))
|
|
712
|
-
(red,) = [gate["commit"] for gate in rig.gates("full") if gate["exit"]] # 03 may land first: then a merge commit
|
|
713
|
-
assert f"BLOCKED at the merge: the full gate is red on {red[:7]}" in blocked(rig), rig.ledger()
|
|
714
|
-
assert len(rig.calls("01", "fixer")) == 2 and rig.state()["tickets"]["01"]["round"] == 2
|
|
715
|
-
assert "fix: 01 round 2" not in rig.pr_subjects() and "Ticket 01: merged" not in "".join(rig.ledger())
|
|
716
|
-
assert not rig.calls("02") and rig.state()["tickets"]["02"]["phase"] == "pending"
|
|
717
|
-
assert rig.state()["tickets"]["03"]["phase"] == "merged"
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
def test_a_run_stopped_after_a_red_full_gate_at_landing_resumes_with_the_fixer(tmp_path, monkeypatch):
|
|
721
|
-
rig = Inside(tmp_path, gate={"full": {"subjects": ["feat: 01 rows"]}})
|
|
722
|
-
real = driver_fixloop.red_landing
|
|
723
|
-
|
|
724
|
-
def stop(*args):
|
|
725
|
-
try:
|
|
726
|
-
real(*args)
|
|
727
|
-
except driver_fixloop.Unlanded:
|
|
728
|
-
raise driver_run.Halted("stopped right after the red landing") from None
|
|
729
|
-
|
|
730
|
-
monkeypatch.setattr(driver_fixloop, "red_landing", stop)
|
|
659
|
+
# Old persisted landing rounds remain resumable; new landings never start one.
|
|
660
|
+
def test_legacy_red_landing_round_resumes_without_another_landing_gate(tmp_path, monkeypatch):
|
|
661
|
+
rig = Inside(tmp_path)
|
|
662
|
+
real = driver._checked_landing
|
|
663
|
+
|
|
664
|
+
def old_landing(ticket, slot, run, may_resolve):
|
|
665
|
+
landing = real(ticket, slot, run, may_resolve)
|
|
666
|
+
record = f".agent/implement/{ticket.number}/gate-full-{landing.commit[:7]}.log"
|
|
667
|
+
(rig.repo / record).write_text("legacy full gate failure\n")
|
|
668
|
+
found = [{"severity": "critical", "kind": "code", "source": "gate", "file": record,
|
|
669
|
+
"line": 0, "title": "legacy landing failure", "evidence": record}]
|
|
670
|
+
(rig.folder() / "findings-0.json").write_text(json.dumps(found))
|
|
671
|
+
run.state.ticket(ticket.number, phase="fix", round=1, landing=landing.commit)
|
|
672
|
+
raise driver_run.Halted("stopped after legacy red landing")
|
|
673
|
+
|
|
674
|
+
monkeypatch.setattr(driver, "_checked_landing", old_landing)
|
|
731
675
|
steps = plan(**{"01/fixer": [fix("01", 1)]})
|
|
732
676
|
rig.run(steps)
|
|
733
677
|
assert rig.code == 4 and not rig.calls("01", "fixer"), rig.ledger()
|
|
734
|
-
entry
|
|
735
|
-
assert (entry["phase"], entry["round"]
|
|
736
|
-
monkeypatch.setattr(
|
|
678
|
+
entry = rig.state()["tickets"]["01"]
|
|
679
|
+
assert (entry["phase"], entry["round"]) == ("fix", 1)
|
|
680
|
+
monkeypatch.setattr(driver, "_checked_landing", real)
|
|
737
681
|
rig.run(steps)
|
|
738
682
|
assert rig.code == 0, rig.ledger()
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
assert
|
|
683
|
+
assert [call["role"] for call in rig.calls("01")] == [
|
|
684
|
+
"test-writer", "implementer", "reviewer", "fixer", "reviewer"]
|
|
685
|
+
assert rig.state()["tickets"]["01"]["round"] == 1
|
|
686
|
+
assert f"gate-full-{entry['landing'][:7]}.log" in rig.prompt("fixer-1")
|
|
687
|
+
assert all(gate["branch"] == "feat/csv" for gate in rig.gates("full"))
|
|
742
688
|
|
|
743
689
|
|
|
744
690
|
def killed(rig, subject, times, end="os.kill(os.getpid(), signal.SIGTERM)"):
|
|
@@ -1091,7 +1037,8 @@ def test_a_reviewer_that_times_out_starts_again_from_the_clean_tip(tmp_path):
|
|
|
1091
1037
|
def test_a_conflict_is_resolved_once_in_the_ticket_slot_and_a_second_one_blocks(tmp_path):
|
|
1092
1038
|
rig = test_review.conflicted(under(tmp_path, "once"))
|
|
1093
1039
|
assert rig.code == 0, rig.ledger()
|
|
1094
|
-
assert
|
|
1040
|
+
assert dict(rig.state()["run"]["landed"])["01"] == rig.tip()
|
|
1041
|
+
assert len(rig.gates("full")) == 1 and rig.gates("full")[0]["branch"] == "feat/csv"
|
|
1095
1042
|
assert rig.led("Ticket 01: the conflict agent resolved the merge conflict in demo/cli.py at ")
|
|
1096
1043
|
prompt = rig.prompt("conflict-0")
|
|
1097
1044
|
assert "Files in conflict: demo/cli.py\n" in prompt and f"at commit {rig.sha('03', 'implementer')}\n" in prompt
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""Plumbing merges: fast-forward, merge commit, conflict, the guarded ref move and the guarded branch delete."""
|
|
2
2
|
import subprocess
|
|
3
3
|
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
4
6
|
import driver_merge
|
|
5
7
|
from conftest import GIT
|
|
6
8
|
|
|
@@ -101,9 +103,31 @@ def test_begin_opens_the_conflicting_merge_on_a_machine_with_no_git_identity(rep
|
|
|
101
103
|
assert driver_merge.begin(".", pr_tip) == ["a.txt"]
|
|
102
104
|
|
|
103
105
|
|
|
104
|
-
def
|
|
106
|
+
def test_unpushable_names_the_commits_origin_lacks_with_no_good_signature_when_commit_gpgsign_is_on(repo, monkeypatch):
|
|
105
107
|
repo()
|
|
106
108
|
tip = sh("git", "rev-parse", "--short", "HEAD")
|
|
107
|
-
assert driver_merge.
|
|
109
|
+
assert driver_merge.unpushable("HEAD") == []
|
|
108
110
|
monkeypatch.setenv("GIT_CONFIG_VALUE_2", "true") # the fixture's commit.gpgsign
|
|
109
|
-
assert driver_merge.
|
|
111
|
+
assert driver_merge.unpushable("HEAD") == [f"{tip} has no good signature"]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@pytest.mark.parametrize("trailer", ["Co-Authored-By: C <c@x>", "co-authored-by: C <c@x>", "Co-authored-by : C <c@x>",
|
|
115
|
+
"Co-authored-by: C\n <c@x> folded\n x"])
|
|
116
|
+
def test_unpushable_names_a_commit_whose_trailers_hold_a_co_author_in_any_form_git_reads(repo, monkeypatch, trailer):
|
|
117
|
+
repo()
|
|
118
|
+
monkeypatch.setenv("GIT_CONFIG_VALUE_2", "true")
|
|
119
|
+
sh(*GIT, "commit", "-q", "--allow-empty", "-m", f"fix\n\n{trailer}")
|
|
120
|
+
co, base = sh("git", "rev-parse", "--short", "HEAD"), sh("git", "rev-parse", "--short", "HEAD~1")
|
|
121
|
+
assert driver_merge.unpushable("HEAD") == [f"{co} has no good signature", f"{co} has a Co-authored-by trailer",
|
|
122
|
+
f"{base} has no good signature"]
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def test_a_commit_the_driver_makes_has_no_co_author_trailer_and_keeps_a_body_line_that_only_names_one(repo):
|
|
126
|
+
repo()
|
|
127
|
+
base = sh("git", "rev-parse", "HEAD")
|
|
128
|
+
message = ("fix: x\n\nCo-authored-by: is a trailer only at the end.\n\nWhy.\nSigned-off-by: A <a@x>\n"
|
|
129
|
+
"Co-Authored-By: C <c@x>\nco-authored-by : D\n <d@x>\n")
|
|
130
|
+
made = driver_merge.commit_tree([f"{base}^{{tree}}", "-p", base], message, {}).stdout.strip()
|
|
131
|
+
assert sh("git", "log", "-1", "--format=%B", made) == (
|
|
132
|
+
"fix: x\n\nCo-authored-by: is a trailer only at the end.\n\nWhy.\nSigned-off-by: A <a@x>")
|
|
133
|
+
assert driver_merge.unpushable(made) == []
|
|
@@ -265,9 +265,13 @@ def cli(text):
|
|
|
265
265
|
return f"def main():\n return {text!r}\n"
|
|
266
266
|
|
|
267
267
|
|
|
268
|
-
def conflicted(tmp, moves_again=False):
|
|
268
|
+
def conflicted(tmp, moves_again=False, dirty=False):
|
|
269
269
|
"""01 and 03 both add demo/cli.py; 03 merges first, so 01's merge conflicts."""
|
|
270
270
|
rig = Review(tmp, {k: v for k, v in three().items() if not k.startswith("02")})
|
|
271
|
+
if dirty:
|
|
272
|
+
runner = rig.rig / "run-agent"
|
|
273
|
+
runner.write_text(runner.read_text().replace('if step.get("report") is not None:',
|
|
274
|
+
'if role == "conflict": Path("leftover.txt").write_text("uncommitted work")\nif step.get("report") is not None:'))
|
|
271
275
|
resolve = {"files": {"demo/cli.py": cli("resolved")}, "commit": "merge: resolve cli",
|
|
272
276
|
"report": {"status": "DONE", "commits": ["$SHA"], "files": ["demo/cli.py"], "concerns": []}}
|
|
273
277
|
if moves_again: # while the agent works, another commit lands on the PR branch and changes the same file
|
|
@@ -285,12 +289,12 @@ def conflicted(tmp, moves_again=False):
|
|
|
285
289
|
"01/conflict": [resolve]}))
|
|
286
290
|
|
|
287
291
|
|
|
288
|
-
def
|
|
292
|
+
def test_a_conflicting_merge_runs_the_conflict_agent_once_then_the_final_integration_gate(tmp_path):
|
|
289
293
|
rig = conflicted(tmp_path)
|
|
290
294
|
assert rig.code == 0, rig.output()
|
|
291
295
|
(call,) = rig.calls("01", "conflict")
|
|
292
296
|
assert call["cwd"] == rig.calls("01", "implementer")[0]["cwd"], "in the ticket's slot"
|
|
293
|
-
assert
|
|
297
|
+
assert [g["commit"] for g in rig.gates("full")] == [git(rig.repo, "rev-parse", "feat/csv").strip()]
|
|
294
298
|
assert git(rig.repo, "show", "feat/csv:demo/cli.py") == cli("resolved")
|
|
295
299
|
assert rig.led("demo/cli.py", "onflict")
|
|
296
300
|
|
|
@@ -301,3 +305,12 @@ def test_a_second_conflict_on_the_same_merge_blocks_the_ticket(tmp_path):
|
|
|
301
305
|
assert len(rig.calls("01", "conflict")) == 1
|
|
302
306
|
assert rig.led("01", "BLOCKED") and rig.state()["tickets"]["01"]["phase"] == "blocked"
|
|
303
307
|
assert rig.state()["tickets"]["03"]["phase"] == "merged"
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def test_conflict_resolution_with_uncommitted_work_does_not_land(tmp_path):
|
|
311
|
+
rig = conflicted(tmp_path, dirty=True)
|
|
312
|
+
assert rig.state()["tickets"]["01"]["phase"] == "blocked", rig.output()
|
|
313
|
+
assert len(rig.calls("01", "conflict")) == 1
|
|
314
|
+
assert not rig.gates("full")
|
|
315
|
+
assert rig.led("uncommitted", "BLOCKED")
|
|
316
|
+
assert "ticket/feat%2Fcsv/01" in rig.branches()
|
|
@@ -211,6 +211,14 @@ def test_a_ticket_whose_merge_left_the_tree_as_it_was_gets_the_commit_before_it(
|
|
|
211
211
|
assert git(rig.repo, "log", "-1", "--format=%an %ae", commits["02"]) == "t t@example.com\n"
|
|
212
212
|
|
|
213
213
|
|
|
214
|
+
def test_a_rewritten_commit_drops_its_co_author_trailers_and_keeps_the_rest_of_its_message(repo):
|
|
215
|
+
repo()
|
|
216
|
+
git(".", "commit", "-q", "--allow-empty", "-m",
|
|
217
|
+
"fix(01): quote commas\n\nWhy.\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nco-authored-by: B <b@x>\n")
|
|
218
|
+
(made,) = driver_tidy.rewrite("HEAD~1", [("HEAD", driver_tidy.text("HEAD"))])
|
|
219
|
+
assert driver_tidy.text(made) == "fix(01): quote commas\n\nWhy.\n\n" # %B ends in a blank line
|
|
220
|
+
|
|
221
|
+
|
|
214
222
|
# ---------------------------------------------------------------- the fix batch and its report
|
|
215
223
|
|
|
216
224
|
def test_a_fix_batch_is_named_per_commit_and_a_commit_with_no_owner_is_a_violation(tmp_path):
|
|
@@ -228,7 +236,7 @@ def test_a_fix_batch_is_named_per_commit_and_a_commit_with_no_owner_is_a_violati
|
|
|
228
236
|
assert rig.led("End of run: BLOCKED at the fix batch: commits.0.sha") # `$HEAD~1` is no SHA: a second violation
|
|
229
237
|
reviewed = rig.final()["reviewed"]
|
|
230
238
|
assert rig.branch() == reviewed, "the rejected commits are off the branch"
|
|
231
|
-
(line,) = rig.led(f"End of run: the fix batch was rejected, so the driver moved feat/csv back to its
|
|
239
|
+
(line,) = rig.led(f"End of run: the fix batch was rejected, so the driver moved feat/csv back to its pre-batch tip {reviewed[:7]}")
|
|
232
240
|
left = line.split("the commits of the batch end at ")[1].split()[0]
|
|
233
241
|
assert git(rig.repo, "log", "--format=%s", f"{reviewed}..{left}").split("\n")[:2] == ["escape quotes", "quote commas"]
|
|
234
242
|
assert line.endswith("The files of the fixer stay in slot 1 as they are.")
|
|
@@ -249,7 +257,9 @@ def test_a_fix_batch_is_named_per_commit_and_a_commit_with_no_owner_is_a_violati
|
|
|
249
257
|
assert rig.led("End of run: BLOCKED at the tip", f"is not a tip the driver made: only {reviewed[:7]} gets a review")
|
|
250
258
|
|
|
251
259
|
git(rig.repo, "reset", "-q", "--hard", reviewed)
|
|
252
|
-
|
|
260
|
+
# The fixer's Co-authored-by trailer would block the push: the fix(NN) commit drops it.
|
|
261
|
+
trailer = "quote commas\n\nCo-Authored-By: Claude <noreply@anthropic.com>"
|
|
262
|
+
rig.run(plan(**{"final/fixer": [{}, {}, fixer(fn("02"), trailer)]}), "--push")
|
|
253
263
|
assert rig.code == 0 and [r["subject"] for r in rig.commits(reviewed)] == ["fix(02): quote commas"], rig.out
|
|
254
264
|
assert rig.pushes() == [f"refs/heads/feat/csv {rig.branch()}"] and rig.final()["batch"] == rig.branch()
|
|
255
265
|
|
|
@@ -263,7 +273,7 @@ def test_a_fixer_that_times_out_twice_keeps_its_files_and_the_branch_stays_at_th
|
|
|
263
273
|
assert rig.code == 2 and rig.pushes() == [] and rig.branch() == reviewed, rig.out
|
|
264
274
|
assert decisions(rig)["questions"][0]["id"] == "final-ticket-blocked-1"
|
|
265
275
|
assert (rig.repo / "wip.txt").read_text() == "half done\n"
|
|
266
|
-
assert rig.led(f"End of run: the fix batch was rejected, so the driver moved feat/csv back to its
|
|
276
|
+
assert rig.led(f"End of run: the fix batch was rejected, so the driver moved feat/csv back to its pre-batch tip "
|
|
267
277
|
f"{reviewed[:7]}; the fixer made no commit. The files of the fixer stay in slot 1 as they are.")
|
|
268
278
|
|
|
269
279
|
|
|
@@ -306,14 +316,14 @@ def test_a_lens_that_changes_the_slot_twice_ends_the_run_with_a_clean_slot(tmp_p
|
|
|
306
316
|
assert rig.code == 0 and rig.pushes() == [f"refs/heads/feat/csv {tip}"], rig.out
|
|
307
317
|
|
|
308
318
|
|
|
309
|
-
def
|
|
319
|
+
def test_a_red_gate_on_the_tidied_tip_repairs_then_parks_before_review(tmp_path):
|
|
310
320
|
rig = Inside(tmp_path, ONE, gate={"red": ["feat/csv"]})
|
|
311
|
-
rig.run(plan(), *UNATTENDED)
|
|
312
|
-
assert rig.code ==
|
|
313
|
-
assert rig.led("End of run: BLOCKED at the gate: the full gate
|
|
314
|
-
assert stage(rig)
|
|
315
|
-
|
|
316
|
-
assert rig.
|
|
321
|
+
rig.run(plan(**{"final/fixer": [fixer("fixed\n", "integration fix", ticket_of="01")]}), *UNATTENDED)
|
|
322
|
+
assert rig.code == 2 and not rig.final_calls("final-spec") and rig.pushes() == [], rig.out
|
|
323
|
+
assert rig.led("End of run: BLOCKED at the integration gate: the full integration gate remains red")
|
|
324
|
+
assert stage(rig)["status"] == "awaiting-review" and stage(rig)["open_questions"] == 1
|
|
325
|
+
assert rig.state()["run"]["gates"] == {"fast": 1, "full": 2}
|
|
326
|
+
assert rig.final()["gate_repairs"] == 1
|
|
317
327
|
|
|
318
328
|
|
|
319
329
|
# ---------------------------------------------------------------- the rebase
|
|
@@ -337,7 +347,7 @@ def test_a_base_that_moved_with_no_conflict_is_rebased_onto_with_no_agent_and_on
|
|
|
337
347
|
assert rig.pushes() == [f"refs/heads/feat/csv {rig.branch()}"] and stage(rig) == {"stage": "implement", "status": "done"}
|
|
338
348
|
|
|
339
349
|
|
|
340
|
-
def
|
|
350
|
+
def test_a_resolved_rebase_keeps_ticket_messages_and_gates_only_the_final_tidied_tip(tmp_path):
|
|
341
351
|
cli = {"demo/cli.py": "def main():\n return 'base'\n"}
|
|
342
352
|
resolved = {**RESOLVE, "files": {"demo/cli.py": "def main():\n return 'both'\n"}}
|
|
343
353
|
rig = moved(tmp_path, cli, resolved) # the agent commits as "resolve conflict" and goes on with the rebase
|
|
@@ -351,7 +361,7 @@ def test_a_resolved_rebase_keeps_the_ticket_messages_and_gates_the_rebased_tip_a
|
|
|
351
361
|
(line,) = rig.led("Rebase: the conflict agent resolved the conflict with main in demo/cli.py at ")
|
|
352
362
|
rebased = line.rstrip(".").split()[-1]
|
|
353
363
|
records = sorted(p.name for p in (rig.repo / ".agent/implement/final").glob("gate-*.log"))
|
|
354
|
-
assert records ==
|
|
364
|
+
assert records == [f"gate-full-{rig.branch()[:7]}.log"] and rebased != rig.branch()[:7]
|
|
355
365
|
assert ref(rig.repo, f"{rebased}^{{tree}}") == ref(rig.repo, "feat/csv^{tree}")
|
|
356
366
|
|
|
357
367
|
|
|
@@ -385,12 +395,13 @@ def test_a_conflict_agent_that_gives_up_leaves_no_rebase_open(tmp_path):
|
|
|
385
395
|
assert not (rig.repo / ".git/rebase-merge").exists()
|
|
386
396
|
|
|
387
397
|
|
|
388
|
-
def
|
|
389
|
-
rig = Inside(tmp_path, ONE, gate={"unbranched": True})
|
|
398
|
+
def test_rebase_conflict_resolution_waits_for_the_final_integration_gate(tmp_path):
|
|
399
|
+
rig = Inside(tmp_path, ONE, gate={"unbranched": True})
|
|
390
400
|
rig.move_base({"demo/export.py": "def export_csv():\n return 'base'\n"})
|
|
391
401
|
rig.run(plan(**{"final/conflict": [{**RESOLVE, "files": {"demo/export.py": "x = 1\n"}}]}))
|
|
392
|
-
assert rig.code ==
|
|
393
|
-
assert rig.
|
|
402
|
+
assert rig.code == 0 and rig.branch() != rig.recovery(), rig.out
|
|
403
|
+
assert len(rig.gates("full")) == 1
|
|
404
|
+
assert rig.gates("full")[0]["commit"] == rig.branch()
|
|
394
405
|
|
|
395
406
|
|
|
396
407
|
def test_a_base_that_holds_a_ticket_commit_already_leaves_the_branch_unrewritten(tmp_path):
|
|
@@ -566,6 +577,19 @@ def test_a_history_that_origin_already_has_is_not_rebased_and_not_tidied(tmp_pat
|
|
|
566
577
|
assert f"- 01: {rig.branch()[:7]} Export rows" in rig.prs()[0]["body"] and stage(rig)["status"] == "done"
|
|
567
578
|
|
|
568
579
|
|
|
580
|
+
def test_a_co_authored_commit_in_a_history_that_origin_already_has_blocks_the_push(tmp_path):
|
|
581
|
+
rig = Inside(tmp_path, ONE)
|
|
582
|
+
stray(rig, "published before the run")
|
|
583
|
+
published = rig.branch()
|
|
584
|
+
git(rig.repo, "push", "-q", "origin", "feat/csv")
|
|
585
|
+
stray(rig, "by hand\n\nCo-Authored-By: C <c@x>") # kept as it is: the history is not tidied
|
|
586
|
+
co_authored = rig.branch()[:7]
|
|
587
|
+
rig.run(plan(), *UNATTENDED)
|
|
588
|
+
assert rig.code == 1 and ref(rig.origin, "refs/heads/feat/csv") == published, rig.out
|
|
589
|
+
assert rig.led(f"End of run: BLOCKED at commits of feat/csv may not be pushed: {co_authored} has a Co-authored-by "
|
|
590
|
+
"trailer: nothing is pushed; sign or reword them, then run with --push again")
|
|
591
|
+
|
|
592
|
+
|
|
569
593
|
def weak(nn="01"):
|
|
570
594
|
return {f"tests/test_{nn}.py": "def test_x():\n assert True\n"}
|
|
571
595
|
|
|
@@ -331,24 +331,23 @@ def test_a_fast_forward_merge_has_one_fast_and_one_full_record_of_the_ticket_tip
|
|
|
331
331
|
a1 = rig.sha("01", "implementer")
|
|
332
332
|
assert rig.walked() == a1
|
|
333
333
|
records = sorted((rig.repo / ".agent/implement/01").glob("gate-*.log"))
|
|
334
|
-
assert [p.name for p in records] == [f"gate-fast-{a1[:7]}.log"
|
|
335
|
-
for tier, record in zip(("fast",
|
|
334
|
+
assert [p.name for p in records] == [f"gate-fast-{a1[:7]}.log"]
|
|
335
|
+
for tier, record in zip(("fast",), records):
|
|
336
336
|
text = record.read_text()
|
|
337
337
|
assert f"tier: {tier}\ncommit: {a1}\n" in text and "GATE-OUTPUT-MARK" in text
|
|
338
338
|
assert len(re.findall(r"\d\d:\d\d:\d\d", text)) >= 2
|
|
339
339
|
assert re.search(r"exit\D*0", text) and not re.search(r"^(\?\?| M|M |A )", text, re.M)
|
|
340
|
-
fast,
|
|
340
|
+
(fast,) = rig.walk_gates()
|
|
341
341
|
assert (fast["tier"], fast["commit"], fast["branch"]) == ("fast", a1, "ticket/feat%2Fcsv/01")
|
|
342
|
-
assert
|
|
343
|
-
assert {gate["
|
|
344
|
-
assert {gate["cwd"] for gate in (fast, full)} == {str(rig.repo.resolve())}
|
|
342
|
+
assert {gate["status"] for gate in (fast,)} == {""}
|
|
343
|
+
assert {gate["cwd"] for gate in (fast,)} == {str(rig.repo.resolve())}
|
|
345
344
|
|
|
346
345
|
|
|
347
346
|
def test_gate_environment_names_the_pr_branch_and_a_pycache_prefix_under_agent_implement(tmp_path):
|
|
348
347
|
rig = Rig(tmp_path, {"01-export-rows.md": ticket("01", "Export rows")}).run(plan())
|
|
349
348
|
assert rig.code == 0, rig.output()
|
|
350
349
|
gates = rig.walk_gates()
|
|
351
|
-
assert [gate["tier"] for gate in gates] == ["fast"
|
|
350
|
+
assert [gate["tier"] for gate in gates] == ["fast"]
|
|
352
351
|
for gate in gates:
|
|
353
352
|
assert gate["base"] == "feat/csv" and gate["pycache"]
|
|
354
353
|
assert os.path.realpath(gate["pycache"]).startswith(str((rig.repo / ".agent/implement").resolve()) + os.sep)
|
|
@@ -375,7 +374,7 @@ def test_blocked_ticket_stops_only_the_tickets_it_blocks(blocked):
|
|
|
375
374
|
assert blocked.code == 1
|
|
376
375
|
|
|
377
376
|
|
|
378
|
-
def
|
|
377
|
+
def test_non_fast_forward_merge_is_a_plumbing_merge_commit_without_a_landing_gate(tmp_path):
|
|
379
378
|
files = {k: v for k, v in three().items() if not k.startswith("02")}
|
|
380
379
|
rig = Rig(tmp_path, files)
|
|
381
380
|
steps = plan(**{"01_test-writer": [{**tw("01"), "touch": ["s1"]}],
|
|
@@ -388,8 +387,8 @@ def test_non_fast_forward_merge_is_a_plumbing_merge_commit_gated_once(tmp_path):
|
|
|
388
387
|
assert len(git(rig.repo, "rev-list", "--parents", "-n1", tip).split()) == 3, "tip is a merge commit"
|
|
389
388
|
fast = [g["commit"] for g in rig.walk_gates() if g["tier"] == "fast"]
|
|
390
389
|
full = [g["commit"] for g in rig.walk_gates() if g["tier"] == "full"]
|
|
391
|
-
# 03 lands first, as a fast-forward; 01 lands as the merge commit.
|
|
392
|
-
assert sorted(fast) == sorted([a01, a03]) and full == [
|
|
390
|
+
# 03 lands first, as a fast-forward; 01 lands as the merge commit. Both wait for the final full gate.
|
|
391
|
+
assert sorted(fast) == sorted([a01, a03]) and full == [], (fast, full)
|
|
393
392
|
waited = rig.calls("01", "implementer")[0]
|
|
394
393
|
assert waited["after_wait"]["branch"] == "ticket/feat%2Fcsv/01" and waited["after_wait"]["head"] == waited["head"]
|
|
395
394
|
assert waited["after_wait"]["status"] == ""
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-09T17:40:37.516Z",
|
|
4
4
|
"skills": [
|
|
5
5
|
{
|
|
6
6
|
"name": "agents-wayfinder",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"name": "implement-spec",
|
|
61
|
-
"version": "0.1.
|
|
62
|
-
"hash": "sha256-
|
|
61
|
+
"version": "0.1.58",
|
|
62
|
+
"hash": "sha256-39e2112bd7fac98fc3e510821f6cb2d1ca4265b08853d8eada8a40441d8eeafe",
|
|
63
63
|
"description": "Implement a specification in code."
|
|
64
64
|
},
|
|
65
65
|
{
|