mandrel 2.118.0 → 2.119.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 (35) hide show
  1. package/.agents/docs/agentrc-reference.json +2 -1
  2. package/.agents/docs/configuration.md +14 -5
  3. package/.agents/schemas/agentrc.schema.json +25 -2
  4. package/.agents/schemas/story-deliver-terminal.schema.json +15 -1
  5. package/.agents/scripts/lib/baselines/crap-preview-coverage.js +17 -0
  6. package/.agents/scripts/lib/baselines/crap-preview-scan.js +11 -6
  7. package/.agents/scripts/lib/baselines/preview-gates.js +2 -0
  8. package/.agents/scripts/lib/baselines/refresh-service.js +21 -6
  9. package/.agents/scripts/lib/close-validation/base-sync-revalidation.js +152 -0
  10. package/.agents/scripts/lib/close-validation/ci-deferral.js +23 -5
  11. package/.agents/scripts/lib/close-validation/gates.js +8 -2
  12. package/.agents/scripts/lib/close-validation/runner.js +8 -10
  13. package/.agents/scripts/lib/config-settings-schema-delivery.js +22 -2
  14. package/.agents/scripts/lib/coverage-deferral.js +17 -0
  15. package/.agents/scripts/lib/generated/agentrc-validator.js +2 -2
  16. package/.agents/scripts/lib/observability/story-outcome.js +5 -4
  17. package/.agents/scripts/lib/orchestration/handoff-rescore.js +95 -25
  18. package/.agents/scripts/lib/orchestration/merge-block-class.js +12 -1
  19. package/.agents/scripts/lib/orchestration/merge-poll.js +9 -0
  20. package/.agents/scripts/lib/orchestration/merge-queue.js +14 -7
  21. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +2 -25
  22. package/.agents/scripts/lib/orchestration/single-story-close/phases/base-sync.js +8 -1
  23. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +26 -7
  24. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +50 -8
  25. package/.agents/scripts/lib/orchestration/single-story-close/phases/finish.js +3 -2
  26. package/.agents/scripts/lib/orchestration/single-story-close/phases/pre-push.js +9 -3
  27. package/.agents/scripts/lib/orchestration/single-story-close/result.js +9 -6
  28. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +1 -0
  29. package/.agents/scripts/lib/orchestration/story-close/duplication-close-rescore.js +158 -71
  30. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +4 -0
  31. package/.agents/scripts/lib/orchestration/story-handoff.js +100 -25
  32. package/.agents/scripts/quality-preview.js +57 -8
  33. package/.agents/workflows/helpers/deliver-reference.md +10 -1
  34. package/docs/CHANGELOG.md +10 -0
  35. package/package.json +1 -1
@@ -108,7 +108,7 @@ const EXECUTION_SCHEMA = {
108
108
  minimum: 1,
109
109
  default: 1,
110
110
  description:
111
- "Story #5997. The most handoff preflight checks that may run at once. `1` (the default) is the serial preflight. Above 1, typecheck, lint and format (close's independent gates) may also run in up to N − 1 extra lanes, each admitted through suite admission with no wait under close's argv for that gate; a miss hands the check back to the serial lane. Set it per host in `.agentrc.local.json`: whether a host can afford a second CPU-heavy check is a per-host fact.",
111
+ "Story #5997. The most handoff preflight checks that may run at once. `1` (the default) is the serial preflight. Above 1, typecheck, lint and format (close's independent gates) may also run in up to N − 1 extra lanes, each admitted through suite admission with no wait under close's argv for that gate; a miss hands the check back to the serial lane. When lanes are admitted (and not under `--report-all`), the handoff's duplication re-score scan also overlaps preflight instead of running before it: a moved row is committed at a join before the independent baseline compare runs, and the preflight credits re-key onto that commit. Set it per host in `.agentrc.local.json`: whether a host can afford a second CPU-heavy check is a per-host fact.",
112
112
  },
113
113
  },
114
114
  additionalProperties: false,
