forgedock 1.63.0 → 1.64.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 (84) hide show
  1. package/bin/config-schema.mjs +3 -0
  2. package/bin/engine/outcome-codes.mjs +5 -0
  3. package/bin/engine-cli.mjs +88 -12
  4. package/bin/env/cli.mjs +18 -1
  5. package/bin/lean/basered.mjs +56 -11
  6. package/bin/lean/basered.test.mjs +58 -5
  7. package/bin/lean/batch-health.mjs +46 -4
  8. package/bin/lean/batch-health.test.mjs +55 -1
  9. package/bin/lean/batch.mjs +6 -1
  10. package/bin/lean/batch.test.mjs +71 -6
  11. package/bin/lean/ceiling.mjs +47 -3
  12. package/bin/lean/ceiling.test.mjs +32 -1
  13. package/bin/lean/conformance.e2e.test.mjs +32 -6
  14. package/bin/lean/conformance.mjs +57 -13
  15. package/bin/lean/conformance.test.mjs +93 -1
  16. package/bin/lean/execution.mjs +15 -6
  17. package/bin/lean/execution.test.mjs +44 -3
  18. package/bin/lean/issuewatch-reconcile.mjs +2 -0
  19. package/bin/lean/issuewatch-reconcile.test.mjs +25 -0
  20. package/bin/lean/issuewatch.mjs +3 -0
  21. package/bin/lean/lanecheck.test.mjs +13 -1
  22. package/bin/lean/lean.mjs +157 -28
  23. package/bin/lean/lean.test.mjs +289 -21
  24. package/bin/lean/live-execution.mjs +25 -0
  25. package/bin/lean/live-execution.test.mjs +35 -1
  26. package/bin/lean/merged-park.mjs +76 -0
  27. package/bin/lean/merged-park.test.mjs +64 -0
  28. package/bin/lean/mergetrain.mjs +357 -0
  29. package/bin/lean/mergetrain.test.mjs +348 -0
  30. package/bin/lean/orchestrate-envhold.test.mjs +62 -0
  31. package/bin/lean/orchestrate-stacking.test.mjs +23 -1
  32. package/bin/lean/orchestrate-train.test.mjs +130 -0
  33. package/bin/lean/orchestrate-transient-git.test.mjs +53 -0
  34. package/bin/lean/orchestrate.mjs +159 -13
  35. package/bin/lean/prompts.mjs +4 -3
  36. package/bin/lean/release-review.mjs +8 -1
  37. package/bin/lean/release-review.test.mjs +42 -2
  38. package/bin/lean/release-status.test.mjs +53 -1
  39. package/bin/lean/release.mjs +6 -3
  40. package/bin/lean/render.mjs +6 -1
  41. package/bin/lean/sandbox-provider.contract.test.mjs +6 -0
  42. package/bin/lean/sandbox-remote.mjs +12 -2
  43. package/bin/lean/sched.mjs +19 -2
  44. package/bin/lean/sched.test.mjs +33 -1
  45. package/bin/lean/schedd-health.mjs +2 -1
  46. package/bin/lean/schedd-health.test.mjs +7 -0
  47. package/bin/lean/schedd.mjs +55 -7
  48. package/bin/lean/schedd.test.mjs +42 -1
  49. package/bin/lean/stacking.mjs +45 -0
  50. package/bin/lean/stacking.test.mjs +25 -1
  51. package/bin/lean/statuscomment.mjs +14 -8
  52. package/bin/lean/statuscomment.test.mjs +18 -1
  53. package/bin/lean/validate-catalog.mjs +1 -1
  54. package/bin/lean/validate-catalog.test.mjs +3 -0
  55. package/bin/lean/worktree.mjs +8 -3
  56. package/bin/lean/worktree.test.mjs +18 -0
  57. package/bin/pool/agent.mjs +296 -31
  58. package/bin/pool/cli.mjs +120 -6
  59. package/bin/pool/disk.mjs +43 -0
  60. package/bin/pool/docker.mjs +10 -0
  61. package/bin/pool/health.mjs +95 -0
  62. package/bin/pool/router.mjs +274 -27
  63. package/bin/runner.mjs +3 -1
  64. package/bin/stats/chains.mjs +101 -0
  65. package/bin/stats/chains.test.mjs +53 -0
  66. package/bin/stats/efficiency.mjs +7 -6
  67. package/bin/stats/efficiency.test.mjs +48 -7
  68. package/bin/stats/index.mjs +11 -3
  69. package/bin/stats/stats.test.mjs +9 -0
  70. package/docs/CONFIG.md +8 -1
  71. package/docs/OUTCOME-CODES.md +4 -0
  72. package/package.json +1 -1
  73. package/pool/README.md +10 -0
  74. package/pool/image/Dockerfile +2 -1
  75. package/pool/image/entrypoint.sh +6 -6
  76. package/pool/image/mirror.sh +71 -0
  77. package/pool/install/install-agent-linux.sh +57 -5
  78. package/pool/install/install-agent-macos.sh +148 -0
  79. package/pool/install/install-agent.ps1 +11 -0
  80. package/pool/install/install-agent.sh +59 -7
  81. package/pool/install/uninstall-agent-linux.sh +75 -0
  82. package/pool/install/uninstall-agent-macos.sh +60 -0
  83. package/pool/install/uninstall-agent.ps1 +1 -0
  84. package/scripts/transition-label.sh +11 -0
