forgedock 1.61.1 → 1.62.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 (134) hide show
  1. package/bin/config-schema.mjs +10 -1
  2. package/bin/engine/outcome-codes.mjs +4 -0
  3. package/bin/engine-cli.mjs +160 -18
  4. package/bin/env/env.mjs +6 -4
  5. package/bin/forge-home-check.mjs +91 -0
  6. package/bin/forgedock.mjs +50 -7
  7. package/bin/gc.mjs +2 -0
  8. package/bin/hooks/pre-tool-use.mjs +4 -0
  9. package/bin/journey.mjs +55 -5
  10. package/bin/lean/admission.mjs +16 -5
  11. package/bin/lean/batch-health.mjs +55 -16
  12. package/bin/lean/batch-health.test.mjs +67 -1
  13. package/bin/lean/batch.mjs +8 -0
  14. package/bin/lean/batch.test.mjs +5 -0
  15. package/bin/lean/ceiling.mjs +20 -0
  16. package/bin/lean/ceiling.test.mjs +33 -2
  17. package/bin/lean/ci-gate.mjs +240 -0
  18. package/bin/lean/ci-gate.test.mjs +227 -0
  19. package/bin/lean/ci-precheck.mjs +178 -0
  20. package/bin/lean/ci-precheck.test.mjs +149 -0
  21. package/bin/lean/conformance.mjs +118 -20
  22. package/bin/lean/conformance.test.mjs +193 -3
  23. package/bin/lean/context.test.mjs +7 -6
  24. package/bin/lean/dag.mjs +128 -0
  25. package/bin/lean/dag.test.mjs +131 -0
  26. package/bin/lean/decisions.mjs +5 -4
  27. package/bin/lean/decisions.test.mjs +11 -0
  28. package/bin/lean/delguard.mjs +84 -0
  29. package/bin/lean/delguard.test.mjs +104 -0
  30. package/bin/lean/depcache.mjs +125 -17
  31. package/bin/lean/depcache.test.mjs +111 -0
  32. package/bin/lean/design-gate.mjs +5 -5
  33. package/bin/lean/design-gate.test.mjs +14 -0
  34. package/bin/lean/effects.mjs +81 -7
  35. package/bin/lean/execution.mjs +81 -15
  36. package/bin/lean/execution.test.mjs +156 -3
  37. package/bin/lean/forgedock-lane-workflow.test.mjs +35 -0
  38. package/bin/lean/guardgate.mjs +30 -7
  39. package/bin/lean/guardgate.test.mjs +44 -1
  40. package/bin/lean/guards.test.mjs +1 -1
  41. package/bin/lean/heavy.test.mjs +87 -0
  42. package/bin/lean/hotarea.mjs +73 -0
  43. package/bin/lean/hotarea.test.mjs +73 -0
  44. package/bin/lean/issuewatch-reconcile.mjs +20 -1
  45. package/bin/lean/issuewatch-reconcile.test.mjs +30 -0
  46. package/bin/lean/lanecheck.mjs +27 -3
  47. package/bin/lean/lanecheck.test.mjs +47 -5
  48. package/bin/lean/laneconfine.mjs +83 -0
  49. package/bin/lean/laneconfine.test.mjs +113 -0
  50. package/bin/lean/lean.mjs +398 -91
  51. package/bin/lean/lean.test.mjs +792 -26
  52. package/bin/lean/live-reconcile.mjs +169 -0
  53. package/bin/lean/live-reconcile.test.mjs +176 -0
  54. package/bin/lean/orchestrate-envhold.test.mjs +245 -0
  55. package/bin/lean/orchestrate-hostfallback.test.mjs +39 -0
  56. package/bin/lean/orchestrate.mjs +207 -17
  57. package/bin/lean/outcomeevidence.mjs +104 -0
  58. package/bin/lean/outcomeevidence.test.mjs +78 -0
  59. package/bin/lean/page-capture.mjs +68 -0
  60. package/bin/lean/page-capture.test.mjs +44 -0
  61. package/bin/lean/pagegate.mjs +46 -7
  62. package/bin/lean/pagegate.test.mjs +66 -1
  63. package/bin/lean/postdeploy-check.mjs +18 -4
  64. package/bin/lean/postdeploy-check.test.mjs +32 -1
  65. package/bin/lean/prefilter.mjs +36 -4
  66. package/bin/lean/prefilter.test.mjs +31 -1
  67. package/bin/lean/preflight.mjs +22 -0
  68. package/bin/lean/preflight.test.mjs +19 -1
  69. package/bin/lean/probe.mjs +18 -0
  70. package/bin/lean/probe.test.mjs +40 -0
  71. package/bin/lean/prompts.mjs +41 -4
  72. package/bin/lean/recovery.test.mjs +20 -0
  73. package/bin/lean/recurrence.mjs +133 -0
  74. package/bin/lean/recurrence.test.mjs +99 -0
  75. package/bin/lean/release-config.mjs +2 -1
  76. package/bin/lean/release-config.test.mjs +18 -0
  77. package/bin/lean/release-control.mjs +4 -2
  78. package/bin/lean/release-control.test.mjs +15 -0
  79. package/bin/lean/release-merge-hold.mjs +65 -0
  80. package/bin/lean/release-merge-hold.test.mjs +69 -0
  81. package/bin/lean/release-review.mjs +26 -9
  82. package/bin/lean/release-review.test.mjs +53 -0
  83. package/bin/lean/release-status.mjs +3 -1
  84. package/bin/lean/release-status.test.mjs +11 -0
  85. package/bin/lean/release.test.mjs +26 -1
  86. package/bin/lean/render.mjs +8 -7
  87. package/bin/lean/repro-output.test.mjs +45 -0
  88. package/bin/lean/routing.mjs +49 -0
  89. package/bin/lean/routing.test.mjs +54 -1
  90. package/bin/lean/run-issue-placement.test.mjs +30 -1
  91. package/bin/lean/sandbox-actions.mjs +121 -0
  92. package/bin/lean/sandbox-actions.test.mjs +94 -0
  93. package/bin/lean/sandbox-provider.contract.test.mjs +22 -1
  94. package/bin/lean/sandbox-remote.mjs +3 -1
  95. package/bin/lean/schedd-health.mjs +14 -2
  96. package/bin/lean/schedd-health.test.mjs +13 -0
  97. package/bin/lean/schedd.mjs +43 -17
  98. package/bin/lean/schedd.test.mjs +61 -1
  99. package/bin/lean/toolchain.mjs +16 -6
  100. package/bin/lean/toolplace.mjs +12 -0
  101. package/bin/lean/weakguard.mjs +105 -0
  102. package/bin/lean/weakguard.test.mjs +59 -0
  103. package/bin/lean/winspawn.mjs +61 -0
  104. package/bin/lean/winspawn.test.mjs +45 -0
  105. package/bin/lean/worktree.mjs +3 -1
  106. package/bin/lean/worktree.test.mjs +11 -0
  107. package/bin/pool/agent.mjs +215 -15
  108. package/bin/pool/cache-sweep.mjs +74 -0
  109. package/bin/pool/cli.mjs +11 -3
  110. package/bin/pool/docker.mjs +33 -2
  111. package/bin/pool/health.mjs +38 -0
  112. package/bin/pool/lane-tools.mjs +23 -4
  113. package/bin/pool/lane-tools.test.mjs +12 -1
  114. package/bin/pool/router.mjs +21 -3
  115. package/bin/runner.mjs +37 -0
  116. package/bin/splash-scene.mjs +356 -0
  117. package/bin/win-hide-children.mjs +114 -0
  118. package/commands/orchestrate.md +18 -27
  119. package/commands/review-pr-agents/infra.md +1 -0
  120. package/commands/review-pr-staging.md +2 -2
  121. package/docs/CONFIG.md +60 -3
  122. package/docs/OUTCOME-CODES.md +3 -0
  123. package/package.json +1 -1
  124. package/plugins/forgedock-splash/.claude-plugin/plugin.json +1 -1
  125. package/plugins/forgedock-splash/README.md +1 -1
  126. package/plugins/forgedock-splash/hooks/scene.ts +142 -8
  127. package/pool/README.md +6 -0
  128. package/pool/image/entrypoint.sh +1 -0
  129. package/scripts/acceptance-red-green.sh +8 -3
  130. package/scripts/acceptance-red-green.test.sh +8 -0
  131. package/scripts/check-spec-size.sh +3 -1
  132. package/scripts/gen-splash-scene.mjs +24 -0
  133. package/scripts/review-staging-pre.sh +8 -3
  134. package/scripts/review-staging-pre.test.sh +2 -0
