@ericrisco/rsc 1.0.12 → 1.0.13

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/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.12",
2
+ "version": "1.0.13",
3
3
  "counts": {
4
4
  "skills": 264
5
5
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ericrisco/rsc",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Eric Risco's agent-skills catalog as a granular, self-recommending CLI installer.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,9 +9,20 @@
9
9
  # Auto-detects each tool. If a tool is missing it prints a yellow SKIP and continues
10
10
  # (it never FAILs on a missing tool). Prefers `uv run <tool>` when `uv` is present,
11
11
  # else the bare tool on PATH. Exits non-zero only if a tool actually ran and reported
12
- # a failure. The coverage threshold is read from the project's pyproject.toml
13
- # (--cov-fail-under); this script does not hardcode a second threshold. Idempotent:
14
- # re-running yields the same result (read-only beyond whatever the project's pytest does).
12
+ # a failure. Idempotent: re-running yields the same result (read-only beyond whatever
13
+ # the project's pytest does).
14
+ #
15
+ # COVERAGE IS ONLY A GATE IF YOUR PROJECT MAKES IT ONE. The threshold is deliberately
16
+ # delegated to the project (--cov-fail-under in pyproject.toml / setup.cfg / .coveragerc)
17
+ # rather than hardcoded here. But when the project sets none, `pytest --cov` prints a
18
+ # percentage and exits 0 however far coverage falls — and a layer that prints a number and
19
+ # exits 0 is a report, not a gate. That case is reported as [gap] instead of PASS, because
20
+ # the two are indistinguishable on screen and the broken one can only ever produce green:
21
+ # no failing run will ever surface it.
22
+ #
23
+ # A [gap] does NOT change the exit code — breaking every repo that passes today is not this
24
+ # script's call. This script reports; the `verify` skill judges, and there a gap counts as
25
+ # an unverified criterion, which fails the verdict.
15
26
  #
16
27
  # Compatible with stock macOS bash 3.2: no `mapfile`, no associative arrays, and every
17
28
  # array access is guarded so `set -u` never trips on an "unbound" empty array.
@@ -30,7 +41,28 @@ warn() { printf '%s%s%s\n' "$YELLOW" "$*" "$RESET"; }
30
41
  ok() { printf '%s%s%s\n' "$GREEN" "$*" "$RESET"; }
31
42
  fail() { printf '%s%s%s\n' "$RED" "$*" "$RESET"; }
32
43
 
33
- PASSED=0; SKIPPED=0; FAILED=0
44
+ PASSED=0; SKIPPED=0; FAILED=0; GAPS=0
45
+
46
+ # gap <reason> — the layer ran and had nothing to fail with. Counted and printed, but it
47
+ # deliberately does NOT touch FAILED: see the header note on why the exit code is unchanged.
48
+ gap() { printf '%sGAP: %s%s\n' "$YELLOW" "$*" "$RESET"; GAPS=$((GAPS + 1)); }
49
+
50
+ # coverage_threshold_configured — does the project actually gate on coverage?
51
+ # Looks for pytest's --cov-fail-under (addopts or a bare flag) and coverage.py's fail_under.
52
+ # Grep rc: 0 = found, 1 = not found, >=2 = the scan itself broke. Treat "broke" as NOT
53
+ # configured so the answer errs toward reporting a gap; a broken scan must never buy a pass.
54
+ coverage_threshold_configured() {
55
+ local f rc
56
+ for f in "$TARGET/pyproject.toml" "$TARGET/setup.cfg" "$TARGET/tox.ini" "$TARGET/.coveragerc" "$TARGET/pytest.ini"; do
57
+ [ -f "$f" ] || continue
58
+ grep -qE 'cov-fail-under|fail_under' "$f" && return 0
59
+ rc=$?
60
+ if [ "$rc" -ge 2 ]; then
61
+ warn "NOTE: could not read '${f}' while checking for a coverage threshold; treating it as absent"
62
+ fi
63
+ done
64
+ return 1
65
+ }
34
66
 
35
67
  have() { command -v "$1" >/dev/null 2>&1; }
36
68
 
@@ -105,12 +137,21 @@ run_step "ruff check" ruff check "$TARGET"
105
137
  run_step "ruff format check" ruff format --check "$TARGET"
106
138
  run_step "mypy" mypy "$TARGET"
107
139
  run_step "pytest + coverage" pytest --cov --cov-report=term-missing
140
+ # Only meaningful if pytest actually ran; a SKIP already says nothing was measured.
141
+ if tool_available pytest && ! coverage_threshold_configured; then
142
+ gap "coverage ran without a threshold (no --cov-fail-under / fail_under found) — this layer cannot fail. Add --cov-fail-under=<n> to pyproject.toml addopts to make it a gate."
143
+ fi
108
144
  run_step "pip-audit" pip-audit
109
145
 
110
- printf '\n%d passed, %d skipped, %d failed\n' "$PASSED" "$SKIPPED" "$FAILED"
146
+ printf '\n%d passed, %d skipped, %d failed, %d gap(s)\n' "$PASSED" "$SKIPPED" "$FAILED" "$GAPS"
147
+ if [ "$GAPS" -gt 0 ]; then
148
+ warn "A GAP is neither a pass nor a failure: the layer ran and could not have failed. Report it as unverified."
149
+ fi
111
150
  if [ "$FAILED" -gt 0 ]; then
112
151
  fail "verify.sh: failures detected"
113
152
  exit 1
114
153
  fi
115
- ok "verify.sh: ok"
154
+ # "every check that could fail, passed" rather than a bare ok: with a GAP present, the
155
+ # stronger claim would be false in exactly the way this script now exists to prevent.
156
+ ok "verify.sh: ok (every check that could fail, passed)"
116
157
  exit 0
@@ -11,6 +11,17 @@
11
11
  # Real problems (unformatted code, vet/test/vuln failures) exit non-zero.
12
12
  # Read-only: never mutates your source.
13
13
  #
14
+ # ONE LAYER HERE IS A REPORT, NOT A GATE. `go test -cover` takes no threshold flag, so
15
+ # coverage can print any number — 4%, 0% — and still exit 0. It is therefore reported as
16
+ # [gap]: the layer ran and had nothing to fail with. Said out loud because a layer that
17
+ # prints a number and exits 0 looks exactly like a layer that passed, and that shape can
18
+ # only ever produce green — no failing run will ever tell you about it. Want a real
19
+ # coverage gate in Go? Parse `go tool cover -func` and compare, or use a CI action; this
20
+ # script does not pretend to be one.
21
+ #
22
+ # A [gap] does NOT change the exit code: this script reports, the `verify` skill judges,
23
+ # and there it counts as an unverified criterion, which fails the verdict.
24
+ #
14
25
  # Portability: runs on stock macOS bash 3.2 (no mapfile, no associative arrays,
15
26
  # no unguarded array expansions under `set -u`).
16
27
 
@@ -24,12 +35,16 @@ else
24
35
  fi
25
36
 
26
37
  failed=0
38
+ gaps=0
27
39
 
28
40
  have() { command -v "$1" >/dev/null 2>&1; }
29
41
  warn() { printf '%s[skip]%s %s\n' "$YELLOW" "$RESET" "$*"; }
30
42
  fail() { printf '%s[fail]%s %s\n' "$RED" "$RESET" "$*"; failed=1; }
31
43
  ok() { printf '%s[ ok ]%s %s\n' "$GREEN" "$RESET" "$*"; }
32
44
  info() { printf -- '----- %s\n' "$*"; }
45
+ # A layer that ran but had nothing to fail with. Deliberately does NOT set `failed`:
46
+ # breaking every repo that passes today is not this script's call to make.
47
+ gap() { printf '%s[gap ]%s %s\n' "$YELLOW" "$RESET" "$*"; gaps=$((gaps + 1)); }
33
48
 
34
49
  # Must run from a module root.
35
50
  if [ ! -f go.mod ]; then
@@ -89,6 +104,10 @@ if have go; then
89
104
  warn "cgo disabled or C compiler '$cgo_cc' not found; running plain go test -cover"
90
105
  if go test -cover ./...; then ok "tests pass (no race)"; else fail "tests failed"; fi
91
106
  fi
107
+ # The tests above are a gate; the coverage number printed alongside them is not.
108
+ # `go test -cover` has no threshold flag, so coverage cannot fail this script no matter
109
+ # how far it falls. Reported so nobody reads the percentage as a checked constraint.
110
+ gap "coverage: reported, not gated — 'go test -cover' takes no threshold, so this layer cannot fail"
92
111
  else
93
112
  warn "go not found - skipping tests"
94
113
  fi
@@ -102,8 +121,14 @@ else
102
121
  fi
103
122
 
104
123
  echo
124
+ if [ "$gaps" -ne 0 ]; then
125
+ printf '%s%d layer(s) ran without being able to fail (see [gap] above).%s\n' "$YELLOW" "$gaps" "$RESET"
126
+ printf 'Not a pass and not a failure: report them as unverified rather than green.\n'
127
+ fi
105
128
  if [ "$failed" -ne 0 ]; then
106
129
  printf '%sFAIL:%s one or more checks failed.\n' "$RED" "$RESET"
107
130
  exit 1
108
131
  fi
109
- printf '%sPASS:%s all checks passed.\n' "$GREEN" "$RESET"
132
+ # Deliberately "checks that could fail, passed" and not "all checks passed": with a [gap]
133
+ # present the second sentence would be false in the way this whole change exists to stop.
134
+ printf '%sPASS:%s every check that could fail, passed.\n' "$GREEN" "$RESET"
@@ -76,6 +76,24 @@ code tells you nothing about whether it can fail. **Refactor only on green** kee
76
76
  reversible against a passing bar. **Checkpoint after each task** is what makes this resumable and
77
77
  reviewable instead of a 2000-line surprise diff.
78
78
 
79
+ ### Four things you may never do to reach green
80
+
81
+ The loop only means anything if green cannot be manufactured. These are absolute, and each one is a
82
+ way people reach green without fixing anything:
83
+
84
+ 1. **Never weaken a test to make it pass.** Not broadening an assertion, not adding a skip, not
85
+ raising a tolerance, not deleting it. A test that looks wrong is a **spec conversation** — surface
86
+ it, don't bury it.
87
+ 2. **Never edit a test and the implementation in the same step to reach green.** Change one, run,
88
+ then the other. Simultaneous edits let you redefine correctness to match your bug without
89
+ noticing you did it.
90
+ 3. **Never mock the unit under test**, or mock so much that the test only exercises the mocks. Mock
91
+ boundaries you don't own — network, clock, filesystem, third-party SDK — never the logic you are
92
+ being paid to verify.
93
+ 4. **Never chase the coverage number.** Coverage detects untested code; it is not a target. A test
94
+ added to touch lines, with no meaningful assertion, is gaming — and mutation testing exists
95
+ precisely to catch it (`../testing-py/SKILL.md`, `../testing-web/SKILL.md`, `../testing-go/SKILL.md`).
96
+
79
97
  ### The done-check is the contract
80
98
 
81
99
  Each task carries a done-check from the `tasks` phase ("returns 409 on duplicate email", "list
@@ -128,9 +128,41 @@ gap deliberately with `--accept-partial-lenses` (it is recorded). Every approval
128
128
 
129
129
  **Lenses by risk tier** — tier 0 never reaches you (the gate passes docs/copy silently);
130
130
  tier 1 → run the single most relevant pass from the table above yourself; tier 2 → dispatch
131
- **three parallel fresh-context subagents** (correctness · security · tests-as-evidence), each
132
- given only the diff and told to *refute* readiness, not confirm it. Fresh context is the point:
133
- a reviewer who inherits the implementer's context inherits its blind spots.
131
+ **three parallel fresh-context subagents** (correctness · security · tests-as-evidence), each told
132
+ to *refute* readiness, not confirm it. Fresh context is the point: a reviewer who inherits the
133
+ implementer's context inherits its blind spots.
134
+
135
+ **Give each refuter exactly four inputs — no more, no less.** The diff alone is not enough, and
136
+ that is not a detail: with only the diff, the one failure class no test suite can structurally
137
+ catch — *the change is correct and is not what the approved spec asked for* — is invisible to the
138
+ whole panel.
139
+
140
+ 1. **The task contract** — the original request **plus every scope change a human explicitly
141
+ approved since.** Not just the first message: without the approved changes a legitimate scope
142
+ revision reads as a spec gap and you get a confident false positive.
143
+ 2. **The approved spec** (`02-DOCS/wiki/sdd/specs/<slug>.md`).
144
+ 3. **The exact source state** — commit SHA, or a tree hash when git is absent. A verdict belongs to
145
+ the state that was reviewed, not to the project.
146
+ 4. **The entry point** — the one command that reruns the checks.
147
+
148
+ **And say what they do not get:** your conversation, your reasoning, your defences, and your draft
149
+ verdict. If a claim needs your justification to stand, it is not proven.
150
+
151
+ **Blind first, compare second.** Each refuter records what it attacked and what it found *before*
152
+ being shown your conclusions. Only then may it compare and add findings — the blind record is
153
+ append-only after that, never rewritten. Skip this and the fresh context is spent confirming your
154
+ framing, which is the one thing it was bought to avoid.
155
+
156
+ **The attack list is the deliverable, not just the findings.** "Nothing found" without saying where
157
+ you looked is indistinguishable from not having looked — the same rule that governs a dismissal.
158
+
159
+ Two extra finding classes the four inputs unlock, neither reachable from a diff:
160
+
161
+ - **Contract vs spec** — what would a caller reasonably expect, given the stated deployment, that
162
+ no clause covers? An exclusion the spec deliberately approved is **not** a finding; an exclusion
163
+ the spec describes *inaccurately* is.
164
+ - **Mapping, both directions** — an acceptance criterion with no test that can be made to fail, and
165
+ a test pinning behaviour no criterion asked for.
134
166
 
135
167
  **A finding blocks only if it survives all three filters** — no exceptions, and eagerness to
136
168
  find something is not evidence:
@@ -78,3 +78,5 @@ capability:
78
78
  - "Captures observable behaviour (what the user sees/can do) and explicit non-goals / out-of-scope rather than implementation (no file format library, storage, or job-queue detail)."
79
79
  - "Turns answers into binary acceptance criteria and defers unresolved items (e.g. data scope, retention, format) to Points to clarify instead of fabricating decisions."
80
80
  - "Notes that the spec is complete-enough-to-plan with open points remaining, and hands off to clarify — not to plan or implementation."
81
+ - "After the user answers a question, folds the answer in, states what changed, shows the revised spec, and asks for approval AGAIN — it does not treat the answer as approval of the spec, including when the user picked the recommended option."
82
+ - "If told to run the whole chain up front, records the approval as autopilot rather than item-by-item, and says the spec is the artifact to review after the fact."
@@ -42,3 +42,5 @@ capability:
42
42
  - A hand-written interface fake or net/http/httptest server for the HTTP dependency, not a mock framework by default
43
43
  - Runs with -race for the concurrent path and shows a go test -coverprofile / cross-package coverage command
44
44
  - A benchmark using for b.Loop() with b.ReportAllocs() rather than a b.N loop
45
+ - "Does not present the coverage percentage as proof the suite detects bugs: states Go has no mature mutation tool, gives the manual procedure, and distinguishes mutation (tests that would not notice a bug) from fuzzing (inputs the code mishandles)."
46
+ - "Requires a hand-rolled mutant runner to prove it executed each mutant, and says why — a kill reported without running can only inflate the score, so no failing run would ever reveal it."
@@ -42,3 +42,5 @@ capability:
42
42
  - "asserts on the return value / observable behavior, not on mock private internals like _mock_calls"
43
43
  - "mentions a strict posture: --strict-markers and/or --strict-config (or the pytest 9 strict_* aliases)"
44
44
  - "at least one negative/error-path test (e.g. raises on non-200), not only the happy path"
45
+ - "Does not present branch coverage as proof the suite detects bugs: names mutation testing (mutmut) as the layer that catches assertion-free tests, and scopes it to the changed module rather than the whole tree."
46
+ - "Calibrates mutation by risk rather than prescribing it as a default toll, and says a surviving mutant may be semantically equivalent — to be classified with a reason, never killed with an assertion about non-behaviour."
@@ -50,3 +50,5 @@ capability:
50
50
  - Tests an error path (500 -> visible error / role=alert) in a separate case
51
51
  - No bare act() misuse in the component test; no assertions on state/props/className
52
52
  - At least one real expect(...) assertion per test
53
+ - "Does not present coverage as proof the suite detects bugs: names Stryker as the layer that catches assertion-free tests, and scopes `mutate` to the changed files because a whole-project run does not finish."
54
+ - "Calibrates mutation by risk rather than prescribing it always, and treats a surviving mutant as possibly equivalent (classified with a reason) instead of adding an assertion about non-behaviour."
@@ -80,6 +80,7 @@ If `config.yaml` provides `testing.commands.verify`, run those commands first or
80
80
  Rules for RUN:
81
81
 
82
82
  - The stack `verify.sh` **skips missing tools** (yellow SKIP) rather than failing on them — so a SKIP is not a pass. Note every SKIP; a skipped test suite means that criterion is **unverified**, which is not the same as verified-passing.
83
+ - A `GAP` is the third thing, and it is the one that looks most like a pass: **the layer ran and had nothing to fail with.** The fastapi gate reports it when coverage runs with no `--cov-fail-under` configured; the Go gate reports it always, because `go test -cover` takes no threshold. The script deliberately does not fail on a GAP — that judgement is yours. **Treat a GAP as an unverified criterion, which fails the verdict**, and record it (see the mapping below). A gate that reports and a gate that checks are indistinguishable on screen, and only the broken one is guaranteed to stay green.
83
84
  - A non-zero exit from a tool that actually ran is a hard FAIL. Record the failing tool and its output.
84
85
  - Run from the directory the stack skill documents (Go runs from the module root; others from the subproject root). Don't guess paths.
85
86
  - If no `scripts/verify.sh` exists for a touched stack, that's a gap — say the gate is incomplete and recommend the user add the stack skill, rather than hand-rolling a one-off check that drifts from the real gate.
@@ -157,6 +158,15 @@ source_state: 3f9a1c2 (clean)
157
158
 
158
159
  `SUSTITUIDA` is the dangerous one. "Ran the suite twice" is not *suite health: stable* — it is a substitute that cannot see whole-suite order dependence, and a reader who can't tell the two apart reads "found nothing" where the truth is "did not look with that instrument".
159
160
 
161
+ **Where a `GAP` goes — and do not invent a fourth label.** A layer that ran without being able to fail is not `NO-APLICA` (the surface exists) and not `HERRAMIENTA-AUSENTE` (the tool ran). It is `SUSTITUIDA`: what ran was **a report in place of a gate**, and what it cannot detect is **coverage falling**. Write it that way:
162
+
163
+ ```text
164
+ - **SUSTITUIDA** — coverage: ran without a threshold (GAP). A report, not a gate;
165
+ cannot detect coverage regressing. Fix: --cov-fail-under=<n> in pyproject addopts.
166
+ ```
167
+
168
+ **And while you are there: the global percentage is the wrong number.** A project-wide floor barely moves when your change lands untested — 200 new uncovered lines in a 20k-line codebase is a rounding error against an 85% floor, so the gate passes and the change is untested. What matters is whether **the lines you touched** are exercised: `diff-cover coverage.xml --fail-under=100` gates exactly those. This is guidance, not something the generated `verify.sh` scripts do — recommend it, don't assume it ran.
169
+
160
170
  **A dismissed finding carries evidence, one line each.** A fix is self-evidencing — the test now passes. A dismissal is not: "not a real problem" is indistinguishable from "did not check". Name the command, the `file:line`, or the test that disproves it, or write "ninguno".
161
171
 
162
172
  Append-only spirit: don't overwrite a prior run's record; a new run is a new dated file. The record is the receipt the `review` and `ship` phases trust.
@@ -72,3 +72,8 @@ capability:
72
72
  - "RECORDS a dated verification file under 02-DOCS/wiki/sdd/verifications/ and indexes it in the root CLAUDE.md Knowledge map."
73
73
  - "Returns a VERDICT that is PASS only if EVERY item has passing evidence; a single unverified acceptance criterion makes the whole verdict FAIL — and refuses to call it 'done' otherwise."
74
74
  - "On PASS, points to the review phase; on FAIL, routes failing checks to debug and missing coverage back to implement."
75
+ - "Treats a coverage GAP (the layer ran with no threshold configured, so it could not have failed) as an unverified criterion that fails the verdict — not as a pass — and records it as SUSTITUIDA: a report in place of a gate, unable to detect coverage regressing."
76
+ - "Before trusting any home-grown gate that reports green, asks for it to be watched failing on a known-bad input, and states the limit: one negative control proves one bad case reaches the failure path, not that the gate covers the rule it claims to enforce."
77
+ - "Splits layers that did not run into NO-APLICA / HERRAMIENTA-AUSENTE / SUSTITUIDA rather than one undifferentiated SKIP list, and never writes SUSTITUIDA as a pass."
78
+ - "Binds the record to a source state (short commit SHA plus clean/dirty) and takes every number from one fresh run made after the last edit, refusing to reuse mid-task figures."
79
+ - "Gives any dismissed finding its own evidence line (command, file:line, or the test that disproves it) rather than asserting it was not a real problem."