forgedock 1.53.0 → 1.54.1

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 (186) hide show
  1. package/.claude-plugin/marketplace.json +51 -0
  2. package/README.md +8 -2
  3. package/bin/auth/app-manifest.mjs +89 -0
  4. package/bin/auth/app-manifest.test.mjs +75 -0
  5. package/bin/auth/app-token.mjs +258 -0
  6. package/bin/auth/app-token.test.mjs +240 -0
  7. package/bin/brand.mjs +7 -0
  8. package/bin/config-history.mjs +151 -0
  9. package/bin/config-schema.mjs +115 -0
  10. package/bin/demo.mjs +65 -11
  11. package/bin/engine/outcome-codes.mjs +6 -3
  12. package/bin/engine/telemetry-seam.mjs +8 -2
  13. package/bin/engine/telemetry-seam.test.mjs +17 -0
  14. package/bin/engine-cli.mjs +57 -20
  15. package/bin/first-run.mjs +122 -0
  16. package/bin/forgedock.mjs +128 -146
  17. package/bin/help-text.mjs +144 -0
  18. package/bin/hooks/pre-tool-use.mjs +7 -0
  19. package/bin/journey.mjs +82 -83
  20. package/bin/lean/acceptance.mjs +313 -0
  21. package/bin/lean/acceptance.test.mjs +215 -0
  22. package/bin/lean/activation.mjs +18 -0
  23. package/bin/lean/activation.test.mjs +23 -1
  24. package/bin/lean/batch-health.mjs +74 -1
  25. package/bin/lean/batch-health.test.mjs +54 -1
  26. package/bin/lean/batch.test.mjs +11 -9
  27. package/bin/lean/branchlock.mjs +54 -0
  28. package/bin/lean/branchlock.test.mjs +49 -0
  29. package/bin/lean/ceiling.mjs +72 -0
  30. package/bin/lean/ceiling.test.mjs +54 -0
  31. package/bin/lean/ci-budget.mjs +366 -0
  32. package/bin/lean/ci-budget.test.mjs +167 -0
  33. package/bin/lean/conformance.e2e.test.mjs +7 -0
  34. package/bin/lean/conformance.mjs +77 -19
  35. package/bin/lean/conformance.test.mjs +129 -3
  36. package/bin/lean/context.mjs +35 -6
  37. package/bin/lean/context.test.mjs +27 -1
  38. package/bin/lean/depcache.mjs +25 -1
  39. package/bin/lean/depcache.test.mjs +26 -0
  40. package/bin/lean/e2e.mjs +18 -2
  41. package/bin/lean/e2e.test.mjs +26 -1
  42. package/bin/lean/effects.mjs +40 -11
  43. package/bin/lean/execution.test.mjs +24 -0
  44. package/bin/lean/facts.mjs +3 -3
  45. package/bin/lean/facts.test.mjs +5 -0
  46. package/bin/lean/fixround.mjs +14 -0
  47. package/bin/lean/fixround.test.mjs +25 -2
  48. package/bin/lean/gh-assoc.test.mjs +2 -1
  49. package/bin/lean/integration.mjs +100 -9
  50. package/bin/lean/integration.test.mjs +98 -0
  51. package/bin/lean/issuewatch-parity.mjs +64 -0
  52. package/bin/lean/issuewatch-parity.test.mjs +127 -0
  53. package/bin/lean/issuewatch-release.test.mjs +1 -1
  54. package/bin/lean/issuewatch.mjs +34 -5
  55. package/bin/lean/issuewatch.test.mjs +3 -2
  56. package/bin/lean/lean.mjs +316 -74
  57. package/bin/lean/lean.test.mjs +397 -24
  58. package/bin/lean/mechfix.mjs +136 -0
  59. package/bin/lean/mechfix.test.mjs +95 -0
  60. package/bin/lean/orchestrate.mjs +20 -2
  61. package/bin/lean/phaseledger.mjs +47 -5
  62. package/bin/lean/phaseledger.test.mjs +30 -1
  63. package/bin/lean/precheck.mjs +23 -4
  64. package/bin/lean/precheck.test.mjs +14 -1
  65. package/bin/lean/prereq.mjs +28 -0
  66. package/bin/lean/prereq.test.mjs +20 -0
  67. package/bin/lean/probe.mjs +4 -2
  68. package/bin/lean/prodparity.mjs +52 -0
  69. package/bin/lean/prodparity.test.mjs +67 -0
  70. package/bin/lean/prompts.mjs +69 -12
  71. package/bin/lean/recovery.test.mjs +1 -1
  72. package/bin/lean/release-io.test.mjs +42 -0
  73. package/bin/lean/release-postmerge.mjs +6 -0
  74. package/bin/lean/release-preflight.mjs +58 -0
  75. package/bin/lean/release-preflight.test.mjs +114 -0
  76. package/bin/lean/release-rehearsal.mjs +8 -7
  77. package/bin/lean/release-review.mjs +67 -11
  78. package/bin/lean/release-review.test.mjs +128 -1
  79. package/bin/lean/release-snapshot.mjs +188 -0
  80. package/bin/lean/release-snapshot.test.mjs +190 -0
  81. package/bin/lean/release.mjs +87 -13
  82. package/bin/lean/release.test.mjs +104 -0
  83. package/bin/lean/render.mjs +1 -1
  84. package/bin/lean/replan.mjs +184 -0
  85. package/bin/lean/replan.test.mjs +110 -0
  86. package/bin/lean/resume.mjs +9 -7
  87. package/bin/lean/resume.test.mjs +16 -0
  88. package/bin/lean/schedd.mjs +34 -1
  89. package/bin/lean/schedd.test.mjs +21 -1
  90. package/bin/lean/selfreview.mjs +94 -0
  91. package/bin/lean/selfreview.test.mjs +58 -1
  92. package/bin/lean/selftest-gate.mjs +22 -0
  93. package/bin/lean/selftest-gate.test.mjs +18 -1
  94. package/bin/lean/selftest-journey.mjs +234 -0
  95. package/bin/lean/selftest-journey.test.mjs +130 -0
  96. package/bin/lean/selftest-live.mjs +2 -1
  97. package/bin/lean/seqlease.mjs +35 -1
  98. package/bin/lean/seqlease.test.mjs +15 -0
  99. package/bin/lean/seqreserve.e2e.test.mjs +135 -0
  100. package/bin/lean/seqreserve.mjs +73 -0
  101. package/bin/lean/seqreserve.test.mjs +134 -0
  102. package/bin/lean/sequence.mjs +35 -6
  103. package/bin/lean/seqversioned.mjs +147 -0
  104. package/bin/lean/stagestamp.mjs +28 -0
  105. package/bin/lean/stagestamp.test.mjs +32 -0
  106. package/bin/lean/surfaces.mjs +75 -0
  107. package/bin/lean/surfaces.test.mjs +59 -0
  108. package/bin/lean/toolplace.mjs +28 -0
  109. package/bin/lean/toolplace.test.mjs +24 -0
  110. package/bin/lean/toolstats.mjs +3 -1
  111. package/bin/lean/toolstats.test.mjs +11 -0
  112. package/bin/lean/validatebest.mjs +28 -0
  113. package/bin/lean/validatebest.test.mjs +27 -0
  114. package/bin/pool/agent.mjs +9 -0
  115. package/bin/pool/docker.mjs +5 -0
  116. package/bin/pool/router.mjs +8 -4
  117. package/bin/prereqs.mjs +111 -0
  118. package/bin/replay-timelapse.mjs +149 -0
  119. package/bin/review-staging.mjs +100 -16
  120. package/bin/review-staging.test.mjs +18 -0
  121. package/bin/runner.mjs +49 -7
  122. package/bin/splash-install.mjs +157 -0
  123. package/bin/stats/aggregate.mjs +8 -1
  124. package/bin/stats/conformance-outcomes.mjs +100 -19
  125. package/bin/stats/conformance-outcomes.test.mjs +87 -1
  126. package/bin/stats/depth.mjs +88 -31
  127. package/bin/stats/depth.test.mjs +63 -38
  128. package/bin/stats/efficiency.mjs +26 -5
  129. package/bin/stats/efficiency.test.mjs +45 -1
  130. package/bin/stats/first-review.mjs +77 -0
  131. package/bin/stats/first-review.test.mjs +36 -0
  132. package/bin/stats/firstmerge.mjs +40 -0
  133. package/bin/stats/firstmerge.test.mjs +41 -0
  134. package/bin/stats/github-source.mjs +51 -13
  135. package/bin/stats/index.mjs +91 -15
  136. package/bin/stats/local-source.mjs +1 -0
  137. package/bin/stats/origin.mjs +80 -0
  138. package/bin/stats/origin.test.mjs +58 -0
  139. package/bin/stats/render.mjs +3 -1
  140. package/bin/stats/scoreboard.mjs +137 -0
  141. package/bin/stats/scoreboard.test.mjs +87 -0
  142. package/bin/stats/stats.test.mjs +80 -0
  143. package/bin/tui.mjs +3 -2
  144. package/commands/bootstrap.md +15 -14
  145. package/commands/deploy-pr.md +18 -3
  146. package/commands/forge-stats.md +1 -1
  147. package/commands/forgedock-ci-setup.md +28 -0
  148. package/commands/forgedock-init.md +4 -5
  149. package/commands/issue.md +2 -0
  150. package/commands/milestone.md +9 -1
  151. package/commands/replay.md +2 -0
  152. package/commands/review-pr-staging.md +4 -1
  153. package/commands/work-on/close.md +8 -0
  154. package/docs/CI.md +1 -1
  155. package/docs/CONFIG.md +105 -10
  156. package/docs/ISSUE-WATCH.md +23 -0
  157. package/docs/OUTCOME-CODES.md +1 -0
  158. package/docs/REPLAY.md +9 -0
  159. package/docs/SELFTEST.md +11 -0
  160. package/docs/STATS.md +19 -2
  161. package/docs/eval/README.md +6 -0
  162. package/docs/eval/adversarial-bench.md +68 -0
  163. package/docs/eval/corpus/adversarial-v1.json +285 -0
  164. package/docs/eval/feature-bench.md +42 -0
  165. package/docs/eval/feature-specs/crud-auth/journeys/notes-crud-isolated.mjs +21 -0
  166. package/docs/eval/feature-specs/crud-auth/journeys/register-login.mjs +12 -0
  167. package/docs/eval/feature-specs/crud-auth/spec.md +15 -0
  168. package/docs/site/start-a-new-project.md +2 -1
  169. package/package.json +5 -2
  170. package/plugins/forgedock-splash/.claude-plugin/plugin.json +10 -0
  171. package/plugins/forgedock-splash/README.md +27 -0
  172. package/plugins/forgedock-splash/hooks/hooks.json +1 -0
  173. package/plugins/forgedock-splash/hooks/register.tsx +74 -0
  174. package/plugins/forgedock-splash/hooks/scene.ts +222 -0
  175. package/plugins/forgedock-splash/types/index.d.ts +10 -0
  176. package/scripts/bench-adversarial.mjs +216 -0
  177. package/scripts/bench-feature.mjs +170 -0
  178. package/scripts/bench-lightlane.mjs +2 -2
  179. package/scripts/bootstrap-create.mjs +2 -2
  180. package/scripts/bootstrap-validate.mjs +35 -2
  181. package/scripts/check-spec-size.sh +4 -3
  182. package/scripts/check-spec-size.test.sh +3 -0
  183. package/scripts/plan-validate-live.mjs +40 -6
  184. package/scripts/review-pr-staging-scope.test.sh +1 -1
  185. package/scripts/review-staging-post.sh +23 -0
  186. package/scripts/review-staging-post.test.sh +8 -0
