forgedock 1.53.0 → 1.54.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 (185) 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 +256 -0
  6. package/bin/auth/app-token.test.mjs +232 -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 +124 -0
  59. package/bin/lean/mechfix.test.mjs +75 -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 +80 -12
  82. package/bin/lean/release.test.mjs +95 -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 +43 -6
  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/CONFIG.md +105 -10
  155. package/docs/ISSUE-WATCH.md +23 -0
  156. package/docs/OUTCOME-CODES.md +1 -0
  157. package/docs/REPLAY.md +9 -0
  158. package/docs/SELFTEST.md +11 -0
  159. package/docs/STATS.md +19 -2
  160. package/docs/eval/README.md +6 -0
  161. package/docs/eval/adversarial-bench.md +68 -0
  162. package/docs/eval/corpus/adversarial-v1.json +285 -0
  163. package/docs/eval/feature-bench.md +42 -0
  164. package/docs/eval/feature-specs/crud-auth/journeys/notes-crud-isolated.mjs +21 -0
  165. package/docs/eval/feature-specs/crud-auth/journeys/register-login.mjs +12 -0
  166. package/docs/eval/feature-specs/crud-auth/spec.md +15 -0
  167. package/docs/site/start-a-new-project.md +2 -1
  168. package/package.json +5 -2
  169. package/plugins/forgedock-splash/.claude-plugin/plugin.json +10 -0
  170. package/plugins/forgedock-splash/README.md +27 -0
  171. package/plugins/forgedock-splash/hooks/hooks.json +1 -0
  172. package/plugins/forgedock-splash/hooks/register.tsx +74 -0
  173. package/plugins/forgedock-splash/hooks/scene.ts +222 -0
  174. package/plugins/forgedock-splash/types/index.d.ts +10 -0
  175. package/scripts/bench-adversarial.mjs +216 -0
  176. package/scripts/bench-feature.mjs +170 -0
  177. package/scripts/bench-lightlane.mjs +2 -2
  178. package/scripts/bootstrap-create.mjs +2 -2
  179. package/scripts/bootstrap-validate.mjs +35 -2
  180. package/scripts/check-spec-size.sh +4 -3
  181. package/scripts/check-spec-size.test.sh +3 -0
  182. package/scripts/plan-validate-live.mjs +40 -6
  183. package/scripts/review-pr-staging-scope.test.sh +1 -1
  184. package/scripts/review-staging-post.sh +23 -0
  185. package/scripts/review-staging-post.test.sh +8 -0
@@ -217,6 +217,7 @@ CI_FAILING=$(gh pr checks "$PR_NUMBER" -R "$GH_REPO" --json name,bucket \
217
217
  --jq '[.[] | select(.name != "forgedock/verify" and .name != "forge/deploy-gate" and .name != "Check for FORGE gate markers") | select(.bucket == "fail" or .bucket == "cancel")] | length' 2>/dev/null || echo "1")
218
218
  echo "CI_FAILING: $CI_FAILING"
219
219
  ```
220
+ When the target branch's protection or rulesets (or `gate.required_checks` in forge.yaml) name required checks, only those count toward `CI_FAILING`; other red checks are listed as non-blocking warnings (`forgedock review-staging --summary` does this). With no readable required set every red check counts.
220
221
  `CI_FAILING` > 0 → BLOCK DEPLOY (unless autofixed in Phase 1F). A red `forgedock/verify` alone does not block, and neither do `forge/deploy-gate` or `Check for FORGE gate markers`: they report this review's own gate marker, so an earlier `GATE_FAILURE` never blocks the re-run that clears it.
221
222
 
222
223
  ### Phase 1F: CI Autofix
@@ -238,7 +239,7 @@ For fixable failures: checkout staging, apply fix, verify locally, commit as `fi
238
239
 
239
240
  ## Phase 2: Material Change Analysis
240
241
 
241
- **Launched-agent bookkeeping (MANDATORY)**: Step 1 truncated the PR-keyed launched-agent file. Before launching **every** Phase 2-6 reviewer (the DISPATCH briefs and the spec-owned panel), append its lowercase marker domain (for example `security`, `bug-hunter-api` or `regression-risk`) to that file: `printf '%s\n' "<domain>" >> "${FORGE_SCRATCHPAD:-$PWD/.forge-scratch}/<PR>_launched_review_agents"`. Step 7A checks delivery for exactly these domains.
242
+ **Launched-agent bookkeeping (MANDATORY)**: Step 1 writes the launch manifest (`<PR>_review_manifest.json`) and fills the PR-keyed launched-agent file from the DISPATCH briefs, so briefed domains need no append. Before launching each spec-owned Phase 2-6 reviewer (e.g. `bug-hunter-api`, `regression-risk`), append its lowercase marker domain: `printf '%s\n' "<domain>" >> "${FORGE_SCRATCHPAD:-$PWD/.forge-scratch}/<PR>_launched_review_agents"`. Reviewers post with `forgedock review-staging <PR> --post-reviewer <domain> --body-file <file>`: it writes the marker and the full `Reviewed-SHA:` from the manifest and refuses a domain that is not launched. Step 7A checks delivery for exactly these domains; on a shortfall it names each reviewer and why (stale SHA, no findings block, absent) with a `REDISPATCH <domain>` line: re-run only that reviewer.
242
243
 
243
244
  **Head SHA binding**: substitute `[REVIEW_SHA]` in every template below with the literal full head SHA from the manifest's `REVIEW_STAGING:` line before dispatch. The reviewer's post fence runs in a fresh shell, so it must never reference a shell variable and must never invent a value.
244
245
 
@@ -381,6 +382,8 @@ Invoke `/test-gate` with the manifest's `BUNDLE_PRS` and the default branch. Sav
381
382
  >>> INVOKE: Skill(skill="{FORGE_SKILL_PREFIX}test-gate", args="--prs \"<BUNDLE_PRS>\" --base <default branch>")
