@jesdi/skills 0.0.80 → 0.0.82
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 +2 -1
- package/skills/crap-gate/launcher.sh +104 -0
- package/skills/crap-gate/run.sh +15 -75
- package/skills/crap-gate/test_launcher.py +39 -0
- package/skills/implement-spec/launcher.sh +104 -0
- package/skills/implement-spec/run.sh +10 -89
- package/skills/implement-spec/tests/test_launcher.py +138 -0
- package/skills/test-prune/SKILL.md +4 -2
- package/skills/test-prune/prune_strengthen.py +24 -12
- package/skills/test-prune/tests/test_prune_guards.py +1 -1
- package/skills/test-prune/tests/test_prune_inputs.py +10 -5
- package/skills/test-prune/tests/test_prune_strengthen.py +34 -12
- package/skills/test-weigh-in/SKILL.md +16 -0
- package/skills/test-weigh-in/dashboard.html +112 -0
- package/skills/test-weigh-in/launcher.sh +104 -0
- package/skills/test-weigh-in/rules.toml +134 -0
- package/skills/test-weigh-in/run.sh +21 -0
- package/skills/test-weigh-in/tests/brittle_repo.py +79 -0
- package/skills/test-weigh-in/tests/conftest.py +35 -0
- package/skills/test-weigh-in/tests/fixture_repo.py +99 -0
- package/skills/test-weigh-in/tests/kill_repo.py +87 -0
- package/skills/test-weigh-in/tests/maint_repo.py +139 -0
- package/skills/test-weigh-in/tests/map_fixture.py +56 -0
- package/skills/test-weigh-in/tests/pt_repo.py +46 -0
- package/skills/test-weigh-in/tests/red_repo.py +44 -0
- package/skills/test-weigh-in/tests/rule_repo.py +208 -0
- package/skills/test-weigh-in/tests/rules_fixture.py +65 -0
- package/skills/test-weigh-in/tests/smell_repo.py +138 -0
- package/skills/test-weigh-in/tests/test_brittleness.py +75 -0
- package/skills/test-weigh-in/tests/test_brittleness_history.py +168 -0
- package/skills/test-weigh-in/tests/test_coverage_run.py +201 -0
- package/skills/test-weigh-in/tests/test_coverage_value.py +76 -0
- package/skills/test-weigh-in/tests/test_dashboard_map.py +20 -0
- package/skills/test-weigh-in/tests/test_interpreters.py +115 -0
- package/skills/test-weigh-in/tests/test_kill_matrix.py +126 -0
- package/skills/test-weigh-in/tests/test_maintainability_smells.py +113 -0
- package/skills/test-weigh-in/tests/test_mutation_recovery.py +67 -0
- package/skills/test-weigh-in/tests/test_mutation_sampling.py +53 -0
- package/skills/test-weigh-in/tests/test_mutation_score.py +140 -0
- package/skills/test-weigh-in/tests/test_mutation_stale.py +30 -0
- package/skills/test-weigh-in/tests/test_mutmut_contract.py +43 -0
- package/skills/test-weigh-in/tests/test_ruff_pt_smells.py +45 -0
- package/skills/test-weigh-in/tests/test_runs.py +156 -0
- package/skills/test-weigh-in/tests/test_score.py +26 -0
- package/skills/test-weigh-in/tests/test_scoring.py +154 -0
- package/skills/test-weigh-in/tests/test_smell_rules.py +96 -0
- package/skills/test-weigh-in/tests/test_smells.py +71 -0
- package/skills/test-weigh-in/tests/test_walking_skeleton.py +91 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/demo/__init__.py +0 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/demo/board.py +2 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/demo/config.py +2 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/pyproject.toml +8 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_board.py +19 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_config.py +19 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_parser.py +19 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_render.py +19 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_report.py +17 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_session.py +19 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_store.py +17 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/tests/test_sync.py +17 -0
- package/skills/test-weigh-in/tests/testdata/default_repo/uv.lock +1 -0
- package/skills/test-weigh-in/weigh.py +133 -0
- package/skills/test-weigh-in/weigh_coverage.py +154 -0
- package/skills/test-weigh-in/weigh_dashboard.py +72 -0
- package/skills/test-weigh-in/weigh_env.py +112 -0
- package/skills/test-weigh-in/weigh_git.py +119 -0
- package/skills/test-weigh-in/weigh_inventory.py +49 -0
- package/skills/test-weigh-in/weigh_mutation.py +190 -0
- package/skills/test-weigh-in/weigh_pytest_plugin.py +70 -0
- package/skills/test-weigh-in/weigh_ruff.py +22 -0
- package/skills/test-weigh-in/weigh_rules.py +65 -0
- package/skills/test-weigh-in/weigh_runs.py +134 -0
- package/skills/test-weigh-in/weigh_score.py +80 -0
- package/skills/test-weigh-in/weigh_smells.py +355 -0
- package/skills/test-weigh-in/weigh_snapshot.py +49 -0
- package/skills-manifest.json +13 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"""strengthen-start, strengthen-verify and strengthen-finish: prove
|
|
2
|
-
|
|
1
|
+
"""strengthen-start, strengthen-verify and strengthen-finish: prove which of the mutant ids each
|
|
2
|
+
strengthen item names it kills (surviving on the base, killed on the head), keep what the reviewer accepts,
|
|
3
3
|
lower the baseline, and (unattended) open the strengthen PR from the base commit."""
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -229,13 +229,15 @@ def _close(repo, st: dict, item_id: str, commits: list, status: str, why: str) -
|
|
|
229
229
|
|
|
230
230
|
|
|
231
231
|
def item_proof(base_codes: dict, codes: dict, item: dict, has_commits: bool) -> dict:
|
|
232
|
-
"""Per mutant id the base and head exit codes
|
|
233
|
-
|
|
232
|
+
"""Per mutant id the base and head exit codes, and the ids the item kills: survived on the base,
|
|
233
|
+
killed on the head. Proven when it kills at least one and has a commit; the ids it does not kill
|
|
234
|
+
are no longer its claim, so one survivor no longer throws away the kills it did make."""
|
|
234
235
|
module = item.get("module")
|
|
235
236
|
mutants = {m: {"base": base_codes.get(module, {}).get(m), "head": codes.get(module, {}).get(m)}
|
|
236
237
|
for m in item["mutant_ids"]}
|
|
237
|
-
|
|
238
|
-
return {"status": "proven" if
|
|
238
|
+
kills = [m for m, e in mutants.items() if e["base"] in SURVIVING and e["head"] in KILLED]
|
|
239
|
+
return {"status": "proven" if has_commits and kills else "unproven", "module": module,
|
|
240
|
+
"mutants": mutants, "kills": kills}
|
|
239
241
|
|
|
240
242
|
|
|
241
243
|
def _judge(ctx, base: dict, st: dict, proof: dict, commits: list) -> list:
|
|
@@ -261,7 +263,7 @@ def _prove(ctx, base: dict, st: dict) -> dict:
|
|
|
261
263
|
failing = _judge(ctx, base, st, proof, commits)
|
|
262
264
|
for item_id in failing:
|
|
263
265
|
_close(ctx.repo, st, item_id, commits, "reverted",
|
|
264
|
-
"
|
|
266
|
+
"None of its mutant ids is killed on the head while surviving on the base.")
|
|
265
267
|
proof[item_id]["status"] = "reverted"
|
|
266
268
|
ctx.state.save("strengthen.json", st)
|
|
267
269
|
ctx.state.save("strengthen-proof.json", {"start": st["start"], "head": ctx.repo.head(), "items": proof})
|
|
@@ -273,7 +275,8 @@ def _proof_lines(proof: dict) -> list:
|
|
|
273
275
|
lines = []
|
|
274
276
|
for item_id, entry in proof.items():
|
|
275
277
|
lines.append(f"- {item_id}: {entry['status']}")
|
|
276
|
-
lines += [f" {m}: base exit code {e['base']}, head exit code {e['head']}"
|
|
278
|
+
lines += [f" {m}: base exit code {e['base']}, head exit code {e['head']}"
|
|
279
|
+
f"{'' if m in entry.get('kills', ()) else ' (not killed)'}" for m, e in entry["mutants"].items()]
|
|
277
280
|
return lines
|
|
278
281
|
|
|
279
282
|
|
|
@@ -317,23 +320,32 @@ def _guard_equivalents(repo, base: dict, new: dict) -> None:
|
|
|
317
320
|
+ "; ".join(f"{m}: {', '.join(ids)}" for m, ids in gained.items()))
|
|
318
321
|
|
|
319
322
|
|
|
320
|
-
def _test_lines(items: dict, accepted: list, tests: dict) -> list:
|
|
323
|
+
def _test_lines(items: dict, accepted: list, tests: dict, proof: dict) -> list:
|
|
321
324
|
lines = []
|
|
322
325
|
for item_id in accepted:
|
|
323
|
-
ids =
|
|
326
|
+
ids = proof[item_id]["kills"]
|
|
324
327
|
kills = f"now kills {', '.join(f'`{m}`' for m in ids)}" if ids else f"adds `{items[item_id]['assertion']}`"
|
|
325
328
|
lines += [f"- `{t}` ({item_id}) {kills}" for t in tests[item_id]] or [f"- {item_id}: {kills}"]
|
|
326
329
|
return lines
|
|
327
330
|
|
|
328
331
|
|
|
332
|
+
def _still_surviving(accepted: list, proof: dict) -> list:
|
|
333
|
+
"""The ids a kept item named but does not kill: still open for a later run."""
|
|
334
|
+
left = [f"- `{m}` ({i}) still survives: its tests do not kill it" for i in accepted
|
|
335
|
+
for m in proof[i]["mutants"] if m not in proof[i]["kills"]]
|
|
336
|
+
return ["", "## Still surviving", ""] + left if left else []
|
|
337
|
+
|
|
338
|
+
|
|
329
339
|
def _body(base: dict, st: dict, proof: dict, accepted: list, tests: dict, new: dict, ratchet: str, out: dict) -> str:
|
|
330
340
|
lines = [f"Strengthened tests from `{base['branch']}` at {base['commit'][:12]}, independent of the prune PR. "
|
|
331
341
|
"Every mutant id listed survived the cold mutation run on the base and is killed by the cold run on "
|
|
332
342
|
"this branch.", "", "## Changed tests", ""]
|
|
333
|
-
lines += _test_lines({i["id"]: i for i in st["items"]}, accepted, tests)
|
|
343
|
+
lines += _test_lines({i["id"]: i for i in st["items"]}, accepted, tests, proof)
|
|
334
344
|
lines += ["", "## Proof per mutant id", ""]
|
|
335
345
|
lines += [f"- `{m}` ({proof[i]['module']}): survived the base run (exit code {e['base']}), killed on this "
|
|
336
|
-
f"branch (exit code {e['head']})" for i in accepted for m, e in proof[i]["mutants"].items()
|
|
346
|
+
f"branch (exit code {e['head']})" for i in accepted for m, e in proof[i]["mutants"].items()
|
|
347
|
+
if m in proof[i]["kills"]]
|
|
348
|
+
lines += _still_surviving(accepted, proof)
|
|
337
349
|
lines += ["", "## Baseline survivors", ""]
|
|
338
350
|
lines += [f"- {m}: {base['baseline'].get(m, {}).get('survivors', 'new')} → {e['survivors']}" for m, e in new.items()]
|
|
339
351
|
lines += ["", "## Mutation ratchet", "", "```", ratchet.strip(), "```"]
|
|
@@ -225,7 +225,7 @@ def test_finish_refuses_a_head_moved_since_the_proof_and_stays_for_the_rerun(tar
|
|
|
225
225
|
|
|
226
226
|
|
|
227
227
|
def test_new_commits_for_a_reverted_item_are_refused(target):
|
|
228
|
-
drift_ids = ["
|
|
228
|
+
drift_ids = ["x_apply_drift__mutmut_4"] # DRIFT_TEST kills only _2: nothing proven, reverted
|
|
229
229
|
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
|
230
230
|
groups={COMPUTE: strengthen_group(IDS_7_9), DRIFT: strengthen_group(drift_ids)})
|
|
231
231
|
target.ok("strengthen-start")
|
|
@@ -61,14 +61,19 @@ def test_commit_problems_need_one_known_trailer_and_test_paths_only():
|
|
|
61
61
|
assert commit_problems("a" * 40, [], [], {"m.f"})
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
def
|
|
64
|
+
def test_item_proof_keeps_each_id_that_survived_on_base_and_is_killed_on_head():
|
|
65
65
|
item = {"module": "s.py", "mutant_ids": ["m1", "m2"]}
|
|
66
66
|
base = {"s.py": {"m1": 0, "m2": 33}}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
def proof(base_codes, head_codes, has_commits=True):
|
|
69
|
+
p = item_proof(base_codes, {"s.py": head_codes}, item, has_commits)
|
|
70
|
+
return p["status"], p["kills"]
|
|
71
|
+
|
|
72
|
+
assert proof(base, {"m1": 1, "m2": 3}) == ("proven", ["m1", "m2"])
|
|
73
|
+
assert proof(base, {"m1": 1, "m2": 0}) == ("proven", ["m1"]) # m2 stays a survivor, m1 is kept
|
|
74
|
+
assert proof(base, {"m1": 0, "m2": 5}) == ("unproven", []) # kills nothing it named
|
|
75
|
+
assert proof(base, {"m1": 1, "m2": 3}, has_commits=False) == ("unproven", ["m1", "m2"])
|
|
76
|
+
assert proof({"s.py": {"m1": 1, "m2": 0}}, {"m1": 1, "m2": 1}) == ("proven", ["m2"]) # m1 was never a survivor
|
|
72
77
|
|
|
73
78
|
|
|
74
79
|
def test_changed_tests_lists_new_and_edited_tests():
|
|
@@ -4,7 +4,7 @@ import re
|
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
|
-
from prune_harness import PRUNE_BRANCH, REFERENCE, STRENGTHEN_BRANCH, R, arg, cand, case
|
|
7
|
+
from prune_harness import PRUNE_BRANCH, REFERENCE, STRENGTHEN_BRANCH, R, arg, cand, case, lines_with
|
|
8
8
|
|
|
9
9
|
COMPUTE = "rebalancer.compute_trades"
|
|
10
10
|
DRIFT = "rebalancer.apply_drift"
|
|
@@ -144,8 +144,8 @@ def test_a_commit_naming_two_items_is_rejected_with_a_recovery_the_agent_can_run
|
|
|
144
144
|
target.ok("strengthen-verify")
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
def
|
|
148
|
-
drift_ids = ["
|
|
147
|
+
def test_strengthen_item_that_kills_none_of_its_ids_is_reverted_and_left_out_of_the_pr(target):
|
|
148
|
+
drift_ids = ["x_apply_drift__mutmut_4"] # DRIFT_TEST kills only _2
|
|
149
149
|
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
|
150
150
|
groups={COMPUTE: strengthen_group(IDS_7_9), DRIFT: strengthen_group(drift_ids)})
|
|
151
151
|
|
|
@@ -285,10 +285,10 @@ def test_strengthen_commit_refuses_an_unknown_item(target):
|
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
def test_strengthen_commit_refuses_an_item_strengthen_verify_closed(target):
|
|
288
|
-
two_items(target, drift_ids=("
|
|
288
|
+
two_items(target, drift_ids=("x_apply_drift__mutmut_4",))
|
|
289
289
|
write_test(target, DRIFT_TEST)
|
|
290
290
|
target.ok("strengthen-commit", "--item", DRIFT)
|
|
291
|
-
target.ok("strengthen-verify") # DRIFT_TEST
|
|
291
|
+
target.ok("strengthen-verify") # DRIFT_TEST kills none of its ids (_4): reverted, closed
|
|
292
292
|
assert target.read_state("strengthen.json")["status"][DRIFT] == "reverted"
|
|
293
293
|
write_test(target, DRIFT_TEST.replace("_new", "_again"))
|
|
294
294
|
refused(target, DRIFT, "reverted")
|
|
@@ -342,7 +342,7 @@ def test_strengthen_commit_refuses_a_head_off_the_strengthen_start(target):
|
|
|
342
342
|
|
|
343
343
|
def test_an_unproven_item_committed_before_a_proven_one_is_removed_without_a_conflict(target):
|
|
344
344
|
# Both items append to the end of one file: `git revert` of the earlier one conflicts.
|
|
345
|
-
two_items(target, drift_ids=("
|
|
345
|
+
two_items(target, drift_ids=("x_apply_drift__mutmut_4",))
|
|
346
346
|
for item, source in [(DRIFT, DRIFT_TEST), (COMPUTE, COMPUTE_TEST)]:
|
|
347
347
|
write_test(target, source)
|
|
348
348
|
target.ok("strengthen-commit", "--item", item)
|
|
@@ -360,7 +360,7 @@ def test_an_unproven_item_committed_before_a_proven_one_is_removed_without_a_con
|
|
|
360
360
|
|
|
361
361
|
|
|
362
362
|
def test_a_new_file_left_without_tests_by_a_closed_item_is_deleted(target):
|
|
363
|
-
two_items(target, drift_ids=("
|
|
363
|
+
two_items(target, drift_ids=("x_apply_drift__mutmut_4",))
|
|
364
364
|
new_file = "backend/tests/test_drift_new.py"
|
|
365
365
|
(target.root / new_file).write_text("from services.rebalancer import apply_drift\n" + DRIFT_TEST)
|
|
366
366
|
write_test(target, DRIFT_TEST.replace("_new", "_also")) # the append COMPUTE's append conflicts with
|
|
@@ -379,13 +379,13 @@ def test_a_new_file_left_without_tests_by_a_closed_item_is_deleted(target):
|
|
|
379
379
|
|
|
380
380
|
|
|
381
381
|
def test_a_test_a_closed_item_changed_is_free_for_another_item(target):
|
|
382
|
-
two_items(target, drift_ids=("
|
|
382
|
+
two_items(target, drift_ids=("x_apply_drift__mutmut_4",))
|
|
383
383
|
path = target.root / TESTS_FILE
|
|
384
384
|
path.write_text(path.read_text().rstrip("\n") + "\n assert apply_drift(-0.5) == 0\n")
|
|
385
385
|
target.ok("strengthen-commit", "--item", DRIFT)
|
|
386
386
|
write_test(target, COMPUTE_TEST)
|
|
387
387
|
target.ok("strengthen-commit", "--item", COMPUTE)
|
|
388
|
-
target.ok("strengthen-verify") # DRIFT
|
|
388
|
+
target.ok("strengthen-verify") # DRIFT kills none of its ids: reverted, test_drift_scales is back to the base
|
|
389
389
|
scales = " assert apply_drift(base) <= base\n"
|
|
390
390
|
path.write_text(path.read_text().replace(scales, scales + " assert apply_drift(base) >= 0\n"))
|
|
391
391
|
|
|
@@ -404,7 +404,7 @@ def test_strengthen_commit_refuses_a_test_another_item_already_changed(target):
|
|
|
404
404
|
|
|
405
405
|
|
|
406
406
|
def test_a_test_the_closed_item_changed_is_restored_under_a_later_items_test(target):
|
|
407
|
-
two_items(target, drift_ids=("
|
|
407
|
+
two_items(target, drift_ids=("x_apply_drift__mutmut_4",))
|
|
408
408
|
path = target.root / TESTS_FILE
|
|
409
409
|
path.write_text(path.read_text().rstrip("\n") + "\n assert apply_drift(-0.5) == 0\n")
|
|
410
410
|
target.ok("strengthen-commit", "--item", DRIFT)
|
|
@@ -418,7 +418,7 @@ def test_a_test_the_closed_item_changed_is_restored_under_a_later_items_test(tar
|
|
|
418
418
|
|
|
419
419
|
|
|
420
420
|
def test_a_closed_item_that_changed_more_than_functions_still_stops_the_run_on_a_conflict(target):
|
|
421
|
-
two_items(target, drift_ids=("
|
|
421
|
+
two_items(target, drift_ids=("x_apply_drift__mutmut_4",))
|
|
422
422
|
write_test(target, "LIMIT = -0.5\n" + DRIFT_TEST)
|
|
423
423
|
target.ok("strengthen-commit", "--item", DRIFT)
|
|
424
424
|
write_test(target, COMPUTE_TEST)
|
|
@@ -432,7 +432,7 @@ def test_a_closed_item_that_changed_more_than_functions_still_stops_the_run_on_a
|
|
|
432
432
|
|
|
433
433
|
|
|
434
434
|
def test_the_strengthen_pr_is_one_commit_on_the_base_with_a_trailer_per_kept_item(target):
|
|
435
|
-
drift_ids = ["
|
|
435
|
+
drift_ids = ["x_apply_drift__mutmut_4"] # DRIFT_TEST kills only _2: nothing proven, reverted
|
|
436
436
|
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
|
437
437
|
groups={COMPUTE: strengthen_group(IDS_7_9), DRIFT: strengthen_group(drift_ids)})
|
|
438
438
|
|
|
@@ -448,3 +448,25 @@ def test_the_strengthen_pr_is_one_commit_on_the_base_with_a_trailer_per_kept_ite
|
|
|
448
448
|
source = target.show(head, TESTS_FILE)
|
|
449
449
|
assert "def test_compute_trades_rounding(targets):" in source and "test_apply_drift_new" not in source
|
|
450
450
|
assert baseline_at(target, head)["services/rebalancer.py"]["survivors"] == 18
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def test_an_item_that_kills_some_of_its_ids_is_kept_for_those_and_reports_the_rest(target):
|
|
454
|
+
# DRIFT_TEST kills _2 but not _4: keep the test and its proven kill, drop only the claim on _4.
|
|
455
|
+
drift_ids = ["x_apply_drift__mutmut_2", "x_apply_drift__mutmut_4"]
|
|
456
|
+
target.prepare([cand(case(1))], accept=[COMPUTE, DRIFT],
|
|
457
|
+
groups={COMPUTE: strengthen_group(IDS_7_9), DRIFT: strengthen_group(drift_ids)})
|
|
458
|
+
|
|
459
|
+
finish = strengthen(target, [(COMPUTE, COMPUTE_TEST), (DRIFT, DRIFT_TEST)], [COMPUTE, DRIFT])
|
|
460
|
+
|
|
461
|
+
assert finish.returncode == 0, finish.stdout + finish.stderr
|
|
462
|
+
assert target.read_state("strengthen.json")["status"][DRIFT] == "proven"
|
|
463
|
+
head = target.remote_sha(STRENGTHEN_BRANCH)
|
|
464
|
+
assert "def test_apply_drift_new():" in target.show(head, TESTS_FILE)
|
|
465
|
+
assert baseline_at(target, head)["services/rebalancer.py"]["survivors"] == 17
|
|
466
|
+
body = strengthen_pr(target)
|
|
467
|
+
kills = lines_with(body, "test_apply_drift_new")
|
|
468
|
+
assert "x_apply_drift__mutmut_2" in kills and "x_apply_drift__mutmut_4" not in kills
|
|
469
|
+
proof = body[body.index("## Proof per mutant id"):body.index("## Still surviving")]
|
|
470
|
+
assert "x_apply_drift__mutmut_2" in proof and "x_apply_drift__mutmut_4" not in proof
|
|
471
|
+
still = lines_with(body, "x_apply_drift__mutmut_4")
|
|
472
|
+
assert "still survives" in still and DRIFT in still
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-weigh-in
|
|
3
|
+
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.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# test-weigh-in
|
|
7
|
+
|
|
8
|
+
Run the engine through the wrapper:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
sh <skill-dir>/run.sh <repo-path> [--pytest-args "<options>"]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`<skill-dir>` is the directory holding this file. `<repo-path>` is the Python repo whose suite to weigh. The engine writes a JSON snapshot and `dashboard.html`, opens the dashboard unless `--no-open` is given, prints the five scores, the inventory line and both paths, and exits non-zero with a message on stderr when it cannot run.
|
|
15
|
+
|
|
16
|
+
Relay the engine's output to the user exactly as printed. Do not add interpretation, scores, advice or a summary of your own.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en"><head><meta charset="utf-8"><title>test-weigh-in</title>
|
|
3
|
+
<style>
|
|
4
|
+
body{font:14px system-ui,sans-serif;margin:24px;color:#222}
|
|
5
|
+
#gauges{display:flex;gap:12px;margin:16px 0}
|
|
6
|
+
.gauge{flex:1;border:2px solid #ccc;border-radius:8px;padding:12px;background:#fff;text-align:center;cursor:pointer;font:inherit}
|
|
7
|
+
.gauge[aria-pressed=true]{border-color:#2563eb}
|
|
8
|
+
.score{display:block;font-size:32px;font-weight:600}
|
|
9
|
+
#banner{background:#fef2f2;color:#991b1b;padding:8px 12px;border-radius:6px}
|
|
10
|
+
.flag{display:block;color:#92400e}
|
|
11
|
+
table{border-collapse:collapse}td,th{padding:4px 12px;text-align:left}
|
|
12
|
+
</style></head><body>
|
|
13
|
+
<h1>test-weigh-in</h1>
|
|
14
|
+
<p data-testid="inventory" id="inventory"></p>
|
|
15
|
+
<p data-testid="banner" id="banner"></p>
|
|
16
|
+
<div id="gauges"></div>
|
|
17
|
+
<section data-testid="details" id="details"></section>
|
|
18
|
+
<script>
|
|
19
|
+
const data = __DATA__;
|
|
20
|
+
const shown = (s) => Math.min(99, Math.max(1, Math.round(s)));
|
|
21
|
+
const el = (tag, text, parent) => { const e = document.createElement(tag); e.textContent = text; parent.appendChild(e); return e; };
|
|
22
|
+
const fmt = (n) => String(Math.round(n * 100) / 100);
|
|
23
|
+
let selected = 0, tab = 'Metrics', picked = null;
|
|
24
|
+
const NS = 'http://www.w3.org/2000/svg';
|
|
25
|
+
function drawMap(parent) {
|
|
26
|
+
const near = picked ? new Map(picked.similar) : new Map();
|
|
27
|
+
const svg = document.createElementNS(NS, 'svg');
|
|
28
|
+
parent.appendChild(svg);
|
|
29
|
+
// tests with the same or nearly the same coverage land on or near one place: push apart each pair of dots that
|
|
30
|
+
// overlaps until none does, so every dot stays clickable; same data, same pushes, same map on every load
|
|
31
|
+
// ponytail: all pairs per pass, quadratic; a spatial grid if maps of thousands of dots get slow
|
|
32
|
+
const dots = data.map.map((d) => ({ d, cx: 20 + d.x * 360, cy: 20 + d.y * 260, r: 4 + Math.min(10, d.runtime * 4) }));
|
|
33
|
+
for (let pass = 0, moved = true; moved && pass < 200; pass++) {
|
|
34
|
+
moved = false;
|
|
35
|
+
dots.forEach((a, i) => dots.slice(i + 1).forEach((b, k) => {
|
|
36
|
+
const dx = b.cx - a.cx, dy = b.cy - a.cy, dist = Math.hypot(dx, dy), gap = a.r + b.r + 2;
|
|
37
|
+
if (dist >= gap) return;
|
|
38
|
+
// dots on one spot part along an angle fixed by their order
|
|
39
|
+
const angle = dist > 1e-9 ? Math.atan2(dy, dx) : 2.39996 * (i + k + 1), push = (gap - dist) / 2 + 0.01;
|
|
40
|
+
a.cx -= push * Math.cos(angle); a.cy -= push * Math.sin(angle);
|
|
41
|
+
b.cx += push * Math.cos(angle); b.cy += push * Math.sin(angle);
|
|
42
|
+
moved = true;
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
// the view grows to hold every ring, at one unit per pixel so sizes keep their meaning
|
|
46
|
+
const x0 = Math.min(0, ...dots.map((o) => o.cx - o.r - 2)), y0 = Math.min(0, ...dots.map((o) => o.cy - o.r - 2));
|
|
47
|
+
const w = Math.max(400, ...dots.map((o) => o.cx + o.r + 2)) - x0, h = Math.max(300, ...dots.map((o) => o.cy + o.r + 2)) - y0;
|
|
48
|
+
svg.setAttribute('viewBox', `${x0} ${y0} ${w} ${h}`); svg.setAttribute('width', w); svg.setAttribute('height', h);
|
|
49
|
+
dots.forEach(({ d, cx, cy, r }) => {
|
|
50
|
+
const c = document.createElementNS(NS, 'circle');
|
|
51
|
+
c.setAttribute('cx', cx); c.setAttribute('cy', cy);
|
|
52
|
+
c.setAttribute('r', r);
|
|
53
|
+
c.setAttribute('fill', d.unique === 0 ? '#9ca3af' : d.unique < 4 ? '#f59e0b' : '#16a34a');
|
|
54
|
+
c.setAttribute('stroke', picked && (picked === d || near.has(d.test)) ? '#2563eb' : 'none');
|
|
55
|
+
c.setAttribute('stroke-width', '3');
|
|
56
|
+
c.setAttribute('data-testid', 'map-dot'); c.dataset.test = d.test;
|
|
57
|
+
if (picked && (picked === d || near.has(d.test))) c.dataset.highlighted = 'true';
|
|
58
|
+
c.onclick = () => { picked = d; render(); };
|
|
59
|
+
svg.appendChild(c);
|
|
60
|
+
});
|
|
61
|
+
const list = el('div', '', parent); list.setAttribute('data-testid', 'map-similar');
|
|
62
|
+
if (picked) picked.similar.forEach(([n, s]) => el('p', n + ' ' + s.toFixed(2), list).setAttribute('data-testid', 'map-similar-item'));
|
|
63
|
+
}
|
|
64
|
+
function render() {
|
|
65
|
+
document.getElementById('inventory').textContent = data.inventory;
|
|
66
|
+
const banner = document.getElementById('banner');
|
|
67
|
+
if (banner) { if (data.banner) banner.textContent = data.banner; else banner.remove(); }
|
|
68
|
+
const gauges = document.getElementById('gauges'), details = document.getElementById('details');
|
|
69
|
+
gauges.replaceChildren(); details.replaceChildren();
|
|
70
|
+
data.pillars.forEach((p, i) => {
|
|
71
|
+
const g = el('button', '', gauges);
|
|
72
|
+
g.className = 'gauge'; g.dataset.testid = 'gauge'; g.setAttribute('data-testid', 'gauge');
|
|
73
|
+
g.setAttribute('aria-pressed', i === selected);
|
|
74
|
+
el('span', p.name, g);
|
|
75
|
+
el('span', p.score === null ? '–' : shown(p.score), g).className = 'score';
|
|
76
|
+
if (p.partial) el('span', 'partial: ' + p.metrics.length + ' of ' + p.total + ' metrics measured', g).className = 'flag';
|
|
77
|
+
g.onclick = () => { selected = i; tab = 'Metrics'; picked = null; render(); };
|
|
78
|
+
});
|
|
79
|
+
const p = data.pillars[selected];
|
|
80
|
+
el('h2', p.name, details);
|
|
81
|
+
const names = ['Metrics', 'Worst tests', 'Smells', ...(p.key === 'economy' ? ['Overlaps', 'Map'] : [])];
|
|
82
|
+
names.forEach((n) => { const b = el('button', n, details); b.setAttribute('aria-pressed', n === tab); b.onclick = () => { tab = n; picked = null; render(); }; });
|
|
83
|
+
el('h3', tab, details);
|
|
84
|
+
if (tab === 'Metrics') {
|
|
85
|
+
const t = el('table', '', details);
|
|
86
|
+
p.metrics.forEach((m) => {
|
|
87
|
+
const r = el('tr', '', t);
|
|
88
|
+
el('td', m.name, r); el('td', fmt(m.value), r); el('td', String(shown(m.score)), r);
|
|
89
|
+
});
|
|
90
|
+
if (data.skipped.length) {
|
|
91
|
+
el('h3', 'Skipped tests', details);
|
|
92
|
+
data.skipped.forEach((n) => el('p', n + ' (skipped)', details));
|
|
93
|
+
}
|
|
94
|
+
if (p.key === 'economy' && data.insufficient.length) {
|
|
95
|
+
el('h3', 'Insufficient evidence (fewer than 2 sampled mutants on their lines)', details);
|
|
96
|
+
data.insufficient.forEach((n) => el('p', n, details));
|
|
97
|
+
}
|
|
98
|
+
} else if (tab === 'Worst tests') {
|
|
99
|
+
p.worst.forEach((w) => el('p', w.test + ' (' + w.reason + ')', details).setAttribute('data-testid', 'worst-test'));
|
|
100
|
+
} else if (tab === 'Smells') {
|
|
101
|
+
const smells = Object.entries(p.smells);
|
|
102
|
+
if (!smells.length) el('p', 'No test has a smell of this pillar.', details);
|
|
103
|
+
smells.forEach(([smell, tests]) => {
|
|
104
|
+
el('h4', smell + ' (' + tests.length + (tests.length === 1 ? ' test)' : ' tests)'), details).setAttribute('data-testid', 'smell');
|
|
105
|
+
tests.forEach((n) => el('p', n, details).setAttribute('data-testid', 'smell-test'));
|
|
106
|
+
});
|
|
107
|
+
} else if (tab === 'Overlaps') {
|
|
108
|
+
data.overlaps.forEach((o) => el('p', o.tests.join(' ~ ') + ' ' + o.jaccard.toFixed(2), details));
|
|
109
|
+
} else if (tab === 'Map') drawMap(details);
|
|
110
|
+
}
|
|
111
|
+
render();
|
|
112
|
+
</script></body></html>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Sourced by a skill wrapper. The wrapper sets: inherited (`export -p` output
|
|
2
|
+
# taken before its first assignment), skill_dir, name (cache dir name,
|
|
3
|
+
# e.g. crap-gate), env_prefix (e.g. CRAP_GATE), prefix (message prefix), fail_code, engine (file in
|
|
4
|
+
# skill_dir; it gets the cached uv's path as <env_prefix>_UV), and optionally defines setup_failed MESSAGE (stdout on failure) and
|
|
5
|
+
# pins (space-separated requirements) with venv_key (e.g. jsonschema-4.26.0, whose
|
|
6
|
+
# first word names the package in errors): the engine then runs in a venv per pin set.
|
|
7
|
+
set -eu
|
|
8
|
+
|
|
9
|
+
fail() {
|
|
10
|
+
printf '%s: %s\n' "$prefix" "$1" >&2
|
|
11
|
+
! command -v setup_failed >/dev/null 2>&1 || setup_failed "$1"
|
|
12
|
+
exit "$fail_code"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
eval "cache_override=\${${env_prefix}_CACHE_DIR:-} offline=\${${env_prefix}_OFFLINE:-0}"
|
|
16
|
+
cache=${cache_override:-${XDG_CACHE_HOME:-$HOME/.cache}/$name}
|
|
17
|
+
case "$cache" in /*) ;; *) fail "${env_prefix}_CACHE_DIR must be an absolute path" ;; esac
|
|
18
|
+
uv_version=0.12.13
|
|
19
|
+
python_version=3.13.7
|
|
20
|
+
case "$(uname -s):$(uname -m)" in
|
|
21
|
+
Darwin:arm64|Darwin:aarch64)
|
|
22
|
+
target=aarch64-apple-darwin
|
|
23
|
+
digest=7e6ddb9316acc00f2296c82ff4d99977870ee34b2f0ddcae9444d714db9364ed ;;
|
|
24
|
+
Darwin:x86_64)
|
|
25
|
+
target=x86_64-apple-darwin
|
|
26
|
+
digest=5e287ef61cb6a9b61b3a83fef124fd143e400468a7dac794230147a810e17119 ;;
|
|
27
|
+
Linux:aarch64|Linux:arm64)
|
|
28
|
+
target=aarch64-unknown-linux-musl
|
|
29
|
+
digest=f44bc1037a17889fe562fffd2002d4ed108e499fbe68b4f022af244dc7b8244f ;;
|
|
30
|
+
Linux:x86_64)
|
|
31
|
+
target=x86_64-unknown-linux-musl
|
|
32
|
+
digest=4e2bfd0c9007b1032a50e539e965fd0a6037d87ad93ae1580d220a92d4c94098 ;;
|
|
33
|
+
*) fail 'Unsupported platform: use macOS or Linux on x86_64 or ARM64 (Windows: WSL)' ;;
|
|
34
|
+
esac
|
|
35
|
+
uv_dir=$cache/uv/$uv_version/$target
|
|
36
|
+
uv=$uv_dir/uv
|
|
37
|
+
if [ ! -x "$uv" ]; then
|
|
38
|
+
[ "$offline" != 1 ] || fail 'uv is not cached; provision this cache online first'
|
|
39
|
+
mkdir -p "$uv_dir" || fail 'Cannot create runtime cache'
|
|
40
|
+
stage=$(mktemp -d "$uv_dir/.download.XXXXXX") || fail 'Cannot create download directory'
|
|
41
|
+
trap 'rm -rf "$stage"' EXIT
|
|
42
|
+
trap 'exit "$fail_code"' HUP INT TERM
|
|
43
|
+
printf '%s: downloading uv %s\n' "$prefix" "$uv_version" >&2
|
|
44
|
+
curl --fail --location --silent --show-error --connect-timeout 15 --max-time 300 \
|
|
45
|
+
"https://github.com/astral-sh/uv/releases/download/$uv_version/uv-$target.tar.gz" \
|
|
46
|
+
-o "$stage/uv.tar.gz" || fail 'Cannot download uv; check network access and retry'
|
|
47
|
+
if command -v sha256sum >/dev/null 2>&1; then
|
|
48
|
+
actual=$(sha256sum "$stage/uv.tar.gz")
|
|
49
|
+
elif command -v shasum >/dev/null 2>&1; then
|
|
50
|
+
actual=$(shasum -a 256 "$stage/uv.tar.gz")
|
|
51
|
+
else
|
|
52
|
+
fail 'SHA-256 verification requires sha256sum or shasum'
|
|
53
|
+
fi
|
|
54
|
+
[ "${actual%% *}" = "$digest" ] || fail 'uv archive checksum mismatch'
|
|
55
|
+
tar -xzf "$stage/uv.tar.gz" -C "$stage" || fail 'Cannot extract uv'
|
|
56
|
+
# Atomic publication: concurrent first runs never see a partial executable.
|
|
57
|
+
mv -f "$stage/uv-$target/uv" "$uv" || fail 'Cannot install cached uv'
|
|
58
|
+
rm -rf "$stage"
|
|
59
|
+
trap - EXIT HUP INT TERM
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# Limit uv settings to this subprocess. Do not activate a venv or change PATH:
|
|
63
|
+
# coverage commands inherit the caller's project environment (the engine adds
|
|
64
|
+
# only the repo's own .venv/bin, when no virtualenv is active).
|
|
65
|
+
managed_uv() (
|
|
66
|
+
unset UV_NO_MANAGED_PYTHON UV_PYTHON UV_PYTHON_DOWNLOADS UV_PYTHON_BIN_DIR
|
|
67
|
+
export UV_PYTHON_INSTALL_DIR="$cache/python"
|
|
68
|
+
export UV_CACHE_DIR="$cache/uv-cache"
|
|
69
|
+
export UV_MANAGED_PYTHON=true
|
|
70
|
+
"$uv" --no-config "$@"
|
|
71
|
+
)
|
|
72
|
+
python=$(managed_uv python find --no-project --system --managed-python --no-python-downloads "$python_version" 2>/dev/null) || {
|
|
73
|
+
[ "$offline" != 1 ] || fail 'Python is not cached; provision this cache online first'
|
|
74
|
+
managed_uv python install --no-bin "$python_version" >&2 || fail 'Cannot provision Python; check network access and retry'
|
|
75
|
+
python=$(managed_uv python find --no-project --system --managed-python --no-python-downloads "$python_version") || fail 'Cannot locate managed Python'
|
|
76
|
+
}
|
|
77
|
+
if [ -n "${pins:-}" ]; then
|
|
78
|
+
venv=$cache/venv/$python_version-$venv_key
|
|
79
|
+
if [ ! -x "$venv/bin/python" ]; then
|
|
80
|
+
[ "$offline" != 1 ] || fail "${venv_key%%-*} is not cached; provision this cache online first"
|
|
81
|
+
mkdir -p "$cache/venv" || fail 'Cannot create runtime cache'
|
|
82
|
+
stage=$(mktemp -d "$cache/venv/.build.XXXXXX") || fail 'Cannot create build directory'
|
|
83
|
+
trap 'rm -rf "$stage"' EXIT
|
|
84
|
+
trap 'exit "$fail_code"' HUP INT TERM
|
|
85
|
+
# shellcheck disable=SC2086 # pins is a deliberate word list
|
|
86
|
+
managed_uv venv --quiet --python "$python" "$stage/venv" >&2 &&
|
|
87
|
+
managed_uv pip install --quiet --python "$stage/venv/bin/python" $pins >&2 ||
|
|
88
|
+
fail "Cannot provision ${venv_key%%-*}; check network access and retry"
|
|
89
|
+
# Publish by rename(2): a concurrent first run never sees a partial venv. A run that loses the
|
|
90
|
+
# race fails the rename (mv would move into the winner's directory) and uses the winner's venv.
|
|
91
|
+
[ -x "$venv/bin/python" ] || "$python" -I -c 'import os, sys; os.rename(*sys.argv[1:])' "$stage/venv" "$venv" 2>/dev/null || :
|
|
92
|
+
[ -x "$venv/bin/python" ] || fail 'Cannot install cached venv'
|
|
93
|
+
rm -rf "$stage"
|
|
94
|
+
trap - EXIT HUP INT TERM
|
|
95
|
+
fi
|
|
96
|
+
python=$venv/bin/python
|
|
97
|
+
fi
|
|
98
|
+
# Ignore Python-specific ambient settings for the engine, but preserve them for
|
|
99
|
+
# child coverage processes. -I would also remove the sibling module directory.
|
|
100
|
+
set -- "$python" -E -s "$skill_dir/$engine" "$@"
|
|
101
|
+
eval "$inherited"
|
|
102
|
+
# The engine finds the cached uv here: PATH stays the caller's.
|
|
103
|
+
export "${env_prefix}_UV=$uv"
|
|
104
|
+
exec "$@"
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
version = 1
|
|
2
|
+
|
|
3
|
+
[ruff]
|
|
4
|
+
# PT rules that are not style-only; each violation inside a test is a maintainability smell of it
|
|
5
|
+
pt = ["PT009", "PT010", "PT011", "PT012", "PT014", "PT015", "PT017", "PT018", "PT027", "PT029", "PT030", "PT031"]
|
|
6
|
+
|
|
7
|
+
[pillars.regression]
|
|
8
|
+
name = "Protection against regressions"
|
|
9
|
+
|
|
10
|
+
[pillars.regression.metrics.mutation_score]
|
|
11
|
+
name = "Mutation score"
|
|
12
|
+
weight = 0.45
|
|
13
|
+
target = 80
|
|
14
|
+
bad = 40
|
|
15
|
+
|
|
16
|
+
[pillars.regression.metrics.branch_coverage]
|
|
17
|
+
name = "Branch coverage"
|
|
18
|
+
weight = 0.25
|
|
19
|
+
target = 90
|
|
20
|
+
bad = 50
|
|
21
|
+
partial_weight = 0.6
|
|
22
|
+
|
|
23
|
+
[pillars.regression.metrics.hollow_tests]
|
|
24
|
+
name = "Hollow tests"
|
|
25
|
+
weight = 0.2
|
|
26
|
+
target = 0
|
|
27
|
+
bad = 10
|
|
28
|
+
partial_weight = 0.4
|
|
29
|
+
|
|
30
|
+
[pillars.regression.metrics.pseudo_tested_functions]
|
|
31
|
+
name = "Pseudo-tested functions"
|
|
32
|
+
weight = 0.1
|
|
33
|
+
target = 0
|
|
34
|
+
bad = 15
|
|
35
|
+
|
|
36
|
+
[pillars.refactoring]
|
|
37
|
+
name = "Resistance to refactoring"
|
|
38
|
+
|
|
39
|
+
[pillars.refactoring.metrics.brittle_test_files]
|
|
40
|
+
name = "Brittle test files"
|
|
41
|
+
weight = 0.4
|
|
42
|
+
target = 15
|
|
43
|
+
bad = 60
|
|
44
|
+
|
|
45
|
+
[pillars.refactoring.metrics.private_access]
|
|
46
|
+
name = "Tests with private access"
|
|
47
|
+
weight = 0.25
|
|
48
|
+
target = 2
|
|
49
|
+
bad = 30
|
|
50
|
+
|
|
51
|
+
[pillars.refactoring.metrics.mock_heavy]
|
|
52
|
+
name = "Mock-heavy tests"
|
|
53
|
+
weight = 0.2
|
|
54
|
+
target = 5
|
|
55
|
+
bad = 30
|
|
56
|
+
|
|
57
|
+
[pillars.refactoring.metrics.interaction_only]
|
|
58
|
+
name = "Interaction-only tests"
|
|
59
|
+
weight = 0.15
|
|
60
|
+
target = 5
|
|
61
|
+
bad = 30
|
|
62
|
+
|
|
63
|
+
[pillars.feedback]
|
|
64
|
+
name = "Fast feedback"
|
|
65
|
+
|
|
66
|
+
[pillars.feedback.metrics.total_runtime]
|
|
67
|
+
name = "Total runtime"
|
|
68
|
+
weight = 0.4
|
|
69
|
+
target = 60
|
|
70
|
+
bad = 600
|
|
71
|
+
log = true
|
|
72
|
+
|
|
73
|
+
[pillars.feedback.metrics.p95_duration]
|
|
74
|
+
name = "p95 test duration"
|
|
75
|
+
weight = 0.3
|
|
76
|
+
target = 0.1
|
|
77
|
+
bad = 2
|
|
78
|
+
log = true
|
|
79
|
+
|
|
80
|
+
[pillars.feedback.metrics.slowest_decile_share]
|
|
81
|
+
name = "Runtime share of slowest 10% of tests"
|
|
82
|
+
weight = 0.15
|
|
83
|
+
target = 40
|
|
84
|
+
bad = 90
|
|
85
|
+
|
|
86
|
+
[pillars.feedback.metrics.tests_over_10s]
|
|
87
|
+
name = "Tests over 10 s"
|
|
88
|
+
weight = 0.15
|
|
89
|
+
target = 0
|
|
90
|
+
bad = 2
|
|
91
|
+
|
|
92
|
+
[pillars.maintainability]
|
|
93
|
+
name = "Maintainability"
|
|
94
|
+
|
|
95
|
+
[pillars.maintainability.metrics.smelly_tests]
|
|
96
|
+
name = "Tests with a maintainability smell"
|
|
97
|
+
weight = 0.5
|
|
98
|
+
target = 5
|
|
99
|
+
bad = 40
|
|
100
|
+
|
|
101
|
+
[pillars.maintainability.metrics.long_tests]
|
|
102
|
+
name = "Tests longer than 50 lines"
|
|
103
|
+
weight = 0.2
|
|
104
|
+
target = 2
|
|
105
|
+
bad = 20
|
|
106
|
+
|
|
107
|
+
[pillars.maintainability.metrics.test_source_ratio]
|
|
108
|
+
name = "Test : source lines-of-code ratio"
|
|
109
|
+
weight = 0.3
|
|
110
|
+
target = 1.5
|
|
111
|
+
bad = 4.0
|
|
112
|
+
|
|
113
|
+
[pillars.economy]
|
|
114
|
+
name = "Economy"
|
|
115
|
+
|
|
116
|
+
[pillars.economy.metrics.no_unique_coverage]
|
|
117
|
+
name = "Tests with no unique coverage"
|
|
118
|
+
weight = 0.35
|
|
119
|
+
target = 10
|
|
120
|
+
bad = 50
|
|
121
|
+
partial_weight = 0.6
|
|
122
|
+
|
|
123
|
+
[pillars.economy.metrics.subsumed_in_kill_matrix]
|
|
124
|
+
name = "Tests subsumed in the kill matrix"
|
|
125
|
+
weight = 0.4
|
|
126
|
+
target = 5
|
|
127
|
+
bad = 35
|
|
128
|
+
|
|
129
|
+
[pillars.economy.metrics.duplicate_clusters]
|
|
130
|
+
name = "Tests in a duplicate-body cluster"
|
|
131
|
+
weight = 0.25
|
|
132
|
+
target = 2
|
|
133
|
+
bad = 20
|
|
134
|
+
partial_weight = 0.4
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Wrapper: configures the shared launcher (launcher.sh is a byte-identical copy
|
|
3
|
+
# of shared/launcher.sh).
|
|
4
|
+
set -eu
|
|
5
|
+
# Snapshot the caller's environment: the launcher restores it before exec, so
|
|
6
|
+
# its settings never overwrite an inherited variable of the same name.
|
|
7
|
+
inherited=$(export -p)
|
|
8
|
+
|
|
9
|
+
# Resolve file symlinks as well as symlinked skill directories.
|
|
10
|
+
entry=$0
|
|
11
|
+
while [ -L "$entry" ]; do
|
|
12
|
+
parent=$(CDPATH= cd -- "$(dirname -- "$entry")" && pwd)
|
|
13
|
+
entry=$(readlink "$entry")
|
|
14
|
+
case "$entry" in /*) ;; *) entry=$parent/$entry ;; esac
|
|
15
|
+
done
|
|
16
|
+
skill_dir=$(CDPATH= cd -- "$(dirname -- "$entry")" && pwd)
|
|
17
|
+
|
|
18
|
+
name=test-weigh-in env_prefix=TEST_WEIGH_IN prefix=test-weigh-in fail_code=2 engine=weigh.py
|
|
19
|
+
# No pinned venv: ignore any inherited pins/venv_key.
|
|
20
|
+
pins= venv_key=
|
|
21
|
+
. "$skill_dir/launcher.sh"
|