@@ -19,6 +19,9 @@
19
19
  * missing-section, missing-type-tag, missing-parent, missing-labels, unknown-label, code-depends-on-needs-human,
20
20
  * missing-design-spec (a `ui` issue lacks a design-spec item), hero-not-routed (a `hero` issue never names `/design`),
21
21
  * missing-needs-human-section (a needs-human issue lacks setup steps, env var names or secret handling) (#4176).
22
+ * Skeleton (#5337): the first milestone holds exactly one `"skeleton": true` issue (also the `skeleton` label) whose body names the
23
+ * #5336 journey; every other issue depends on it transitively (exempt: the spike, needs-human issues, the skeleton's own
24
+ * ancestors): missing-skeleton, multiple-skeletons, skeleton-misplaced, skeleton-no-journey, not-behind-skeleton.
22
25
  * Warns (never fails; exit stays 0): deploy-last (#4665: every milestone holding deploy workflows comes after the feature
23
26
  * milestones, so nothing can be previewed or deployed until they all ship).
24
27
  * `Depends on` lines are read with the engine's own parser (bin/engine/phases.mjs parseDependsOn) after placeholder
@@ -74,6 +77,10 @@ const NEEDS_HUMAN_PARTS = [
74
77
  const DEPLOY_RE = /\.github\/workflows\/[^\s`'")]*deploy|\bdeploy(?:ment)? workflow\b|\bstaging environment\b/i;
75
78
  const isDeployIssue = (it) => DEPLOY_RE.test(`${it?.title ?? ""}\n${it?.body ?? ""}`);
76
79
 
80
+ export const SKELETON_LABEL = "skeleton";
81
+ /** #5337: the plan's walking-skeleton issue flag (`skeleton: true` or the `skeleton` label). */
82
+ export const isSkeleton = (it) => it?.skeleton === true || (Array.isArray(it?.labels) && it.labels.includes(SKELETON_LABEL));
83
+
77
84
  const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
78
85
  const isNonEmptyString = (v) => typeof v === "string" && v.trim() !== "";
79
86
  const normHeading = (h) => h.replace(/\([^)]*\)\s*$/, "").trim().toLowerCase();
@@ -154,7 +161,7 @@ function checkStructure(plan) {
154
161
  at("`labels` must be an array of strings");
155
162
  }
156
163
  if (typeof it.body !== "string") at("needs a string `body`");
157
- for (const f of ["ui", "hero"]) if (it[f] !== undefined && typeof it[f] !== "boolean") at(`\`${f}\` must be a boolean`);
164
+ for (const f of ["ui", "hero", "skeleton"]) if (it[f] !== undefined && typeof it[f] !== "boolean") at(`\`${f}\` must be a boolean`);
158
165
  });
