@jesdi/skills 0.0.86 → 0.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/implement-spec/ARCHITECTURE.md +33 -14
- package/skills/implement-spec/README.md +30 -15
- package/skills/implement-spec/SKILL.md +1 -1
- package/skills/implement-spec/driver.py +3 -2
- package/skills/implement-spec/driver_agents.py +93 -32
- package/skills/implement-spec/driver_decisions.py +3 -2
- package/skills/implement-spec/driver_dispute.py +82 -57
- package/skills/implement-spec/driver_fixloop.py +18 -21
- package/skills/implement-spec/driver_legacy.py +31 -2
- package/skills/implement-spec/driver_report.py +13 -3
- package/skills/implement-spec/driver_run.py +23 -13
- package/skills/implement-spec/driver_state.py +9 -8
- package/skills/implement-spec/driver_summary.py +8 -1
- package/skills/implement-spec/prompts/correction.md +1 -0
- package/skills/implement-spec/prompts/reviewer.md +3 -3
- package/skills/implement-spec/prompts/ruled.md +1 -1
- package/skills/implement-spec/tests/conftest.py +2 -0
- package/skills/implement-spec/tests/test_agents.py +56 -5
- package/skills/implement-spec/tests/test_arbitration.py +104 -11
- package/skills/implement-spec/tests/test_decisions.py +7 -5
- package/skills/implement-spec/tests/test_driver.py +2 -1
- package/skills/implement-spec/tests/test_fixloop.py +3 -3
- package/skills/implement-spec/tests/test_legacy.py +27 -0
- package/skills/implement-spec/tests/test_lenses.py +10 -5
- package/skills/implement-spec/tests/test_models.py +74 -0
- package/skills/implement-spec/tests/test_state.py +1 -1
- package/skills/implement-spec/tests/test_summary.py +8 -0
- package/skills/test-weigh-in/dashboard.html +70 -17
- package/skills/test-weigh-in/tests/browser_driver.py +46 -5
- package/skills/test-weigh-in/tests/layout_page.py +7 -3
- package/skills/test-weigh-in/tests/overlap_page.py +3 -0
- package/skills/test-weigh-in/tests/rules_fixture.py +1 -1
- package/skills/test-weigh-in/tests/test_coverage_run.py +5 -1
- package/skills/test-weigh-in/tests/test_dashboard_layout.py +50 -9
- package/skills/test-weigh-in/tests/test_score.py +53 -2
- package/skills/test-weigh-in/weigh.py +2 -2
- package/skills/test-weigh-in/weigh_coverage.py +22 -2
- package/skills/test-weigh-in/weigh_dashboard.py +51 -10
- package/skills/test-weigh-in/weigh_score.py +6 -3
- package/skills/test-weigh-in/weigh_smells.py +3 -2
- package/skills-manifest.json +3 -3
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import json
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
|
-
from weigh_coverage import similarity_map, valued
|
|
6
|
-
from weigh_score import display
|
|
5
|
+
from weigh_coverage import left_out, similarity_map, valued, value_kind
|
|
6
|
+
from weigh_score import VALUE_METRICS, display
|
|
7
7
|
from weigh_smells import PILLAR_SMELLS, pillar_smells, worst_tests
|
|
8
8
|
|
|
9
9
|
TEMPLATE = Path(__file__).resolve().parent / "dashboard.html"
|
|
@@ -15,40 +15,80 @@ def inventory_line(inv):
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def _failing(tests):
|
|
18
|
-
return sum(t
|
|
18
|
+
return sum(value_kind(t) == "failing" for t in tests.values())
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def _failing_names(tests):
|
|
22
|
-
return [n for n, t in tests.items() if t
|
|
22
|
+
return [n for n, t in tests.items() if value_kind(t) == "failing"]
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def _flaky(tests):
|
|
26
|
+
# every flaky test, a failing one too: this warns about flakiness, left_out about the value a test gives
|
|
26
27
|
return sum(t.get("flaky", False) for t in tests.values())
|
|
27
28
|
|
|
28
29
|
|
|
30
|
+
def _tests(n, what):
|
|
31
|
+
return f"{n} {'test' if n == 1 else 'tests'} {what}"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def left_out_line(kinds):
|
|
35
|
+
"""Every kind with its count, e.g. "3 tests failing, 4 skipped", for the Metrics tab."""
|
|
36
|
+
return ", ".join([_tests(*kinds[0]), *(f"{n} {kind}" for n, kind in kinds[1:])])
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _names(words):
|
|
40
|
+
return words[0] if len(words) == 1 else ", ".join(words[:-1]) + " and " + words[-1]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def pillar_status(data, rules):
|
|
44
|
+
"""{pillar key: status}, the words for how complete each pillar's score is, said the same in the chat summary and
|
|
45
|
+
on the dashboard:
|
|
46
|
+
head "partial:", or "all <n> metrics measured" for a pillar that is not partial
|
|
47
|
+
reasons why it is partial, [] when it is not: how many metrics were measured and the tests a red suite leaves out;
|
|
48
|
+
short enough for two lines of a 150 px gauge, so one kind of test is named and several summed as not green
|
|
49
|
+
note with a red suite, the sentence for the Metrics tab naming the pillar's value metrics and every kind left
|
|
50
|
+
out; None otherwise"""
|
|
51
|
+
kinds = left_out(data["tests"])
|
|
52
|
+
status = {}
|
|
53
|
+
for key, pillar in rules["pillars"].items():
|
|
54
|
+
snap, total = data["pillars"][key], len(pillar["metrics"])
|
|
55
|
+
measured = sum(i in data["metrics"] for i in pillar["metrics"])
|
|
56
|
+
reasons, note = [], None
|
|
57
|
+
if snap["red_suite"]:
|
|
58
|
+
red = left_out_line(kinds) if len(kinds) == 1 else _tests(sum(n for n, _ in kinds), "not green")
|
|
59
|
+
reasons = [f"{measured} of {total} measured", red] if measured < total else [red]
|
|
60
|
+
value = [m["name"] for i, m in pillar["metrics"].items() if i in VALUE_METRICS]
|
|
61
|
+
note = (f"Partial: {_names(value)} {'counts' if len(value) == 1 else 'count'} only the tests that passed in both "
|
|
62
|
+
"the plain and the coverage run. "
|
|
63
|
+
f"Left out: {left_out_line(kinds)}.")
|
|
64
|
+
elif snap["partial"]:
|
|
65
|
+
reasons = [f"{measured} of {total} metrics measured"]
|
|
66
|
+
status[key] = {"head": "partial:" if reasons else f"all {total} metrics measured", "reasons": reasons, "note": note}
|
|
67
|
+
return status
|
|
68
|
+
|
|
69
|
+
|
|
29
70
|
def _slow(rules):
|
|
30
71
|
"""A test is slow when it takes longer than the target of the p95 test duration."""
|
|
31
72
|
return rules["pillars"]["feedback"]["metrics"]["p95_duration"]["target"]
|
|
32
73
|
|
|
33
74
|
|
|
34
75
|
def write_dashboard(home, data, rules):
|
|
35
|
-
failing = _failing(data["tests"])
|
|
76
|
+
failing, status = _failing(data["tests"]), pillar_status(data, rules)
|
|
36
77
|
page = {
|
|
37
78
|
"banner": f"{failing} tests are failing" if failing > 1 else "1 test is failing" if failing else None,
|
|
38
79
|
"failing": _failing_names(data["tests"]),
|
|
39
|
-
"skipped": [n for n, t in data["tests"].items() if t
|
|
80
|
+
"skipped": [n for n, t in data["tests"].items() if value_kind(t) == "skipped"],
|
|
40
81
|
"insufficient": [n for n, t in data["tests"].items() if t.get("insufficient_evidence")],
|
|
41
82
|
"overlaps": data.get("overlaps", []),
|
|
42
83
|
"map": [{**d, "runtime": data["tests"][d["test"]]["duration"], "unique": data["tests"][d["test"]].get("unique_coverage", 0)}
|
|
43
84
|
for d in similarity_map(valued(data["tests"]))],
|
|
44
85
|
"inventory": inventory_line(data["inventory"]),
|
|
45
86
|
"pillars": [
|
|
46
|
-
{"key": k, "name": p["name"], **data["pillars"][k],
|
|
87
|
+
{"key": k, "name": p["name"], **data["pillars"][k], "status": status[k],
|
|
47
88
|
"metrics": [{"name": m["name"], "unit": m["unit"], "target": m["target"], "bad": m["bad"], **data["metrics"][i]}
|
|
48
89
|
for i, m in p["metrics"].items() if i in data["metrics"]],
|
|
49
90
|
# an entry the snapshot does not record (older data) has no known cause
|
|
50
91
|
"missing": [{"name": m["name"], "reason": data.get("unmeasured", {}).get(i)} for i, m in p["metrics"].items() if i not in data["metrics"]],
|
|
51
|
-
"total": len(p["metrics"]),
|
|
52
92
|
"worst": worst_tests(data["tests"], k, _slow(rules)),
|
|
53
93
|
"smells": pillar_smells(data["tests"], PILLAR_SMELLS.get(k, ()))}
|
|
54
94
|
for k, p in rules["pillars"].items()
|
|
@@ -63,10 +103,11 @@ def write_dashboard(home, data, rules):
|
|
|
63
103
|
|
|
64
104
|
def summary(data, rules, snapshot, dashboard):
|
|
65
105
|
lines = [inventory_line(data["inventory"])]
|
|
106
|
+
status = pillar_status(data, rules)
|
|
66
107
|
for k, p in rules["pillars"].items():
|
|
67
|
-
s = data["pillars"][k]
|
|
108
|
+
s, st = data["pillars"][k], status[k]
|
|
68
109
|
shown = "not measured" if s["score"] is None else str(display(s["score"]))
|
|
69
|
-
lines.append(f"{p['name']}: {shown}" + (" (
|
|
110
|
+
lines.append(f"{p['name']}: {shown}" + (f" ({st['head']} {'; '.join(st['reasons'])})" if st["reasons"] else ""))
|
|
70
111
|
failing, flaky = _failing(data["tests"]), _flaky(data["tests"])
|
|
71
112
|
if failing:
|
|
72
113
|
lines.append(f"Warning: {failing} tests are failing" if failing > 1 else "Warning: 1 test is failing")
|
|
@@ -33,10 +33,11 @@ VALUE_METRICS = {"mutation_score", "branch_coverage", "pseudo_tested_functions",
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def score(rules, values, red=False):
|
|
36
|
-
"""Metrics {id: {value, score}} and pillars {key: {score, partial}}; unmeasured metrics are left out and the weights re-normalized.
|
|
36
|
+
"""Metrics {id: {value, score}} and pillars {key: {score, partial, red_suite}}; unmeasured metrics are left out and the weights re-normalized.
|
|
37
37
|
|
|
38
38
|
Without the mutation tier (no mutation_score), a pillar that gives partial weights uses them, and its metrics without one do not count.
|
|
39
|
-
With a red suite (a test that gives no value), every pillar using a value metric is partial (req 14)
|
|
39
|
+
With a red suite (a test that gives no value), every pillar using a value metric is partial (req 14) and red_suite, so
|
|
40
|
+
the report can say why: a pillar can be partial for a missing metric, a red suite or both."""
|
|
40
41
|
metrics, pillars = {}, {}
|
|
41
42
|
for key, pillar in rules["pillars"].items():
|
|
42
43
|
partial_weights = "mutation_score" not in values and any("partial_weight" in m for m in pillar["metrics"].values())
|
|
@@ -49,9 +50,11 @@ def score(rules, values, red=False):
|
|
|
49
50
|
if weight:
|
|
50
51
|
scored.append((weight, s))
|
|
51
52
|
weight = sum(w for w, _ in scored)
|
|
53
|
+
red_suite = red and bool(VALUE_METRICS & pillar["metrics"].keys())
|
|
52
54
|
pillars[key] = {
|
|
53
55
|
"score": sum(w * s for w, s in scored) / weight if weight else None,
|
|
54
|
-
"partial": not values.keys() >= pillar["metrics"].keys() or
|
|
56
|
+
"partial": not values.keys() >= pillar["metrics"].keys() or red_suite,
|
|
57
|
+
"red_suite": red_suite,
|
|
55
58
|
}
|
|
56
59
|
return metrics, pillars
|
|
57
60
|
|
|
@@ -3,6 +3,7 @@ import ast
|
|
|
3
3
|
import copy
|
|
4
4
|
import hashlib
|
|
5
5
|
|
|
6
|
+
from weigh_coverage import value_kind
|
|
6
7
|
from weigh_inventory import is_test
|
|
7
8
|
|
|
8
9
|
MOCK_ASSERTS = ("assert_called", "assert_any_call", "assert_has_calls", "assert_not_called", "assert_awaited", "assert_not_awaited")
|
|
@@ -337,8 +338,8 @@ def _measured(test, pillar, slow):
|
|
|
337
338
|
return [f"{test['lines']} lines"], test["lines"]
|
|
338
339
|
if pillar == "feedback" and test["duration"] > slow:
|
|
339
340
|
return [f"{test['duration']:.2f} s"], test["duration"]
|
|
340
|
-
# unique coverage is measured only for tests that
|
|
341
|
-
if pillar == "economy" and test
|
|
341
|
+
# unique coverage is measured only for the tests that give value
|
|
342
|
+
if pillar == "economy" and value_kind(test) == "valued" and not test.get("unique_coverage", 0):
|
|
342
343
|
return ["No unique coverage"], 0
|
|
343
344
|
return [], 0
|
|
344
345
|
|
package/skills-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-06T01:48:56.950Z",
|
|
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.52",
|
|
62
|
+
"hash": "sha256-b31df9477b2d36aaf396d4f36c7ee15af10286eb726ed27d214b1858f98a780d",
|
|
63
63
|
"description": "Implement a specification in code."
|
|
64
64
|
},
|
|
65
65
|
{
|