@@ -222,7 +222,7 @@ const WORKTREE_ISOLATION_SCHEMA = {
222
222
  const CLOSE_SCHEMA = {
223
223
  type: 'object',
224
224
  description:
225
- 'Close-time posture (Story #5954). `baseSync` decides whether close and a handoff re-run merge `origin/<baseBranch>` before validating.',
225
+ 'Close-time posture (Story #5954). `baseSync` decides whether close and a handoff re-run merge `origin/<baseBranch>` before validating; the `revalidate*` keys decide what close re-runs after that merge.',
226
226
  properties: {
227
227
  baseSync: {
228
228
  type: 'string',
@@ -231,6 +231,26 @@ const CLOSE_SCHEMA = {
231
231
  "`always` (default) merges `origin/<baseBranch>` on every close, as before. `on-conflict` first runs a conflict-only probe and skips the merge when it is conflict-free (`git merge-tree --write-tree`) and the incoming and Story paths are disjoint (raw paths, `baselines/` and renames included); `check-baselines` then compares against the merge-base and the terminal envelope's `baseSync` says why. Any other probe answer merges as today. A handoff applies the probe only on a re-run. Opt in only behind a merge queue that re-tests the merged tree and with no up-to-date-branch requirement: a semantic conflict the probe cannot see surfaces in CI, and coverage is measured on the pre-merge tree.",
232
232
  default: 'always',
233
233
  },
234
+ revalidateAfterBaseSync: {
235
+ type: 'string',
236
+ enum: ['full', 'ci'],
237
+ description:
238
+ "What close re-runs after base-sync merged `origin/<baseBranch>`. `full` (default) re-runs every gate, as before. `ci` defers `typecheck`, `lint` and the coverage capture to the CI checks named in `revalidateCiChecks` — never spawned, reported `deferred`, the capture writing `Coverage-deferred: base-sync-ci` — but only for a conflict-free merge commit whose pre-sync head carries `typecheck` and `lint` pass evidence, with no incoming path under `revalidateAlwaysPaths` and, when the capture is registered, a `coverage.ciRatchetCheck`. Any other close re-runs everything and the terminal envelope's `revalidation` names why.",
239
+ default: 'full',
240
+ },
241
+ revalidateCiChecks: {
242
+ type: 'array',
243
+ items: { type: 'string', minLength: 1 },
244
+ uniqueItems: true,
245
+ description:
246
+ 'The CI check names (check-run or status context) a `revalidateAfterBaseSync: "ci"` deferral leans on. Absent or empty, the mode falls back to a full re-run.',
247
+ },
248
+ revalidateAlwaysPaths: {
249
+ type: 'array',
250
+ items: { type: 'string', minLength: 1 },
251
+ description:
252
+ 'Globs (picomatch, dotfiles included) for whole-repo invariants: a base merge bringing in any matching path always re-runs every gate under `revalidateAfterBaseSync: "ci"`.',
253
+ },
234
254
  },
235
255
  additionalProperties: false,
236
256
  };
@@ -13,14 +13,30 @@ const COVERAGE_DEFERRED_KEY = 'Coverage-deferred';
13
13
  export const COVERAGE_DEFERRED_REASONS = Object.freeze({
14
14
  overBudget: 'over-budget',
15
15
  suiteOfRecordCi: 'suite-of-record-ci',
16
+ baseSyncCi: 'base-sync-ci',
16
17
  });
17
18
 
19
+ /** The gates that run the suite: only their deferral is a coverage deferral. */
20
+ export const SUITE_GATE_NAMES = new Set(['test', 'coverage-capture']);
21
+
22
+ /**
23
+ * The suite gate's entry among a close's `deferred[]`, else `undefined`; a
24
+ * typecheck or lint deferral never stands for the suite.
25
+ *
26
+ * @param {Array<{ gate: { name: string }, reason: string }>|undefined} deferred
27
+ */
28
+ export function suiteGateDeferral(deferred) {
29
+ return (deferred ?? []).find((d) => SUITE_GATE_NAMES.has(d.gate.name));
30
+ }
31
+
18
32
  /** The prose line each reason adds beneath `Closes #<id>`. */
19
33
  const PROSE = Object.freeze({
20
34
  [COVERAGE_DEFERRED_REASONS.overBudget]:
21
35
  "Coverage deferred to CI: the capture slice was over this host's budget (exit 76, onOverBudget: defer-to-ci).",
22
36
  [COVERAGE_DEFERRED_REASONS.suiteOfRecordCi]:
23
37
  'Coverage deferred to CI: CI is the coverage and CRAP ratchet of record (suiteOfRecord: ci).',
38
+ [COVERAGE_DEFERRED_REASONS.baseSyncCi]:
39
+ 'Coverage deferred to CI: close merged the base conflict-free and CI revalidates the merged tree (revalidateAfterBaseSync: ci).',
24
40
  });
25
41
 
26
42
  const PROSE_LINES = new Set(Object.values(PROSE));
@@ -29,6 +45,7 @@ const PROSE_LINES = new Set(Object.values(PROSE));
29
45
  const POLICY = Object.freeze({
30
46
  [COVERAGE_DEFERRED_REASONS.overBudget]: 'defer-to-ci',
31
47
  [COVERAGE_DEFERRED_REASONS.suiteOfRecordCi]: 'suite-of-record',
48
+ [COVERAGE_DEFERRED_REASONS.baseSyncCi]: 'base-sync',
32
49
  });
33
50
 
34
51
  /**