@@ -0,0 +1,113 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
2
+ // SPDX-License-Identifier: AGPL-3.0-or-later
3
+ import { describe, it } from "node:test";
4
+ import assert from "node:assert/strict";
5
+ import { execFileSync } from "node:child_process";
6
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { tmpDir } from "../tests/_tmp.mjs";
9
+ import { ceilingEnv, ceilingSep, listedWorktree, normPath, quarantineDir, samePath, verifyLaneWorktree } from "./laneconfine.mjs";
10
+
11
+ // git with a clean environment: the host's own GIT_* variables (a hook, a ceiling) never leak into a fixture
12
+ const baseEnv = Object.fromEntries(Object.entries(process.env).filter(([k]) => !k.startsWith("GIT_")));
13
+ const gitSync = (args, cwd, env = {}) => execFileSync("git", args, { cwd, encoding: "utf8", env: { ...baseEnv, ...env }, stdio: ["ignore", "pipe", "pipe"] });
14
+ const git = async (args, { cwd, env } = {}) => gitSync(args, cwd, env);
15
+ const exists = async (p) => existsSync(p);
16
+
17
+ /** A repo whose lane root sits inside its checkout, as `<repo>/.claude/worktrees/`, with an untracked operator file. */
18
+ function repo() {
19
+ const r = join(tmpDir("lc5825-"), "r");
20
+ mkdirSync(r, { recursive: true });
21
+ gitSync(["init", "-q", "-b", "main"], r);
22
+ writeFileSync(join(r, "a.txt"), "a\n");
23
+ gitSync(["add", "a.txt"], r);
24
+ gitSync(["-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "init"], r);
25
+ writeFileSync(join(r, "operator-untracked.txt"), "mine\n");
26
+ const root = join(r, ".claude", "worktrees");
27
+ mkdirSync(root, { recursive: true });
28
+ return { r, root, wt: join(root, "lean-5") };
29
+ }
30
+ const staged = (r) => gitSync(["diff", "--cached", "--name-only"], r).trim();
31
+
32
+ describe("ceilingEnv / path comparison (#5825)", () => {
33
+ it("win32: the ceiling is the worktree parent, joined with `;` (git's PATH_SEP), never split on the drive colon", () => {
34
+ const wt = "C:\\Users\\u\\repo\\.claude\\worktrees\\lean-5";
35
+ assert.deepEqual(ceilingEnv(wt, { platform: "win32", env: {} }), { GIT_CEILING_DIRECTORIES: "C:\\Users\\u\\repo\\.claude\\worktrees" });
36
+ assert.deepEqual(ceilingEnv(wt, { platform: "win32", env: { GIT_CEILING_DIRECTORIES: "D:\\x;c:/users/u/repo/.claude/worktrees" } }), { GIT_CEILING_DIRECTORIES: "C:\\Users\\u\\repo\\.claude\\worktrees;D:\\x" });
37
+ const v = ceilingEnv(wt, { platform: "win32", env: {} }).GIT_CEILING_DIRECTORIES;
38
+ assert.ok(!v.split(ceilingSep("win32")).some((d) => /lean-5/.test(d)), "no entry carries the lane folder");
39
+ });
40
+ it("posix: `:` join; a parent containing the separator is refused (null), never split into fragments", () => {
41
+ assert.deepEqual(ceilingEnv("/r/.claude/worktrees/lean-5", { platform: "linux", env: { GIT_CEILING_DIRECTORIES: "/x" } }), { GIT_CEILING_DIRECTORIES: "/r/.claude/worktrees:/x" });
42
+ assert.equal(ceilingEnv("/a:b/lean-5", { platform: "linux", env: {} }), null);
43
+ assert.equal(ceilingEnv("C:\\a;C\\lean-5", { platform: "win32", env: {} }), null);
44
+ });
45
+ it("paths compare in the platform's form: git's `C:/...` equals `C:\\...` on win32; case matters on posix", () => {
46
+ assert.ok(samePath("C:/Users/U/repo/.claude/worktrees/lean-5", "c:\\users\\u\\repo\\.claude\\worktrees\\lean-5\\", { platform: "win32" }));
47
+ assert.ok(!samePath("/r/Lean-5", "/r/lean-5", { platform: "linux" }));
48
+ assert.equal(normPath("/", { platform: "linux" }), "/");
49
+ const porcelain = "worktree C:/r\nHEAD abc\n\nworktree C:/r/.claude/worktrees/lean-5\nbranch refs/heads/x\n";
50
+ assert.ok(listedWorktree(porcelain, "C:\\r\\.claude\\worktrees\\lean-5", { platform: "win32" }));
51
+ assert.ok(!listedWorktree(porcelain, "C:\\r\\.claude\\worktrees\\lean-6", { platform: "win32" }));
52
+ });
53
+ });
54
+
55
+ describe("lane git confinement against real git (#5825)", () => {
56
+ it("a git call from a lane folder without .git does not reach the parent checkout once the ceiling is set", () => {
57
+ const { r, wt } = repo();
58
+ mkdirSync(join(wt, "src"), { recursive: true });
59
+ writeFileSync(join(wt, "src", "x.js"), "x\n");
60
+ // control: without the ceiling git walks up to the operator's checkout (the bug)
61
+ assert.equal(normPath(gitSync(["rev-parse", "--show-toplevel"], join(wt, "src")).trim()), normPath(gitSync(["rev-parse", "--show-toplevel"], r).trim()));
62
+ const env = ceilingEnv(wt);
63
+ assert.throws(() => gitSync(["add", "-A"], wt, env), /not a git repository/i);
64
+ assert.throws(() => gitSync(["status", "--porcelain"], join(wt, "src"), env), /not a git repository/i);
65
+ assert.equal(staged(r), "", "nothing staged in the operator's checkout");
66
+ });
67
+
68
+ it("verify: a folder with no .git link fails before any git call; a stale .git link fails; a registered worktree passes", async () => {
69
+ const { r, wt } = repo();
70
+ mkdirSync(wt);
71
+ const calls = [];
72
+ const v1 = await verifyLaneWorktree({ git: async (a, o) => { calls.push(a); return git(a, o); }, exists, wt, cwd: r });
73
+ assert.equal(v1.ok, false); assert.match(v1.why, /no \.git link/); assert.deepEqual(calls, []);
74
+ writeFileSync(join(wt, ".git"), `gitdir: ${join(r, ".git", "worktrees", "gone")}\n`);
75
+ const v2 = await verifyLaneWorktree({ git, exists, wt, cwd: r });
76
+ assert.equal(v2.ok, false); assert.match(v2.why, /rev-parse failed in the lane folder/);
77
+ assert.equal(staged(r), "");
78
+ });
79
+
80
+ it("verify: a worktree of another repository fails on the common dir, with evidence", async () => {
81
+ const a = repo(), b = repo();
82
+ gitSync(["worktree", "add", "-q", "--detach", a.wt], b.r); // b's worktree sitting where a's lane folder belongs
83
+ const v = await verifyLaneWorktree({ git, exists, wt: a.wt, cwd: a.r });
84
+ assert.equal(v.ok, false); assert.match(v.why, /not the repository's/);
85
+ assert.ok(v.evidence.common_dir && v.evidence.repo_common_dir && v.evidence.toplevel);
86
+ });
87
+
88
+ it("salvage path: an unlinked folder is quarantined, then a fresh registered worktree is added and verifies", async () => {
89
+ const { r, root, wt } = repo();
90
+ mkdirSync(join(wt, "half-deleted"), { recursive: true });
91
+ writeFileSync(join(wt, "half-deleted", "f.txt"), "left\n");
92
+ assert.equal((await verifyLaneWorktree({ git, exists, wt, cwd: r })).ok, false);
93
+ const to = quarantineDir(wt, { now: () => 1 });
94
+ assert.equal(to, join(root, ".quarantine", "lean-5-1"));
95
+ assert.ok(existsSync(join(to, "half-deleted", "f.txt")) && !existsSync(wt), "moved aside, not deleted");
96
+ gitSync(["worktree", "add", "-q", "-b", "feat/issue-5-lean", wt, "main"], r);
97
+ assert.ok(listedWorktree(gitSync(["worktree", "list", "--porcelain"], r), wt), "registered");
98
+ const v = await verifyLaneWorktree({ git, exists, wt, cwd: r });
99
+ assert.equal(v.ok, true, v.why);
100
+ assert.equal(staged(r), "", "the operator's checkout is untouched");
101
+ });
102
+
103
+ it("quarantine never overwrites an earlier quarantined folder; a failed move throws", () => {
104
+ const { wt } = repo();
105
+ mkdirSync(wt);
106
+ const first = quarantineDir(wt, { now: () => 7 });
107
+ mkdirSync(wt);
108
+ const second = quarantineDir(wt, { now: () => 7 });
109
+ assert.notEqual(first, second);
110
+ mkdirSync(wt);
111
+ assert.throws(() => quarantineDir(wt, { rename: () => { throw new Error("EBUSY: resource busy or locked"); } }), /EBUSY/);
112
+ });
113
+ });