mandrel 2.56.0 → 2.57.0

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 (106) hide show
  1. package/.agents/agents/plan-critic.md +13 -18
  2. package/.agents/agents/story-worker.md +25 -34
  3. package/.agents/docs/agentrc-reference.json +0 -30
  4. package/.agents/docs/configuration.md +8 -28
  5. package/.agents/docs/execution-reference.md +5 -5
  6. package/.agents/docs/quality-gates.md +8 -7
  7. package/.agents/instructions.md +9 -10
  8. package/.agents/schemas/agentrc.schema.json +9 -185
  9. package/.agents/schemas/story-deliver-terminal.schema.json +1 -1
  10. package/.agents/scripts/acceptance-eval.js +107 -17
  11. package/.agents/scripts/ceremony-derive.js +191 -0
  12. package/.agents/scripts/check-context-budget.js +28 -33
  13. package/.agents/scripts/check-cyclomatic.js +4 -3
  14. package/.agents/scripts/deliver-light.js +31 -94
  15. package/.agents/scripts/lib/audit-suite/checklist-threading.js +15 -2
  16. package/.agents/scripts/lib/baselines/coverage-updater-cli.js +110 -0
  17. package/.agents/scripts/lib/baselines/crap-preview-scan.js +25 -0
  18. package/.agents/scripts/lib/baselines/crap-updater-cli.js +223 -0
  19. package/.agents/scripts/lib/bdd-scenario-budget.js +21 -3
  20. package/.agents/scripts/lib/bootstrap/quality-bootstrap.js +0 -1
  21. package/.agents/scripts/lib/close-validation/gates.js +52 -1
  22. package/.agents/scripts/lib/config/acceptance-eval.js +25 -57
  23. package/.agents/scripts/lib/config/delivery-routing.js +7 -33
  24. package/.agents/scripts/lib/config/explain.js +0 -19
  25. package/.agents/scripts/lib/config/limits.js +18 -78
  26. package/.agents/scripts/lib/config/quality.js +6 -3
  27. package/.agents/scripts/lib/config/runners.js +3 -2
  28. package/.agents/scripts/lib/config-settings-schema-delivery.js +15 -68
  29. package/.agents/scripts/lib/config-settings-schema-quality.js +0 -14
  30. package/.agents/scripts/lib/config-settings-schema.js +16 -143
  31. package/.agents/scripts/lib/crap-engine.js +35 -4
  32. package/.agents/scripts/lib/crap-utils.js +17 -1
  33. package/.agents/scripts/lib/cyclomatic-ceiling.js +19 -7
  34. package/.agents/scripts/lib/generated/agentrc-validator.js +1 -1
  35. package/.agents/scripts/lib/observability/runtime-friction.js +1 -1
  36. package/.agents/scripts/lib/observability/source-classifier.js +1 -0
  37. package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +5 -4
  38. package/.agents/scripts/lib/orchestration/ceremony-routing.js +19 -73
  39. package/.agents/scripts/lib/orchestration/complexity-gate.js +46 -212
  40. package/.agents/scripts/lib/orchestration/file-assumptions.js +32 -17
  41. package/.agents/scripts/lib/orchestration/light-escalation.js +3 -3
  42. package/.agents/scripts/lib/orchestration/light-suitability.js +66 -233
  43. package/.agents/scripts/lib/orchestration/plan-context.js +181 -387
  44. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +42 -153
  45. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +14 -70
  46. package/.agents/scripts/lib/orchestration/plan-persist/changes-repair.js +300 -0
  47. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +131 -168
  48. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +118 -297
  49. package/.agents/scripts/lib/orchestration/plan-persist/soft-findings.js +55 -0
  50. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +16 -65
  51. package/.agents/scripts/lib/orchestration/plan-persist/wave-serialisation.js +22 -35
  52. package/.agents/scripts/lib/orchestration/plan-text-hygiene.js +30 -139
  53. package/.agents/scripts/lib/orchestration/planning/memory-pool-advisory.js +61 -223
  54. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +5 -0
  55. package/.agents/scripts/lib/orchestration/single-story-close/phases/pre-gate-steps.js +46 -16
  56. package/.agents/scripts/lib/orchestration/story-close/context-budget-writeback.js +213 -0
  57. package/.agents/scripts/lib/orchestration/task-body-validator.js +10 -63
  58. package/.agents/scripts/lib/orchestration/ticket-validator-conflicts.js +33 -539
  59. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +21 -414
  60. package/.agents/scripts/lib/orchestration/ticket-validator.js +54 -118
  61. package/.agents/scripts/lib/orchestration/verify-credit.js +69 -24
  62. package/.agents/scripts/lib/story-body/body-format-lints.js +15 -85
  63. package/.agents/scripts/lib/story-body/story-body.js +17 -237
  64. package/.agents/scripts/lib/templates/decomposer-prompts.js +84 -121
  65. package/.agents/scripts/lib/test-isolate/cli-options.js +93 -0
  66. package/.agents/scripts/lib/test-isolate/progress-log.js +45 -0
  67. package/.agents/scripts/lib/test-isolate/render-report.js +97 -0
  68. package/.agents/scripts/lib/test-isolate/run-isolate.js +87 -0
  69. package/.agents/scripts/lib/test-run-credit.js +266 -0
  70. package/.agents/scripts/lib/wave-runner/footprint.js +48 -358
  71. package/.agents/scripts/lib/wave-runner/ready-set.js +6 -5
  72. package/.agents/scripts/lib/workers/crap-worker.js +32 -41
  73. package/.agents/scripts/plan-context.js +7 -9
  74. package/.agents/scripts/plan-critics.js +28 -54
  75. package/.agents/scripts/plan-persist.js +25 -68
  76. package/.agents/scripts/quality-preview.js +51 -0
  77. package/.agents/scripts/run-tests.js +12 -0
  78. package/.agents/scripts/stories-wave-tick.js +23 -45
  79. package/.agents/scripts/test-isolate.js +13 -180
  80. package/.agents/scripts/update-coverage-baseline.js +25 -70
  81. package/.agents/scripts/update-crap-baseline.js +19 -123
  82. package/.agents/skills/core/scope-triage/SKILL.md +3 -3
  83. package/.agents/workflows/audit-clean-code.md +4 -3
  84. package/.agents/workflows/helpers/acceptance-self-eval.md +41 -41
  85. package/.agents/workflows/helpers/code-quality-guardrails.md +4 -4
  86. package/.agents/workflows/helpers/code-review.md +2 -3
  87. package/.agents/workflows/helpers/deliver-digest.md +41 -57
  88. package/.agents/workflows/helpers/deliver-light.md +40 -105
  89. package/.agents/workflows/helpers/deliver-reference.md +1 -1
  90. package/.agents/workflows/helpers/deliver-story-reference.md +37 -58
  91. package/.agents/workflows/helpers/deliver-story.md +9 -13
  92. package/.agents/workflows/helpers/plan-reference.md +132 -219
  93. package/.agents/workflows/mandrel-plan.md +27 -40
  94. package/.agents/workflows/memory-consolidate.md +9 -13
  95. package/docs/CHANGELOG.md +23 -0
  96. package/lib/migrations/index.js +4 -0
  97. package/lib/migrations/steps/2.57.0-retire-delivery-limit-knobs.js +45 -0
  98. package/lib/migrations/steps/2.57.0-retire-planning-limit-knobs.js +59 -0
  99. package/package.json +1 -1
  100. package/.agents/scripts/lib/framework-version.js +0 -39
  101. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +0 -223
  102. package/.agents/scripts/lib/orchestration/plan-persist/fan-out-gate.js +0 -97
  103. package/.agents/scripts/lib/orchestration/planning/decomposer-context.js +0 -26
  104. package/.agents/scripts/lib/orchestration/spec-budget.js +0 -89
  105. package/.agents/scripts/lib/orchestration/spec-spill.js +0 -74
  106. package/.agents/scripts/lib/orchestration/verify-tier-repair.js +0 -107