159
166
  return errors;
160
167
  }
@@ -232,7 +239,7 @@ export function validatePlan(plan) {
232
239
  if (labels.filter(isNonEmptyString).length === 0) err(it.key, "missing-labels", "issue has no labels");
233
240
  if (declaredLabels) {
234
241
  for (const l of labels) {
235
- if (isNonEmptyString(l) && !declaredLabels.has(l)) err(it.key, "unknown-label", `label ${l} is not in the plan's labels`);
242
+ if (isNonEmptyString(l) && l !== SKELETON_LABEL && !declaredLabels.has(l)) err(it.key, "unknown-label", `label ${l} is not in the plan's labels`);
236
243
  }
237
244
  }
238
245
 
@@ -288,9 +295,35 @@ export function validatePlan(plan) {
288
295
  }
289
296
  }
290
297
  }
298
+ for (const e of skeletonErrors(plan, byKey)) err(e.issue, e.code, e.message);
291
299
  return { ok: errors.length === 0, errors, warnings: deployWarnings(issues, milestones) };
292
300
  }
293
301
 
302
+ /** #5337: walking-skeleton rules (see the header). Needs a valid structure; cycles are reported separately and tolerated here. */
303
+ function skeletonErrors(plan, byKey) {
304
+ const out = [];
305
+ const add = (issue, code, message) => out.push({ issue, code, message });
306
+ const { issues, milestones } = plan;
307
+ const first = milestones[0].key;
308
+ const marked = issues.filter(isSkeleton);
309
+ const inFirst = marked.filter((it) => it.milestone === first);
310
+ for (const it of marked.filter((x) => x.milestone !== first)) add(it.key, "skeleton-misplaced", `skeleton issue is in milestone ${it.milestone}; it belongs in the first milestone ${first}`);
311
+ if (!inFirst.length) { add(issues.find((x) => x.milestone === first)?.key ?? null, "missing-skeleton", `first milestone ${first} has no skeleton issue (\`"skeleton": true\`): the thinnest real path that builds, boots and passes one journey`); return out; }
312
+ if (inFirst.length > 1) add(inFirst[1].key, "multiple-skeletons", `first milestone ${first} has ${inFirst.length} skeleton issues (${inFirst.map((x) => x.key).join(", ")}); exactly one is allowed`);
313
+ const sk = inFirst[0];
314
+ if (!/\bjourney\b/i.test(sk.body)) add(sk.key, "skeleton-no-journey", "skeleton issue acceptance names no journey (one #5336 journey must pass on the thinnest real path)");
315
+ const closure = (start, next) => { const seen = new Set(); const todo = [start]; while (todo.length) { for (const n of next(todo.pop())) if (!seen.has(n)) { seen.add(n); todo.push(n); } } return seen; };
316
+ const ancestors = closure(sk.key, (k) => (byKey.get(k)?.deps ?? []).filter((d) => byKey.has(d)));
317
+ const spike = plan.spike ?? "SPIKE";
318
+ for (const it of issues) {
319
+ if (it.key === sk.key || it.key === spike || isNeedsHuman(it) || ancestors.has(it.key) || isSkeleton(it)) continue;
320
+ if (!closure(it.key, (k) => (byKey.get(k)?.deps ?? []).filter((d) => byKey.has(d))).has(sk.key)) {
321
+ add(it.key, "not-behind-skeleton", `does not depend on skeleton issue ${sk.key}, directly or transitively`);
322
+ }
323
+ }
324
+ return out;
325
+ }
326
+
294
327
  /** #4665: `deploy-last` when deploy work exists but none of it sits in milestones 1-2 (needs >= 3 milestones). */
