@nathapp/nax 0.68.3 → 0.68.4

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.
Files changed (2) hide show
  1. package/dist/nax.js +39 -10
  2. package/package.json +1 -1
package/dist/nax.js CHANGED
@@ -41077,10 +41077,18 @@ ${exceptions.join(`
41077
41077
 
41078
41078
  `)}`;
41079
41079
  }
41080
+ function implementerOwnsTests(story) {
41081
+ return SINGLE_SESSION_TEST_OWNING_STRATEGIES.has(story.routing?.testStrategy ?? "");
41082
+ }
41083
+ function testEditHeadline(story, prohibition) {
41084
+ return implementerOwnsTests(story) ? SINGLE_SESSION_PERMIT_HEADLINE : prohibition;
41085
+ }
41080
41086
  function exceptionCountWord(story) {
41081
41087
  return THREE_SESSION_STRATEGIES.has(story.routing?.testStrategy ?? "") ? "four" : "three";
41082
41088
  }
41083
41089
  function escapeHatchFor(story) {
41090
+ if (implementerOwnsTests(story))
41091
+ return SINGLE_SESSION_TEST_EDIT_POLICY;
41084
41092
  const isTdd = THREE_SESSION_STRATEGIES.has(story.routing?.testStrategy ?? "");
41085
41093
  return buildEscapeHatch({ includeMockHandoff: isTdd });
41086
41094
  }
@@ -41152,7 +41160,7 @@ ${errors3}
41152
41160
  2. Only fix findings that are actually valid problems
41153
41161
  3. Do NOT add keys, functions, or imports that already exist \u2014 check first
41154
41162
 
41155
- Do NOT change test files or test behavior \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below.
41163
+ ${testEditHeadline(story, `Do NOT change test files or test behavior \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below.`)}
41156
41164
  Do NOT add new features \u2014 only fix valid issues.
41157
41165
  Commit your fixes when done.${scopeConstraint}${noTestIsolationBlock(story)}${escapeHatchFor(story)}`;
41158
41166
  }
@@ -41206,6 +41214,7 @@ Commit your fixes when done.${scopeConstraint}${noTestIsolationBlock(story)}${es
41206
41214
  }
41207
41215
  function mechanicalRectification(checks3, story, scopeConstraint, opts) {
41208
41216
  const errors3 = formatCheckErrors(checks3, opts);
41217
+ const scopeDirective = implementerOwnsTests(story) ? `Fix all errors listed above that are within this story's scope. ${SINGLE_SESSION_PERMIT_HEADLINE}` : `Fix all errors listed above that are within this story's scope \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below for sibling-story spillover. Do NOT change test files or test behavior except via those exceptions.`;
41209
41218
  return `You are fixing lint/typecheck errors from a code review.
41210
41219
 
41211
41220
  Story: ${story.title} (${story.id})
@@ -41214,7 +41223,7 @@ The following quality checks failed after implementation:
41214
41223
 
41215
41224
  ${errors3}
41216
41225
 
41217
- Fix all errors listed above that are within this story's scope \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below for sibling-story spillover. Do NOT change test files or test behavior except via those exceptions.
41226
+ ${scopeDirective}
41218
41227
  Do NOT add new features \u2014 only fix the quality check errors.
41219
41228
  After fixing, re-run the failing check(s) to verify they pass, then commit your changes.${scopeConstraint}${noTestIsolationBlock(story)}${escapeHatchFor(story)}`;
41220
41229
  }
@@ -41285,11 +41294,29 @@ REASON: <one paragraph: which mock is wrong vs which dispatch the new code uses,
41285
41294
  Rules:
41286
41295
  - Do NOT make any edits yourself; the test-writer will fulfill.
