@jesdi/skills 0.0.40 → 0.0.41
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 +2 -2
- package/skills/implement-spec/README.md +1 -1
- package/skills/implement-spec/driver_fixloop.py +4 -3
- package/skills/implement-spec/tests/test_driver.py +12 -9
- package/skills/implement-spec/tests/test_fixloop.py +15 -0
- package/skills/implement-spec/tests/test_review.py +1 -8
- package/skills/implement-spec/tests/test_walk.py +16 -5
- package/skills-manifest.json +3 -3
package/package.json
CHANGED
|
@@ -110,8 +110,8 @@ and do not know about the run, except `driver_run.py`, which the three deciding
|
|
|
110
110
|
A timeout doubles the time of the rerun.
|
|
111
111
|
- Fix rounds stop at 4, and round 3 goes to the next implementer entry. The correctness pass never runs on the
|
|
112
112
|
provider of the implementer.
|
|
113
|
-
- A red gate on a fixer's commit is a finding of the next round (`driver_fixloop._gate`), so
|
|
114
|
-
round 4.
|
|
113
|
+
- A red gate on the implementer's or a fixer's commit is a finding of the next round (`driver_fixloop._gate`), so
|
|
114
|
+
it blocks only after round 4. A red gate on a test-writer correction blocks.
|
|
115
115
|
|
|
116
116
|
### Questions
|
|
117
117
|
|
|
@@ -119,7 +119,7 @@ Rules for each agent:
|
|
|
119
119
|
|
|
120
120
|
A fix round is one **fixer** (`prompts/fixer.md`), then the gate on the new tip, then a re-review of the range of the fix. A mutation proof is repeated only when the fix changed its production line.
|
|
121
121
|
|
|
122
|
-
A red gate on the commit of a fixer is a critical finding with source `gate`. Its file is the gate record, and the record holds the output. No review runs on that tip, and the next round starts. The
|
|
122
|
+
A red gate on the commit of the implementer or of a fixer is a critical finding with source `gate`. Its file is the gate record, and the record holds the output. No review runs on that tip, and the next round starts: a red gate on the commit of the implementer starts round 1. The review after that round covers each fix since the last review and repeats each proof that one of them made due. A red gate after round 4 blocks the ticket, as does a red gate on the commit of a test-writer correction: the correction is outside the fix rounds, and a fixer may not edit the locked files.
|
|
123
123
|
|
|
124
124
|
- Rounds 1 and 2 run on the first entry of the implementer list.
|
|
125
125
|
- Rounds 3 and 4 run on the second entry of the implementer list. When the list has one entry, they stay on it and the ledger says so.
|
|
@@ -164,12 +164,13 @@ def _act_on(job: Job, found: list[dict]) -> bool:
|
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
def _gate(job: Job) -> list[dict]:
|
|
167
|
-
"""Gate the tip. A red gate on a fixer's commit before round 4 is a finding for the
|
|
168
|
-
gate blocks. Returns the findings: the red gate,
|
|
167
|
+
"""Gate the tip. A red gate on the implementer's commit or a fixer's commit before round 4 is a finding for the
|
|
168
|
+
next round; a red gate after round 4 or on a test-writer correction blocks. Returns the findings: the red gate,
|
|
169
|
+
or none."""
|
|
169
170
|
run, number = job.run, job.ticket.number
|
|
170
171
|
job.red = False
|
|
171
172
|
with during("the gate"):
|
|
172
|
-
if
|
|
173
|
+
if job.round == ROUNDS or job.corrected:
|
|
173
174
|
run.gate(number, job.slot, job.tip)
|
|
174
175
|
return []
|
|
175
176
|
record = run.red_gate(number, job.slot, job.tip)
|
|
@@ -358,6 +358,9 @@ echo "$nn $PWD" >> "$0.calls"
|
|
|
358
358
|
# Ticket 01 waits until ticket 02 has its branch, so both start from the same PR tip.
|
|
359
359
|
TOGETHER = """[ "$nn" != 01 ] || until git rev-parse -q --verify refs/heads/ticket/02 > /dev/null; do sleep 0.02; done\n"""
|
|
360
360
|
REFACTOR = {"seam": "none — refactor"}
|
|
361
|
+
# A fixer that cannot make the red gate green: the ticket blocks at fix round 1.
|
|
362
|
+
GIVE_UP = """[ $role != fixer ] || { printf '{"status": "BLOCKED", "commits": [], "files": [], "concerns": ["the gate stays red"], "green": [], "ticket": "01"}' > "$report"; exit 0; }\n"""
|
|
363
|
+
GAVE_UP = "Ticket 01: BLOCKED at fix round 1: the fixer reported BLOCKED: the gate stays red."
|
|
361
364
|
|
|
362
365
|
|
|
363
366
|
def walk(tmp_path, capsys, body, *args, gate="true"):
|
|
@@ -452,13 +455,13 @@ def test_a_conflict_cli_that_fails_stops_the_run_and_leaves_no_open_merge(repo,
|
|
|
452
455
|
assert out_of("git", "-C", slot, "rev-parse", "-q", "--verify", "MERGE_HEAD") == ""
|
|
453
456
|
|
|
454
457
|
|
|
455
|
-
def
|
|
458
|
+
def test_a_red_gate_is_a_finding_and_the_ticket_it_blocks_never_starts(repo, tmp_path, capsys):
|
|
456
459
|
two(repo, second="01")
|
|
457
|
-
code, ledger, out = walk(tmp_path, capsys, WORK + REPORT, gate="echo CHECK-OUTPUT; exit 1")
|
|
460
|
+
code, ledger, out = walk(tmp_path, capsys, GIVE_UP + WORK + REPORT, gate="echo CHECK-OUTPUT; exit 1")
|
|
458
461
|
tip = out_of("git", "rev-parse", "--short=7", "ticket/01")
|
|
459
|
-
assert code == 1 and
|
|
460
|
-
assert ledger[1] == (f"Ticket 01:
|
|
461
|
-
f"
|
|
462
|
+
assert code == 1 and ledger[-1] == GAVE_UP, out
|
|
463
|
+
assert ledger[1] == (f"Ticket 01: critical finding of kind code from the gate at "
|
|
464
|
+
f".agent/implement/01/gate-{tip}.log:0: the gate is red on {tip}.")
|
|
462
465
|
record = (tmp_path / f".agent/implement/01/gate-{tip}.log").read_text()
|
|
463
466
|
assert "status: clean\n" in record and "CHECK-OUTPUT\n\nexit: 1\nafter: clean\nend: " in record
|
|
464
467
|
assert "Ticket 02 is not merged: its phase is pending." in out and "| gates run | 1 |" in out
|
|
@@ -479,8 +482,8 @@ def test_a_red_merge_gate_blocks_the_ticket_and_the_pr_branch_does_not_move(repo
|
|
|
479
482
|
|
|
480
483
|
def test_a_tree_that_is_not_clean_is_a_red_gate_and_the_slot_keeps_the_work(repo, tmp_path, capsys):
|
|
481
484
|
repo(t01=ticket("01", **REFACTOR))
|
|
482
|
-
code, ledger, out = walk(tmp_path, capsys, WORK + REPORT + "echo left > junk.txt\n", gate="echo NEVER")
|
|
483
|
-
assert code == 1 and "
|
|
485
|
+
code, ledger, out = walk(tmp_path, capsys, GIVE_UP + WORK + REPORT + "echo left > junk.txt\n", gate="echo NEVER")
|
|
486
|
+
assert code == 1 and "from the gate at .agent/implement/01/gate-" in ledger[-3] and ledger[-1] == GAVE_UP, out
|
|
484
487
|
record = next((tmp_path / ".agent/implement/01").glob("gate-*.log")).read_text()
|
|
485
488
|
assert "status: not clean\n ?? junk.txt\n" in record and "exit: not run" in record and "\nNEVER\n" not in record
|
|
486
489
|
assert out_of("git", "symbolic-ref", "--short", "HEAD") == "ticket/01" and (tmp_path / "junk.txt").exists()
|
|
@@ -729,8 +732,8 @@ def test_a_merge_commit_the_slot_cannot_check_out_is_not_gated_and_does_not_land
|
|
|
729
732
|
])
|
|
730
733
|
def test_a_gate_that_changes_the_tree_or_moves_head_is_red(repo, tmp_path, capsys, gate, after):
|
|
731
734
|
repo(t01=ticket("01", **REFACTOR))
|
|
732
|
-
code, ledger, out = walk(tmp_path, capsys, WORK + REPORT, gate=gate)
|
|
733
|
-
assert code == 1 and "
|
|
735
|
+
code, ledger, out = walk(tmp_path, capsys, GIVE_UP + WORK + REPORT, gate=gate)
|
|
736
|
+
assert code == 1 and "from the gate at .agent/implement/01/gate-" in ledger[-3] and ledger[-1] == GAVE_UP, out
|
|
734
737
|
record = next((tmp_path / ".agent/implement/01").glob("gate-*.log")).read_text()
|
|
735
738
|
assert "\nexit: 0\n" in record and after in record
|
|
736
739
|
assert state_of(tmp_path)["tickets"]["01"]["green_gates"] == []
|
|
@@ -399,6 +399,21 @@ def test_a_red_gate_on_a_fixer_commit_starts_the_next_round_with_the_record_as_e
|
|
|
399
399
|
assert f"The fix is {rig.sha('01', 'implementer')}..{second}" in again and "demo/export.py:2" in again
|
|
400
400
|
|
|
401
401
|
|
|
402
|
+
def test_a_red_gate_on_the_implementer_commit_starts_fix_round_1_with_the_record_as_evidence(tmp_path):
|
|
403
|
+
"""Issue 80: the gate of the implementer commit is red. That is a finding for round 1, not a BLOCKED ticket."""
|
|
404
|
+
rig = Inside(tmp_path, gate={"subjects": ["feat: 01 rows"]})
|
|
405
|
+
rig.run(plan(**{"01/reviewer": [review("01")], "01/fixer": [fix("01", 1)]}))
|
|
406
|
+
assert rig.code == 0, rig.ledger()
|
|
407
|
+
assert [call["role"] for call in rig.calls("01")] == ["test-writer", "implementer", "fixer", "reviewer"]
|
|
408
|
+
tip = rig.sha("01", "implementer")
|
|
409
|
+
record = f".agent/implement/01/gate-{tip[:7]}.log"
|
|
410
|
+
(gate,) = json.loads((rig.folder() / "findings-0.json").read_text())
|
|
411
|
+
assert (gate["source"], gate["severity"], gate["kind"]) == ("gate", "critical", "code")
|
|
412
|
+
assert gate["title"] == f"the gate is red on {tip[:7]}" and record in gate["evidence"]
|
|
413
|
+
assert "findings-0.json" in rig.prompt("fixer-1") and rig.state()["tickets"]["01"]["phase"] == "merged"
|
|
414
|
+
assert "The fix is" not in rig.prompt("reviewer-1") # no review saw the implementer commit: a full review
|
|
415
|
+
|
|
416
|
+
|
|
402
417
|
def test_a_red_gate_on_the_fixer_commit_of_round_4_blocks_the_ticket(tmp_path):
|
|
403
418
|
rig = Inside(tmp_path, gate={"subjects": ["fix: 01 round 4"]})
|
|
404
419
|
rig.run(plan(**{"01/reviewer": [review("01", [STUCK])] * 4, "01/fixer": [fix("01", n) for n in (1, 2, 3, 4)]}))
|
|
@@ -22,7 +22,7 @@ from pathlib import Path
|
|
|
22
22
|
import pytest
|
|
23
23
|
|
|
24
24
|
from test_cli import SKILL, ticket, three, git, models_file
|
|
25
|
-
from test_walk import RUNNER, Rig, impl, plan, tw
|
|
25
|
+
from test_walk import RUNNER, Rig, fix, impl, plan, tw
|
|
26
26
|
|
|
27
27
|
# The fake runner of test_walk plus two hooks: `git` runs before the step's files, `git_after` right after them.
|
|
28
28
|
HOOKED = RUNNER.replace(
|
|
@@ -76,13 +76,6 @@ def correct(findings=(), **extra):
|
|
|
76
76
|
return {"report": report, **extra}
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
def fix(nn, n, text=None, **changes):
|
|
80
|
-
"""A fixer step: one commit on the ticket branch."""
|
|
81
|
-
step = impl(nn, text=text or f"def fn_{nn}():\n return 'fix{n}'\n", commit=f"fix: {nn} round {n}", **changes)
|
|
82
|
-
step["report"]["ticket"] = nn
|
|
83
|
-
return step
|
|
84
|
-
|
|
85
|
-
|
|
86
79
|
def edit(text, **new):
|
|
87
80
|
"""`text` with line N replaced (keyword `l<N>`)."""
|
|
88
81
|
lines = text.splitlines(keepends=True)
|
|
@@ -130,6 +130,13 @@ def impl(nn, path="demo/export.py", text=None, **changes):
|
|
|
130
130
|
return {**step, **changes}
|
|
131
131
|
|
|
132
132
|
|
|
133
|
+
def fix(nn, n, text=None, **changes):
|
|
134
|
+
"""A fixer step: one commit on the ticket branch."""
|
|
135
|
+
step = impl(nn, text=text or f"def fn_{nn}():\n return 'fix{n}'\n", commit=f"fix: {nn} round {n}", **changes)
|
|
136
|
+
step["report"]["ticket"] = nn
|
|
137
|
+
return step
|
|
138
|
+
|
|
139
|
+
|
|
133
140
|
PATHS = {"01": "demo/export.py", "02": "demo/export.py", "03": "demo/cli.py"}
|
|
134
141
|
|
|
135
142
|
|
|
@@ -264,8 +271,9 @@ def std(tmp_path_factory):
|
|
|
264
271
|
|
|
265
272
|
@pytest.fixture(scope="module")
|
|
266
273
|
def blocked(tmp_path_factory):
|
|
267
|
-
"""The default scenario with a red gate on ticket/01."""
|
|
268
|
-
|
|
274
|
+
"""The default scenario with a red gate on ticket/01 that four fix rounds do not make green."""
|
|
275
|
+
fixes = [fix("01", n) for n in (1, 2, 3, 4)]
|
|
276
|
+
return Rig(tmp_path_factory.mktemp("blocked"), gate={"red": ["ticket/01"]}).run(plan(**{"01/fixer": fixes}))
|
|
269
277
|
|
|
270
278
|
|
|
271
279
|
def test_01_starts_in_slot_1_03_in_slot_2_and_02_after_the_merge_of_01(std):
|
|
@@ -331,12 +339,15 @@ def test_gate_environment_names_the_pr_branch_and_a_pycache_prefix_under_agent_i
|
|
|
331
339
|
assert os.path.realpath(gate["pycache"]).startswith(str((rig.repo / ".agent/implement").resolve()) + os.sep)
|
|
332
340
|
|
|
333
341
|
|
|
334
|
-
def
|
|
342
|
+
def test_red_gate_blocks_the_ticket_after_round_4_names_the_record_and_launches_no_review(blocked):
|
|
335
343
|
assert blocked.code == 1, blocked.output()
|
|
336
344
|
a1 = blocked.sha("01", "implementer")
|
|
337
|
-
|
|
345
|
+
finding = f"Ticket 01: critical finding of kind code from the gate at .agent/implement/01/gate-{a1[:7]}.log:0: "
|
|
346
|
+
assert [l for l in blocked.ledger() if l.startswith(finding)], blocked.ledger()
|
|
338
347
|
assert re.search(r"exit\D*1", (blocked.repo / f".agent/implement/01/gate-{a1[:7]}.log").read_text())
|
|
339
|
-
|
|
348
|
+
last = blocked.calls("01", "fixer")[-1]["sha"]
|
|
349
|
+
assert [l for l in blocked.ledger() if "01" in l and "BLOCKED" in l and f"gate-{last[:7]}.log" in l], blocked.ledger()
|
|
350
|
+
assert [c["role"] for c in blocked.calls("01")] == ["test-writer", "implementer"] + ["fixer"] * 4
|
|
340
351
|
assert blocked.state()["tickets"]["01"]["phase"] == "blocked"
|
|
341
352
|
assert "ticket/01" in blocked.branches() and "feat: 01 rows" not in blocked.pr_subjects()
|
|
342
353
|
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-16T09:21:05.102Z",
|
|
4
4
|
"skills": [
|
|
5
5
|
{
|
|
6
6
|
"name": "backlog",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"name": "implement-spec",
|
|
49
|
-
"version": "0.1.
|
|
50
|
-
"hash": "sha256-
|
|
49
|
+
"version": "0.1.17",
|
|
50
|
+
"hash": "sha256-3e93a264e28048f143a4d39786bb30974e42b4da6a6f5da36a1ea3418b840632",
|
|
51
51
|
"description": "Implement a specification in code."
|
|
52
52
|
},
|
|
53
53
|
{
|