@jjchill/probity-rules 0.4.14 → 0.4.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,69 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.15
4
+
5
+ The JS/TS TDD judge no longer blocks adding a new red test (#73), and it
6
+ now blocks a production write whose new test was never run.
7
+
8
+ - **What went wrong.** In #73, a JS/TS project on 0.4.14 added one new
9
+ failing `it(...)` to an existing Vitest file, straight after a green
10
+ run, with no production change. The judge denied it: "This test has
11
+ not been observed failing … here it is being added as a green->red
12
+ crossing without that observed red." A test can't fail before it
13
+ exists. This is the #43 bug in the Kotlin judge, fixed in 0.4.3. The
14
+ JS preset runs Probity's built-in `enforceTdd()`, which never got
15
+ that fix. Its default rules say both "adding a test is the red step"
16
+ and "judge a new red at the green->red boundary too" (the refactor
17
+ check), and the judge read the second as a demand for a failing run.
18
+ - **Now:** a new rule, `enforceJsTdd()` (in `rules/js-tdd.ts`,
19
+ exported), is `enforceTdd()` with an addendum, wrapped the way the JS
20
+ preset already wrapped it. The JS preset uses it. The addendum says:
21
+ - Adding one failing test is the red step and needs no prior run.
22
+ "Must be observed failing" applies only to the production write
23
+ that follows. This holds even when the test contradicts what the
24
+ previous cycle just implemented.
25
+ - At a test write, the only green->red question is whether the prior
26
+ green left a refactor unmade. A passing prior run is never a reason
27
+ to block a new test.
28
+ - A production write still needs an observed failing test: a run,
29
+ after the test was written, whose output shows that test failing.
30
+ A test written but never run does not count. Neither does an
31
+ earlier failing run of a different test.
32
+ - **Measured** against the live judge (Probity's `claudeCode()` agent,
33
+ as the hook runs it), replaying the real #73 write. The input was the
34
+ session's own transcript, cut just before the write and read with
35
+ Probity's transcript reader, plus the test and production files as
36
+ they stood on disk then (10 runs each, 0.4.14 → 0.4.15):
37
+ - the reported write: allowed **2/10 → 10/10**. On 0.4.14 the
38
+ denials read like the reported one ("has not been observed
39
+ failing");
40
+ - the same session, then a production write with the new test never
41
+ run: blocked **4/10 → 9/10**;
42
+ - the same session, then the new test run and seen failing, then the
43
+ production write: allowed 10/10 → 10/10.
44
+
45
+ A replica built from the same files, but with a hand-written session,
46
+ never reproduced the denial (allowed 20/20 on both versions). On it,
47
+ the controls that must stay blocked, as 0.4.14 → 0.4.15 (5 runs
48
+ each unless noted):
49
+ - a production write before any test for it: 5/5 → 5/5;
50
+ - a test plus a production change in one write (an in-source `it` in
51
+ `account.ts`): 5/5 → 5/5;
52
+ - two new tests in one write: 5/5 → 5/5;
53
+ - a production write after the new test was added but never run:
54
+ 1/10 → 15/15.
55
+ - **Not changed:** Probity's own `enforceTdd({ fastPath: true })` stays
56
+ off. It would pass a single-test write with no AI call, but it skips
57
+ the refactor check at the green->red boundary. It also lacks the
58
+ byte-preservation checks the Kotlin fast path has.
59
+ - **Action needed** if your `probity.config.ts` wires the TDD rule
60
+ itself rather than through `jsRuleEntries`. Replace
61
+ `withJudgeFailureDiagnostics(withContradictionRetry(enforceTdd()))`
62
+ with `enforceJsTdd()`, imported from `@jjchill/probity-rules` or
63
+ `@jjchill/probity-rules/rules/js-tdd`. Configs that use
64
+ `jsRuleEntries` get it automatically.
65
+ - New exports: `enforceJsTdd`, `JS_TDD_ADDENDUM`.
66
+
3
67
  ## 0.4.14
4
68
 
5
69
  Extracting existing code into a new file under green now passes in the
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  * ones together.
13
13
  */
14
14
  export * from './rules/gates.js';
15
+ export * from './rules/js-tdd.js';
15
16
  export * from './rules/ports-and-adapters.js';
16
17
  export * from './rules/acceptance-language.js';
17
18
  export * from './rules/spec-test-parity.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA"}
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@
12
12
  * ones together.
13
13
  */
14
14
  export * from './rules/gates.js';
15
+ export * from './rules/js-tdd.js';
15
16
  export * from './rules/ports-and-adapters.js';
16
17
  export * from './rules/acceptance-language.js';
17
18
  export * from './rules/spec-test-parity.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../presets/js.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,gBAAgB,C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D;IAC5D,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;oEACgE;IAChE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,eAAoB,GAAG,SAAS,EAAE,CAgKxE"}
@@ -4,7 +4,7 @@
4
4
  * Turns three of the agent-skills catalog's prose disciplines into
5
5
  * hard PreToolUse gates via https://github.com/nizos/probity :
6
6
  *
7
- * test-driven-development → enforceTdd (built-in)
7
+ * test-driven-development → enforceJsTdd (built-in enforceTdd + addendum)
8
8
  * ports-and-adapters → enforcePortsBoundary + forbidInternalModuleMocks
9
9
  * + a deterministic import screen
10
10
  * acceptance-testing → enforceAcceptanceLanguage
@@ -16,9 +16,10 @@
16
16
  * only the options its layout needs.
17
17
  */
18
18
  import { basename } from 'node:path';
19
- import { enforceTdd, forbidContentPattern } from '@nizos/probity';
19
+ import { forbidContentPattern } from '@nizos/probity';
20
20
  import { enforceAcceptanceLanguage } from '../rules/acceptance-language.js';
21
- import { forbidNewAmbientEffects, JS_AMBIENT_EFFECT_PATTERNS, requireGreenTestRun, withJudgeFailureDiagnostics, withContradictionRetry, } from '../rules/gates.js';
21
+ import { forbidNewAmbientEffects, JS_AMBIENT_EFFECT_PATTERNS, requireGreenTestRun, } from '../rules/gates.js';
22
+ import { enforceJsTdd } from '../rules/js-tdd.js';
22
23
  import { enforcePortsBoundary, forbidInternalModuleMocks, } from '../rules/ports-and-adapters.js';
23
24
  import { withExcludeGlobs } from '../rules/scoping.js';
24
25
  import { enforceSpecTestParity, JS_TEST_DECLARATION, requireSpecBackedAcceptanceTest, surfaceScenarioLinkBreakage, } from '../rules/spec-test-parity.js';
@@ -137,7 +138,7 @@ export function jsRuleEntries(options = {}) {
137
138
  // screen, never after a model call.
138
139
  entries.push({
139
140
  files: tddGlobs,
140
- rules: [withJudgeFailureDiagnostics(withContradictionRetry(enforceTdd()))],
141
+ rules: [enforceJsTdd()],
141
142
  });
142
143
  // ── Outer loop: acceptance-testing ──────────────────────────────
143
144
  // The Language Test on the spec layer only. Do NOT widen this to
@@ -1 +1 @@
1
- {"version":3,"file":"js.js","sourceRoot":"","sources":["../../presets/js.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAkB,MAAM,gBAAgB,CAAA;AAEjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,+BAA+B,EAC/B,2BAA2B,GAE5B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAA;AAE7E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,kRAAkR,CAAA;AAiEpR;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,UAA2B,EAAE;IACzD,MAAM,SAAS,GAAU,OAAO,CAAC,SAAS,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,CAAA;IAC9E,MAAM,SAAS,GAAU,OAAO,CAAC,SAAS,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;IACnG,MAAM,QAAQ,GAAU,OAAO,CAAC,QAAQ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AQ;YAC1B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YAC/C,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,YAAY,EAAE,OAAO,CAAC,kBAAkB;YACxC,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC,CACH,CAAA;IACH,CAAC;IAED,mEAAmE;IACnE,iEAAiE;IACjE,mEAAmE;IACnE,+DAA+D;IAC/D,+DAA+D;IAC/D,gEAAgE;IAChE,oBAAoB;IACpB,OAAO,CAAC,IAAI,CACV,mBAAmB,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC,aAAa,IAAI,6BAA6B;QAC/D,cAAc,EACZ,OAAO,CAAC,oBAAoB,IAAI,iDAAiD;QACnF,cAAc,EAAE,OAAO,CAAC,oBAAoB,IAAI,mBAAmB;KACpE,CAAC,CACH,CAAA;IAED,OAAO,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;AAChD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type Rule } from '@nizos/probity';
2
+ /**
3
+ * Appended to Probity's default TDD rules for JS/TS. The defaults say
4
+ * both "adding a test is the red step" and "judge a new red at the
5
+ * green->red boundary too" (the refactor check), and the judge has
6
+ * read the second as a demand that the new test was already observed
7
+ * failing (#73; the Kotlin judge did the same in #43).
8
+ */
9
+ export declare const JS_TDD_ADDENDUM = "## Adding a red test\n\n- Adding a failing test is the red step itself. A test-file write that adds one new test (with any imports, fixtures, or helpers it needs) passes without any prior run of that test: a test cannot have failed before it exists. \"Must be observed failing for the right reason\" applies only to the production write that follows it, never to the test write. This holds whether the asserted behavior is missing entirely or exists but is wrong, including behavior the previous cycle just implemented.\n- At a test write, the only green->red question is whether the prior green left an unmistakable refactor unmade. A passing prior run is the expected state before a new test is added, never a reason to block it. Do not block a test write because the new test has not been observed failing, because the last run was for a previous test, or because the test contradicts what production code does now.\n- The other rules still hold: a write adding more than one new test is a violation (restructuring existing tests is not adding), and so is a production write with no observed failing test for it. Observed failing means a test run, after the test was written, whose output shows that test failing. A test written in the session with no run after it has not been observed failing, and an earlier failing run of a different test does not count.";
10
+ /**
11
+ * Probity's `enforceTdd()` with {@link JS_TDD_ADDENDUM} appended, wrapped
12
+ * as the JS preset wires it: a self-contradicting deny is retried, and a
13
+ * judge that returns no verdict (spend limit, auth failure) is reported
14
+ * as an infrastructure failure rather than a TDD rejection. Use this in
15
+ * place of `withJudgeFailureDiagnostics(withContradictionRetry(enforceTdd()))`.
16
+ */
17
+ export declare function enforceJsTdd(): Rule;
18
+ //# sourceMappingURL=js-tdd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-tdd.d.ts","sourceRoot":"","sources":["../../rules/js-tdd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAItD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,s1CAI8Z,CAAA;AAE1b;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAMnC"}
@@ -0,0 +1,25 @@
1
+ import { enforceTdd } from '@nizos/probity';
2
+ import { withJudgeFailureDiagnostics, withContradictionRetry } from './gates.js';
3
+ /**
4
+ * Appended to Probity's default TDD rules for JS/TS. The defaults say
5
+ * both "adding a test is the red step" and "judge a new red at the
6
+ * green->red boundary too" (the refactor check), and the judge has
7
+ * read the second as a demand that the new test was already observed
8
+ * failing (#73; the Kotlin judge did the same in #43).
9
+ */
10
+ export const JS_TDD_ADDENDUM = `## Adding a red test
11
+
12
+ - Adding a failing test is the red step itself. A test-file write that adds one new test (with any imports, fixtures, or helpers it needs) passes without any prior run of that test: a test cannot have failed before it exists. "Must be observed failing for the right reason" applies only to the production write that follows it, never to the test write. This holds whether the asserted behavior is missing entirely or exists but is wrong, including behavior the previous cycle just implemented.
13
+ - At a test write, the only green->red question is whether the prior green left an unmistakable refactor unmade. A passing prior run is the expected state before a new test is added, never a reason to block it. Do not block a test write because the new test has not been observed failing, because the last run was for a previous test, or because the test contradicts what production code does now.
14
+ - The other rules still hold: a write adding more than one new test is a violation (restructuring existing tests is not adding), and so is a production write with no observed failing test for it. Observed failing means a test run, after the test was written, whose output shows that test failing. A test written in the session with no run after it has not been observed failing, and an earlier failing run of a different test does not count.`;
15
+ /**
16
+ * Probity's `enforceTdd()` with {@link JS_TDD_ADDENDUM} appended, wrapped
17
+ * as the JS preset wires it: a self-contradicting deny is retried, and a
18
+ * judge that returns no verdict (spend limit, auth failure) is reported
19
+ * as an infrastructure failure rather than a TDD rejection. Use this in
20
+ * place of `withJudgeFailureDiagnostics(withContradictionRetry(enforceTdd()))`.
21
+ */
22
+ export function enforceJsTdd() {
23
+ return withJudgeFailureDiagnostics(withContradictionRetry(enforceTdd({ instructions: (defaults) => `${defaults}\n\n${JS_TDD_ADDENDUM}` })));
24
+ }
25
+ //# sourceMappingURL=js-tdd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-tdd.js","sourceRoot":"","sources":["../../rules/js-tdd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,gBAAgB,CAAA;AAEtD,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;0bAI2Z,CAAA;AAE1b;;;;;;GAMG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,2BAA2B,CAChC,sBAAsB,CACpB,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,QAAQ,OAAO,eAAe,EAAE,EAAE,CAAC,CAChF,CACF,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjchill/probity-rules",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "Versioned Probity rule presets and CLI tooling for the agent-skills catalog (test-driven-development, ports-and-adapters, acceptance-testing, spec-test parity, ubiquitous-language) — see hooks/PROBITY.md.",
5
5
  "license": "MIT",
6
6
  "repository": {