41287
41296
  - Do NOT also emit \`UNRESOLVED:\` in the same turn \u2014 this declaration IS the handoff.
41288
- - FILES must list real test files. Each path must exist and be a test file.`, THREE_SESSION_STRATEGIES, CONTRADICTION_ESCAPE_HATCH, MAX_STRUCTURED_FINDINGS = 10, RAW_WITH_FINDINGS_LIMIT = 1000, RAW_FALLBACK_LIMIT = 4000;
41297
+ - FILES must list real test files. Each path must exist and be a test file.`, THREE_SESSION_STRATEGIES, SINGLE_SESSION_TEST_OWNING_STRATEGIES, SINGLE_SESSION_PERMIT_HEADLINE = "You authored these tests in the same session as the implementation, so you MAY edit test files \u2014 but ONLY to resolve a genuine contradiction between a test and this story's acceptance criteria (or between two acceptance criteria). NEVER weaken, delete, loosen, or skip a test merely to make it pass. See the test-edit guidance appended below.", SINGLE_SESSION_TEST_EDIT_POLICY = `
41298
+
41299
+ ## Test-edit guidance (single-session implementer)
41300
+
41301
+ You wrote both the tests and the implementation for this story in one session, so no
41302
+ separate test-writer owns the test contract. You therefore MAY edit test files during
41303
+ rectification \u2014 subject to these limits:
41304
+
41305
+ - Edit a test ONLY to resolve a genuine contradiction between the test and an acceptance
41306
+ criterion, a contradiction between two acceptance criteria, or a clear defect in a test
41307
+ you authored (wrong arity/type, impossible setup, or asserting behavior the ACs do not require).
41308
+ - NEVER weaken, delete, loosen, or \`skip\` a test simply because the implementation fails it.
41309
+ A failing test usually means the SOURCE is wrong \u2014 fix the source first.
41310
+ - The semantic and adversarial reviewers still gate correctness; gaming a test to pass will be caught.
41311
+
41312
+ If two findings or two acceptance criteria contradict each other and you cannot satisfy
41313
+ both even after adjusting tests, do not guess. Emit:
41314
+ UNRESOLVED: <which findings/ACs conflicted and why they cannot both be satisfied>`, CONTRADICTION_ESCAPE_HATCH, MAX_STRUCTURED_FINDINGS = 10, RAW_WITH_FINDINGS_LIMIT = 1000, RAW_FALLBACK_LIMIT = 4000;
41289
41315
  var init_rectifier_builder_helpers = __esm(() => {
41290
41316
  init_review();
41291
41317
  init_sections2();
41292
41318
  THREE_SESSION_STRATEGIES = new Set(["three-session-tdd", "three-session-tdd-lite"]);
41319
+ SINGLE_SESSION_TEST_OWNING_STRATEGIES = new Set(["tdd-simple", "test-after"]);
41293
41320
  CONTRADICTION_ESCAPE_HATCH = buildEscapeHatch({ includeMockHandoff: false });
41294
41321
  });
41295
41322
 
