@jesdi/skills 0.0.76 → 0.0.78
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/README.md +5 -0
- package/package.json +2 -1
- package/skills/implement-spec/ARCHITECTURE.md +102 -54
- package/skills/implement-spec/README.md +53 -51
- package/skills/implement-spec/SKILL.md +5 -6
- package/skills/implement-spec/driver.py +67 -153
- package/skills/implement-spec/driver_agents.py +75 -25
- package/skills/implement-spec/driver_decisions.py +92 -199
- package/skills/implement-spec/driver_dispute.py +189 -0
- package/skills/implement-spec/driver_final.py +196 -97
- package/skills/implement-spec/driver_fixloop.py +102 -192
- package/skills/implement-spec/driver_legacy.py +73 -5
- package/skills/implement-spec/driver_locked.py +186 -0
- package/skills/implement-spec/driver_merge.py +3 -48
- package/skills/implement-spec/driver_report.py +84 -64
- package/skills/implement-spec/driver_review.py +12 -119
- package/skills/implement-spec/driver_run.py +167 -130
- package/skills/implement-spec/driver_state.py +11 -9
- package/skills/implement-spec/models.json +0 -2
- package/skills/implement-spec/prompts/arbitration.md +34 -0
- package/skills/implement-spec/prompts/conflict.md +1 -0
- package/skills/implement-spec/prompts/correction.md +7 -4
- package/skills/implement-spec/prompts/elsewhere.md +6 -0
- package/skills/implement-spec/prompts/final-fixer.md +1 -1
- package/skills/implement-spec/prompts/final-lens.md +40 -0
- package/skills/implement-spec/prompts/final-reviewer.md +7 -7
- package/skills/implement-spec/prompts/fixer.md +2 -2
- package/skills/implement-spec/prompts/implementer.md +1 -1
- package/skills/implement-spec/prompts/lens-copy.md +1 -0
- package/skills/implement-spec/prompts/lens-correctness.md +8 -0
- package/skills/implement-spec/prompts/lens-spec.md +2 -0
- package/skills/implement-spec/prompts/lens-structure.md +2 -0
- package/skills/implement-spec/prompts/rebase-conflict.md +1 -0
- package/skills/implement-spec/prompts/rereview.md +0 -1
- package/skills/implement-spec/prompts/rerun.md +1 -1
- package/skills/implement-spec/prompts/reviewer.md +3 -6
- package/skills/implement-spec/prompts/ruled.md +3 -0
- package/skills/implement-spec/prompts/test-writer.md +4 -5
- package/skills/implement-spec/tests/test_agents.py +23 -22
- package/skills/implement-spec/tests/test_amendments.py +6 -48
- package/skills/implement-spec/tests/test_arbitration.py +314 -0
- package/skills/implement-spec/tests/test_cli.py +3 -3
- package/skills/implement-spec/tests/test_decisions.py +251 -374
- package/skills/implement-spec/tests/test_driver.py +22 -50
- package/skills/implement-spec/tests/test_final.py +45 -77
- package/skills/implement-spec/tests/test_fixloop.py +400 -633
- package/skills/implement-spec/tests/test_landing.py +23 -126
- package/skills/implement-spec/tests/test_lenses.py +217 -0
- package/skills/implement-spec/tests/test_merge.py +0 -43
- package/skills/implement-spec/tests/test_models.py +50 -1
- package/skills/implement-spec/tests/test_report.py +9 -23
- package/skills/implement-spec/tests/test_review.py +15 -153
- package/skills/implement-spec/tests/test_review_page.py +7 -3
- package/skills/implement-spec/tests/test_scoped.py +125 -0
- package/skills/implement-spec/tests/test_state.py +8 -3
- package/skills/implement-spec/tests/test_stops.py +43 -61
- package/skills/implement-spec/tests/test_tidy.py +77 -98
- package/skills/implement-spec/tests/test_walk.py +7 -6
- package/skills/review-page/SKILL.md +1 -1
- package/skills/test-prune/SKILL.md +10 -4
- package/skills/test-prune/prune.py +5 -4
- package/skills/test-prune/prune_repo.py +5 -0
- package/skills/test-prune/prune_strengthen.py +36 -5
- package/skills/test-prune/tests/test_prune_strengthen.py +144 -0
- package/skills/to-tickets/SKILL.md +1 -1
- package/skills-manifest.json +9 -9
- package/skills/implement-spec/prompts/corrected.md +0 -3
- package/skills/implement-spec/prompts/correctness.md +0 -42
- package/skills/implement-spec/prompts/final-scoped.md +0 -1
- package/skills/implement-spec/prompts/full-review.md +0 -2
- package/skills/implement-spec/prompts/overruled.md +0 -7
- package/skills/implement-spec/prompts/rejected.md +0 -1
- package/skills/implement-spec/prompts/restored-red.md +0 -3
- package/skills/implement-spec/prompts/restored.md +0 -3
- package/skills/implement-spec/prompts/stands.md +0 -2
|
@@ -11,7 +11,7 @@ description: >-
|
|
|
11
11
|
# test-prune: delete what the mutation ratchet proves redundant, strengthen what it proves weak
|
|
12
12
|
|
|
13
13
|
You are the orchestrator. `prune.py` owns every git, make and file operation and every safety
|
|
14
|
-
guard; the subagents only write JSON files or
|
|
14
|
+
guard; the subagents only write JSON files or tests. Each role is a fresh subagent with no
|
|
15
15
|
context from the others: the reviewer reads the fixer's proposals, reasons included, and judges
|
|
16
16
|
them against the code itself.
|
|
17
17
|
|
|
@@ -130,13 +130,19 @@ when `prune` exited 1 (the status keeps that failure, so the job still goes red)
|
|
|
130
130
|
detaches HEAD at the base commit. `nothing to strengthen` ends the loop.
|
|
131
131
|
2. **Strengthen agent.** Dispatch a fresh subagent with `strengthen-input.json`. Brief: per item,
|
|
132
132
|
test-first, write the assertion or test that fails against each named mutant and passes on
|
|
133
|
-
the real code;
|
|
134
|
-
|
|
133
|
+
the real code; edit only files under `backend/tests/`, and commit each item with
|
|
134
|
+
`python3 <skill-dir>/prune.py strengthen-commit --item <item id>` as soon as its tests are
|
|
135
|
+
written. Never run `git commit` yourself: the command commits every change under
|
|
136
|
+
`backend/tests/` with the item's trailer, one item per call (an item may take several calls),
|
|
137
|
+
and refuses an unknown or closed item, any change outside `backend/tests/`, or nothing to
|
|
138
|
+
commit. Leave the tree clean.
|
|
135
139
|
3. `strengthen-verify` rejects commits without a known trailer or outside `backend/tests/`, then
|
|
136
140
|
proves each item on a cold run: every named id survived on the base and is killed on the
|
|
137
141
|
head. Unproven items are reverted and closed: a later commit for a closed item is refused. It
|
|
138
142
|
writes `<state>/strengthen-proof.json`, including the proven head. On failure HEAD stays
|
|
139
|
-
where the commits are (detached, unattended): fix and rerun.
|
|
143
|
+
where the commits are (detached, unattended): fix and rerun. A rejection names the recovery
|
|
144
|
+
that needs no reset: `git checkout <start>`, then commit each item again with
|
|
145
|
+
`strengthen-commit`. To abandon the loop instead,
|
|
140
146
|
`git checkout <base branch>`; the item commits stay reachable through `git reflog`.
|
|
141
147
|
4. **Strengthen reviewer.** Dispatch a fresh subagent with `strengthen-proof.json` and the diff
|
|
142
148
|
of the proven items (`git log -p <start>..HEAD`). Brief: accept an item only when its test
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"""test-prune: drive the fixer/reviewer prune loop and the strengthen loop over a target repo.
|
|
3
3
|
|
|
4
4
|
collect → (fixer) → review-input → (reviewer) → batch → apply (interactive) | prune (unattended);
|
|
5
|
-
strengthen-start → (strengthen agent) → strengthen-verify → (reviewer) → strengthen-finish.
|
|
6
|
-
The script owns every git, make and file operation; the agents only write JSON or test
|
|
5
|
+
strengthen-start → (strengthen agent, strengthen-commit per item) → strengthen-verify → (reviewer) → strengthen-finish.
|
|
6
|
+
The script owns every git, make and file operation; the agents only write JSON or test files.
|
|
7
7
|
"""
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
@@ -17,12 +17,12 @@ from pathlib import Path
|
|
|
17
17
|
from prune_repo import BadInput, Fail, Repo, State, read_agent_json
|
|
18
18
|
from prune_review import batch, collect, review_input
|
|
19
19
|
from prune_runs import apply, prune
|
|
20
|
-
from prune_strengthen import strengthen_finish, strengthen_start, strengthen_verify
|
|
20
|
+
from prune_strengthen import strengthen_commit, strengthen_finish, strengthen_start, strengthen_verify
|
|
21
21
|
|
|
22
22
|
COMMANDS = {
|
|
23
23
|
"collect": collect, "review-input": review_input, "batch": batch, "apply": apply, "prune": prune,
|
|
24
24
|
"strengthen-start": strengthen_start, "strengthen-verify": strengthen_verify,
|
|
25
|
-
"strengthen-finish": strengthen_finish,
|
|
25
|
+
"strengthen-commit": strengthen_commit, "strengthen-finish": strengthen_finish,
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
|
|
@@ -54,6 +54,7 @@ def build_parser():
|
|
|
54
54
|
sub.add_parser("apply", parents=[common])
|
|
55
55
|
sub.add_parser("prune", parents=[common])
|
|
56
56
|
sub.add_parser("strengthen-start", parents=[common])
|
|
57
|
+
sub.add_parser("strengthen-commit", parents=[common]).add_argument("--item", required=True)
|
|
57
58
|
sub.add_parser("strengthen-verify", parents=[common])
|
|
58
59
|
sub.add_parser("strengthen-finish", parents=[common]).add_argument("--reviews", required=True)
|
|
59
60
|
return parser
|
|
@@ -119,6 +119,11 @@ class Repo:
|
|
|
119
119
|
fields.pop(0)
|
|
120
120
|
return paths
|
|
121
121
|
|
|
122
|
+
def changes(self) -> list[str]:
|
|
123
|
+
"""Every staged, unstaged or untracked path, from `git status --porcelain -z --no-renames`."""
|
|
124
|
+
out = self.git("status", "--porcelain", "-z", "--no-renames", "--untracked-files=all")
|
|
125
|
+
return [entry[3:] for entry in out.split("\0") if entry]
|
|
126
|
+
|
|
122
127
|
def require_clean(self) -> None:
|
|
123
128
|
dirty = self.dirty()
|
|
124
129
|
if dirty:
|
|
@@ -47,8 +47,9 @@ def strengthen_start(ctx) -> int:
|
|
|
47
47
|
ctx.state.save("strengthen.json", {"start": start, "verified": False, "items": work,
|
|
48
48
|
"status": {i["id"]: "open" for i in work}, "closed": {}})
|
|
49
49
|
path = ctx.state.save("strengthen-input.json", {"start": start, "items": work})
|
|
50
|
-
ctx.state.emit(f"{len(work)} strengthen items → {path}\
|
|
51
|
-
f"
|
|
50
|
+
ctx.state.emit(f"{len(work)} strengthen items → {path}\nWrite each item's tests test-first on top of {start[:12]}, touching "
|
|
51
|
+
f"only backend/tests/, and commit each item with `prune.py strengthen-commit --item <item id>` (one item "
|
|
52
|
+
f"per call; an item may take several). Never run `git commit` yourself.")
|
|
52
53
|
return 0
|
|
53
54
|
|
|
54
55
|
|
|
@@ -77,11 +78,21 @@ def reopened(history: list, closed: dict) -> list:
|
|
|
77
78
|
if len(items) == 1 and items[0] in closed and i > position.get(closed[items[0]], -1)]
|
|
78
79
|
|
|
79
80
|
|
|
81
|
+
def _recovery(start: str) -> str:
|
|
82
|
+
"""How to redo rejected commits with checkout, edits and commits alone (no reset)."""
|
|
83
|
+
return (f"Redo them one item per commit: `git checkout {start}`, then write each item's tests again and "
|
|
84
|
+
f"commit each item with `prune.py strengthen-commit --item <item id>`.")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _require_descends(repo, start: str) -> None:
|
|
88
|
+
if repo.run_git("merge-base", "--is-ancestor", start, "HEAD").returncode:
|
|
89
|
+
raise BadInput(f"HEAD does not descend from the strengthen start {start}")
|
|
90
|
+
|
|
91
|
+
|
|
80
92
|
def _commits(repo, st: dict) -> list:
|
|
81
93
|
"""[(sha, item id)] since start; every commit must name a known, open item and touch only backend/tests/."""
|
|
82
94
|
start = st["start"]
|
|
83
|
-
|
|
84
|
-
raise BadInput(f"HEAD does not descend from the strengthen start {start}")
|
|
95
|
+
_require_descends(repo, start)
|
|
85
96
|
errors = ["merge commits since the strengthen start"] if repo.git(
|
|
86
97
|
"rev-list", "--min-parents=2", f"{start}..HEAD").strip() else []
|
|
87
98
|
history = _history(repo, start)
|
|
@@ -90,10 +101,30 @@ def _commits(repo, st: dict) -> list:
|
|
|
90
101
|
errors += commit_problems(sha, items, paths, known)
|
|
91
102
|
errors += reopened(history, st["closed"])
|
|
92
103
|
if errors:
|
|
93
|
-
raise BadInput("strengthen commits rejected:\n" + "\n".join(errors))
|
|
104
|
+
raise BadInput("strengthen commits rejected:\n" + "\n".join(errors) + "\n" + _recovery(start))
|
|
94
105
|
return [(sha, items[0]) for sha, items, _ in history]
|
|
95
106
|
|
|
96
107
|
|
|
108
|
+
def strengthen_commit(ctx) -> int:
|
|
109
|
+
"""Commit the working tree's changes under backend/tests/ as one commit for one open item; the
|
|
110
|
+
trailer is written here, so a commit can never name two items."""
|
|
111
|
+
repo, st, item_id = ctx.repo, ctx.state.load("strengthen.json"), ctx.args.item
|
|
112
|
+
status = st["status"].get(item_id)
|
|
113
|
+
if status not in ("open", "proven"):
|
|
114
|
+
raise BadInput(f"{item_id} is not an open strengthen item (status: {status or 'unknown'})")
|
|
115
|
+
_require_descends(repo, st["start"])
|
|
116
|
+
changed = repo.changes()
|
|
117
|
+
outside = [p for p in changed if not p.startswith("backend/tests/")]
|
|
118
|
+
if outside:
|
|
119
|
+
raise BadInput("changes outside backend/tests/, discard them first:\n" + "\n".join(outside))
|
|
120
|
+
if not changed:
|
|
121
|
+
raise BadInput(f"nothing to commit for {item_id}: write its tests under backend/tests/ first")
|
|
122
|
+
repo.git("add", "-A", "--", "backend/tests/")
|
|
123
|
+
repo.git("commit", "-q", "-m", f"test: strengthen {item_id}", "-m", f"{TRAILER}: {item_id}")
|
|
124
|
+
ctx.state.emit(repo.head())
|
|
125
|
+
return 0
|
|
126
|
+
|
|
127
|
+
|
|
97
128
|
def _revert(repo, item_id: str, commits: list, why: str) -> None:
|
|
98
129
|
shas = [sha for sha, item in reversed(commits) if item == item_id]
|
|
99
130
|
if not shas:
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import json
|
|
3
3
|
import re
|
|
4
4
|
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
5
7
|
from prune_harness import PRUNE_BRANCH, REFERENCE, STRENGTHEN_BRANCH, R, arg, cand, case
|
|
6
8
|
|
|
7
9
|
COMPUTE = "rebalancer.compute_trades"
|
|
@@ -120,6 +122,28 @@ def test_a_co_author_paragraph_after_the_item_trailer_does_not_hide_it(target):
|
|
|
120
122
|
assert all(i in strengthen_pr(target) for i in IDS_7_9)
|
|
121
123
|
|
|
122
124
|
|
|
125
|
+
def test_a_commit_naming_two_items_is_rejected_with_a_recovery_the_agent_can_run(target):
|
|
126
|
+
# The unattended agent may not reset: the recovery must need only checkout, edits and commits.
|
|
127
|
+
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
|
128
|
+
groups={COMPUTE: strengthen_group(IDS_7_9), DRIFT: strengthen_group(["x_apply_drift__mutmut_2"])})
|
|
129
|
+
target.ok("strengthen-start")
|
|
130
|
+
start = target.read_state("strengthen.json")["start"]
|
|
131
|
+
path = target.root / "backend/tests/test_rebalancer.py"
|
|
132
|
+
path.write_text(path.read_text() + COMPUTE_TEST + DRIFT_TEST)
|
|
133
|
+
target.git("commit", "-qam", f"test: both\n\nTest-Prune-Item: {COMPUTE}\nTest-Prune-Item: {DRIFT}")
|
|
134
|
+
|
|
135
|
+
verify = target.run("strengthen-verify")
|
|
136
|
+
|
|
137
|
+
assert verify.returncode == 2
|
|
138
|
+
out = verify.stdout + verify.stderr
|
|
139
|
+
assert "one item per commit" in out
|
|
140
|
+
assert f"git checkout {start}" in out
|
|
141
|
+
target.git("checkout", "-q", start)
|
|
142
|
+
target.commit_test(COMPUTE, COMPUTE_TEST)
|
|
143
|
+
target.commit_test(DRIFT, DRIFT_TEST)
|
|
144
|
+
target.ok("strengthen-verify")
|
|
145
|
+
|
|
146
|
+
|
|
123
147
|
def test_strengthen_item_whose_ids_are_not_all_killed_is_reverted_and_left_out_of_the_pr(target):
|
|
124
148
|
drift_ids = ["x_apply_drift__mutmut_2", "x_apply_drift__mutmut_4"]
|
|
125
149
|
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
|
@@ -192,3 +216,123 @@ def test_every_post_batch_mutation_run_starts_from_an_empty_mutants_directory(ta
|
|
|
192
216
|
assert all(r["mutants"] in ("absent", "empty") for r in runs), runs
|
|
193
217
|
assert all(r["KEEP_CACHE"] is None for r in runs), runs
|
|
194
218
|
assert culprit in target.ids_at(target.remote_sha(PRUNE_BRANCH))
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
# --- strengthen-commit: prune.py makes each item's commit, one item per call -------------------
|
|
222
|
+
|
|
223
|
+
TESTS_FILE = "backend/tests/test_rebalancer.py"
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def write_test(target, source, file=TESTS_FILE):
|
|
227
|
+
path = target.root / file
|
|
228
|
+
path.write_text(path.read_text() + "\n\n" + source.strip("\n") + "\n")
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def two_items(target, drift_ids=("x_apply_drift__mutmut_2",)):
|
|
232
|
+
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
|
233
|
+
groups={COMPUTE: strengthen_group(IDS_7_9), DRIFT: strengthen_group(list(drift_ids))})
|
|
234
|
+
target.ok("strengthen-start")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def refused(target, item, needle):
|
|
238
|
+
head = target.git("rev-parse", "HEAD").strip()
|
|
239
|
+
proc = target.run("strengthen-commit", "--item", item)
|
|
240
|
+
assert proc.returncode == 2, proc.stdout + proc.stderr
|
|
241
|
+
assert needle in proc.stderr, proc.stderr
|
|
242
|
+
assert target.git("rev-parse", "HEAD").strip() == head
|
|
243
|
+
assert target.read_state("status.json")["commands"][-1] == {
|
|
244
|
+
"command": "strengthen-commit", "exit": 2, "reason": proc.stderr.strip().splitlines()[0]}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def test_strengthen_commit_makes_one_commit_per_item_that_strengthen_verify_accepts(target):
|
|
248
|
+
two_items(target)
|
|
249
|
+
shas = []
|
|
250
|
+
for item, source in [(COMPUTE, COMPUTE_TEST), (DRIFT, DRIFT_TEST)]:
|
|
251
|
+
write_test(target, source)
|
|
252
|
+
proc = target.ok("strengthen-commit", "--item", item)
|
|
253
|
+
sha = target.git("rev-parse", "HEAD").strip()
|
|
254
|
+
assert proc.stdout.strip() == sha
|
|
255
|
+
assert target.git("log", "-1", "--format=%s", sha).strip() == f"test: strengthen {item}"
|
|
256
|
+
trailers = target.git("log", "-1", "--format=%(trailers:key=Test-Prune-Item,valueonly)", sha).split()
|
|
257
|
+
assert trailers == [item]
|
|
258
|
+
assert target.git("diff-tree", "--no-commit-id", "--name-only", "-r", sha).split() == [TESTS_FILE]
|
|
259
|
+
shas.append(sha)
|
|
260
|
+
assert target.git("rev-list", "--reverse", f"{target.base}..HEAD").split() == shas
|
|
261
|
+
assert target.git("status", "--porcelain").strip() == ""
|
|
262
|
+
|
|
263
|
+
target.ok("strengthen-verify")
|
|
264
|
+
|
|
265
|
+
assert target.read_state("strengthen.json")["status"] == {
|
|
266
|
+
COMPUTE: "proven", DRIFT: "proven"}
|
|
267
|
+
write_test(target, COMPUTE_TEST.replace("_rounding", "_rounding_again"))
|
|
268
|
+
target.ok("strengthen-commit", "--item", COMPUTE) # a proven item is still open for more commits
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def test_strengthen_commit_commits_a_new_test_file_under_backend_tests(target):
|
|
272
|
+
two_items(target)
|
|
273
|
+
(target.root / "backend/tests/test_new.py").write_text(DRIFT_TEST)
|
|
274
|
+
|
|
275
|
+
target.ok("strengthen-commit", "--item", DRIFT)
|
|
276
|
+
|
|
277
|
+
assert target.git("diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD").split() == [
|
|
278
|
+
"backend/tests/test_new.py"]
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def test_strengthen_commit_refuses_an_unknown_item(target):
|
|
282
|
+
two_items(target)
|
|
283
|
+
write_test(target, COMPUTE_TEST)
|
|
284
|
+
refused(target, "rebalancer.no_such_group", "rebalancer.no_such_group")
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def test_strengthen_commit_refuses_an_item_strengthen_verify_closed(target):
|
|
288
|
+
two_items(target, drift_ids=("x_apply_drift__mutmut_2", "x_apply_drift__mutmut_4"))
|
|
289
|
+
write_test(target, DRIFT_TEST)
|
|
290
|
+
target.ok("strengthen-commit", "--item", DRIFT)
|
|
291
|
+
target.ok("strengthen-verify") # DRIFT_TEST leaves _4 alive: the item is reverted and closed
|
|
292
|
+
assert target.read_state("strengthen.json")["status"][DRIFT] == "reverted"
|
|
293
|
+
write_test(target, DRIFT_TEST.replace("_new", "_again"))
|
|
294
|
+
refused(target, DRIFT, "reverted")
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def test_strengthen_commit_refuses_before_strengthen_start(target):
|
|
298
|
+
target.prepare([cand(case(1))], accept=[COMPUTE], groups={COMPUTE: strengthen_group(IDS_7_9)})
|
|
299
|
+
write_test(target, COMPUTE_TEST)
|
|
300
|
+
refused(target, COMPUTE, "strengthen.json")
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
@pytest.mark.parametrize("outside", ["backend/services/rebalancer.py", "backend/notes.txt", "README-x.md"])
|
|
304
|
+
def test_strengthen_commit_refuses_any_change_outside_backend_tests(target, outside):
|
|
305
|
+
two_items(target)
|
|
306
|
+
write_test(target, COMPUTE_TEST)
|
|
307
|
+
path = target.root / outside
|
|
308
|
+
path.write_text((path.read_text() if path.exists() else "") + "\n# edited\n")
|
|
309
|
+
refused(target, COMPUTE, outside)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def test_strengthen_commit_refuses_a_staged_change_outside_backend_tests(target):
|
|
313
|
+
two_items(target)
|
|
314
|
+
write_test(target, COMPUTE_TEST)
|
|
315
|
+
path = target.root / "backend/services/rebalancer.py"
|
|
316
|
+
path.write_text(path.read_text() + "\n# edited\n")
|
|
317
|
+
target.git("add", "backend/services/rebalancer.py")
|
|
318
|
+
target.git("restore", "--worktree", "--source=HEAD", "backend/services/rebalancer.py")
|
|
319
|
+
refused(target, COMPUTE, "backend/services/rebalancer.py")
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def test_strengthen_commit_refuses_a_file_moved_into_backend_tests_from_outside(target):
|
|
323
|
+
two_items(target)
|
|
324
|
+
target.git("mv", "backend/services/rebalancer.py", "backend/tests/moved.py")
|
|
325
|
+
refused(target, COMPUTE, "\nbackend/services/rebalancer.py")
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def test_strengthen_commit_refuses_when_nothing_changed(target):
|
|
329
|
+
two_items(target)
|
|
330
|
+
refused(target, COMPUTE, "nothing to commit")
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def test_strengthen_commit_refuses_a_head_off_the_strengthen_start(target):
|
|
334
|
+
two_items(target)
|
|
335
|
+
target.git("checkout", "-q", "--orphan", "elsewhere")
|
|
336
|
+
target.git("commit", "-q", "-m", "unrelated root")
|
|
337
|
+
write_test(target, COMPUTE_TEST)
|
|
338
|
+
refused(target, COMPUTE, "does not descend")
|
|
@@ -123,7 +123,7 @@ The **Touches** line is a best guess, for scheduling: `implement-spec` never run
|
|
|
123
123
|
|
|
124
124
|
<risk-rule>
|
|
125
125
|
|
|
126
|
-
The optional **Risk** line names the shared state, persistence keys or identities, concurrency, money or auth the ticket touches
|
|
126
|
+
The optional **Risk** line names the shared state, persistence keys or identities, concurrency, money or auth the ticket touches. `implement-spec`'s reviewer checks it as one more criterion: a risk that the diff does not handle is an unmet criterion, which starts a fix round and blocks the ticket at the cap. The driver reads any text on the line as a risk, so a ticket with no such risk has no **Risk** line, never `**Risk:** none`.
|
|
127
127
|
|
|
128
128
|
</risk-rule>
|
|
129
129
|
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-31T08:31:27.446Z",
|
|
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.47",
|
|
62
|
+
"hash": "sha256-0aef522504cc63d918dd8731f9b2fa00e33c7291c680f37c3dfc6a08adc38d93",
|
|
63
63
|
"description": "Implement a specification in code."
|
|
64
64
|
},
|
|
65
65
|
{
|
|
@@ -94,14 +94,14 @@
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"name": "review-page",
|
|
97
|
-
"version": "0.1.
|
|
98
|
-
"hash": "sha256-
|
|
97
|
+
"version": "0.1.2",
|
|
98
|
+
"hash": "sha256-12746275595aafc21ea043843ee89a6bbc6f5a82e1e5440af831a1f3384b63d7",
|
|
99
99
|
"description": "One interactive HTML page for a plan review or a questionnaire, built from a fixed template. Use when a pipeline session must deliver a plan review or a questionnaire as an interactive page the console shows."
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"name": "test-prune",
|
|
103
|
-
"version": "0.1.
|
|
104
|
-
"hash": "sha256-
|
|
103
|
+
"version": "0.1.3",
|
|
104
|
+
"hash": "sha256-fc4cd53e5898627982dc8b48bf6c5fcea34c3acf492dbfd9a05b4181ce9160ef",
|
|
105
105
|
"description": "Mutation-guided test pruning: a fixer proposes deleting redundant tests and strengthening weak ones, an independent reviewer accepts or rejects each proposal, and prune.py applies the accepted batch behind a cold mutation run and the ratchet. Use when the user says \"prune tests\", \"test-prune\", \"mutation test pruning\" or \"strengthen weak tests\", or when a scheduled job runs it with `--unattended`."
|
|
106
106
|
},
|
|
107
107
|
{
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
"name": "to-tickets",
|
|
121
|
-
"version": "0.1.
|
|
122
|
-
"hash": "sha256-
|
|
121
|
+
"version": "0.1.7",
|
|
122
|
+
"hash": "sha256-c67cfed832cad39836bd054f7ca3ce423f4dc51055aa07e14c773c3bafa922f4",
|
|
123
123
|
"description": "Break a spec, plan, or the current conversation into numbered tracer-bullet ticket files under .agent/tickets/, each declaring its blocking edges and acceptance criteria phrased as observable behavior. Use after a spec is approved and before implementation starts."
|
|
124
124
|
},
|
|
125
125
|
{
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
When this correction adds a requirement, update each shared fake or fixture that other locked tests use, so that those tests satisfy the requirement too. List each file you change in `locked`, and each one that holds no test in `fixtures` too.
|
|
3
|
-
Then run each whole file of `locked` and each locked test of merged tickets. In `concerns`, name each red test and why it is expected to be red, or write that all are green.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Correctness pass
|
|
2
|
-
|
|
3
|
-
Spec: {spec}
|
|
4
|
-
Ticket: {ticket}
|
|
5
|
-
Seam: {seam}
|
|
6
|
-
Range: {pr_branch}...{branch}, with the ticket tip at {start_sha}
|
|
7
|
-
Locked files: {locked}
|
|
8
|
-
|
|
9
|
-
Apply each check of the review-diff checks below to the diff of the range, with the Risk line of the ticket first: races, idempotency, time, authorization, persistence keys and identities, migrations, error paths.
|
|
10
|
-
The output section of the checks does not apply here: your findings go into the report.
|
|
11
|
-
|
|
12
|
-
<checks>
|
|
13
|
-
{correctness}
|
|
14
|
-
</checks>
|
|
15
|
-
|
|
16
|
-
Read file content from git at {start_sha} (`git diff`, `git show {start_sha}:<path>`), never from the working tree, and run no tests: another agent makes temporary edits in this worktree while you work.
|
|
17
|
-
The one exception is the input of the driver, which git can lack because `.agent/` is ignored: read the spec, the ticket and the findings file from the working tree. The other agent does not edit them.
|
|
18
|
-
Report only a defect that you can show with a concrete sequence of events. Put an unmet ticket criterion or regression of merged-ticket behavior in `findings`; put every other defect in `observations` for final review. Set `basis` on each finding to `criterion` or `regression` accordingly. `mutations` is optional for this pass.
|
|
19
|
-
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.
|
|
20
|
-
Do not commit and do not dispatch subagents. Leave the tree as you found it.
|
|
21
|
-
|
|
22
|
-
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:
|
|
23
|
-
|
|
24
|
-
```json
|
|
25
|
-
{
|
|
26
|
-
"type": "object",
|
|
27
|
-
"required": ["status", "files", "concerns", "findings"],
|
|
28
|
-
"properties": {
|
|
29
|
-
"status": {"enum": ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"]},
|
|
30
|
-
"files": {"type": "array", "items": {"type": "string"}},
|
|
31
|
-
"concerns": {"type": "array", "items": {"type": "string"}},
|
|
32
|
-
"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"]}}}},
|
|
33
|
-
"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"]}}}},
|
|
34
|
-
"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"]}}}},
|
|
35
|
-
"mutations": {"description": "Optional for this pass.", "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}}}}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Run git as plain `git` in this worktree, and leave the git config as it is: all worktrees read one shared config, and one key written there, such as a `core.worktree`, breaks git in each of them. So never set GIT_DIR or GIT_WORK_TREE, and never write with `git config`.
|
|
41
|
-
The gate record of the driver for {start_sha} is {gate_record}.
|
|
42
|
-
Never run `git stash`, never reset, and never check out another branch: worktrees share one stash and one ref store.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This is the scoped review after the fix batch: the range holds only the `fix(NN)` commits, and the commits up to {reviewed} have their review. Check that each critical or important finding in {findings} is fixed, including every must-fix finding, and that the fix commits break nothing else. Put each verified must-fix title in `resolved_must_fix`.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
This call is a correction after a ruling, not a new test set. The implementer or the fixer reported that a locked test contradicts the spec or the ticket, and the operator ruled that the test is wrong: read `concerns` in {blocked_report}.
|
|
3
|
-
Correct only the tests that those concerns name, so that they state what the spec and the ticket require. Keep each other test as it is.
|
|
4
|
-
The branch can hold commits of the implementer, and the tree can hold its uncommitted work: change neither, and commit only the test files you correct.
|
|
5
|
-
A corrected test fails because the behavior is missing: run it, print that failing output, and give its failure line in `red`. A corrected test can be green, because the implementer's code is there: then break the production line that the test protects, run the test, print its failing output, give that line in `red`, and revert the edit. In `locked`, list each test file you corrected.
|
|
6
|
-
When a concern needs no test change, leave the test as it is and add the concern to `not_addressed`: `finding` is its text, copied exactly from this list, and `reason` is why the test stands:
|
|
7
|
-
{overruled}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Before the ruling of the operator, the driver rejected two reports of this role in this review: {rejection}. This time, give what the driver asked for.
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
The driver ran the gate on that commit, {start_sha}, and the gate is red: read the output in {record}. The gate was green before the restore, so a restored file fails with the code of this ticket.
|
|
3
|
-
Update each restored file that fails so that it works with the new interface: keep what each test asserts, and list the file in `locked`. When no such update can keep what a test asserts, report BLOCKED with a concern that starts with `locked test contradicts spec:`, then the test and the evidence.
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
The driver put back these files at their locked versions, in a commit before this call, because the implementer or a fixer had changed them: {restored}.
|
|
3
|
-
A fixer may not change a locked file. When a test in one of these files now fails only because this ticket changed an interface that the test uses, update that file so it works with the new interface: keep what each test asserts, and list the file in `locked`. Else leave the file as it is, unless a finding of this correction is on it.
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
The earlier attempt reported that a locked test contradicts the spec, and the operator ruled that the locked tests stand as they are. Your earlier commits are on the branch and your uncommitted work is in the tree: continue from them and make the locked tests green. Do not report that contradiction again.
|