@@ -124,10 +124,27 @@ describe("#5592 gh helpers", () => {
124
124
  assert.deepEqual(pipelineLabels([{ name: "bug" }, "needs-human", { name: "parked:x" }]), ["needs-human", "parked:x"]);
125
125
  const log = [];
126
126
  assert.deepEqual(await clearPipelineLabels({ gh: ghWith([], log), repo: "o/r", issue: 7 }), ["parked:ci.red", "needs-human"]);
127
- assert.deepEqual(log.at(-1), ["issue", "edit", "7", "-R", "o/r", "--remove-label", "parked:ci.red,needs-human"]);
127
+ assert.deepEqual(log.slice(-2), [["issue", "edit", "7", "-R", "o/r", "--remove-label", "parked:ci.red"], ["issue", "edit", "7", "-R", "o/r", "--remove-label", "needs-human"]]);
128
128
  const log2 = [];
129
129
  assert.deepEqual(await clearPipelineLabels({ gh: ghWith([], log2), repo: "o/r", issue: 7, labels: [{ name: "bug" }] }), []);
130
130
  assert.equal(log2.length, 0, "nothing to remove: no gh call");
131
131
  assert.deepEqual(await clearPipelineLabels({ gh: async () => { throw new Error("boom"); }, repo: "o/r", issue: 7, labels: ["needs-human"] }), [], "best effort");
132
132
  });
133
+ it("clearPipelineLabels removes the rest when one removal fails and reports it", async () => {
134
+ const edits = [];
135
+ const gh = async (a) => { if (a[1] === "edit") { if (a.at(-1) === "remediation-queue") throw new Error("not found"); edits.push(a.at(-1)); } return ""; };
136
+ const reported = [];
137
+ const out = await clearPipelineLabels({ gh, repo: "o/r", issue: 7, labels: ["needs-human:external", "remediation-queue", "parked:x"], onFail: (n) => reported.push(...n) });
138
+ assert.deepEqual(out, ["needs-human:external", "parked:x"]);
139
+ assert.deepEqual(edits, ["needs-human:external", "parked:x"]);
140
+ assert.deepEqual(reported, ["remediation-queue"]);
141
+ });
142
+ it("clearPipelineLabels reports failed removals to the reporter", async () => {
143
+ const seen = [];
144
+ await clearPipelineLabels({ gh: async () => { throw new Error("boom"); }, repo: "o/r", issue: 7, labels: ["needs-human"], onFail: (n, e) => seen.push([n, e.message]) });
145
+ assert.deepEqual(seen, [[["needs-human"], "boom"]]);
146
+ const read = [];
147
+ await clearPipelineLabels({ gh: async () => { throw new Error("read"); }, repo: "o/r", issue: 7, onFail: (n) => read.push(n) });
148
+ assert.deepEqual(read, [[]]);
149
+ });
133
150
  });
@@ -91,7 +91,7 @@ export function equivalentRuns(frozen, sub) {
91
91
  return a.size > 0 && a.size === b.size && [...a].every(([id, ok]) => ok && b.get(id) === true);
92
92
  }
93
93
 
