forgedock 1.57.0 → 1.58.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.
package/docs/CONFIG.md CHANGED
@@ -758,7 +758,7 @@ gate:
758
758
 
759
759
  ## `release` (OPTIONAL)
760
760
 
761
- 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.
761
+ 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. `forgedock release status [<id>] [--watch] [--interval s] [--json]` (bare `forgedock release --watch` runs the same loop) and `forgedock release explain <id | #issue | PR> [--json]` (#5554) are read-only: status reads the ledger (when `release.managed`) or the local cache plus the release PR's gate; `--watch` polls until the release is done, refused or blocked. `explain #N` prints the ordered rule trace (skip labels, priority, theme_map, `Depends on`, recorded release set, each with its config key), the lane and what would change it; `explain <PR>` prints the gate decision. `--json` output has schema `forgedock.release.status/v1` or `forgedock.release.explain/v1` and `next_actions[]`, the exact commands an agent may run; output carries no host name, so another host prints the same text. `status --watch [--interval s]` prints only when the output changes and stops at a terminal state; `forgedock release --watch` runs the same loop. Status prints `unknown` for any field the ledger does not hold. `explain #N` also reads the `FORGE:CLASSIFY` record (else `classification: absent`), `plan.skip_labels`, `classify.min_confidence`, `risk.rules[i]`, `forces[i]`, prints `planner: not installed` until the planner registers, and takes the lane from the latest `lane` entry in `controls.jsonl`; `explain <PR>` lists each required check with its outcome and any demotion (actor, expiry, reason, issue). `next_actions[]` carries `hold|resume|cancel` and `lane #N --force <lane>` commands (the `release-control.mjs` verbs) with `--reason <reason>` placeholders; there is no `rollback` verb yet, so none is emitted. `explain <PR>` reads the live `_active.exemptions` records (`release exempt`), `explain #N` the `_active.lanes` records.
762
762
 
763
763
  ```yaml
764
764
  release:
@@ -779,6 +779,8 @@ release:
779
779
 
780
780
  `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.
781
781
 
782
+ `forgedock release verify <release id>` (#5562) re-runs the deploy verification of a release that passed LIVE_CHECK; a release id (`rYYYYMMDD-HHMMSS-N`) is never mistaken for a sha. Policy `verify` block (default branch, `.forge/release.yaml`): `results` (list of `{workflow, kind: smoke|edge|convergence}`, layer 1), `workflow` (verification workflow dispatched through the epoch fence, layer 2), `slis` (layer 3, entries `{name, tolerance, worse: higher|lower, abs}` read through an injected read-only metric source; without one the layer reports `sli: skipped (no host)`), `post_deploy_checks_file` (layer 4, each issue's `[check:id]` runs once; entries with `for` are windowed and become rollup follow-ups), `flags` (layer 5, `{flag, off_command}` verified in the off state, never activated) and `close_requires: verified|deployed`. With `verified` (default once the block is set) an issue is closed only after a `FORGE:VERIFIED <deploy sha>` comment; `deployed` closes without it. Soak minutes by risk class: low 10, medium 20, full 30, p0 15, overridden by `lanes.<lane>.soak_min` (a number or a map by class). An empty `verify` block leaves VERIFYING a bare transition to LIVE.
783
+
782
784
  ### `.forge/release.yaml` (#5551)
783
785
 
784
786
  Nested release policy (`schema: 1`) lives in a committed `.forge/release.yaml`, not in the host-local forge.yaml. It is read from the default branch with `git show origin/<default>:.forge/release.yaml`, never from the PR head or the worktree, so a PR cannot weaken its own gates. The flat `release.*` keys above stay the fallback when the file is absent there. Sections: `branches`, `trust`, `state`, `units`, `couplings`, `contracts`, `forces`, `classify`, `risk`, `plan`, `lanes`, `merge`, `ci`, `preflight`, `deploy`, `verify`, `rollback`, `controls`.
@@ -833,6 +835,22 @@ budget:
833
835
 
834
836
  The release state (and so the ledger) records `lane` and `minutes: {runs, total}`, where total is the sum of ceil(job minutes) of the Actions runs created since the release started, read from the jobs API.
835
837
 
838
+
839
+ ### Deploy gate catalogue and false-block telemetry (#5583)
840
+
841
+ Optional; with no `.forge/gates.yaml` (on the ref) every command below is a no-op with zero writes. `forgedock release check-config` validates the file when present. Fields per gate under `gates:` (`schema: 1`): `id`, `protects_against` (origin issue), `where`, `determinism`, `pre_merge_artifact` (fixture), `version`, `mode` (`block|skip|rollback|freeze|warn|red`), `owner`, `review_by` (`YYYY-MM-DD`); admission also needs `on_uncertainty: inconclusive`, `failure_triggers` and `proportionality`.
842
+
843
+ `.forge/release.yaml` `gates:`: `demote_fb_rate` (percent, default 5), `demote_window` (runs, default 20), `safety` (never demoted; default `migration-immutability`, `identity-preflight`, `backup-freshness`, `health-auto-restore`, plus the unskippable classes).
844
+
845
+ A `deploy-telemetry` job prints one JSON line per gate per run: `{"schema":"forgedock.release.gate/v1","gate":"<id>","outcome":"pass|fail|inconclusive|skip","class":"TP|FB|unknown","minutes":<n>,"evidence":"<text>"}`. A `TP`/`FB` class without `evidence` is stored as `unknown`. `forgedock release gates record <release-id> --file <jsonl>` stores the lines in the release state (`gates`). When `FORGE_GATE_TELEMETRY` names such a JSON-lines file and a catalogue exists, the release run stores its lines in `state.gates` next to `state.minutes` automatically; `historyFromRoot` exposes them as its `gates` property.
846
+
847
+ | Command | Description |
848
+ |---------|-------------|
849
+ | `release gates [--since 30d] [--json]` | Per gate: `runs`, `fails`, `fb`, `fb_share` (FB runs / runs, in percent), `minutes`. Text: a tab-separated header `gate runs fails fb fb_share minutes` and one row per gate. JSON: one line `{"schema":"forgedock.release.gates/v1","gates":[{gate,runs,fails,fb,minutes,fb_share}]}`. |
850
+ | `release gates check [--base <ref>]` | Fails for a gate added or changed against the base ref (default `origin/<default>`) that lacks the fixture, version, `on_uncertainty: inconclusive`, failure trigger with proportionality, or owner and `review_by`. |
851
+ | `release gates demote` | A gate whose FB rate over the last `demote_window` runs (a full window) exceeds `demote_fb_rate` is demoted to `warn` for 14 days via the audited `release demote` control, and an issue is filed. Safety gates are never demoted. |
852
+ | `release promote <gate> --fixture <ref> --reason <text>` | Re-promotes a demoted gate; refused without a fixture reference. |
853
+
836
854
  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.
837
855
 
838
856
  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:
@@ -1014,6 +1032,7 @@ lean:
1014
1032
  fix_model: claude-sonnet-5-5 # optional model of fresh fix-round sessions (default: the reviewer model)
1015
1033
  builder_routing: on # on (default) | off: route the build to a mid-tier model by the frozen contract
1016
1034
  builder_mid_model: claude-sonnet-5-5 # optional mid-tier builder model (default claude-sonnet-5-5)
1035
+ contract_max_corrections: 3 # #5623: builder correction rounds for a builder-correctable invalid contract before it ends contract.invalid (which a batch then requeues once with a fresh plan)
1017
1036
  light:
1018
1037
  mode: shadow # off | shadow (default) | on: light-lane eligibility (#4448; lane wiring #4450)
1019
1038
  max_lines: 40 # upgrade to the full lane above this many non-test diff lines
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgedock",
3
- "version": "1.57.0",
3
+ "version": "1.58.0",
4
4
  "description": "An AI engineering team that ships to production",
5
5
  "bin": {
6
6
  "forgedock": "bin/forgedock.mjs"
@@ -265,10 +265,29 @@ function ecosystemTests(sctx, tests) {
265
265
  // Which of testFiles can this change reach? { selected, total, widen } ; widen is a reason string or ''.
266
266
  // `universe` is the repo-wide test set used only for the SEC-3 reach check: a step that runs ONE test must not widen just
267
267
  // because the change does not reach that test, only because it reaches no test anywhere. Selection stays within testFiles.
268
+ // #5583 follow-up: a test that enumerates the tree itself (git ls-files, find -name/-path, git grep), directly or through a
269
+ // script it names, is a repo-wide lint: any change can trip it (a new file that breaks a convention names no test), so the
270
+ // reference graph can never select it. Such tests are always selected; they are cheap scans by nature.
271
+ const TREE_SCAN_RE = /\bgit\s+(ls-files|grep)\b|\bfind\s+\S+(\s+-maxdepth\s+\d+)?\s+-(name|path|iname|type)\b/;
272
+ export function treeScanTest(sctx, t) {
273
+ const memo = (sctx.cache.treeScan ??= new Map());
274
+ if (memo.has(t)) return memo.get(t);
275
+ const read = (f) => { try { return fs.readFileSync(path.join(sctx.repo, f), 'utf8'); } catch { return ''; } };
276
+ const body = read(t);
277
+ let hit = TREE_SCAN_RE.test(body);
278
+ if (!hit) { // one hop: scripts the test names (e.g. foo.test.sh runs foo.sh)
279
+ const named = [...new Set(body.match(/[\w./-]+\.(sh|bash|mjs|js|py)\b/g) ?? [])].flatMap((x) => x.split('/').map((_, i, a) => a.slice(i).join('/'))).filter((x) => x && x !== t && sctx.present.has(x)); // every path suffix: $ROOT/scripts/x.sh -> scripts/x.sh
280
+ hit = named.some((f) => TREE_SCAN_RE.test(read(f)));
281
+ }
282
+ memo.set(t, hit);
283
+ return hit;
284
+ }
285
+
268
286
  export function impactedTests(sctx, testFiles, universe = testFiles) {
269
287
  const r = reach(sctx);
270
288
  if (r.widen) return { selected: [...testFiles], total: testFiles.length, widen: r.widen };
271
289
  const selected = new Set();
290
+ if (sctx.changed.length) for (const t of testFiles) if (sctx.present.has(t) && treeScanTest(sctx, t)) selected.add(t);
272
291
  for (const t of testFiles) if (r.files.has(t) && sctx.present.has(t)) selected.add(t);
273
292
  for (const f of sctx.changed) if (!isTestFile(f)) for (const t of siblingTests(f, testFiles)) selected.add(t);
274
293
  // forge#4040 (SEC-3, per file): every changed non-test source file must itself reach at least one test (reverse-reference
@@ -598,6 +598,19 @@ eq "SEC-3: the widened selection is the full set" 3 "$(printf '%s' "$R" | jq '.s
598
598
  R=$(_imp README.md)
599
599
  eq "SEC-3: a docs-only change still selects nothing (no widening)" '[]' "$(printf '%s' "$R" | jq -c '.sel')"
600
600
 
601
+ # #5583 follow-up: a tree-scanning lint test (find/git ls-files, directly or via a script it runs) is selected for any change
602
+ r=$(blank); mkdir -p "$r/scripts" "$r/bin"
603
+ printf '#!/bin/bash\nfind "$1/bin" -name "*.test.mjs" | while read -r f; do grep -q tmpDir "$f" || echo "VIOLATION: $f"; done\n' > "$r/scripts/check-tmp.sh"
604
+ printf '#!/bin/bash\nout=$(bash "$ROOT/scripts/check-tmp.sh" .)\n[ -z "$out" ]\n' > "$r/scripts/check-tmp.test.sh"
605
+ printf '#!/bin/bash\n[ 1 -eq 1 ]\n' > "$r/scripts/plain.test.sh"
606
+ commit_base "$r"
607
+ _imp2() { node -e "
608
+ import('$ROOT/scripts/ci-local/scoping.mjs').then(m=>{const c=process.argv.slice(1);const s=m.makeScopeCtx({repo:'$r',baseRef:'main',from:'main',changed:c});
609
+ const t=['scripts/check-tmp.test.sh','scripts/plain.test.sh'];const r=m.impactedTests(s,t);console.log(JSON.stringify({sel:r.selected,widen:r.widen}))})" "$@"; }
610
+ echo 'import x from "y";' > "$r/bin/new.test.mjs"
611
+ R=$(_imp2 bin/new.test.mjs)
612
+ eq "tree-scan: a new test file selects the lint that scans the tree (via the script it runs)" '["scripts/check-tmp.test.sh"]' "$(printf '%s' "$R" | jq -c '.sel')"
613
+
601
614
  # item 4 (REG-3): the built-in bash-3.2/GNU portability job runs only when CI targets macOS/Windows
602
615
  r=$(blank); mkdir -p "$r/.github/workflows" "$r/scripts"
603
616
  cat > "$r/.github/workflows/ci.yml" <<'YML'