@@ -41375,11 +41402,13 @@ class RectifierPromptBuilder {
41375
41402
  const parts = [];
41376
41403
  const attemptWord = maxAttempts === 1 ? "1 attempt" : `${maxAttempts} attempts`;
41377
41404
  const exCount = story ? exceptionCountWord(story) : "three";
41405
+ const prohibition = `Do NOT change test files or test behavior \u2014 see the ${exCount} narrow exceptions appended below.`;
41406
+ const testDirective = story ? testEditHeadline(story, prohibition) : prohibition;
41378
41407
  parts.push(`Review failed after your implementation. Fix the following issues (${attemptWord} available before escalation):
41379
41408
  `);
41380
41409
  parts.push(renderPrioritizedFailures(failedChecks));
41381
41410
  parts.push(`
41382
- Fix in priority order. After fixing each priority, re-run the failing check(s) at that level to verify they pass before moving on. Do NOT change test files or test behavior \u2014 see the ${exCount} narrow exceptions appended below. Commit your changes when all checks pass.`);
41411
+ Fix in priority order. After fixing each priority, re-run the failing check(s) at that level to verify they pass before moving on. ${testDirective} Commit your changes when all checks pass.`);
41383
41412
  parts.push(story ? escapeHatchFor(story) : CONTRADICTION_ESCAPE_HATCH);
41384
41413
  const guardrails = buildBehavioralGuardrailsSection("implementer", guardrailLevel ?? "lite");
41385
41414
  if (guardrails) {
@@ -41642,7 +41671,7 @@ ${testCommands}
41642
41671
  6. Ensure ALL tests pass before completing.
41643
41672
 
41644
41673
  **IMPORTANT:**
41645
- - Do NOT modify test files \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below if you believe a test has a lint error, a PRD-contract mismatch, or belongs to a sibling story.
41674
+ - ${testEditHeadline(story, `Do NOT modify test files \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below if you believe a test has a lint error, a PRD-contract mismatch, or belongs to a sibling story.`)}
41646
41675
  - Do NOT loosen assertions to mask implementation bugs.
41647
41676
  - Focus on fixing the source code to meet the test requirements.
41648
41677
  - When running tests, run ONLY the failing test files shown above${cmd ? ` \u2014 NEVER run \`${cmd}\` without a file filter` : " \u2014 never run the full test suite without a file filter"}.
@@ -41742,7 +41771,7 @@ ${errors3}${reasoningSection}${historySection}
41742
41771
  2. Only fix findings that are actually valid problems
41743
41772
  3. Do NOT add keys, functions, or imports that already exist \u2014 check first
41744
41773
 
41745
- Do NOT change test files or test behavior \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below.
41774
+ ${testEditHeadline(story, `Do NOT change test files or test behavior \u2014 see the ${exceptionCountWord(story)} narrow exceptions appended below.`)}
41746
41775
  Do NOT add new features \u2014 only fix valid issues.
41747
41776
  Commit your fixes when done.${scopeConstraint}${escapeHatchFor(story)}`;
41748
41777
  }
@@ -41836,7 +41865,7 @@ Tests are failing. Fix the source so all tests pass \u2014 not just the ones lis
41836
41865
  4. Do not declare done until step 3 shows 0 failures.
41837
41866
 
41838
41867
  **IMPORTANT:**
41839
- - Do NOT modify test files \u2014 see the ${exceptionCountWord(opts.story)} narrow exceptions appended below if you believe a test has a lint error, a PRD-contract mismatch, or belongs to a sibling story.
41868
+ - ${testEditHeadline(opts.story, `Do NOT modify test files \u2014 see the ${exceptionCountWord(opts.story)} narrow exceptions appended below if you believe a test has a lint error, a PRD-contract mismatch, or belongs to a sibling story.`)}
41840
41869
  - Do NOT loosen assertions to mask implementation bugs.
41841
41870
  - Focus on fixing the source code to meet the test requirements.`);
41842
41871
  parts.push(escapeHatchFor(opts.story));
@@ -58354,7 +58383,7 @@ var package_default;
58354
58383
  var init_package = __esm(() => {
58355
58384
  package_default = {
58356
58385
  name: "@nathapp/nax",
58357
- version: "0.68.3",
58386
+ version: "0.68.4",
58358
58387
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
58359
58388
  type: "module",
58360
58389
  bin: {
@@ -58449,8 +58478,8 @@ var init_version = __esm(() => {
58449
58478
  NAX_VERSION = package_default.version;
58450
58479
  NAX_COMMIT = (() => {
58451
58480
  try {
58452
- if (/^[0-9a-f]{6,10}$/.test("a1007103"))
58453
- return "a1007103";
58481
+ if (/^[0-9a-f]{6,10}$/.test("197c6530"))
58482
+ return "197c6530";
58454
58483
  } catch {}
58455
58484
  try {
58456
58485
  const result = Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax",
3
- "version": "0.68.3",
3
+ "version": "0.68.4",
4
4
  "description": "AI Coding Agent Orchestrator — loops until done",
5
5
  "type": "module",
6
6
  "bin": {