@@ -348,6 +348,12 @@ function projectScanRow(relPath, mr) {
348
348
  * skipped from the returned rows so the baseline never contains
349
349
  * partially-scored entries. Both counters surface for reporting.
350
350
  *
351
+ * A file neither path could score at all — unreadable, untranspilable, or one
352
+ * the kernel could not parse — is dropped and counted in `unscorableFiles`
353
+ * (Story #5311). Unscorable is not scored-as-nothing: without this counter a
354
+ * dropped file is indistinguishable from a file with no methods, which is what
355
+ * let a whole parse-failure class leave the baseline silently.
356
+ *
351
357
  * When `scopeFiles` is provided (the `--changed-since` code path) files
352
358
  * discovered via directory walking are filtered against that set before any
353
359
  * I/O or scoring happens — so pre-push / PR-CI runs never pay the
@@ -385,6 +391,7 @@ function projectScanRow(relPath, mr) {
385
391
  * scannedFiles: number,
386
392
  * skippedFilesNoCoverage: number,
387
393
  * skippedMethodsNoCoverage: number,
394
+ * unscorableFiles: number,
388
395
  * }}
389
396
  */
390
397
  export async function scanAndScore({
@@ -442,9 +449,16 @@ export async function scanAndScore({
442
449
  const rows = [];
443
450
  let skippedFilesNoCoverage = 0;
444
451
  let skippedMethodsNoCoverage = 0;
452
+ let unscorableFiles = 0;
445
453
  const resolution = newResolutionAccumulator();
446
454
  for (const { item, result } of perFile) {
447
- if (!result) continue; // unrecoverable per-file failure: drop silently to match pre-pool semantics
455
+ if (!result) {
456
+ // Unrecoverable per-file failure (a pool-level error the worker never
457
+ // answered). Dropped like any other unscorable file, and counted — the
458
+ // point of the counter is that no drop is silent.
459
+ unscorableFiles += 1;
460
+ continue;
461
+ }
448
462
  if (result.skippedFileNoCoverage) {
449
463
  skippedFilesNoCoverage += 1;
450
464
  continue;
@@ -453,6 +467,7 @@ export async function scanAndScore({
453
467
  // read/transpile/parse failure: drop and move on, but if the worker
454
468
  // attached an error message (calculateCrapForSource throw) surface it
455
469
  // so the run isn't silent on the ops side.
470
+ unscorableFiles += 1;
456
471
  if (result.error) {
457
472
  Logger.warn(
458
473
  `[crap-utils] failed to score ${item.relPath}: ${result.error}`,
@@ -479,6 +494,7 @@ export async function scanAndScore({
479
494
  scannedFiles,
480
495
  skippedFilesNoCoverage,
481
496
  skippedMethodsNoCoverage,
497
+ unscorableFiles,
482
498
  resolution: summarizeResolution(resolution),
483
499
  };
484
500
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
- * cyclomatic-ceiling.js — the enforcing core behind
3
- * `delivery.quality.codingGuardrails.cyclomaticMustFix` (Story #4923).
2
+ * cyclomatic-ceiling.js — the enforcing core behind the cyclomatic ceiling
3
+ * ratchet (Story #4923; fixed ceiling since Story #5313).
4
4
  *
5
5
  * The two `codingGuardrails` cyclomatic knobs shipped schema-validated,
6
6
  * bootstrap-defaulted and resolver-resolved, and were then read by nothing:
@@ -9,6 +9,12 @@
9
9
  * nothing enforces is worse than no ceiling, because the workflow docs promise
10
10
  * the merge will be refused.
11
11
  *
12
+ * Story #5313 retired the `cyclomaticMustFix` config key: the ratchet's
13
+ * ceiling is the fixed {@link CYCLOMATIC_CEILING} (12), so a consumer cannot
14
+ * bound this gate by tuning a number, and `cyclomaticFlag` is the one
15
+ * advisory knob — `quality-preview.js` reports over-flag methods and exits 0
16
+ * on them.
17
+ *
12
18
  * This module is that enforcement, shaped as a **ratchet** rather than a
13
19
  * cliff. The repository already carries dozens of functions above the
14
20
  * must-fix ceiling; failing every one of them at once would have made the
@@ -37,6 +43,13 @@ import { scanDirectory } from './maintainability-utils.js';
37
43
  /** Default location of the committed breach baseline. */
38
44
  export const DEFAULT_CYCLOMATIC_BASELINE = 'baselines/cyclomatic.json';
39
45
 
46
+ /**
47
+ * The per-function cyclomatic ceiling the ratchet enforces. Fixed — not a
48
+ * config key — since Story #5313.
49
+ * @type {number}
50
+ */
51
+ export const CYCLOMATIC_CEILING = 12;
52
+
40
53
  /** Baseline `$schema` marker, matching the sibling ratchet baselines. */
41
54
  const CYCLOMATIC_BASELINE_SCHEMA =
42
55
  'https://mandrel.dev/baselines/cyclomatic.schema.json';
@@ -44,10 +57,9 @@ const CYCLOMATIC_BASELINE_SCHEMA =
44
57
  /**
45
58
  * Resolve the enforcement policy from a resolved `delivery.quality` block.
46
59
  *
47
- * `mustFix` and `flag` come straight from `resolveCodingGuardrails`, so a
48
- * consumer that tunes either knob tunes this gate — which is the whole point
49
- * of the Story. `targetDirs` / `ignoreGlobs` are borrowed from the
50
- * maintainability gate (see the module note).
60
+ * `mustFix` is the fixed {@link CYCLOMATIC_CEILING}; `flag` comes from
61
+ * `resolveCodingGuardrails` (advisory only). `targetDirs` / `ignoreGlobs`
62
+ * are borrowed from the maintainability gate (see the module note).
51
63
  *
52
64
  * @param {object | null | undefined} quality resolved `delivery.quality`
53
65
  * @returns {{ mustFix: number, flag: number, targetDirs: string[], ignoreGlobs: string[] }}
@@ -56,7 +68,7 @@ export function resolveCyclomaticPolicy(quality) {
56
68
  const guardrails = quality?.codingGuardrails ?? {};
57
69
  const mi = quality?.maintainability ?? {};
58
70
  return {
59
- mustFix: Number(guardrails.cyclomaticMustFix ?? 12),
71
+ mustFix: CYCLOMATIC_CEILING,
60
72
  flag: Number(guardrails.cyclomaticFlag ?? 8),
61
73
  targetDirs: Array.isArray(mi.targetDirs) ? mi.targetDirs : [],
62
74
  ignoreGlobs: Array.isArray(mi.ignoreGlobs) ? mi.ignoreGlobs : [],