forgedock 1.54.0 → 1.55.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 (114) hide show
  1. package/bin/auth/app-token.mjs +2 -0
  2. package/bin/auth/app-token.test.mjs +9 -1
  3. package/bin/engine/events.mjs +1 -0
  4. package/bin/engine/events.test.mjs +5 -1
  5. package/bin/engine/outcome-codes.mjs +3 -0
  6. package/bin/engine-cli.mjs +126 -34
  7. package/bin/forgedock.mjs +56 -4
  8. package/bin/gc-schedule.mjs +83 -0
  9. package/bin/gc.mjs +56 -8
  10. package/bin/help-text.mjs +1 -1
  11. package/bin/hooks/pre-tool-use.mjs +1 -0
  12. package/bin/init-detect.mjs +73 -2
  13. package/bin/labels.json +5 -0
  14. package/bin/lean/admission.mjs +21 -1
  15. package/bin/lean/baselines.mjs +43 -0
  16. package/bin/lean/baselines.test.mjs +33 -0
  17. package/bin/lean/batch-health.mjs +43 -6
  18. package/bin/lean/batch-health.test.mjs +41 -1
  19. package/bin/lean/batch.mjs +41 -4
  20. package/bin/lean/batch.test.mjs +106 -3
  21. package/bin/lean/conformance.mjs +131 -12
  22. package/bin/lean/conformance.test.mjs +172 -3
  23. package/bin/lean/depcache.mjs +23 -2
  24. package/bin/lean/depcache.test.mjs +22 -0
  25. package/bin/lean/docsgate.mjs +137 -0
  26. package/bin/lean/docsgate.test.mjs +78 -0
  27. package/bin/lean/effects.mjs +31 -2
  28. package/bin/lean/enumerating.mjs +39 -13
  29. package/bin/lean/enumerating.test.mjs +20 -0
  30. package/bin/lean/execution.test.mjs +3 -3
  31. package/bin/lean/fastforward.mjs +93 -0
  32. package/bin/lean/fastforward.test.mjs +73 -0
  33. package/bin/lean/guardgate.mjs +38 -7
  34. package/bin/lean/guardgate.test.mjs +39 -0
  35. package/bin/lean/issuewatch-install.mjs +92 -0
  36. package/bin/lean/issuewatch-install.test.mjs +31 -0
  37. package/bin/lean/issuewatch-parity.mjs +33 -3
  38. package/bin/lean/issuewatch-parity.test.mjs +30 -5
  39. package/bin/lean/issuewatch-reconcile.mjs +123 -0
  40. package/bin/lean/issuewatch-reconcile.test.mjs +30 -0
  41. package/bin/lean/issuewatch-verify.mjs +51 -9
  42. package/bin/lean/issuewatch.mjs +153 -33
  43. package/bin/lean/issuewatch.test.mjs +243 -22
  44. package/bin/lean/lean.mjs +381 -75
  45. package/bin/lean/lean.test.mjs +437 -20
  46. package/bin/lean/light.mjs +11 -3
  47. package/bin/lean/light.test.mjs +27 -0
  48. package/bin/lean/lightlane.mjs +8 -3
  49. package/bin/lean/lightlane.test.mjs +20 -0
  50. package/bin/lean/mechfix.mjs +35 -4
  51. package/bin/lean/mechfix.test.mjs +48 -1
  52. package/bin/lean/orchestrate-children.test.mjs +10 -0
  53. package/bin/lean/orchestrate-owned.test.mjs +73 -0
  54. package/bin/lean/orchestrate.mjs +28 -4
  55. package/bin/lean/overlap.mjs +20 -0
  56. package/bin/lean/overlap.test.mjs +49 -0
  57. package/bin/lean/pagegate.mjs +152 -0
  58. package/bin/lean/pagegate.test.mjs +77 -0
  59. package/bin/lean/parked-relabel.mjs +32 -0
  60. package/bin/lean/parked-relabel.test.mjs +45 -0
  61. package/bin/lean/phaseledger.mjs +17 -2
  62. package/bin/lean/postdeploy-check.mjs +27 -0
  63. package/bin/lean/postdeploy-check.test.mjs +13 -1
  64. package/bin/lean/postrun.mjs +32 -0
  65. package/bin/lean/postrun.test.mjs +41 -0
  66. package/bin/lean/preflight.mjs +46 -0
  67. package/bin/lean/preflight.test.mjs +30 -1
  68. package/bin/lean/prompts.mjs +36 -6
  69. package/bin/lean/recovery.test.mjs +16 -0
  70. package/bin/lean/release.mjs +30 -3
  71. package/bin/lean/release.test.mjs +36 -0
  72. package/bin/lean/render.mjs +17 -6
  73. package/bin/lean/reproquality.mjs +116 -0
  74. package/bin/lean/reproquality.test.mjs +85 -0
  75. package/bin/lean/review-trigger.mjs +8 -3
  76. package/bin/lean/sandbox-budget.test.mjs +27 -0
  77. package/bin/lean/schedd.mjs +40 -11
  78. package/bin/lean/schedd.test.mjs +12 -1
  79. package/bin/lean/testadequacy.mjs +97 -0
  80. package/bin/lean/testadequacy.test.mjs +92 -0
  81. package/bin/lean/testsandbox.mjs +202 -0
  82. package/bin/lean/testsandbox.test.mjs +157 -0
  83. package/bin/lean/toolplace.mjs +5 -2
  84. package/bin/lean/toolplace.test.mjs +6 -0
  85. package/bin/lean/verify.mjs +6 -1
  86. package/bin/lean/verify.test.mjs +18 -2
  87. package/bin/lean/warmtree.mjs +77 -0
  88. package/bin/lean/warmtree.test.mjs +81 -0
  89. package/bin/runner.mjs +6 -1
  90. package/bin/stats/conformance-outcomes.mjs +12 -2
  91. package/bin/stats/depth.mjs +24 -1
  92. package/bin/stats/depth.test.mjs +21 -1
  93. package/bin/stats/index.mjs +5 -2
  94. package/bin/stats/query.mjs +2 -1
  95. package/commands/cleanup.md +18 -0
  96. package/commands/fd-introspect.md +19 -0
  97. package/commands/milestone.md +5 -1
  98. package/commands/pipeline-health/phase-2-metrics.md +4 -0
  99. package/commands/recover-orphans.md +31 -1
  100. package/commands/review-pr-staging.md +9 -0
  101. package/commands/review-pr.md +2 -0
  102. package/docs/CI.md +1 -1
  103. package/docs/CONFIG.md +26 -1
  104. package/docs/EVENTS.md +1 -0
  105. package/docs/ISSUE-WATCH.md +12 -3
  106. package/docs/eval/adversarial-bench.md +1 -1
  107. package/docs/eval/published/adversarial-2026-11-11.md +58 -0
  108. package/package.json +1 -1
  109. package/scripts/bench-lightlane.mjs +3 -2
  110. package/scripts/hotspots.sh +7 -4
  111. package/scripts/hotspots.test.sh +12 -0
  112. package/scripts/recover-orphans-stateless.test.sh +79 -0
  113. package/scripts/transition-label.sh +2 -0
  114. package/templates/workflows/forgedock-reopen-clean.yml +33 -0
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env bash
2
+ # recover-orphans-stateless.test.sh — the #5466 STATELESS branch in commands/recover-orphans.md Phase 2 must
3
+ # honour --dry-run and must not re-park an issue a human cleared (#5486). Runs the extracted block with gh mocked.
4
+ #
5
+ # Usage: bash scripts/recover-orphans-stateless.test.sh
6
+ # SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
7
+ # SPDX-License-Identifier: AGPL-3.0-or-later
8
+
9
+ set -uo pipefail
10
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
+ SPEC="$SCRIPT_DIR/../commands/recover-orphans.md"
12
+ TMP=$(mktemp -d); trap 'rm -rf "$TMP"' EXIT
13
+ PASS=0; FAILN=0
14
+ ok() { PASS=$((PASS+1)); echo "ok - $1"; }
15
+ bad() { FAILN=$((FAILN+1)); echo "FAIL - $1"; }
16
+
17
+ # Block: from the "#5466:" comment through the closing "fi" at two-space indent.
18
+ awk '/# #5466: a needs-human annotation/{f=1} f{print} f && /^ fi$/{exit}' "$SPEC" > "$TMP/block.sh"
19
+ [ -s "$TMP/block.sh" ] && ok "STATELESS block extracted" || { bad "STATELESS block extracted"; exit 1; }
20
+
21
+ mkdir "$TMP/bin"
22
+ cat > "$TMP/bin/gh" <<'MOCK'
23
+ #!/usr/bin/env bash
24
+ case "$1 $2" in
25
+ "api repos/o/r/issues/7/events") cat "$MOCK_EVENTS" ;;
26
+ "api graphql") echo "${MOCK_VIEWER:-}" ;;
27
+ "issue edit") echo "EDIT $*" >> "$MOCK_LOG" ;;
28
+ esac
29
+ exit 0
30
+ MOCK
31
+ chmod +x "$TMP/bin/gh"
32
+
33
+ ISSUE='{"labels":[],"comments":[{"body":"<!-- FORGE:NEEDS_HUMAN -->\nx","createdAt":"2026-01-01T00:00:00Z"}]}'
34
+ NOEV='[]'
35
+ CLEARED='[{"event":"unlabeled","label":{"name":"needs-human"},"created_at":"2026-01-02T00:00:00Z"}]'
36
+ OLDER='[{"event":"unlabeled","label":{"name":"needs-human"},"created_at":"2025-12-31T00:00:00Z"}]'
37
+
38
+ BOT_EV='[{"event":"unlabeled","label":{"name":"needs-human"},"created_at":"2026-01-02T00:00:00Z","actor":{"login":"the-bot","type":"User"}}]'
39
+ BOTTYPE_EV='[{"event":"unlabeled","label":{"name":"needs-human"},"created_at":"2026-01-02T00:00:00Z","actor":{"login":"app[bot]","type":"Bot"}}]'
40
+ HUMAN_EV='[{"event":"unlabeled","label":{"name":"needs-human"},"created_at":"2026-01-02T00:00:00Z","actor":{"login":"alice","type":"User"}}]'
41
+
42
+ # run <dry_run> <events-json> -> sets LOG (edit calls), ACTION, REASON
43
+ run() {
44
+ : > "$TMP/log"; echo "$2" > "$TMP/ev"
45
+ local out
46
+ out=$(PATH="$TMP/bin:$PATH" MOCK_LOG="$TMP/log" MOCK_EVENTS="$TMP/ev" MOCK_VIEWER="${VIEWER:-}" DRY_RUN="$1" ISSUE="$ISSUE" ISSUE_LABELS="" \
47
+ GH_REPO=o/r GH_FLAG="-R o/r" NUM=7 bash -c '
48
+ declare -A DIAG_ACTION DIAG_REASON
49
+ for _ in 1; do
50
+ source "$0"
51
+ echo "FELLTHROUGH"
52
+ done
53
+ echo "ACTION=${DIAG_ACTION[7]:-}"; echo "REASON=${DIAG_REASON[7]:-}"' "$TMP/block.sh" 2>&1)
54
+ LOG=$(cat "$TMP/log"); OUT="$out"
55
+ }
56
+
57
+ run false "$NOEV"
58
+ echo "$LOG" | grep -q "add-label needs-human" && ok "live: stateless orphan restored" || bad "live: stateless orphan restored"
59
+ run true "$NOEV"
60
+ [ -z "$LOG" ] && ok "dry-run: no gh issue edit" || bad "dry-run: no gh issue edit"
61
+ echo "$OUT" | grep -q "would restore" && ok "dry-run: reports would-restore" || bad "dry-run: reports would-restore"
62
+ run false "$CLEARED"
63
+ [ -z "$LOG" ] && echo "$OUT" | grep -q "cleared by a human" && ok "human-cleared: not re-parked" || bad "human-cleared: not re-parked"
64
+ run false "$OLDER"
65
+ echo "$LOG" | grep -q "add-label needs-human" && ok "removal before annotation: still restored" || bad "removal before annotation: still restored"
66
+
67
+ VIEWER=the-bot run false "$BOT_EV"
68
+ echo "$LOG" | grep -q "add-label needs-human" && ok "#5494: bot-login removal (viewer) restored" || bad "#5494: bot-login removal (viewer) restored"
69
+ VIEWER="" FORGE_BOT_LOGIN=the-bot run false "$BOT_EV"
70
+ echo "$LOG" | grep -q "add-label needs-human" && ok "#5494: bot-login removal (FORGE_BOT_LOGIN) restored" || bad "#5494: bot-login removal (FORGE_BOT_LOGIN) restored"
71
+ unset FORGE_BOT_LOGIN
72
+ VIEWER=the-bot run false "$BOTTYPE_EV"
73
+ echo "$LOG" | grep -q "add-label needs-human" && ok "#5494: Bot-type removal restored" || bad "#5494: Bot-type removal restored"
74
+ VIEWER=the-bot run false "$HUMAN_EV"
75
+ [ -z "$LOG" ] && echo "$OUT" | grep -q "cleared by a human" && ok "#5494: human removal still skipped" || bad "#5494: human removal still skipped"
76
+ VIEWER="" run false "$BOT_EV"
77
+ [ -z "$LOG" ] && ok "#5494: unresolved bot login stays fail-closed" || bad "#5494: unresolved bot login stays fail-closed"
78
+
79
+ echo "passed=$PASS failed=$FAILN"; [ "$FAILN" -eq 0 ]
@@ -182,6 +182,7 @@ VALID_STATES=(
182
182
  "building"
183
183
  "in-review"
184
184
  "merged"
185
+ "merged-unverified"
185
186
  "invalid"
186
187
  "decomposed"
187
188
  "awaiting-merge"
@@ -294,6 +295,7 @@ ensure_label() {
294
295
  "workflow:remediating") LBL_COLOR="C5DEF5"; LBL_DESC="Pipeline: autonomous remediation pending (no human action needed). Managed by ForgeDock." ;;
295
296
  "workflow:awaiting-merge") LBL_COLOR="FF8C00"; LBL_DESC="Pipeline: remediated + re-reviewed, awaiting a human merge decision. Managed by ForgeDock." ;;
296
297
  "workflow:merged") LBL_COLOR="0E8A16"; LBL_DESC="Pipeline: PR merged, issue closed. Managed by ForgeDock." ;;