94
- const DRIFT_RE = /(?:generated|artifact|snapshot)s?\b[^\n]*\b(?:out of date|out-of-date|stale|differ|drift|not up to date)|\b(?:out of date|stale)\b[^\n]*\b(?:generated|regenerate)|run [`'"]?[^\n]*\bgenerate[\w:-]*[`'"]? to (?:update|regenerate)/i;
94
+ const DRIFT_RE = /(?:generated|artifact|snapshot)s?\b[^\n]*\b(?:out of date|out-of-date|stale|differ|drift|not up to date)|\b(?:out of date|stale)\b[^\n]*\b(?:generated|regenerate)|run [`'"]?[^\n]*\bgenerate[\w:-]*[`'"]? to (?:update|regenerate)|\bmissing or out[ -]of[ -]date\b|\brun [`'"]?[^\n)]*--(?:render|write|update)\b/i; // #5730: "missing or out of date (run --render-agent-md)"
95
95
  /** True when a validate failure's output reads as a stale generated artifact (a regenerate case), not a failing test. */
96
96
  export const isDriftFailure = (output) => DRIFT_RE.test(String(output ?? ""));
97
97
 
@@ -38,6 +38,9 @@ describe("#5653 validate catalogue", () => {
38
38
  it("classifies a stale generated artifact, not a test failure", () => {
39
39
  assert.equal(isDriftFailure("error: generated tools file is out of date"), true);
40
40
  assert.equal(isDriftFailure("AssertionError: 1 != 2"), false);
41
+ // 5730: the AlterLab #40841 line
42
+ assert.equal(isDriftFailure("listings/official/maps/agent.md: missing or out of date (run --render-agent-md --render-page)"), true);
43
+ assert.equal(isDriftFailure("AssertionError: expected 3, got 4"), false);
41
44
  });
42
45
  });
43
46
 
@@ -39,6 +39,11 @@ export function sparsePatterns(excludes) {
39
39
  return ["/*", ...excludes.map((p) => `!/${esc(p)}`)];
40
40
  }
41
41
 
42
+ /** forge#5890: a git spawn failure (missing cwd/binary, no exit status), as opposed to a git exit failure. */
43
+ export const isSpawnError = (e) => (e?.code === "ENOENT" || e?.code === "EACCES") && String(e?.syscall ?? "").startsWith("spawn") && typeof e?.status !== "number";
44
+ /** forge#5890: tag a spawn error with the typed deferral (sandbox.repo_missing, requeued); returns the same error. */
45
+ export const repoMissing = (e) => Object.assign(e, { deferCode: "sandbox.repo_missing", deferDetail: `lane repo directory is missing or git cannot run there (${e.code} ${e.syscall}); the lane is requeued`, retryInSeconds: 120 });
46
+
42
47
  /**
43
48
  * Add a lane worktree, sparse when the plan is non-empty. `git(args, {cwd})` is the injected io.git; `write(path, text)`
44
49
  * writes the pattern file (argv-safe for any number of patterns). `addArgs` is the plain `["worktree","add",...]` argv.
@@ -47,13 +52,13 @@ export function sparsePatterns(excludes) {
47
52
  export async function addLaneWorktree(git, write, { cwd, wt, addArgs, ref, maxBlobBytes = DEFAULT_SPARSE_MAX_KB * 1024 }) {
48
53
  let plan = { excludes: [], bytes: 0 };
49
54
  if (maxBlobBytes > 0 && typeof write === "function") {
50
- try { plan = sparsePlan(await git(["ls-tree", "-r", "-l", "-z", ref], { cwd }), { maxBlobBytes }); } catch { /* no plan: full checkout */ }
55
+ try { plan = sparsePlan(await git(["ls-tree", "-r", "-l", "-z", ref], { cwd }), { maxBlobBytes }); } catch (e) { if (isSpawnError(e)) throw repoMissing(e); /* no plan: full checkout */ }
51
56
  }
52
57
  if (!plan.excludes.length) {
53
- await git(addArgs, { cwd });
58
+ try { await git(addArgs, { cwd }); } catch (e) { throw isSpawnError(e) ? repoMissing(e) : e; }
54
59
  return { sparse: false, excluded: 0, bytes: 0 };
55
60
  }
56
- await git([...addArgs.slice(0, 2), "--no-checkout", ...addArgs.slice(2)], { cwd });
61
+ try { await git([...addArgs.slice(0, 2), "--no-checkout", ...addArgs.slice(2)], { cwd }); } catch (e) { throw isSpawnError(e) ? repoMissing(e) : e; }
57
62
  const g = (a) => git(a, { cwd: wt });
58
63
  try {
59
64
  await g(["sparse-checkout", "set", "--no-cone", "/*"]);
@@ -149,4 +149,22 @@ describe("sparse pattern file path on Windows (#5825)", () => {
149
149
  assert.equal(r.sparse, true);
150
150
  assert.deepEqual(wrote, ["C:/r/.git/worktrees/lean-5/info/sparse-checkout"]);
151
151
  });
152
+
153
+ // forge#5890
154
+ it("5890: a spawn ENOENT on ls-tree raises the typed sandbox.repo_missing error and never reaches worktree add", async () => {
155
+ const calls = [];
156
+ const fake = async (a) => { calls.push(a[0]); throw Object.assign(new Error("spawn git ENOENT"), { code: "ENOENT", syscall: "spawn git" }); };
157
+ await assert.rejects(addLaneWorktree(fake, async () => {}, { cwd: "/gone", wt: "/gone/wt", addArgs: ["worktree", "add", "/gone/wt", "main"], ref: "main" }),
158
+ (e) => e.deferCode === "sandbox.repo_missing" && e.retryInSeconds === 120 && !!e.deferDetail);
159
+ assert.deepEqual(calls, ["ls-tree"]);
160
+ });
161
+ it("5890: a non-spawn ls-tree failure still falls back to a full checkout; a spawn error from worktree add is typed", async () => {
162
+ const calls = [];
163
+ const fake = async (a) => { calls.push(a[0]); if (a[0] === "ls-tree") throw Object.assign(new Error("fatal"), { status: 128 }); return ""; };
164
+ const r = await addLaneWorktree(fake, async () => {}, { cwd: "/r", wt: "/r/wt", addArgs: ["worktree", "add", "/r/wt", "main"], ref: "main" });
165
+ assert.equal(r.sparse, false);
166
+ assert.deepEqual(calls, ["ls-tree", "worktree"]);
167
+ const bad = async () => { throw Object.assign(new Error("spawn git EACCES"), { code: "EACCES", syscall: "spawn git" }); };
168
+ await assert.rejects(addLaneWorktree(bad, null, { cwd: "/r", wt: "/r/wt", addArgs: ["worktree", "add", "/r/wt", "main"], ref: "main" }), (e) => e.deferCode === "sandbox.repo_missing");
169
+ });
152
170
  });