295
328
  function deployWarnings(issues, milestones) {
296
329
  const index = new Map(milestones.map((m, i) => [m.key, i]));
@@ -5,7 +5,7 @@
5
5
  #
6
6
  # Usage: check-spec-size.sh [base_ref] (default: $BASE_REF, else origin/staging)
7
7
  # Env: PR_LABELS comma-separated PR label names (untrusted; grep-matched only)
8
- # PR_HEAD_REF / PR_BASE_REF PR head and base branch names; staging -> main
8
+ # PR_HEAD_REF / PR_BASE_REF PR head and base branch names; staging|release/* -> main
9
9
  # (a release PR) is skipped: cumulative growth is not judged here
10
10
  # PR_SAME_REPO must be "true" for the release skip (a fork branch named
11
11
  # staging must not bypass the budget)
@@ -40,10 +40,11 @@ if ! git rev-parse --verify -q "$BASE^{commit}" >/dev/null; then
40
40
  fi
41
41
 
42
42
  # --- release PR skip (staging -> main) ---------------------------------------
43
- if [ "${PR_HEAD_REF:-}" = "staging" ] && [ "${PR_BASE_REF:-}" = "main" ] && [ "${PR_SAME_REPO:-}" = "true" ]; then
43
+ case "${PR_HEAD_REF:-}" in staging|release/*) _REL_HEAD=1 ;; *) _REL_HEAD=0 ;; esac
44
+ if [ "$_REL_HEAD" = "1" ] && [ "${PR_BASE_REF:-}" = "main" ] && [ "${PR_SAME_REPO:-}" = "true" ]; then
44
45
  out "## Spec-size budget"
45
46
  out ""
46
- out "Result: SKIPPED (release PR staging -> main; growth was checked per PR)"
47
+ out "Result: SKIPPED (release PR staging|release/* -> main; growth was checked per PR)"
47
48
  echo "spec-size: skipped for release PR staging -> main"
48
49
  exit 0
49
50
  fi
@@ -122,6 +122,9 @@ run "stub plus a re-pasted resolver block fails" 1
122
122
  # Release PR skip (staging -> main only)
123
123
  reset; gen 100 >> commands/review-pr.md
124
124
  run "release PR skipped" 0 PR_HEAD_REF=staging PR_BASE_REF=main PR_SAME_REPO=true; has "skip reported" "SKIPPED"
125
+ run "release/* branch to main skipped" 0 PR_HEAD_REF=release/20261110-2 PR_BASE_REF=main PR_SAME_REPO=true; has "skip reported" "SKIPPED"
126
+ run "release/* fork branch still checked" 1 PR_HEAD_REF=release/20261110-2 PR_BASE_REF=main PR_SAME_REPO=false
127
+ run "release/* to other base still checked" 1 PR_HEAD_REF=release/20261110-2 PR_BASE_REF=dev PR_SAME_REPO=true
125
128
  run "fork branch named staging still checked" 1 PR_HEAD_REF=staging PR_BASE_REF=main PR_SAME_REPO=false
126
129
  run "release PR without same-repo flag still checked" 1 PR_HEAD_REF=staging PR_BASE_REF=main
127
130
  run "hotfix to main still checked" 1 PR_HEAD_REF=hotfix PR_BASE_REF=main
@@ -39,6 +39,35 @@ export function classifyEdges({ order, issues }) {
39
39
  return { ok: !edges.some((e) => e.state === "invalid"), edges };
40
40
  }
41
41
 
42
+ /**
43
+ * #5337: walking-skeleton rule on live milestones. Every open milestone with issues needs exactly one `skeleton`-labelled
44
+ * issue, and every other issue (not an epic or needs-human, nor one the skeleton itself depends on) reaches it through `Depends on`.
45
+ * @param {{ open?: string[], issues: Array<{ number: number, milestone: string|null, body?: string, labels?: Array<string|{name: string}> }> }} live
46
+ * @returns {Array<{ milestone: string, issue: number|null, code: string, message: string }>}
47
+ */
48
+ export function skeletonProblems({ open = [], issues }) {
49
+ const names = (it) => (Array.isArray(it.labels) ? it.labels : []).map((l) => (typeof l === "string" ? l : l?.name));
50
+ const has = (it, re) => names(it).some((n) => re.test(String(n)));
51
+ const byNumber = new Map(issues.map((it) => [it.number, it]));
52
+ const reach = (n) => { const seen = new Set(); const todo = [n]; while (todo.length) for (const d of parseDependsOn(byNumber.get(todo.pop())?.body, n)) if (byNumber.has(d) && !seen.has(d)) { seen.add(d); todo.push(d); } return seen; };
53
+ const out = [];
54
+ for (const title of open) {
55
+ const mine = issues.filter((it) => it.milestone === title);
56
+ if (!mine.length) continue;
57
+ const sk = mine.filter((it) => has(it, /^skeleton$/));
58
+ if (sk.length !== 1) {
59
+ out.push({ milestone: title, issue: sk[1]?.number ?? null, code: sk.length ? "multiple-skeletons" : "missing-skeleton", message: `${sk.length} skeleton issues; exactly one \`skeleton\` issue is required` });
60
+ continue;
61
+ }
62
+ const ancestors = reach(sk[0].number);
63
+ for (const it of mine) {
64
+ if (it === sk[0] || ancestors.has(it.number) || has(it, /^(epic|needs-human(:.*)?)$/)) continue;
65
+ if (!reach(it.number).has(sk[0].number)) out.push({ milestone: title, issue: it.number, code: "not-behind-skeleton", message: `#${it.number} does not depend on skeleton issue #${sk[0].number}, directly or transitively` });
66
+ }
67
+ }
68
+ return out;
69
+ }
70
+
42
71
  export function formatLiveReport({ edges }) {
43
72
  if (!edges.length) return "plan validate --live: no cross-milestone edges";
44
73
  const lines = edges.map((e) => `${e.state}: #${e.from} (${e.fromMilestone}) depends on #${e.to} (${e.toMilestone})`);
@@ -52,9 +81,10 @@ const parse = (s) => { try { return JSON.parse(String(s)); } catch { return null
52
81
  export async function readLive({ gh, repo }) {
53
82
  const r = repo ? ["-R", repo] : [];
54
83
  const ms = parse(await gh(["api", `repos/${repo || "{owner}/{repo}"}/milestones?state=all&per_page=100`, "--paginate", "--slurp"]));
55
- const issues = parse(await gh(["issue", "list", ...r, "--state", "all", "--limit", "1000", "--json", "number,body,state,milestone"]));
84
+ const issues = parse(await gh(["issue", "list", ...r, "--state", "all", "--limit", "1000", "--json", "number,body,state,milestone,labels"]));
56
85
  if (!Array.isArray(ms) || !Array.isArray(issues)) throw new Error("could not read milestones/issues from GitHub");
57
- return { order: orderMilestones(ms.flat()), issues: issues.map((i) => ({ ...i, milestone: i.milestone?.title ?? null })) };
86
+ return { order: orderMilestones(ms.flat()), open: ms.flat().filter((m) => String(m.state).toLowerCase() === "open").map((m) => m.title),
87
+ issues: issues.map((i) => ({ ...i, milestone: i.milestone?.title ?? null })) };
58
88
  }
59
89
 
60
90
  /**
@@ -136,10 +166,14 @@ export async function runLive(argv, { gh = ghExec, out = (t) => process.stdout.w
136
166
  if (argv[0] !== "validate" || !argv.includes("--live")) { err("usage: forgedock plan validate --live [--repo owner/repo] [--json]"); return 2; }
137
167
  const i = argv.indexOf("--repo");
138
168
  const repo = i >= 0 ? argv[i + 1] : "";
139
- let report;
140
- try { report = classifyEdges(await readLive({ gh, repo })); } catch (e) { err(`plan validate --live: ${e.message}`); return 2; }
141
- out(argv.includes("--json") ? JSON.stringify(report) : formatLiveReport(report));
142
- return report.ok ? 0 : 1;
169
+ let report, skeleton;
170
+ try { const live = await readLive({ gh, repo }); report = classifyEdges(live); skeleton = skeletonProblems(live); } catch (e) { err(`plan validate --live: ${e.message}`); return 2; }
171
+ if (argv.includes("--json")) out(JSON.stringify({ ...report, skeleton }));
172
+ else {
173
+ out(formatLiveReport(report));
174
+ for (const p of skeleton) out(`invalid: [${p.code}] ${p.milestone}: ${p.message}`);
175
+ }
176
+ return report.ok && !skeleton.length ? 0 : 1;
143
177
  }
144
178
 
145
179
  if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
@@ -90,7 +90,7 @@ UNCOVERED=$(awk '
90
90
  grep -q 'test_gate_verdict' "$POST" && grep -q 'launched_review_agents' "$POST" && ok || bad "TEST_GATE_VERDICT and LAUNCHED_REVIEW_AGENTS must be persisted to the scratchpad"
91
91
  # PR-keyed (concurrent runs in one cwd must not share state) and reset by an executable command, not prose
92
92
  if grep -qE '\$_SD/(test_gate_verdict|test_gate_reason|launched_review_agents)|\.forge-scratch\}/launched_review_agents' "$SPEC" "$POST"; then bad "gate/launched-agent scratch files must be keyed by \${PR_NUMBER}_"; else ok; fi
93
- grep -qF 'io.writeFile(launchedFile, "")' "$CLI" && grep -qF 'rm -f "${_SD:?}/${PR_NUMBER:?}_test_gate_verdict" "${_SD:?}/${PR_NUMBER:?}_test_gate_reason"' "$POST" && ok || bad "the pre-dispatch must truncate the launched-agent file and the test gate must rm -f the PR-keyed verdict files"
93
+ grep -qF 'io.writeFile(launchedFile, briefs.map((b) => `${b.domain}\n`).join(""))' "$CLI" && grep -qF 'rm -f "${_SD:?}/${PR_NUMBER:?}_test_gate_verdict" "${_SD:?}/${PR_NUMBER:?}_test_gate_reason"' "$POST" && ok || bad "the pre-dispatch must reset the launched-agent file from the manifest and the test gate must rm -f the PR-keyed verdict files"
94
94
  if awk '/^### 7E:/,/^### 7F:/' "$SPEC" | grep -qF '{GH_REPO}'; then bad "7E must not use the {GH_REPO} template token"; else ok; fi
95
95
  # (8b) forge#3733: Phase 6.75 fails closed on an empty/absent launched-agent list or empty PR_NUMBER; Phase 6 fails closed on a bad SELECTED_AGENT_COUNT
96
96
  F675=$(blk "$POST" delivery-check)
@@ -84,6 +84,23 @@ delivery_count() {
84
84
  case "$n" in ''|*[!0-9]*) n=0 ;; esac # fail closed: counts as missing
85
85
  printf '%s\n' "$n"
86
86
  }
87
+ # Why each given domain has no usable current-head comment, one REDISPATCH line per domain (only that reviewer is re-run, at head ${REVIEW_SHA_FULL}).
88
+ delivery_report() {
89
+ local d b shas last brief
90
+ [ -s "$DELIVERY_CACHE" ] || return 0
91
+ for d in "$@"; do
92
+ b=$(bash "$TRUSTED_SCRIPT" bodies "^<!-- FORGE:REVIEW-AGENT:${d} -->" < "$DELIVERY_CACHE" 2>/dev/null)
93
+ shas=$(printf '%s\n' "$b" | jq -r 'capture("(^|\\n)Reviewed-SHA:[ ]*(?<s>[^\\s]*)") | .s' 2>/dev/null | grep . | tr '\n' ' ')
94
+ if [ -z "$b" ]; then echo "DELIVERY: ${d}: no trusted comment with marker FORGE:REVIEW-AGENT:${d} (not posted, or posted under another name)"
95
+ elif [ -z "$shas" ]; then echo "DELIVERY: ${d}: comment has no Reviewed-SHA line; expected ${REVIEW_SHA_FULL}"
96
+ else
97
+ last=${shas%% }; last=${last##* }
98
+ case "$shas" in *"${REVIEW_SHA_FULL} "*) echo "DELIVERY: ${d}: posted at the right SHA but without a REVIEW-FINDINGS-START/END block" ;; *) echo "DELIVERY: ${d}: stale or wrong Reviewed-SHA ${last} (expected ${REVIEW_SHA_FULL})" ;; esac
99
+ fi
100
+ brief="$_SD/review-staging-${PR_NUMBER}/brief-${d}.md"
101
+ if [ -r "$brief" ]; then echo "REDISPATCH ${d} ${brief}"; else echo "REDISPATCH ${d}"; fi
102
+ done
103
+ }
87
104
  # END delivery-fetch
88
105
  # BEGIN panel-guard
89
106
  # Each Bash call is a fresh shell: re-resolve the full head SHA if it is not set, and refuse when it is not a commit id
@@ -134,6 +151,10 @@ if [ "${DISPATCH_FAILED:-}" != "true" ] && [ "$SELECTED_COUNT_INVALID" != "true"
134
151
  exit 2
135
152
  fi
136
153
  if [ "${DISPATCH_FAILED:-}" = "true" ] || [ "$SELECTED_COUNT_INVALID" = "true" ] || [ "$ACTUAL_AGENT_COUNT" -lt "$SELECTED_AGENT_COUNT" ]; then
154
+ _SHORT=""
155
+ for _D in ${LAUNCHED_REVIEW_AGENTS:-}; do case "$DELIVERY_FOUND" in *" $_D "*) ;; *) _SHORT="${_SHORT} ${_D}" ;; esac; done
156
+ # shellcheck disable=SC2086 # word-split on purpose: one domain per argument
157
+ [ -n "$_SHORT" ] && [ -n "$REVIEW_SHA_FULL" ] && [ "$DELIVERY_LAST" = ok ] && delivery_report $_SHORT
137
158
  gh label create "review-degraded" --color "E4E669" --description "PR review panel was incomplete; re-review required before deployment. Managed by ForgeDock." --force -R "$GH_REPO" 2>/dev/null || true
138
159
  gh pr edit "$PR_NUMBER" -R "$GH_REPO" --add-label "review-degraded" --add-label "needs-human" 2>/dev/null || true # allowlist:check-command-side-effects
139
160
  gh pr comment "$PR_NUMBER" -R "$GH_REPO" --body "<!-- FORGE:GATE_FAILURE:TYPE=review-panel-integrity -->
@@ -163,6 +184,8 @@ done
163
184
 
164
185
  if [ -n "$MISSING_AGENT_COMMENTS" ]; then
165
186
  echo "REVIEW DELIVERY FAILURE: missing findings comment(s) for:${MISSING_AGENT_COMMENTS}"
187
+ # shellcheck disable=SC2086 # word-split on purpose: one domain per argument
188
+ delivery_report $MISSING_AGENT_COMMENTS
166
189
  echo "A comment without a REVIEW-FINDINGS-START block counts as missing. Re-dispatch the missing agent once with the note: structured findings block required. A second miss is a degraded panel. Recover each agent's returned verdict, findings, and durable body path before rerunning review."
167
190
  exit 1
168
191
  fi
@@ -95,6 +95,14 @@ for c in missing noblock untrusted otherhead; do
95
95
  grep -qF 'review-degraded' "$FIX/edits" 2>/dev/null && ok || bad "$c: shortfall must label the PR review-degraded"
96
96
  fi
97
97
  done
98
+ # (4b) stale SHA: the reviewer is named with its found SHA and is the only REDISPATCH line; a block-less one is named too
99
+ newfix stale; printf 'security\nmaterial-change\n' > "$FIX/sd/42_launched_review_agents"; mkdir -p "$FIX/sd/review-staging-42"; : > "$FIX/sd/review-staging-42/brief-security.md"
100
+ { cm "$(agent security "${HEAD:0:7}")"; cm "$(agent material-change)"; } | comments
101
+ OUT=$(deliver)
102
+ case "$OUT" in *"security: stale or wrong Reviewed-SHA ${HEAD:0:7} (expected $HEAD)"*) ok ;; *) bad "stale: reviewer and SHA must be named (got: $OUT)" ;; esac
103
+ [ "$(printf '%s\n' "$OUT" | grep -c '^REDISPATCH ')" = 1 ] && printf '%s\n' "$OUT" | grep -q "^REDISPATCH security $FIX/sd/review-staging-42/brief-security.md$" && ok || bad "stale: only security may be re-dispatched (got: $OUT)"
104
+ newfix noblock2; printf 'security\n' > "$FIX/sd/42_launched_review_agents"; cm "$(agent security "$HEAD" 'no block')" | comments
105
+ OUT=$(deliver); case "$OUT" in *"security: posted at the right SHA but without"*"REDISPATCH security"*) ok ;; *) bad "noblock: reason must be given (got: $OUT)" ;; esac
98
106
  # empty / absent launched list fails closed
99
107
  newfix empty; : > "$FIX/sd/42_launched_review_agents"; cm "$(agent security)" | comments
100
108
  OUT=$(deliver); case "$OUT" in *"rc=1") ok ;; *) bad "empty launched list must fail (got: $OUT)" ;; esac