@jesdi/skills 0.0.102 → 0.0.104
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/pr-exam/SKILL.md +22 -2
- package/skills/pr-exam/fixtures/README.md +3 -0
- package/skills/pr-exam/fixtures/chat-answer/prompt.md +92 -0
- package/skills/pr-exam/fixtures/chat-answer/reply.md +7 -0
- package/skills/pr-exam/fixtures/chat-answer/turn.json +1 -0
- package/skills/pr-exam/fixtures/tip-choice/prompt.md +97 -0
- package/skills/pr-exam/fixtures/tip-choice/reply.md +1 -0
- package/skills/pr-exam/fixtures/tip-choice/turn.json +1 -0
- package/skills/pr-exam/fixtures/tip-text/prompt.md +97 -0
- package/skills/pr-exam/fixtures/tip-text/reply.md +1 -0
- package/skills/pr-exam/fixtures/tip-text/turn.json +1 -0
- package/skills/pr-exam/pr_exam.py +206 -24
- package/skills/pr-exam/test_context.py +174 -0
- package/skills/pr-exam/test_flag_shapes.py +18 -0
- package/skills/pr-exam/test_learning_records.py +88 -0
- package/skills/pr-exam/test_scoring.py +166 -0
- package/skills/pr-exam/test_skill_fixtures.py +48 -0
- package/skills/pr-exam/test_turn_shapes.py +34 -0
- package/skills/test-weigh-in/tests/test_mutation_score.py +26 -0
- package/skills/test-weigh-in/weigh_mutation.py +11 -1
- package/skills-manifest.json +5 -5
|
@@ -8,6 +8,8 @@ import subprocess
|
|
|
8
8
|
import sys
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
|
+
import pytest
|
|
12
|
+
|
|
11
13
|
SCRIPT = Path(__file__).parent / "pr_exam.py"
|
|
12
14
|
SHA = "a" * 40
|
|
13
15
|
CONCEPTS = [("c-why", "why"), ("lease-ownership", "concept"),
|
|
@@ -119,3 +121,167 @@ def test_refuse_text_question_without_grade(tmp_path):
|
|
|
119
121
|
def test_refuse_unknown_grade(tmp_path):
|
|
120
122
|
g = {"q1": {"grade": "excellent", "feedback": "f"}, "q2": {"grade": "pass", "feedback": "f"}}
|
|
121
123
|
refused(score(tmp_path, grades=g), "q1", "excellent")
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# --- spec specs/pr-exam-assist: requirements 5-8 (bypassed and assisted questions) ---
|
|
127
|
+
# Optional --flags reads {"bypassed": [qid, ...], "assisted": [qid, ...]}.
|
|
128
|
+
# Omitted keys mean no flags; output questions use help="bypassed" or "assisted".
|
|
129
|
+
# Exam: q1-q3 choice (key answer 1), q4 text on the why concept, q5 and q6 text.
|
|
130
|
+
ASSIST_CONCEPTS = [("merge-lease", "concept"), ("retry-budget", "concept"), ("head-recheck", "architecture"),
|
|
131
|
+
("lease-owner", "why"), ("fencing-token", "concept"), ("stale-lease", "concept")]
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def assist_exam(n=6):
|
|
135
|
+
qs, key = [], {}
|
|
136
|
+
for i, (slug, _) in enumerate(ASSIST_CONCEPTS[:n], 1):
|
|
137
|
+
t = "choice" if i <= 3 else "text"
|
|
138
|
+
q = {"id": f"q{i}", "concept": slug, "type": t, "prompt": f"Prompt {i}?"}
|
|
139
|
+
k = {"explanation": f"Explain {i}.", "hunk": f"+hunk {i}"}
|
|
140
|
+
if t == "choice":
|
|
141
|
+
q["options"] = ["alpha beta", "gamma delta", "zeta eta"]
|
|
142
|
+
k["answer"] = 1
|
|
143
|
+
else:
|
|
144
|
+
k["rubric"] = {"pass": "Names it.", "partial": "Mentions it."}
|
|
145
|
+
qs.append(q)
|
|
146
|
+
key[q["id"]] = k
|
|
147
|
+
concepts = [{"id": s, "title": s, "kind": k} for s, k in ASSIST_CONCEPTS[:n]]
|
|
148
|
+
if n == 1:
|
|
149
|
+
concepts = [{"id": "readme-typo", "title": "README typo", "kind": "behaviour"}]
|
|
150
|
+
qs[0].update(concept="readme-typo", prompt="Which word did the README correct?",
|
|
151
|
+
options=["merge lease", "retry budget", "fencing token"])
|
|
152
|
+
key["q1"].update(explanation="The README now spells retry budget correctly.",
|
|
153
|
+
hunk="-retry buget\n+retry budget")
|
|
154
|
+
return {"version": 1, "mode": "first", "repo": "jesdi/general-skills", "pr": 240, "head_sha": SHA,
|
|
155
|
+
"concepts": concepts, "questions": qs, "key": key}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def flagged(tmp_path, flags, wrong=(), grades=None, skip=(), n=6):
|
|
159
|
+
"""Everything full points except `wrong` choice ids (answered 0) and `grades` overrides.
|
|
160
|
+
Questions in `skip` get neither an answer nor a grade."""
|
|
161
|
+
g = {"q4": "pass", "q5": "pass", "q6": "pass", **(grades or {})}
|
|
162
|
+
a = {f"q{i}": (0 if f"q{i}" in wrong else 1) for i in (1, 2, 3)}
|
|
163
|
+
a.update({"q4": "t", "q5": "t", "q6": "t"})
|
|
164
|
+
ans = {k: v for k, v in a.items() if k in {f"q{i}" for i in range(1, n + 1)} and k not in skip}
|
|
165
|
+
grs = {k: {"grade": v, "feedback": "f"} for k, v in g.items()
|
|
166
|
+
if k in {f"q{i}" for i in range(1, n + 1)} and k not in skip}
|
|
167
|
+
files = {"exam": assist_exam(n), "answers": ans, "grades": grs}
|
|
168
|
+
if flags is not None:
|
|
169
|
+
files["flags"] = flags
|
|
170
|
+
for name, data in files.items():
|
|
171
|
+
(tmp_path / f"{name}.json").write_text(json.dumps(data))
|
|
172
|
+
cmd = [sys.executable, str(SCRIPT), "score", "--exam", str(tmp_path / "exam.json"),
|
|
173
|
+
"--answers", str(tmp_path / "answers.json"), "--grades", str(tmp_path / "grades.json")]
|
|
174
|
+
if flags is not None:
|
|
175
|
+
cmd += ["--flags", str(tmp_path / "flags.json")]
|
|
176
|
+
return subprocess.run(cmd, capture_output=True, text=True)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def by_id(res):
|
|
180
|
+
return {q["id"]: q for q in res["questions"]}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def test_bypassed_question_leaves_the_score(tmp_path):
|
|
184
|
+
res = ok(flagged(tmp_path, {"bypassed": ["q6"]}, skip=("q6",)))
|
|
185
|
+
assert (res["score"], res["max"], res["passed"]) == (5, 5, True)
|
|
186
|
+
assert by_id(res)["q6"]["help"] == "bypassed"
|
|
187
|
+
assert "stale-lease" not in res["missed"]
|
|
188
|
+
assert "points" not in by_id(res)["q6"]
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def test_exactly_80_percent_of_not_bypassed_passes(tmp_path):
|
|
192
|
+
res = ok(flagged(tmp_path, {"bypassed": ["q6"]}, wrong=("q1",), skip=("q6",)))
|
|
193
|
+
assert (res["score"], res["max"], res["passed"]) == (4, 5, True)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def test_under_80_percent_of_not_bypassed_fails(tmp_path):
|
|
197
|
+
res = ok(flagged(tmp_path, {"bypassed": ["q6"]}, wrong=("q1",), grades={"q5": "partial"}, skip=("q6",)))
|
|
198
|
+
assert (res["score"], res["max"], res["passed"]) == (3.5, 5, False)
|
|
199
|
+
assert sorted(res["missed"]) == ["fencing-token", "merge-lease"]
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def test_bypassed_why_question_does_not_fail_the_attempt(tmp_path):
|
|
203
|
+
res = ok(flagged(tmp_path, {"bypassed": ["q4"]}, skip=("q4",)))
|
|
204
|
+
assert (res["score"], res["max"], res["passed"]) == (5, 5, True)
|
|
205
|
+
assert "lease-owner" not in res["missed"]
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def test_two_bypasses_are_refused(tmp_path):
|
|
209
|
+
r = flagged(tmp_path, {"bypassed": ["q2", "q6"]})
|
|
210
|
+
refused(r, "q2", "q6")
|
|
211
|
+
assert r.stdout == ""
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def test_answer_to_bypassed_question_is_ignored(tmp_path):
|
|
215
|
+
res = ok(flagged(tmp_path, {"bypassed": ["q2"]}, wrong=("q2",)))
|
|
216
|
+
q2 = by_id(res)["q2"]
|
|
217
|
+
assert (res["score"], res["max"]) == (5, 5)
|
|
218
|
+
assert q2["help"] == "bypassed" and "points" not in q2
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def test_bypassed_question_carries_explanation_and_hunk(tmp_path):
|
|
222
|
+
q6 = by_id(ok(flagged(tmp_path, {"bypassed": ["q6"]}, skip=("q6",))))["q6"]
|
|
223
|
+
assert (q6["explanation"], q6["hunk"]) == ("Explain 6.", "+hunk 6")
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def test_assisted_question_scores_as_usual(tmp_path):
|
|
227
|
+
res = ok(flagged(tmp_path, {"assisted": ["q2"]}))
|
|
228
|
+
q2 = by_id(res)["q2"]
|
|
229
|
+
assert (q2["points"], q2["help"]) == (1, "assisted")
|
|
230
|
+
assert (res["score"], res["max"]) == (6, 6)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def test_bypass_outranks_assisted(tmp_path):
|
|
234
|
+
q6 = by_id(ok(flagged(tmp_path, {"bypassed": ["q6"], "assisted": ["q6"]}, skip=("q6",))))["q6"]
|
|
235
|
+
assert q6["help"] == "bypassed"
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def test_bypassing_the_only_question_passes(tmp_path):
|
|
239
|
+
res = ok(flagged(tmp_path, {"bypassed": ["q1"]}, skip=("q1",), n=1))
|
|
240
|
+
assert (res["score"], res["max"], res["passed"]) == (0, 0, True)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
@pytest.mark.parametrize("flag", ["assisted", "bypassed"])
|
|
244
|
+
def test_flags_with_unknown_question_are_refused(tmp_path, flag):
|
|
245
|
+
result = flagged(tmp_path, {flag: ["q9"]})
|
|
246
|
+
refused(result, "q9")
|
|
247
|
+
assert result.stdout == ""
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def test_flags_with_unknown_key_are_refused(tmp_path):
|
|
251
|
+
result = flagged(tmp_path, {"skipped": ["q1"]})
|
|
252
|
+
refused(result, "skipped")
|
|
253
|
+
assert result.stdout == ""
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
@pytest.mark.parametrize("grades,bypassed", [
|
|
258
|
+
({"q6": "fail"}, "q6"),
|
|
259
|
+
({"q6": "excellent"}, "q6"),
|
|
260
|
+
({"q2": "pass"}, "q2"),
|
|
261
|
+
])
|
|
262
|
+
def test_grade_for_bypassed_question_is_ignored(tmp_path, grades, bypassed):
|
|
263
|
+
res = ok(flagged(tmp_path, {"bypassed": [bypassed]}, grades=grades))
|
|
264
|
+
assert (res["score"], res["max"], res["passed"]) == (5, 5, True)
|
|
265
|
+
assert "stale-lease" not in res["missed"]
|
|
266
|
+
assert by_id(res)[bypassed]["help"] == "bypassed"
|
|
267
|
+
assert "points" not in by_id(res)[bypassed]
|
|
268
|
+
assert res["missed"] == []
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def test_flags_are_never_inferred_without_the_flags_file(tmp_path):
|
|
272
|
+
"""A follow-up exam reuses ids: stale flag data elsewhere must not mark q6 bypassed."""
|
|
273
|
+
baseline = flagged(tmp_path, None)
|
|
274
|
+
ok(baseline)
|
|
275
|
+
exam_data = json.loads((tmp_path / "exam.json").read_text())
|
|
276
|
+
exam_data["mode"] = "followup"
|
|
277
|
+
exam_data["flags"] = {"bypassed": ["q6"], "assisted": ["q2"]}
|
|
278
|
+
exam_data["questions"][5]["help"] = "bypassed"
|
|
279
|
+
(tmp_path / "exam.json").write_text(json.dumps(exam_data))
|
|
280
|
+
(tmp_path / "flags.json").write_text(json.dumps({"bypassed": ["q6"], "assisted": ["q2"]}))
|
|
281
|
+
r = subprocess.run([sys.executable, str(SCRIPT), "score", "--exam", str(tmp_path / "exam.json"),
|
|
282
|
+
"--answers", str(tmp_path / "answers.json"), "--grades", str(tmp_path / "grades.json")],
|
|
283
|
+
capture_output=True, text=True)
|
|
284
|
+
res = ok(r)
|
|
285
|
+
assert (res["score"], res["max"]) == (6, 6)
|
|
286
|
+
assert all("help" not in q for q in res["questions"])
|
|
287
|
+
assert r.stdout == baseline.stdout
|
|
@@ -9,10 +9,16 @@ Fixture layout the skill ships (ticket 06, Touches `skills/pr-exam/fixtures/`),
|
|
|
9
9
|
each: request.json, diff.patch, exam.json; the later modes also records/, a delta passed.diff
|
|
10
10
|
fixtures/grading/ request.json, questions.json, answers.json -> grades.json (one grading session),
|
|
11
11
|
and attempt.json: every answer of the attempt, which the host scores
|
|
12
|
+
fixtures/tip-choice/ a recorded tip on a `choice` question of the twelve-concept exam
|
|
13
|
+
fixtures/tip-text/ a recorded tip 1 on a `text` question of the same exam
|
|
14
|
+
fixtures/chat-answer/ a recorded `question` turn on a `choice` question: "what is the answer?"
|
|
15
|
+
each: turn.json, prompt.md (= `context` on turn.json, exam, diff and body of fixtures/twelve-concepts),
|
|
16
|
+
reply.md (the model's reply to prompt.md)
|
|
12
17
|
`request.json` is the session's request; its `diff`, `body`, `records`, `out`, `passed_diff` and `glossary`
|
|
13
18
|
paths are rewritten here to a temp directory, so the fixture's own values are not trusted.
|
|
14
19
|
"""
|
|
15
20
|
import json
|
|
21
|
+
import re
|
|
16
22
|
import shutil
|
|
17
23
|
import subprocess
|
|
18
24
|
import sys
|
|
@@ -86,3 +92,45 @@ def test_recorded_grading_run_grades_every_text_question_and_is_accepted_by_scor
|
|
|
86
92
|
result = json.loads(r.stdout)
|
|
87
93
|
assert result["passed"] is False # the failed attempt the recorded followup answers
|
|
88
94
|
assert result["missed"] == json.loads((fixture("followup") / "request.json").read_text())["only_concepts"]
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
TURNS = ["tip-choice", "tip-text", "chat-answer"]
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def turn_run(name):
|
|
101
|
+
d, base = fixture(name), fixture("twelve-concepts")
|
|
102
|
+
for f in ("turn.json", "prompt.md", "reply.md"):
|
|
103
|
+
assert (d / f).is_file() and (d / f).read_text().strip(), f"{d / f} missing or empty"
|
|
104
|
+
turn = json.loads((d / "turn.json").read_text())
|
|
105
|
+
exam = json.loads((base / "exam.json").read_text())
|
|
106
|
+
question = next(q for q in exam["questions"] if q["id"] == turn["question"])
|
|
107
|
+
return d, base, turn, exam, question, (d / "reply.md").read_text()
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_recorded_tip_on_a_choice_question_gives_no_option_away():
|
|
111
|
+
_, _, turn, _, q, reply = turn_run("tip-choice")
|
|
112
|
+
assert turn["kind"] == "tip" and q["type"] == "choice"
|
|
113
|
+
assert q["options"] and not [o for o in q["options"] if o.lower() in reply.lower()]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def test_recorded_first_tip_on_a_text_question_names_a_file_of_the_diff():
|
|
117
|
+
_, base, turn, _, q, reply = turn_run("tip-text")
|
|
118
|
+
assert turn["kind"] == "tip" and turn["tip"] == 1 and q["type"] == "text"
|
|
119
|
+
paths = set(re.findall(r"^diff --git a/(\S+) b/", (base / "diff.patch").read_text(), re.M))
|
|
120
|
+
assert paths and any(p in reply for p in paths), (paths, reply)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def test_recorded_chat_turn_asking_for_the_answer_gives_the_option_at_the_keys_answer_index():
|
|
124
|
+
_, _, turn, exam, q, reply = turn_run("chat-answer")
|
|
125
|
+
assert turn["kind"] == "question" and turn["message"] == "what is the answer?" and q["type"] == "choice"
|
|
126
|
+
assert q["options"][exam["key"][q["id"]]["answer"]].lower() in reply.lower()
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@pytest.mark.parametrize("name", TURNS)
|
|
130
|
+
def test_context_on_a_recorded_turn_reproduces_its_stored_prompt(name):
|
|
131
|
+
d, base, *_ = turn_run(name)
|
|
132
|
+
r = subprocess.run([sys.executable, str(SCRIPT), "context", "--exam", str(base / "exam.json"),
|
|
133
|
+
"--diff", str(base / "diff.patch"), "--body", str(base / "body.md"),
|
|
134
|
+
"--turn", str(d / "turn.json")], capture_output=True, text=True)
|
|
135
|
+
assert r.returncode == 0, r.stderr or r.stdout
|
|
136
|
+
assert r.stdout == (d / "prompt.md").read_text()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""`context` holds each turn kind to its documented shape (design.md, turn.json) and, after submit,
|
|
2
|
+
gives a question turn the submitted answer in place of the draft (spec requirement 2)."""
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from test_context import context, graded_turn, ok, refused, tail, tip
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_submitted_answer_replaces_the_draft(tmp_path):
|
|
9
|
+
p = tail(ok(context(tmp_path, graded_turn(draft="NEW DRAFT", submitted="OLD SUBMISSION"))))
|
|
10
|
+
assert "OLD SUBMISSION" in p and "NEW DRAFT" not in p and "draft" not in p.lower(), p
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@pytest.mark.parametrize("turn, words", [
|
|
14
|
+
({**tip(1, ""), "submitted": "answer", "points": 0}, ("submitted", "tip turn")),
|
|
15
|
+
({**tip(1, ""), "message": "hi"}, ("message", "tip turn")),
|
|
16
|
+
({**tip(2, ""), "tips": "previous tip"}, ("tips", "list of strings")),
|
|
17
|
+
({**tip(2, ""), "tips": [1]}, ("tips", "list of strings")),
|
|
18
|
+
({**tip(1, ""), "thread": []}, ("thread", "tip turn")),
|
|
19
|
+
({"kind": "question", "question": "q2", "tips": [], "message": "m"}, ("tips", "question turn")),
|
|
20
|
+
({"kind": "question", "question": "q2", "thread": ["hi"], "message": "m"}, ("thread", "role")),
|
|
21
|
+
({"kind": "question", "question": "q2", "thread": [{"role": "user"}], "message": "m"}, ("thread", "role")),
|
|
22
|
+
({"kind": "question", "question": "q2", "message": 3}, ("message", "string")),
|
|
23
|
+
(graded_turn(points="0"), ("points", "number")),
|
|
24
|
+
(graded_turn(feedback=["f"]), ("feedback", "string")),
|
|
25
|
+
(graded_turn(submitted=None), ("submitted", "string")),
|
|
26
|
+
({"kind": "general", "question": "q2", "message": "m"}, ("question", "general")),
|
|
27
|
+
({"kind": "general", "thread": {}, "message": "m"}, ("thread", "role")),
|
|
28
|
+
])
|
|
29
|
+
def test_turn_outside_its_shape_is_refused(tmp_path, turn, words):
|
|
30
|
+
refused(context(tmp_path, turn), *words)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_turn_that_is_not_an_object_is_refused(tmp_path):
|
|
34
|
+
refused(context(tmp_path, ["tip"]), "turn kind")
|
|
@@ -154,3 +154,29 @@ def test_ctrl_c_removes_the_worktree(tmp_path, home, cache):
|
|
|
154
154
|
finally:
|
|
155
155
|
reap(proc)
|
|
156
156
|
assert len(worktrees(repo)) == 1
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
DRAIN = """import subprocess, sys
|
|
160
|
+
sys.path.insert(0, {skill!r})
|
|
161
|
+
from weigh_mutation import _drain
|
|
162
|
+
chatty = "import signal, sys\\nsignal.signal(signal.SIGINT, signal.SIG_IGN)\\nwhile True: print('x' * 100, flush=True)"
|
|
163
|
+
proc = subprocess.Popen([sys.executable, "-c", chatty], stdout=subprocess.PIPE, text=True)
|
|
164
|
+
try:
|
|
165
|
+
_drain(proc)
|
|
166
|
+
except KeyboardInterrupt:
|
|
167
|
+
proc.kill()
|
|
168
|
+
sys.exit(130)
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def test_a_ctrl_c_between_two_reads_still_stops_the_wait():
|
|
173
|
+
"""mutmut that keeps printing and ignores Ctrl-C: a plain communicate() misses about one SIGINT in five, here 10 in a row stop."""
|
|
174
|
+
script = DRAIN.format(skill=str(WEIGH.parent))
|
|
175
|
+
for _ in range(10):
|
|
176
|
+
proc = subprocess.Popen([sys.executable, "-c", script], start_new_session=True)
|
|
177
|
+
try:
|
|
178
|
+
time.sleep(0.5)
|
|
179
|
+
os.kill(proc.pid, signal.SIGINT)
|
|
180
|
+
assert proc.wait(timeout=5) == 130
|
|
181
|
+
finally:
|
|
182
|
+
reap(proc)
|
|
@@ -153,6 +153,16 @@ def _matrix(python, repo, wt, env, per_function):
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
|
|
156
|
+
def _drain(proc):
|
|
157
|
+
"""proc's stdout once it exits. It wakes every second: a blocking read misses a Ctrl-C that lands between two reads of
|
|
158
|
+
mutmut's output, and mutmut can hang after its own Ctrl-C, so the run would wait forever."""
|
|
159
|
+
while True:
|
|
160
|
+
try:
|
|
161
|
+
return proc.communicate(timeout=1)[0]
|
|
162
|
+
except subprocess.TimeoutExpired:
|
|
163
|
+
pass
|
|
164
|
+
|
|
165
|
+
|
|
156
166
|
def score(python, repo, overlay, per_function=3):
|
|
157
167
|
"""The pinned mutmut run on HEAD and its kill matrix, as a dict: score (percent of all mutants killed), pseudo_tested
|
|
158
168
|
(percent of the covered functions whose mutants all survived), sampled (mutant ids: per_function per function on
|
|
@@ -170,7 +180,7 @@ def score(python, repo, overlay, per_function=3):
|
|
|
170
180
|
_configure(wt, python_files(wt))
|
|
171
181
|
env = {**os.environ, "PYTHONPATH": str(mutmut_overlay(python)), "PYTHONDONTWRITEBYTECODE": "1"}
|
|
172
182
|
proc = subprocess.Popen([str(python), "-m", "mutmut", "run"], cwd=wt, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
|
173
|
-
out = proc
|
|
183
|
+
out = _drain(proc)
|
|
174
184
|
if proc.returncode:
|
|
175
185
|
raise SetupError(f"mutmut run exited {proc.returncode}:\n" + out)
|
|
176
186
|
exported = subprocess.run([str(python), "-m", "mutmut", "export-cicd-stats"], cwd=wt, env=env, capture_output=True, text=True)
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-25T02:41:02.281Z",
|
|
4
4
|
"skills": [
|
|
5
5
|
{
|
|
6
6
|
"name": "agents-wayfinder",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"name": "pr-exam",
|
|
67
|
-
"version": "0.1.
|
|
68
|
-
"hash": "sha256-
|
|
67
|
+
"version": "0.1.1",
|
|
68
|
+
"hash": "sha256-d0b41f8978fd33978f3a3ce2e6aa6e22a489c1ac479a523cfdc9d23fbdcfd97e",
|
|
69
69
|
"description": "Deterministic rules for a PR exam: validate a generated exam.json against its generation request, project the served (answer-free) exam, score an attempt, read and write learning records, and validate a repo's .pr-exam.json. Use when generating, serving or grading a PR exam, or when the user says \"pr-exam\"."
|
|
70
70
|
},
|
|
71
71
|
{
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
"name": "test-weigh-in",
|
|
115
|
-
"version": "0.1.
|
|
116
|
-
"hash": "sha256-
|
|
115
|
+
"version": "0.1.5",
|
|
116
|
+
"hash": "sha256-eaf67863d41bfeb1ac8a2d98888a9e92aafe0feb78bc498ac8ef6fba7f8bde68",
|
|
117
117
|
"description": "Measure a Python/pytest suite and score it on five pillars (Protection against regressions, Resistance to refactoring, Fast feedback, Maintainability, Economy), writing a JSON snapshot and a static HTML dashboard. Read-only. Use when the user asks to weigh, measure or score their test suite."
|
|
118
118
|
},
|
|
119
119
|
{
|