298
+ "workflow:merged-unverified") LBL_COLOR="FBCA04"; LBL_DESC="Pipeline: PR merged but verification failed, needs a human decision. Managed by ForgeDock." ;;
297
299
  "workflow:decomposed") LBL_COLOR="BFD4F2"; LBL_DESC="Pipeline: decomposed into sub-issues. Managed by ForgeDock." ;;
298
300
  "workflow:invalid") LBL_COLOR="CCCCCC"; LBL_DESC="Pipeline: issue closed as invalid after investigation. Managed by ForgeDock." ;;
299
301
  "needs-human") LBL_COLOR="E4E669"; LBL_DESC="Pipeline stalled — requires human intervention. Managed by ForgeDock." ;;
@@ -0,0 +1,33 @@
1
+ # ForgeDock reopen cleanup — Workflow Template
2
+ #
3
+ # Copy this file to .github/workflows/forgedock-reopen-clean.yml in your repository.
4
+ # When an issue is reopened, remove the terminal labels workflow:merged and
5
+ # workflow:merged-unverified so the open issue does not look merged and the next
6
+ # lane starts from a clean state.
7
+
8
+ name: ForgeDock Reopen Cleanup
9
+
10
+ on:
11
+ issues:
12
+ types: [reopened]
13
+
14
+ # Minimum permissions: edit labels on issues.
15
+ permissions:
16
+ issues: write
17
+
18
+ jobs:
19
+ clean-labels:
20
+ name: Remove terminal labels
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Remove workflow:merged labels
24
+ env:
25
+ GH_TOKEN: ${{ github.token }}
26
+ GH_REPO: ${{ github.repository }}
27
+ ISSUE: ${{ github.event.issue.number }}
28
+ run: |
29
+ for L in "workflow:merged" "workflow:merged-unverified"; do
30
+ if gh issue view "$ISSUE" --json labels --jq '.labels[].name' | grep -qx "$L"; then
31
+ gh issue edit "$ISSUE" --remove-label "$L"
32
+ fi
33
+ done