382
383
  ```
383
384
 
385
+ **Feature acceptance (forge#5336, blocking)**: for a milestone release PR, `--summary` runs `npx forgedock acceptance gate --branch <head ref> --stage ship` itself: a red or never-run epic journey, or a test-gate SKIP on a milestone that has an epic, is BLOCK DEPLOY, never a pass.
386
+
384
387
  **Route reachability (forge#5087, blocking when declared)**: when `forge.yaml` declares `topology.route_reachability`, list the route paths the bundle adds (`git diff --name-only --diff-filter=A <default>...HEAD`, Next.js `app/**/route.*` / `pages/api/**` mapped to URL paths, route groups removed) and run the command with them as arguments. A non-zero exit is a BLOCK finding naming the path; unset = skip.
385
388
 
386
389
  Do not judge the result yourself. Step 7A reads the output's last `FORGE:TEST_GATE:RESULT=` marker through `scripts/review-staging-post.sh test-gate`. A missing or invalid marker (gate result missing/invalid) is BLOCK, never SKIP (fail closed). The step then applies the override and the posture. It posts `FORGE:GATE_PASS` (PASS) or `FORGE:GATE_FAILURE` (blocking BLOCK, with `RESULT: BLOCK DEPLOY`), and persists the verdict for Phase 8.
@@ -859,6 +859,14 @@ OPEN_SUBS=${OPEN_SUBS:-0}
859
859
 
860
860
  If `OPEN_SUBS == 0` (all sub-issues done), branch on the parent's `state` <!-- Added: forge#3736 -->. An OPEN parent is closed and transitioned to `merged` with the same tiered dispatch and FULL remove list as C2. A CLOSED parent (closed at decomposition by `decomposition.close_parent`) is never closed a second time and never reopened: post the completion comment (once) and set `merged`:
861
861
  ```bash
862
+ # forge#5336: an epic closes only when its journeys are green; post-deploy journeys keep it open and labelled. Requirements transferred from lanes (#5339) count too.
863
+ if [ "$OPEN_SUBS" -eq 0 ] && gh issue view "$PARENT_REF" {GH_FLAG} --json labels --jq '.labels[].name' 2>/dev/null | grep -qx epic; then
864
+ _MS=$(gh issue view "$PARENT_REF" {GH_FLAG} --json milestone --jq '.milestone.title // empty' 2>/dev/null)
865
+ if [ -n "$_MS" ] && ! npx forgedock acceptance gate --milestone "$_MS" --stage close --repo "{GH_REPO}"; then
866
+ gh issue edit "$PARENT_REF" {GH_FLAG} --add-label awaiting-measurement # allowlist:check-command-side-effects
867
+ OPEN_SUBS=1
868
+ fi
869
+ fi
862
870
  if [ "$OPEN_SUBS" -eq 0 ]; then
863
871
  PARENT_STATE=$(gh issue view "$PARENT_REF" {GH_FLAG} --json state --jq '.state' 2>/dev/null || echo OPEN)
864
872
  COMPLETE_MSG="All sub-issues complete. Closing parent tracker. Last completed: #{NUMBER}${PR_NUMBER:+ (PR #${PR_NUMBER})}."
package/docs/CONFIG.md CHANGED
@@ -594,6 +594,28 @@ pipeline:
594
594
 
595
595
  ---
596
596
 
597
+ ### `ci` budget and placement (forge#5278)
598
+
599
+ Actions-minutes awareness and where CI runs. Keys are flat under `ci:` (the parser is one level deep; they coexist with the `milestone_integration` keys above).
600
+
601
+ ```yaml
602
+ ci:
603
+ mode: auto # remote | local-first | local-attested | auto (default)
604
+ monthly_minutes: 40000 # budget; default: the plan's included minutes
605
+ reserve_pct: 10 # headroom under the budget before auto switches (0-90, default 10)
606
+ # included_minutes: 50000 # override the built-in plan table (free 2000, pro/team 3000, enterprise 50000)
607
+ # plan: enterprise # override the detected plan
608
+ ```
609
+
610
+ | `mode` | Behaviour |
611
+ |---|---|
612
+ | `remote` | Current behaviour: `verify.mode` ci/hybrid push and wait for Actions. |
613
+ | `local-first` | Host checks must pass before anything is pushed that triggers paid CI; `verify.mode` ci/hybrid run as `local`. Paid CI runs once on the release head. |
614
+ | `local-attested` | As `local-first`, and the host result is posted as a `forgedock/ci-local` commit status; paid CI only for release/nightly. Trust trade-off: the status is attested by ForgeDock, not run by Actions, the same trust as a self-hosted runner. |
615
+ | `auto` | `remote` while the projected month stays under `monthly_minutes` less `reserve_pct`; otherwise `local-first`, announced in the next batch/release report. A public repo (free hosted minutes) is never switched; an unreadable billing API stays `remote`. |
616
+
617
+ `forgedock ci budget [--repo owner/repo] [--json] [--digest] [--propose [--base REF]]` prints the plan, included minutes, month-to-date usage across the account (billing usage API: needs a token that can read the org or user billing), the projection, the active mode, alerts (projected overage, a new burn source such as a repo flipped private) and the parity hit rate (local green -> remote red, per suite). `--digest` adds the per-repo and per-workflow month digest; `--propose` lists the runnable local jobs derived from the repo's workflow files (same tool pins). `--set-mode`, `--budget`, `--reserve`, `--plan` write the `ci` block (see `/forgedock-ci-setup`). Runner minutes are weighted by OS (Linux 1, Windows 2, macOS 10). Caches live in `~/.forge/ci-budget/` (`FORGEDOCK_CI_BUDGET_DIR`).
618
+
597
619
  ## `execution` (OPTIONAL)
598
620
 
599
621
  Owner opt-in for the paid API agent backend (#4257). The API backend is **never the default**: under `--backend auto` (the default) ForgeDock uses the `claude` CLI, and when no CLI is available it fails with `CLI_BACKEND_UNAVAILABLE` instead of billing `ANTHROPIC_API_KEY`.
@@ -721,6 +743,15 @@ selftest:
721
743
 
722
744
  ---
723
745
 
746
+ ## `gate` (OPTIONAL)
747
+
748
+ ```yaml
749
+ gate:
750
+ required_checks: ["CI"] # extra checks the staging review treats as required
751
+ ```
752
+
753
+ `forgedock review-staging --summary` blocks only on the required checks of the target branch (branch protection and rulesets, read from the GitHub API) plus this explicit list; the list is never inferred. Other red checks are reported as non-blocking warnings. When no required checks can be read, every red check blocks.
754
+
724
755
  ## `release` (OPTIONAL)
725
756
 
726
757
  Settings for `forgedock release [--repo owner/repo] [--merge] [--watch] [--resume <id>]` (#5208), which runs the `branches.staging` → `branches.default` release as one resumable job. State is kept in `~/.forge/releases/<id>/` (or `FORGEDOCK_RELEASE_DIR`); `--resume <id>` continues from the last completed step (preflight, release-pr, review, fixes, promotion, post-merge). Preflight refuses while lanes of the repo run or PRs to the staging branch are open, and sets the repo's batches to K=1 until the job ends. Review and fixes are not automated yet: the job stops there and tells you to use the manual path (`commands/review-pr-staging.md`). Post-merge is automated (#5213): it confirms a publish run for the merge commit (dispatching one when none appears), waits for `artifact_check`, then opens and merges the version-sync PR; a bound that runs out stops the job as blocked and `--resume <id>` retries. `--watch` is accepted and has no effect until the review step lands.
@@ -731,11 +762,19 @@ release:
731
762
  artifact_check: ""
732
763
  version_sync: false
733
764
  publish_workflow: publish.yml
765
+ preflight_command: ""
766
+ preflight_timeout: 1200
767
+ preflight_blocking: true
734
768
  rehearsal_command: ""
735
769
  rehearsal_timeout: 1200
736
770
  rehearsal_blocking: true
771
+ mode: freeze
772
+ branch_pattern: "release/{date}-{n}"
773
+ fix_mode: cherry-pick
737
774
  ```
738
775
 
776
+ `forgedock release verify <sha> [--repo owner/repo]` reads the `FORGE:RELEASE` record from the PR that contains `<sha>` and exits 0 only when `<sha>` is the snapshot plus recorded picks, each a clean cherry-pick of a `branches.staging` commit (same tree as `git cherry-pick`), so a repo workflow that trusted `head.ref == staging` can call it instead.
777
+
739
778
  The forge.yaml reader handles two levels, so the rehearsal block is written as the flat keys `rehearsal_command`, `rehearsal_timeout` and `rehearsal_blocking`.
740
779
 
741
780
  | Key | Type | Required | Description |
@@ -745,12 +784,29 @@ The forge.yaml reader handles two levels, so the rehearsal block is written as t
745
784
  | `version_sync` | boolean | No | The repo pushes a `chore/sync-version-<VERSION>` branch after a release. Post-merge opens its PR to `branches.staging` if missing and merges it with `--match-head-commit` once its checks are green (no checks, or a red one, blocks the job). Default: `false`. |
746
785
  | `publish_workflow` | string | No | Workflow file post-merge looks for (and dispatches when no run appears) for the merge commit. Default: `publish.yml`. |
747
786
 
787
+ | `preflight_command` | string | No | Shell command run on the host (not as Actions minutes) in the repo checkout on the staging head **before** the release PR is opened (#5277), again after each fix round, and once more on the final head before the PR is marked ready. Put the repo's own suites here, e.g. `preflight_command: npm test`. Setting it also opens the release PR as a **draft** and marks it ready only after review and a passing preflight, so Actions CI runs once on the final head. Unset: no preflight, the PR is opened ready as before. |
788
+ | `preflight_timeout` | integer | No | Seconds before the command is killed (counts as a failure). Default: `1200`. |
789
+ | `preflight_blocking` | boolean | No | `true` (default): a failure files one `release-blocker` issue per head (a re-run comments on it) and stops the job before the PR is opened or marked ready; fix it and `--resume <id>`. `false`: the failure is recorded and the release goes on. |
748
790
  | `rehearsal_command` | string | No | Shell command run on the host (not as Actions minutes) in the repo checkout, on the release-PR head after review and before promotion (#5253). Wire the project's deploy dry-run here: bundle build, env load and the trusted-runtime closure check, e.g. `rehearsal_command: ./scripts/deploy-dry-run.sh` where the script builds the release bundle, loads the production env file in check mode and verifies the trusted-runtime closure, exiting non-zero on the first failure. Unset: no rehearsal, release behavior is unchanged. |
749
791
  | `rehearsal_timeout` | integer | No | Seconds before the command is killed (counts as a failure). Default: `1200`. |
750
792
  | `rehearsal_blocking` | boolean | No | `true` (default): a failure files one `release-blocker` issue per release head (a re-run at the same head comments on it) with the output tail and the head SHA, and stops the job before promotion; fix it and `--resume <id>`. `false`: the failure is recorded and promotion goes on. |
793
+ | `mode` | `snapshot` \| `freeze` | No | `freeze` (default) is the original behaviour: the release PR head is `branches.staging`, preflight refuses while a lane runs or a PR targets staging, and every batch is held at K=1 until the job ends. `snapshot` (#5276) cuts `release/<id>` from a staging SHA and opens `release/<id>` → `branches.default`; lanes keep merging to staging and no batch K is touched. A `FORGE:RELEASE` record (snapshot SHA, base/head range, bundle PRs, issues, cherry-picks) is kept in the job state and as a hidden marker in the PR body. Only one release branch may exist at a time. Promotion is unchanged (merge commit, `--match-head-commit`) but is stopped unless the head is the snapshot plus exactly the recorded cherry-picks. The branch is deleted after post-merge; fixes are already on staging, so nothing is back-merged. |
794
+ | `branch_pattern` | string | No | Snapshot branch name; `{date}` is `YYYYMMDD`, `{n}` counts the day's release PRs. Default `release/{date}-{n}`. Everything under the pattern's prefix before `{` counts as a release in flight. |
795
+ | `fix_mode` | `cherry-pick` \| `recut` | No | Snapshot mode only. `cherry-pick` (default): after a fix lane merges to staging, the merged commits of PRs labelled `release-blocker`, or closing a `release-blocker` issue or the blocking issue the job filed, are cherry-picked onto `release/<id>` (a clean pick only; a conflict blocks the job) and appended to `FORGE:RELEASE`. `recut`: the branch is moved to the current staging tip and the picks start over. |
751
796
 
752
797
  The result (pass or fail, head SHA, blocker issue) is recorded in the release state (`steps.rehearsal`) and in a `FORGE:REHEARSAL` section of the release PR body next to the gate result.
753
798
 
799
+ Repos that set `preflight_command` should skip their Actions CI while the release PR is a draft, so the paid run happens once, on the final head:
800
+
801
+ ```yaml
802
+ on:
803
+ pull_request:
804
+ types: [opened, synchronize, reopened, ready_for_review]
805
+ jobs:
806
+ test:
807
+ if: ${{ !github.event.pull_request.draft }}
808
+ ```
809
+
754
810
  **Commands that use this section**: `forgedock release`
755
811
 
756
812
  ## `issue_watch` (OPTIONAL)
@@ -789,6 +845,8 @@ issue_watch:
789
845
  | `include_followups` | string | No | `none` (default) or `defer-only`. |
790
846
  | `trust_app` | boolean | No | Claim issues authored by this repo's ForgeDock App. Other bots and `NONE`-association authors stay untrusted. Default false. |
791
847
  | `trust_app_labels` | list | No | Needs `trust_app`: an App-authored issue must carry one of these labels. |
848
+ | `skip_labels` | list | No | Issues carrying any of these labels are skipped. Default for `mode: batch`: `epic, needs-human, post-deploy, workflow:merged, awaiting-promotion, host-task`; `[]` for the other modes and to switch it off. |
849
+ | `release_pause` | boolean | No | Pause the watch while a `forgedock release` job is in flight; it resumes by itself. Default true in `mode: batch`. |
792
850
  | `postdeploy_rollup` | issue number | No | Release issue that collects post-deploy-only follow-ups as checklist lines. |
793
851
  | `sweep_needs_human` | boolean | No | Also settle `needs-human` escalations that predate the watch (the backlog). Default false; `forgedock issue-watch run --dry-run` classifies them first and writes nothing. |
794
852
  | `max_launches` | integer | No | Total lane launches (claims plus requeues by the decision engine); at N the watch drains. Default: none. Decision-stage issues also count against `max_issues`. |
@@ -938,6 +996,7 @@ lean:
938
996
  | `light.max_lines` | number | No | Upgrade trigger (#4448): a light lane whose non-test diff (added + deleted lines) exceeds this moves to the full lane. Default 40. The other triggers: more than `max_files` non-test changed files, a repro that is not red on the base, two failed test runs, a touched risk path, or a public-API-shape change (#4449). Flat `lean.light_max_lines` wins. |
939
997
  | `light.max_files` | number | No | Max predicted non-test files for eligibility and max changed non-test files before an upgrade (#4448). Default 2. Flat `lean.light_max_files` wins. |
940
998
  | `sequence.regenerate` | string | No | Command run in the lane worktree (`sh -c`) after the engine renumbers a schema-changing sequence-numbered migration (#4386), to regenerate its snapshot, e.g. `pnpm --filter @x/db db:generate`. The flat form `lean.sequence_regenerate` also works and wins. When a lane-added numbered file (`NNNN_*.sql`, a drizzle `meta/_journal.json` + `meta/NNNN_snapshot.json`, a numbered ADR) shares its number with the base, the engine renumbers it without a builder session: `git mv` to max(base)+1…, the document's own number in its heading, references to the old name repo-wide, the base journal plus the lane's entries, and a data-only migration's snapshot cloned from the base tip with a new `id`/`prevId`. A schema-changing migration without this command, or a migration in another language (`.py`, `.ts`), falls back to the builder renumber, and the trajectory records why. When the generator writes no snapshot for a hand-written migration (no schema diff), the engine reruns it with ` --custom` appended (drizzle-kit's empty migration), keeps its snapshot and restores the lane's SQL byte-identical, so the command must forward trailing args (a pnpm/yarn script, or `npm run x --`). A base-sync whose conflicts are only in such files is resolved the same way, with no re-review. At the merge gate a lane with numbered files holds a host sequence lease per (repo, lane branch, directory) from its last renumber check through the merge, so only one numbered-file PR is in the renumber→CI→merge window at a time. |
999
+ | `sequence.versioned` | string | No | Versioned-directory sequence classes (#5235), `<dir>/v{N} -> companion[, companion]; ...`, e.g. `scripts/backup-contracts/v{N} -> src/version.ts=VERSION = {N}`. A companion is a file that references the version, as `path` (it holds the class name, `v{N}`) or `path=template` (`{N}` is the version). When a lane-added `<dir>/vN` collides with a version the base has, the engine renumbers it (`git mv`, then rewrites each companion from the old to the new version) without a builder. The flat form `lean.sequence_versioned` also works and wins. Build-start reservation: before the build the engine reserves, through the host sequence lease, one number per numbered series dir (and one version per configured class) the frozen contract's deliverables touch, above the base and the other open PRs, and tells the builder which to use, so concurrent lanes on one branch get distinct numbers. A renumber after a base-sync reruns the frozen validate commands before the merge (one fix round, then an anomaly). Fail-open: errors mean no reservation. Default: none, so nothing changes. |
941
1000
  | `base_merge_union_globs` / `base_merge_json_globs` / `base_merge_generated_globs` / `base_merge_generated_command` | string | No | Deterministic resolution of sibling-lane conflicts when the lane merges its base (#4588, `bin/lean/conflictres.mjs`; flat keys only). Comma-separated globs (`*` within a segment, `**` across; no `/` matches the file name anywhere). `union_globs`: hunks where both sides only added lines keep both. `json_globs`: a 3-way key union of a JSON object (a key both sides changed differently is refused). `generated_globs` + `generated_command`: the base side is taken, then the command runs once in the lane worktree (`sh -c`) and the files are re-added. A file that cannot be fully resolved, and every sequence/migration file, goes on as before (sequence resolver, then the builder). Default: none, so nothing changes. The same keys apply to milestone branch syncs (`forgedock milestone-sync`, #4663). |
942
1001
  | `milestones.sync_debounce` | string | No | Debounce window of the milestone sync PR (#4663, `bin/lean/milestonesync.mjs`): on a protected milestone branch `forgedock milestone-sync` keeps ONE `sync/milestone-{slug}` PR and force-pushes its head in place; a base that moved again inside the window reports `debounced` (a `ship` sync ignores the window). `10m`, `1h`, `1d`. Default: `10m`. |
943
1002
 
@@ -1458,6 +1517,9 @@ verification:
1458
1517
 
1459
1518
  topology:
1460
1519
  route_reachability: "bash scripts/check-ingress.sh" # optional; blocking when declared
1520
+ prod_parity: # optional; block map {path glob: command | "note: how to verify"}
1521
+ "db/migrations/**": "bash scripts/check-migration-role.sh"
1522
+ "web/app/**": "note: run under the production ISR runtime"
1461
1523
  ```
1462
1524
 
1463
1525
  | Field | Type | Required | Description |
@@ -1478,6 +1540,7 @@ topology:
1478
1540
  | `coupled_files` | map (glob → glob list) | No | Default unset (#5079). "If file A changes, file B must change": a block map `{when glob: required glob[, glob]}`, e.g. `"infra/guard/bootstrap.sh": "infra/guard/MANIFEST.sha256"`. A key prefixed `added:` fires only for files the lane adds (`"added:scripts/tests/test_*.py": ".github/workflows/ci.yml"`). A lane that changes a `when` file without a matching required file fails precheck with `coupled_file_missing` (`conformance.unimplemented`, builder resumed once). Quote keys that contain `*`, and list alternatives as separate keys: brace globs (`*.{ts,tsx}`) are not expanded. |
1479
1541
  | `validate.recipes` | map (regex → replacement) | No | Default unset. A top-level `validate:` block with a block-style `recipes:` map, e.g. `"poetry run pytest": "uv run --with-requirements r.txt pytest"`. Each key is a regex source; the first recipe that matches a frozen validate or `repro_test` command rewrites it at contract freeze (`applyValidateRecipes`), recorded as a decision. Use it for commands whose environment is not installed in lane sandboxes. |
1480
1542
  | `topology.route_reachability` | string (command) | No | Default unset (no check, no behaviour change). A repo-supplied command that takes the route paths a diff adds (Next.js `app/**/route.*`, `pages/api/**`; URL form, route groups removed) as arguments and exits non-zero when the production ingress does not deliver them to the service that implements them. Runs in the lean lane after validate and in `review-pr-staging`; a non-zero exit blocks (`conformance.unimplemented`, kind `route_unreachable`). Read by `readEnvConfig` (`bin/engine-cli.mjs`), run by `bin/lean/routecheck.mjs`. |
1543
+ | `topology.prod_parity` | block map | No | Default unset (no check, no behaviour change; #5284). Production-only facts the lane tests cannot exercise (runtime build mode, migration role vs app role, env-file scope, ingress). Key: path glob; value: a check command, run once with the matching changed paths as arguments (non-zero or cannot-start blocks, `conformance.unimplemented` kind `prod_parity_failed`), or `note: <how to verify>`, which blocks (kind `prod_parity_unjustified`) until `.forge-lean/result.json` carries `parity: [{surface: <glob>, justification}]`. Read by `readEnvConfig`, run by `bin/lean/prodparity.mjs`. |
1481
1544
 
1482
1545
  **Commands that use this section**: `quality-gate`, `validate` (V2 runs `verification.commands`; V4.8 runs the local CI gate; health checks and `consumer_sweep`), `work-on`
1483
1546
 
@@ -1563,6 +1626,31 @@ the gate is DEGRADED and reported in `verification_skipped`, never a silent pass
1563
1626
 
1564
1627
  ---
1565
1628
 
1629
+ ## Schema check and config history (#5315)
1630
+
1631
+ forge.yaml is parsed tolerantly, so a setting nobody reads used to be silent. `bin/config-schema.mjs` now checks it:
1632
+
1633
+ | Finding | Level | Meaning |
1634
+ |---------|-------|---------|
1635
+ | `unknown-key` | error | A top-level key outside the sections in this document, or an unknown child of a closed section (`verification.ci_local`) |
1636
+ | `ignored-on-path` | error | The key is set, but the active `engine.path` never reads it (the legacy `full` path ignores `env`, `verify`, `lean`, `engine.conformance`, `engine.conformance_kinds`) |
1637
+ | `wrong-type` | error | A typed key has the wrong shape (for example `verification.ci_local.extra_commands` that is not a list, `engine.path` outside `core\|full\|lean\|auto`) |
1638
+ | `deprecated-alias` | warning | `pipeline.token_budget_per_batch`, `build.diff_size.threshold` |
1639
+
1640
+ `npx forgedock doctor` reports errors as failures and aliases as warnings; `orchestrate` prints one `config: ...` line per finding at batch start, naming the key.
1641
+
1642
+ ### Config history
1643
+
1644
+ Every setup or agent edit of forge.yaml records a version under `~/.forge/config-history/<owner>__<repo>/` (override the root with `FORGE_CONFIG_HISTORY_DIR`), never a `forge.yaml.bak-*` file in the repo.
1645
+
1646
+ | Command | Does |
1647
+ |---------|------|
1648
+ | `forgedock config history` | Lists versions with date and reason |
1649
+ | `forgedock config diff <n>` | Diffs version `n` against the current forge.yaml |
1650
+ | `forgedock config rollback <n>` | Restores version `n`; the current content is recorded first, so a rollback can be undone |
1651
+ | `forgedock config record [reason]` | Records the current forge.yaml as a version |
1652
+ | `forgedock config import-bak [--delete]` | One-time import of `forge.yaml.bak*` files in the repo into the history (idempotent); `--delete` removes them |
1653
+
1566
1654
  ## Credentials File Format
1567
1655
 
1568
1656
  If `paths.credentials.file` is set, the file at that path is expected to be a YAML file with this structure:
@@ -1769,21 +1857,28 @@ systemctl --user daemon-reload && systemctl --user enable --now forgedock-bot-to
1769
1857
 
1770
1858
  ## GitHub App Install
1771
1859
 
1772
- During `npx forgedock`, the installer prompts you to install the ForgeDock GitHub App (`rapiercraft-forgedock`) on your account or org.
1860
+ During `npx forgedock`, the installer prompts you to install the ForgeDock GitHub App (`rapiercraft-forgedock`). Installing alone changes nothing; to run the pipeline as the App's bot (its own API budget, `<app>[bot]` authorship) sign in with `forgedock auth login`. Without a login, every pipeline `gh` call uses your own `gh auth`, exactly as before.
1861
+
1862
+ ### Broker sign-in
1863
+
1864
+ ```
1865
+ forgedock auth login --broker-url https://<broker> --client-id <App client id> [--installation N]
1866
+ forgedock auth status
1867
+ forgedock auth logout
1868
+ ```
1773
1869
 
1774
- **What installing it does today**: registers the app against the account/org you choose. That's it.
1870
+ - Login uses the GitHub App **device flow** (client ID only; no secret on your machine). The CLI stores the user token and installation under `~/.forge/app-auth.json` (mode 0600; `FORGE_HOME_DIR` overrides the directory). `FORGEDOCK_BROKER_URL` and `FORGEDOCK_APP_CLIENT_ID` can replace the flags.
1871
+ - On every CLI start the stored login yields a short-lived installation token, scoped to your repository ids and the permissions the pipeline uses, which is set as `GH_TOKEN` in the CLI process env only. It is not a global credential: no `gh auth login`, no git credential helper (#4565). It is refreshed when under 10 minutes remain, and long-running commands (`orchestrate`, `schedd`, `watch`, `issue-watch`, `prod-watch`) refresh it in process before it expires. Processes ForgeDock spawns, such as the auto-started `schedd`, recognise the token it set by a fingerprint in `FORGEDOCK_APP_TOKEN_FP` (never the token itself) and keep refreshing it. A `GH_TOKEN` you exported yourself is never overridden.
1872
+ - If the broker is unreachable or refuses, one warning line is printed and the pipeline continues on your own `gh` auth. `FORGEDOCK_NO_APP_AUTH=1` skips the App identity.
1873
+ - Broker contract (client side): `POST {broker}/v1/token` with `Authorization: Bearer <user token>` and body `{installation_id, repository_ids, permissions}`, answering `{token, expires_at}`. The broker server, quotas, mint logs, revocation and security page live on the platform side.
1775
1874
 
1776
- **What it does NOT do (yet)**:
1777
- - It does **not** create a bot token. GitHub App *installation* tokens can only be minted with the app's private key, and that key is held solely by RapierCraft Studios (the app's owner) — your installation grants *your* installation ID against *RapierCraft's* app, not a key you can use yourself.
1778
- - It does **not** auto-refresh anything, and there is no background process managing token expiry.
1779
- - It does **not** change which `gh` auth context pipeline commands (`/work-on`, `/orchestrate`, etc.) use. Every pipeline `gh` call always uses whatever auth is currently active in your shell — your personal token unless you've manually configured something else.
1780
- - It does **not** wire up webhook-driven "automatic pipeline triggers" — no webhook receiver exists yet.
1875
+ ### Bring your own App
1781
1876
 
1782
- **Why this matters**: GitHub App installation tokens get materially higher API rate limits than a personal access token, and actions taken with them are attributed to the bot (`rapiercraft-forgedock[bot]`) rather than your personal account. Those benefits are real, but delivering them to arbitrary installers requires a hosted token-minting backend service that doesn't exist yet (tracked as forge#1890). Installing the app today is safe and free, but on its own changes nothing about how the pipeline authenticates.
1877
+ `forgedock auth login --byo [--org ORG] [--installation N]` runs GitHub's App manifest flow through a loopback page, stores the App id and private key (`~/.forge/app-byo.pem`, 0600) and mints installation tokens locally. No third-party broker is involved.
1783
1878
 
1784
- `npx forgedock doctor` reports this status explicitly (Check 12: "GitHub App / bot token") so you aren't left guessing whether a bot token is active.
1879
+ ### Doctor
1785
1880
 
1786
- **If you want bot-token behavior today**: you'd need to register your own GitHub App (with your own private key), and drive your own token-refresh loop (mint an installation token via the app's `/app/installations/{id}/access_tokens` API, then `gh auth login --with-token`, repeating before the ~1-hour expiry). This is an advanced, self-hosted setup — ForgeDock does not package a generic version of this for you.
1881
+ `npx forgedock doctor` (Check 12, "GitHub App / bot token") shows the active identity, its source (`broker`, `byo` or personal fallback) and the `core.limit` of the active token. Without a login it keeps the earlier messages, including the refresh-stamp check for the self-hosted `scripts/refresh-bot-token.sh` setup.
1787
1882
 
1788
1883
  ---
1789
1884
 
@@ -69,6 +69,29 @@ The lane follows the repo rule: a milestone issue goes to `milestone/<slug>` (fo
69
69
 
70
70
  When agents and `gh` run as the ForgeDock App, the issues they file are authored by `rapiercraft-forgedock[bot]` with association `NONE`, so a watch skips them. `trust_app: true` (default false) claims issues authored by this repo's own ForgeDock App. Other bots and outsiders (`NONE` humans) stay excluded. It is an explicit opt-in because the App also files issues from untrusted inputs (prod-watch, ingestion). `trust_app_labels: [operator]` (needs `trust_app`) narrows it further: the App issue must carry one of those labels. `follow-up:` issues from the App still follow `include_followups`.
71
71
 
72
+ ## Parity with an owner-run intake script
73
+
74
+ A watch never claims a pull request: only issues are listed, a PR-shaped item is dropped, a `search` that selects PRs (`is:pr`, `type:pr`) fails the watch at load, and an issue an open PR closes is skipped (`skip #N: open closing PR #M`). `skip_labels` (default for `mode: batch`: `epic`, `needs-human`, `post-deploy`, `workflow:merged`, `awaiting-promotion`, `host-task`) skips by label. One watch per selector gives each its own created-since window:
75
+
76
+ ```yaml
77
+ issue_watch:
78
+ watches:
79
+ nomilestone: { milestone: none, since: 2026-11-08T00:00:00Z, include_followups: defer-only, postdeploy_rollup: 100, mode: batch }
80
+ release-1-5: { milestone: "1.5", since: 2026-11-01T00:00:00Z, include_followups: defer-only, postdeploy_rollup: 100, mode: batch }
81
+ ```
82
+
83
+ `--dry-run` lists what each would claim. A batch that reported is never added to: the next claims start a new one.
84
+
85
+ ## Release pause and liveness
86
+
87
+ With `release_pause` (default in `mode: batch`) the watch pauses while a `forgedock release` job is in flight (its `~/.forge/releases/<id>/state.json` has no end `status` and was written in the last 6 hours): no claims, retries or decisions. The next pass after the job ends resumes by itself. Every pass writes `heartbeat` to `status.json`, and `forgedock issue-watch status` prints it:
88
+
89
+ ```
90
+ state: paused (release r20261110-110000-9 in flight (preflight)) last heartbeat: 2026-11-10T12:00:00.000Z (30s ago)
91
+ ```
92
+
93
+ `running`, `paused`, `stale` (no heartbeat for 3 intervals: the watch is not running) or `done`. `watchLiveness` (`bin/lean/issuewatch-parity.mjs`) is the read for tools such as doctor; it never greps processes.
94
+
72
95
  ## Dry run
73
96
 
74
97
  In `per-issue` and `batch` mode, `forgedock issue-watch run --name <w> --dry-run` prints what one pass would claim and why, then the needs-human classification. It writes nothing: no claim, no status, no launch.
@@ -67,6 +67,7 @@ An absent or unknown code is recorded as `unclassified`, with the raw reason kep
67
67
  | `sandbox.unreachable` | The remote sandbox provider stayed unreachable (connection refused/reset, `fetch failed`, timeout, 502/503/504) for `execution.unreachable_window_min` while a lane polled or adopted its sandbox (forge#4672). `deferred`, requeued after 60s; not counted by the engine-error circuit breaker. The sandbox is NOT torn down: the next attempt or `--resume` adopts it | orchestrate | `bin/lean/execution.mjs` `providerLanes` poll guard |
68
68
  | `lease.held` | Another live agent holds the issue lease | engine | Foreign live lease on acquire |
69
69
  | `dependency.open` | A dependency is still open: a trusted `**Depends on**: #N` line refused the run before any state write, or the core builder reported `block.kind: "dependency"` naming an issue that is open. Carries `dependencies`; never `needs-human`. `forgedock orchestrate` adds the edge and requeues the issue behind it, without skipping dependents | engine, lean | Trusted `**Depends on**` line, or `result.json` `block.issues`, + the dependency issue's live open state |
70
+ | `design.invalidated` | Core work-on: the builder reported `block.kind: "design-invalidated"` (a decision or interface no longer holds). The engine files one spike-amendment issue, holds the affected open siblings behind it with `**Depends on**` edges, and requeues the lane. Carries `dependencies`, `amendment`, `epic`; never `needs-human`. The rework-share rollup counts it | lean | `result.json` `block` + the `FORGE:REPLAN` comment |
70
71
  | `dependency.unreadable` | The issue body or a declared dependency could not be read, so the run was refused (fail closed) | engine, lean | Failed or unparsable `gh api` / `gh issue view` read |
71
72
  | `dependency.blocked` | Core work-on: the builder's dependency is open and itself labelled `needs-human`. Terminal reason `dependency-blocked` (blocked by #X); this issue is not labelled `needs-human` | lean | `result.json` `block.kind: "dependency"` + the dependency's `needs-human` label |
72
73
  | `lane.mismatch` | Core work-on: `--lane` differs from the lane worked out from the issue (milestone → `branches.feature_pattern`, else `branches.staging`); refused before any lease, comment or worktree. `--lane-override` forces it and is recorded in the trajectory. A resumed PR whose base is not the lane is refused the same way before merge | lean | Issue milestone + forge.yaml `branches`, or the open PR's `baseRefName` |
package/docs/REPLAY.md ADDED
@@ -0,0 +1,9 @@
1
+ # Replay time-lapse
2
+
3
+ `forgedock replay --timelapse <batch-id|epic-number> [--repo owner/repo] [--out dir] [--format gif|mp4] [--duration 30-90] [--events file]`
4
+
5
+ Renders a time-lapse of a recorded batch or epic: issues appearing, lanes starting, PRs opening and merging, the release gate passing, with a clock and a running cost counter. The video is 30-90 s (default 60) however long the real run took.
6
+
7
+ - **Data**: the local lifecycle event log (`~/.forge/events/<owner>_<repo>.jsonl`, see `docs/EVENTS.md`; `FORGE_EVENTS_DIR` or `--events` override). A batch id takes its issues from the batch plan (`~/.forge/batches/<id>/plan.json`); an epic number takes the `#N` references in the epic body.
8
+ - **Read-only**: no model call and no GitHub writes. The only `gh` calls are an `issue view` read for an epic, and the runner refuses anything else.
9
+ - **Output** (`--out`, default `timelapse-<id>/`): `frames/frame-NNNN.txt`, `timelapse.tape` and `timelapse.json`. When `vhs` is on PATH the tape is rendered to `timelapse.gif` or `timelapse.mp4`; otherwise the command is printed (`cd <out> && vhs timelapse.tape`). Nothing is installed.
package/docs/SELFTEST.md CHANGED
@@ -5,6 +5,7 @@ The engine's unit tests mock `gh`, git and the pool transport, so defects such a
5
5
  ```
6
6
  forgedock selftest --static
7
7
  forgedock selftest --live [--repo <owner/sandbox>] [--lang node|python] [--pr <staging->main PR>]
8
+ forgedock selftest --journey [--repo <owner/sandbox>] [--pr <N>] [--update-snapshots]
8
9
  ```
9
10
 
10
11
  `--live` also runs the static check. The sandbox repo comes from `--repo` or `selftest.sandbox_repo` in forge.yaml ([CONFIG.md](CONFIG.md#selftest-optional)). Run it on the host or the pool, not in GitHub Actions. The exit code is non-zero and the output names the failed step.
@@ -32,3 +33,13 @@ With `--pr N`, the PR head is read before the run (from `--release-repo`, else t
32
33
  ## Nightly run
33
34
 
34
35
  Off by default. Set `selftest.nightly_interval_hours` (see [CONFIG.md](CONFIG.md#selftest-optional)) and the schedd daemon starts `selftest --live --nightly-report <repo>` on the host, as a detached process, once that many hours have passed since that repo's last run (last run time cached per repo in `selftest-nightly-<owner>_<repo>.json` under the sched dir). The daemon never runs the harness itself, so a long run never holds its other sweeps. It never runs on GitHub Actions. A failing run, including one that cannot start (for example no `selftest.sandbox_repo`, step `config`) or a harness crash, files one issue titled `selftest --live failed at step <step> (nightly)` carrying `<!-- FORGE:SELFTEST_NIGHTLY -->`; the next failure edits that open issue instead of filing another. A passing run writes nothing. The issue lives in the repo schedd resolves for the working directory, and the sandbox repo must be set by `selftest.sandbox_repo`.
36
+
37
+ ## New-user journey
38
+
39
+ `forgedock selftest --journey` (#5305) checks what a first-time user sees, which the mocked unit tests and `--live` do not. Run it on the host before each release, never in GitHub Actions.
40
+
41
+ 1. **Clean environment**: `npm pack`, then `npx --package <tarball> forgedock` in a container holding only Node and git (`docker run --rm`, image `node:22`, override with `FORGE_JOURNEY_IMAGE`; without Docker, a throwaway HOME and a PATH of only node, git and the shell basics). It runs the bare command (the not-ready output), `help`, `doctor` and an unknown command. It fails on: success wording on a machine without gh and Claude Code (steps `banner`), a doctor that exits 0 or does not name the missing tools (`doctor`), raw runtime error text (`errors`), placeholder values in a `forge.yaml` it wrote (`files`), and a CLI that does not start.
42
+ 2. **Sandbox repo**: needs `gh` authenticated and Claude Code; otherwise skipped with a note. In a fresh directory it runs `demo --repo <sandbox>` (`setup`), `doctor` (must exit 0), and `demo --run` (`first-merge`), then requires a PR merged after the start. It prints the time to first merged PR and every prompt shown, and always removes the directory and closes the issues it opened.
43
+ 3. **Snapshots**: the scrubbed output (ANSI, paths, versions and timings removed) is compared with `bin/tests/fixtures/journey-snapshots/*.txt` (`banner`, `help`, `doctor`, `errors`, and `not-ready` for exit codes and the files written). A wording change fails with the file and line; review it and run with `--update-snapshots` to accept it, so the change shows in the diff.
44
+
45
+ The sandbox repo comes from `--repo` or `selftest.sandbox_repo`; the harness refuses the project repo and the release repo. With `--pr N` the result is posted on the release PR as `<!-- FORGE:JOURNEY result=pass|fail sha=<head> step=<failed step|none> ttfm=<seconds|na> -->`, next to the review's `GATE_PASS`. It is a separate marker from `FORGE:SELFTEST` and is informational: `review-staging` does not read it.
package/docs/STATS.md CHANGED
@@ -18,6 +18,16 @@ version (the table embedded in the staging review summary). `--json` is machine-
18
18
  is resolved to its tag time minus one day; an unknown tag falls back to a full crawl and says so on stderr). Progress is
19
19
  printed to stderr while crawling, so `--json` stdout stays parseable.
20
20
 
21
+ ## Feature scoreboard (`--milestone <id|title>`, forge#5341)
22
+
23
+ `forgedock stats --milestone <number|title> [--repo <owner/repo>] [--json]` grades a whole milestone from GitHub (its issues, PRs and
24
+ epic FORGE:ACCEPTANCE comments) and the local run logs, with no manual input. Columns: journey status at ship (pass, fail or
25
+ never-ran, per epic with head and time); minutes from the first lane merge to the first green journey; defects created after the last
26
+ planned child closed, by class (`release-review`, `post-deploy`, `hotfix`, `other`, from labels or title); rework share (issues whose body
27
+ says fix/redo/rework/follow-up of a sibling `#N`, or labelled `rework`); operator interventions (hand PRs whose head branch is not a
28
+ `<type>/issue-N` lane branch, PRs labelled `manual-merge`, plus `needs-human` issues); cost from the run logs. A signal that cannot be read prints n/a. `--json`
29
+ keeps the earlier verdict mix under `query.mix` and adds `query.scoreboard`. The feature benchmark is in `docs/eval/feature-bench.md`.
30
+
21
31
  ## Sources
22
32
 
23
33
  1. **GitHub (primary).** Issues, PRs and labels of the target repo, plus trusted `<!-- FORGE:TELEMETRY v1 -->` comments
@@ -114,8 +124,11 @@ for post-merge defect signals; `--offline` skips that crawl (defects print n/a,
114
124
 
115
125
  Columns per cell: n, merge rate, first-pass rate, needs-human rate, median cost, median wall minutes, median wall/model
116
126
  time, review findings per lane (conformance failures + verifier findings) and the share of lanes with any, conformance
117
- failure rate, and the post-merge defect rate (a reopen, a revert naming the PR, or a `fix`/`bug` PR touching the same
118
- non-test files within 7 days) over merged lanes with known defect data.
127
+ failure rate, and the post-merge defect rate over merged lanes with known defect data. A defect is any of the
128
+ `--conformance-outcomes` signals within 7 days (#5364): reverted, reopened, cited (a later PR names the PR or issue as
129
+ the cause), or `same_hunks` (a later fix PR's old-side lines git-blame to the lane's merge commit). `same_hunks` needs a
130
+ local clone of the repo (run from it); without one a lane with no other signal is n/a, counted as unresolved. Each fix PR
131
+ is blamed once per run (`same-hunks i/N` progress goes to stderr).
119
132
 
120
133
  Cells are grouped by verdict (eligible, ambiguous, ineligible) and by every reason and signal code (`hotspot`,
121
134
  `churn_high`, `label_docs`, `size_S`, ...), so outcomes can be attributed to each signal.
@@ -190,6 +203,10 @@ crawl). Every RUN_START slice of each log counts, so re-running an issue with th
190
203
 
191
204
  `--json` prints the same data as `query.explore_ab`.
192
205
 
206
+ ## Issue origin (`--origin`, forge#5294)
207
+
208
+ `forgedock stats --origin [--repo owner/repo] [--since <date>] [--json]` splits the issues opened in the window (default: last 30 days) into requested (human author), production (`FORGE:PRODWATCH` marker or `prod-watch` label), review-finding (`review-finding`/`staging-review` labels), follow-up (`FORGE:DEFERRED_FROM`, rollup markers) and unknown (no positive evidence; never assumed requested). For each origin it prints the count, the cost from trusted `FORGE:TELEMETRY` runs and how many issues have no recorded cost (counted apart, never as $0). Outcomes are merged, closed-invalid (not planned, duplicate, `invalid`/`duplicate`/`wontfix` label), other-closed and open. The last line gives the pipeline-originated share of recorded cost.
209
+
193
210
  ## Sections (per version and repo)
194
211
 
195
212
  - **Cost**: cache-read tokens per issue (mean, median), per phase (mean over all runs, so phases add up to the per-issue
@@ -30,6 +30,12 @@ Per-release pipeline evaluation results for ForgeDock. Every scorecard here was
30
30
 
31
31
  ---
32
32
 
33
+ ## Adversarial benchmark
34
+
35
+ Full lane vs a bare `claude -p` session on 20 issues, 12 of which must be closed instead of implemented (#5292). Corpus: `corpus/adversarial-v1.json`. Reproduce it with [adversarial-bench.md](adversarial-bench.md). Its scorecards are published as `published/adversarial-<date>.md`; none has been run yet.
36
+
37
+ ---
38
+
33
39
  ## Scorecard schema
34
40
 
35
41
  Every file in `published/` is a JSON object with the following fields:
@@ -0,0 +1,68 @@
1
+ # Adversarial benchmark: full lane vs bare agent (#5292)
2
+
3
+ This benchmark checks the claim that a fixed process beats a bare agent session when the issues are not all valid. The corpus has 20 issues over more-itertools at `670b715`. Of these, 12 must **not** be implemented, and 5 only pass if the change reaches a second integration point.
4
+
5
+ - Harness: `scripts/bench-adversarial.mjs`. It is a sibling of `scripts/bench-lightlane.mjs` (#4453) and reuses its arm runner, so the arms are run and costed the same way.
6
+ - Corpus: `docs/eval/corpus/adversarial-v1.json`
7
+ - Arms: `full` (`forgedock run-issue` with the light lane off) and `control` (a plain `claude -p` session).
8
+
9
+ ## Corpus
10
+
11
+ | Kind | Count | Correct outcome | What a bad arm does |
12
+ |---|---|---|---|
13
+ | `valid` | 3 | Implement; the upstream fix tests (oracle) pass | Fails the oracle |
14
+ | `wrong-premise` | 5 | Close with evidence: the behaviour reported as broken is correct at the base | Implements a change anyway (a *wrong issue implemented*) |
15
+ | `duplicate` | 4 | Close with evidence: the feature exists | Adds a second function (a *duplicate implementation*) |
16
+ | `already-fixed` | 3 | Close with evidence: it already ships at the base | Implements it again |
17
+ | `integration` | 5 | Implement in `more.py` and also touch `more.pyi` and `docs/api.rst` | Skips a file (an *integration point missed*) |
18
+
19
+ Each invalid issue has `evidence: {file, pattern}`. The pattern must match the file at the base commit. `calibrate` checks this.
20
+
21
+ ## Prerequisites and run config
22
+
23
+ Same as `docs/eval/lightlane-bench.md`: `python3`, `git`, `gh`, `claude` and `forgedock` on PATH, plus one **private sandbox repo** for the full arm. The base SHA must exist in it, and its `forge.yaml` sets `lean:` → `light:` → `mode: off`. File the corpus issues in the sandbox with the title and body taken verbatim from the corpus:
24
+
25
+ ```sh
26
+ jq -c '.issues[]' docs/eval/corpus/adversarial-v1.json | while read -r i; do
27
+ gh issue create -R <you>/mi-full --title "$(jq -r .title <<<"$i")" --body "$(jq -r .body <<<"$i")"
28
+ done
29
+ ```
30
+
31
+ `runcfg.json` (not committed) maps each corpus id to its sandbox issue number for `full`, and sets the model for `control`:
32
+
33
+ ```json
34
+ { "arms": { "full": { "repo": "<you>/mi-full", "issues": { "adv-valid-1293": 1, "adv-wp-chunked-tail": 2 } }, "control": { "model": "claude-opus-5-5" } } }
35
+ ```
36
+
37
+ List every corpus id under `full.issues` (20 entries). Use the same model in both arms and no web tools.
38
+
39
+ ## Steps
40
+
41
+ ```sh
42
+ # 1. The corpus shape (20 issues, at least 5 invalid) and its evidence at the base
43
+ node scripts/bench-adversarial.mjs validate --corpus docs/eval/corpus/adversarial-v1.json
44
+ node scripts/bench-adversarial.mjs calibrate --corpus docs/eval/corpus/adversarial-v1.json
45
+ # 2. Run both arms (sequential; appends one graded JSON row per arm and issue)
46
+ node scripts/bench-adversarial.mjs run --corpus docs/eval/corpus/adversarial-v1.json --config runcfg.json --out rows.jsonl
47
+ # 3. Aggregate into the published scorecard
48
+ node scripts/bench-adversarial.mjs aggregate rows.jsonl --corpus docs/eval/corpus/adversarial-v1.json \
49
+ --model claude-opus-5-5 --date YYYY-MM-DD --scorecard docs/eval/published/adversarial-YYYY-MM-DD.md
50
+ ```
51
+
52
+ Use `--arms control` or `--issues id,id` to rerun part of the set, and `--keep` to keep the scratch clones.
53
+
54
+ ## Metrics (per arm)
55
+
56
+ | Metric | Definition |
57
+ |---|---|
58
+ | Wrong issues implemented | Rows of kind `wrong-premise`, `duplicate` or `already-fixed` where the arm claimed a fix (a merged or ci-pending lane, or a control that exited cleanly) with a non-empty diff. Lower is better. |
59
+ | Duplicate implementations created | A `duplicate` row that claimed a fix and whose diff adds a line matching one of the issue's `forbid_new_defs` patterns. |
60
+ | Integration points missed | For each `integration` row, the number of `must_touch` paths absent from the diff against the base. |
61
+ | Oracle pass rate | Over the rows with an oracle (`valid`): the upstream fix tests pass after being overlaid on the arm's head. |
62
+ | Cost and wall time | Sum of `cost_usd` and `wall_ms`, as in `lightlane-bench.md`. |
63
+
64
+ Grading is deterministic: the diff paths and added lines, never an LLM. The scorecard records the run date, the model and the corpus revision (`version@base+<hash of the corpus file>`).
65
+
66
+ ## Published scorecard
67
+
68
+ Scorecards live in `docs/eval/published/adversarial-<date>.md`. No run has been published yet: it needs API spend and private sandbox repos (#5292 follows up).