forgedock 1.54.1 → 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.
- package/bin/engine/events.mjs +1 -0
- package/bin/engine/events.test.mjs +5 -1
- package/bin/engine/outcome-codes.mjs +3 -0
- package/bin/engine-cli.mjs +126 -34
- package/bin/forgedock.mjs +54 -2
- package/bin/gc-schedule.mjs +83 -0
- package/bin/gc.mjs +56 -8
- package/bin/help-text.mjs +1 -1
- package/bin/hooks/pre-tool-use.mjs +1 -0
- package/bin/init-detect.mjs +73 -2
- package/bin/labels.json +5 -0
- package/bin/lean/admission.mjs +21 -1
- package/bin/lean/baselines.mjs +43 -0
- package/bin/lean/baselines.test.mjs +33 -0
- package/bin/lean/batch-health.mjs +43 -6
- package/bin/lean/batch-health.test.mjs +41 -1
- package/bin/lean/batch.mjs +41 -4
- package/bin/lean/batch.test.mjs +106 -3
- package/bin/lean/conformance.mjs +131 -12
- package/bin/lean/conformance.test.mjs +172 -3
- package/bin/lean/depcache.mjs +23 -2
- package/bin/lean/depcache.test.mjs +22 -0
- package/bin/lean/docsgate.mjs +137 -0
- package/bin/lean/docsgate.test.mjs +78 -0
- package/bin/lean/effects.mjs +31 -2
- package/bin/lean/enumerating.mjs +39 -13
- package/bin/lean/enumerating.test.mjs +20 -0
- package/bin/lean/execution.test.mjs +3 -3
- package/bin/lean/fastforward.mjs +93 -0
- package/bin/lean/fastforward.test.mjs +73 -0
- package/bin/lean/guardgate.mjs +38 -7
- package/bin/lean/guardgate.test.mjs +39 -0
- package/bin/lean/issuewatch-install.mjs +92 -0
- package/bin/lean/issuewatch-install.test.mjs +31 -0
- package/bin/lean/issuewatch-parity.mjs +33 -3
- package/bin/lean/issuewatch-parity.test.mjs +30 -5
- package/bin/lean/issuewatch-reconcile.mjs +123 -0
- package/bin/lean/issuewatch-reconcile.test.mjs +30 -0
- package/bin/lean/issuewatch-verify.mjs +51 -9
- package/bin/lean/issuewatch.mjs +153 -33
- package/bin/lean/issuewatch.test.mjs +243 -22
- package/bin/lean/lean.mjs +381 -75
- package/bin/lean/lean.test.mjs +437 -20
- package/bin/lean/light.mjs +11 -3
- package/bin/lean/light.test.mjs +27 -0
- package/bin/lean/lightlane.mjs +8 -3
- package/bin/lean/lightlane.test.mjs +20 -0
- package/bin/lean/mechfix.mjs +21 -2
- package/bin/lean/mechfix.test.mjs +28 -1
- package/bin/lean/orchestrate-children.test.mjs +10 -0
- package/bin/lean/orchestrate-owned.test.mjs +73 -0
- package/bin/lean/orchestrate.mjs +28 -4
- package/bin/lean/overlap.mjs +20 -0
- package/bin/lean/overlap.test.mjs +49 -0
- package/bin/lean/pagegate.mjs +152 -0
- package/bin/lean/pagegate.test.mjs +77 -0
- package/bin/lean/parked-relabel.mjs +32 -0
- package/bin/lean/parked-relabel.test.mjs +45 -0
- package/bin/lean/phaseledger.mjs +17 -2
- package/bin/lean/postdeploy-check.mjs +27 -0
- package/bin/lean/postdeploy-check.test.mjs +13 -1
- package/bin/lean/postrun.mjs +32 -0
- package/bin/lean/postrun.test.mjs +41 -0
- package/bin/lean/preflight.mjs +46 -0
- package/bin/lean/preflight.test.mjs +30 -1
- package/bin/lean/prompts.mjs +36 -6
- package/bin/lean/recovery.test.mjs +16 -0
- package/bin/lean/release.mjs +23 -2
- package/bin/lean/release.test.mjs +28 -1
- package/bin/lean/render.mjs +17 -6
- package/bin/lean/reproquality.mjs +116 -0
- package/bin/lean/reproquality.test.mjs +85 -0
- package/bin/lean/review-trigger.mjs +8 -3
- package/bin/lean/sandbox-budget.test.mjs +27 -0
- package/bin/lean/schedd.mjs +40 -11
- package/bin/lean/schedd.test.mjs +12 -1
- package/bin/lean/testadequacy.mjs +97 -0
- package/bin/lean/testadequacy.test.mjs +92 -0
- package/bin/lean/testsandbox.mjs +202 -0
- package/bin/lean/testsandbox.test.mjs +157 -0
- package/bin/lean/toolplace.mjs +5 -2
- package/bin/lean/toolplace.test.mjs +6 -0
- package/bin/lean/verify.mjs +6 -1
- package/bin/lean/verify.test.mjs +18 -2
- package/bin/lean/warmtree.mjs +77 -0
- package/bin/lean/warmtree.test.mjs +81 -0
- package/bin/stats/conformance-outcomes.mjs +12 -2
- package/bin/stats/depth.mjs +24 -1
- package/bin/stats/depth.test.mjs +21 -1
- package/bin/stats/index.mjs +5 -2
- package/bin/stats/query.mjs +2 -1
- package/commands/cleanup.md +18 -0
- package/commands/fd-introspect.md +19 -0
- package/commands/milestone.md +5 -1
- package/commands/pipeline-health/phase-2-metrics.md +4 -0
- package/commands/recover-orphans.md +31 -1
- package/commands/review-pr-staging.md +9 -0
- package/commands/review-pr.md +2 -0
- package/docs/CONFIG.md +26 -1
- package/docs/EVENTS.md +1 -0
- package/docs/ISSUE-WATCH.md +12 -3
- package/docs/eval/adversarial-bench.md +1 -1
- package/docs/eval/published/adversarial-2026-11-11.md +58 -0
- package/package.json +1 -1
- package/scripts/bench-lightlane.mjs +3 -2
- package/scripts/hotspots.sh +7 -4
- package/scripts/hotspots.test.sh +12 -0
- package/scripts/recover-orphans-stateless.test.sh +79 -0
- package/scripts/transition-label.sh +2 -0
- package/templates/workflows/forgedock-reopen-clean.yml +33 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Introspect lean-lane quality telemetry — trend test-adequacy and test-quality fields per window
|
|
3
|
+
argument-hint: "[window days, default 7]"
|
|
4
|
+
install: extras
|
|
5
|
+
---
|
|
6
|
+
<!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
|
|
7
|
+
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
|
8
|
+
|
|
9
|
+
# /fd-introspect — Lean Lane Test-Quality Trends
|
|
10
|
+
|
|
11
|
+
**Input**: $ARGUMENTS (default window: 7 days)
|
|
12
|
+
|
|
13
|
+
Trends the per-lane test-quality telemetry the lean engine writes on `RUN_TERMINAL` (#5449): `tests_declared`, `tests_ran`, `repro_quality`, `mutation_killed`, `regression_suite_ran`, `post_deploy_check_ids`. The batch report's `test adequacy:` line gives the adequate/weak/missing share per batch.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
forgedock stats --conformance-outcomes
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Per window report: `tests_ran / tests_declared`, the share of lanes with `repro_quality = red_green`, `mutation_killed` per lane, lanes that ran their regression suite, and issues reopened within 14 days split by test-adequacy class (adequate / weak / missing / n/a), which shows whether the gate pays off. A field absent on a lane means the input did not exist for it; do not count it as a failure. The same trend section runs in `/pipeline-health` (phase 2A2).
|
package/commands/milestone.md
CHANGED
|
@@ -167,6 +167,8 @@ For each proposed issue in the preliminary list, MUST read the actual code befor
|
|
|
167
167
|
3. **Write exhaustive acceptance criteria**: For coverage/refactor tasks, acceptance criteria MUST be falsifiable. A `grep`/absence assertion qualifies (e.g., `` `grep -rn 'hardcoded_value' commands/` returns no matches ``). The number of criteria must match the scope — there is no cap. Two criteria for a 14-call-site refactor is not acceptable.
|
|
168
168
|
4. **Identify override/companion files**: If a file needs a change, its companion files (config overrides, prod variants, sibling modules) almost certainly do too. List all of them.
|
|
169
169
|
|
|
170
|
+
**Docs child (forge#5419)**: when forge.yaml sets `docs.required_for` and any planned child touches a user-facing surface (public API endpoint, MCP tool, dashboard page, CLI command, SDK method), also create one child labelled `docs` in the same milestone, depending on those children: it names the docs pages to create or update and their registration (`docs.paths`, `docs.registries`). Without `docs.required_for`, create none.
|
|
171
|
+
|
|
170
172
|
**4C: Output format — per-issue, after code read**
|
|
171
173
|
|
|
172
174
|
For each proposed issue, after completing the per-issue investigation in Step 4B:
|
|
@@ -449,6 +451,8 @@ bash "$(forge_resolve milestone-drift.sh)" "{slug}" --format text
|
|
|
449
451
|
**Re-plan (forge#5342)**: a lane or journey run that finds the design wrong ends with a `design-invalidated` block; the engine files one spike-amendment issue and holds the affected open siblings behind it. After it merges, run `npx forgedock replan apply --amendment N --repo {REPO}` to mark each open child unchanged, re-scoped or dropped and update the epic checklist. A re-scoped user-visible child is routed to `/design` before build (forge#5330 owns the generic visual gate).
|
|
450
452
|
|
|
451
453
|
**Feature acceptance (forge#5336, hard gate)**: `npx forgedock acceptance gate --milestone "{TITLE}" --stage ship`. A non-zero exit (a journey is red or never ran on the branch head) blocks the ship; print its lines and stop. A milestone without an epic is not gated.
|
|
454
|
+
**Docs gate (forge#5419, hard gate)**: `npx forgedock docs gate --milestone "{TITLE}" --repo {REPO}`. A non-zero exit (user-facing children and no merged `docs` child) blocks the ship; print its lines and stop. Exit 0 when `docs.required_for` is unset.
|
|
455
|
+
|
|
452
456
|
|
|
453
457
|
```bash
|
|
454
458
|
# Check milestone branch exists
|
|
@@ -792,7 +796,7 @@ Protected branches get ONE sync PR (`sync/milestone-{slug}`) whose head is force
|
|
|
792
796
|
|
|
793
797
|
## Action: Close Milestone (without shipping)
|
|
794
798
|
|
|
795
|
-
For milestones that are abandoned or superseded: shipped milestones close only after `npx forgedock acceptance gate --milestone "{TITLE}" --stage close` exits 0 (post-deploy journeys passed; the epic keeps `awaiting-measurement` until then). Abandoning an unshipped milestone is not gated.
|
|
799
|
+
For milestones that are abandoned or superseded: shipped milestones close only after `npx forgedock acceptance gate --milestone "{TITLE}" --stage close` exits 0 and `npx forgedock docs gate --milestone "{TITLE}" --repo {REPO}` exits 0 (forge#5419) (post-deploy journeys passed; the epic keeps `awaiting-measurement` until then). Abandoning an unshipped milestone is not gated.
|
|
796
800
|
|
|
797
801
|
```bash
|
|
798
802
|
gh api repos/{owner}/{repo}/milestones/{MILESTONE_NUMBER} --method PATCH --field state="closed"
|
|
@@ -20,6 +20,10 @@ git log --oneline --since="$SINCE" -- commands/ docs/
|
|
|
20
20
|
|
|
21
21
|
Record each commit — these are the independent variables. Each prompt change is a hypothesis: "this change should improve X."
|
|
22
22
|
|
|
23
|
+
### 2A2: Test quality (FORGE:TELEMETRY, #5449)
|
|
24
|
+
|
|
25
|
+
The lean engine writes per-lane `tests_declared`, `tests_ran`, `repro_quality`, `mutation_killed`, `regression_suite_ran` and `post_deploy_check_ids` on the run's telemetry record, and the batch report prints a `test adequacy:` line (adequate/weak/missing share). Trend them per window: `tests_ran / tests_declared`, share of `repro_quality = red_green`, `mutation_killed` per lane, and how many lanes ran their regression suite. For the outcome check run `forgedock stats --conformance-outcomes`: it splits issues reopened within 14 days by test-adequacy class. A field absent on a lane means the input did not exist for it; do not count it as a failure.
|
|
26
|
+
|
|
23
27
|
### 2B: Review finding metrics (the primary quality signal)
|
|
24
28
|
|
|
25
29
|
```bash
|
|
@@ -148,7 +148,7 @@ for NUM in $ORPHAN_LIST; do
|
|
|
148
148
|
|
|
149
149
|
# Read current issue state
|
|
150
150
|
ISSUE=$(gh issue view "$NUM" ${GH_FLAG} \
|
|
151
|
-
--json number,title,labels,state,updatedAt,body 2>/dev/null)
|
|
151
|
+
--json number,title,labels,state,updatedAt,body,comments 2>/dev/null)
|
|
152
152
|
if [ -z "$ISSUE" ]; then
|
|
153
153
|
echo "#$NUM: Could not fetch — skipping"
|
|
154
154
|
continue
|
|
@@ -199,6 +199,36 @@ for NUM in $ORPHAN_LIST; do
|
|
|
199
199
|
continue
|
|
200
200
|
fi
|
|
201
201
|
|
|
202
|
+
# #5466: a needs-human annotation comment with no state label (needs-human, parked:*, remediation-queue, workflow:*) is a
|
|
203
|
+
# stateless orphan (a failed relabel removed needs-human): flag it and put needs-human back so a person is asked.
|
|
204
|
+
if echo "$ISSUE" | jq -e '[.comments[].body | contains("<!-- FORGE" + ":NEEDS_HUMAN")] | any' >/dev/null 2>&1 \
|
|
205
|
+
&& ! echo ", $ISSUE_LABELS," | grep -Eq ", (needs-human|parked:[^,]*|remediation-queue|workflow:[^,]*),"; then
|
|
206
|
+
# #5486: a person who removed needs-human after the annotation was posted cleared it on purpose: do not re-park.
|
|
207
|
+
NH_AT=$(echo "$ISSUE" | jq -r '[.comments[] | select(.body | contains("<!-- FORGE" + ":NEEDS_HUMAN")) | .createdAt] | max // ""')
|
|
208
|
+
# #5494: the pipeline's own removal (a failed #5466 relabel) is not a human clear: ignore events by the bot login
|
|
209
|
+
# (FORGE_BOT_LOGIN, else GraphQL viewer, never /user which 403s for App tokens) or by any actor of type Bot.
|
|
210
|
+
BOT_LOGIN="${FORGE_BOT_LOGIN:-}"
|
|
211
|
+
[ -n "$BOT_LOGIN" ] || BOT_LOGIN=$(gh api graphql -f query='{viewer{login}}' --jq '.data.viewer.login' 2>/dev/null || true)
|
|
212
|
+
NH_CLEARED=$(gh api "repos/${GH_REPO}/issues/$NUM/events" --paginate 2>/dev/null \
|
|
213
|
+
| jq -rs --arg at "$NH_AT" --arg bot "$BOT_LOGIN" '[.[][] | select(.event == "unlabeled" and .label.name == "needs-human" and .created_at > $at
|
|
214
|
+
and (.actor.type // "") != "Bot" and ($bot == "" or (.actor.login // "") != $bot))] | length' 2>/dev/null)
|
|
215
|
+
if [ "${NH_CLEARED:-0}" -gt 0 ] 2>/dev/null; then
|
|
216
|
+
echo " Diagnosis: STATELESS but needs-human was removed after the annotation — cleared by a human, not re-parking"
|
|
217
|
+
DIAG_ACTION[$NUM]="skip"
|
|
218
|
+
DIAG_REASON[$NUM]="needs-human cleared by a human — not re-parked"
|
|
219
|
+
continue
|
|
220
|
+
fi
|
|
221
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
222
|
+
echo " Diagnosis: STATELESS (needs-human annotation comment, no state label) — would restore needs-human (dry-run)"
|
|
223
|
+
else
|
|
224
|
+
echo " Diagnosis: STATELESS (needs-human annotation comment, no state label) — restoring needs-human"
|
|
225
|
+
gh issue edit "$NUM" ${GH_FLAG} --add-label "needs-human" 2>/dev/null || true # allowlist:check-command-side-effects
|
|
226
|
+
fi
|
|
227
|
+
DIAG_ACTION[$NUM]="skip"
|
|
228
|
+
DIAG_REASON[$NUM]="Stateless needs-human orphan — needs-human restored"
|
|
229
|
+
continue
|
|
230
|
+
fi
|
|
231
|
+
|
|
202
232
|
# forge#3148: checked after the merged-PR label cleanup above, so a merged orphan is still closed out.
|
|
203
233
|
# An escalated orphan is waiting on a human — re-running a recovery action every sweep
|
|
204
234
|
# (e.g. re-invoking /review-pr against an unrepaired phase trail) only repeats the same refusal.
|
|
@@ -237,6 +237,14 @@ For fixable failures: checkout staging, apply fix, verify locally, commit as `fi
|
|
|
237
237
|
|
|
238
238
|
---
|
|
239
239
|
|
|
240
|
+
### 1H: Page Gate (BLOCKING when the forge.yaml `pages` gate is on, forge#5428)
|
|
241
|
+
On for repos with `app/**/page.*` files unless `pages.enabled: false`. List every public page the bundle adds or changes (`app/**/page.*`, `pages.routes`) lacking any of: an approved `FORGE:DESIGN_SPEC` on its issue, an SEO intent/ICP brief and GEO brief in the contract `page_gate`, a sitemap entry, metadata, canonical, structured data, a 390/1440 visual check, or content matching `pages.forbid_patterns` (null samples, raw JSON first): each is a BLOCKER (`Page: <path> missing <item>`). A blocker makes the gate fail (`FORGE:GATE_FAILURE`).
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### 1G: Docs Gate (BLOCKING when `docs.required_for` is set, forge#5419)
|
|
246
|
+
`git diff --name-only origin/$DEFAULT_BRANCH...origin/$STAGING_BRANCH` lists the bundle's changes. When forge.yaml sets `docs.required_for`, list every user-facing change in it (public API endpoint, MCP tool, dashboard page, CLI command, SDK method; `docs.surfaces` globs) that has no docs change under `docs.paths`/`docs.registries` and no `docs` justification: each is a BLOCKER (`Docs: <path> has no user docs`). Every `/docs/...` link the bundle adds must resolve (`docs.link_check`). Unset = skip. A blocker here makes the gate fail (`FORGE:GATE_FAILURE`).
|
|
247
|
+
|
|
240
248
|
## Phase 2: Material Change Analysis
|
|
241
249
|
|
|
242
250
|
**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.
|
|
@@ -540,6 +548,7 @@ Every completed staging review MUST leave one of the following structured marker
|
|
|
540
548
|
|--------|---------|
|
|
541
549
|
| `<!-- FORGE:GATE_PASS -->` | Gate ran and passed — deploy may proceed |
|
|
542
550
|
| `<!-- FORGE:GATE_FAILURE -->` | Gate ran and blocked — do NOT deploy |
|
|
551
|
+
| (blockers) | Phase 1G docs-gate blockers (forge#5419) are gate blockers: they produce `FORGE:GATE_FAILURE`, never a pass. |
|
|
543
552
|
|
|
544
553
|
**Absence of both markers = bypass detected.** The `.github/workflows/gate-marker-check.yml` workflow enforces this with the `forge/deploy-gate` commit status on the PR head: success only when the newest trusted marker is `FORGE:GATE_PASS`, failure when it is `FORGE:GATE_FAILURE`, and pending while no trusted marker exists. A missing marker is a deploy blocker, not a pass; requiring `forge/deploy-gate` on `main` makes GitHub refuse the merge.
|
|
545
554
|
|
package/commands/review-pr.md
CHANGED
|
@@ -936,3 +936,5 @@ EOF
|
|
|
936
936
|
```
|
|
937
937
|
|
|
938
938
|
Notify the user: `Review complete for PR #X. Verdict: [VERDICT].` with the domains, agents (names, dispatch mode), integration checks and issues created, plus the merge result under auto-merge (`PR merged and issue closed.` / `Merge FAILED — see issue.`) and the demilestoned count for a milestone PR. For a risk-scaled run, tip: `--thorough` enables full union dispatch for release-critical reviews.
|
|
939
|
+
|
|
940
|
+
**Page domains (forge#5428)**: when the diff adds or changes a public page (`app/**/page.*`, forge.yaml `pages.routes`), the `design` and `seo-geo` review domains join the panel (`bin/lean/review-trigger.mjs` `pathDomains`, checks in `DOMAIN_CHECKS`): an unmet page-gate item is a regression.
|
package/docs/CONFIG.md
CHANGED
|
@@ -533,6 +533,8 @@ hygiene:
|
|
|
533
533
|
delete_merged_branches: true
|
|
534
534
|
max_host_load_ratio: 0.8
|
|
535
535
|
auto_gc: true
|
|
536
|
+
schedule: 6h
|
|
537
|
+
min_free_gb: 5
|
|
536
538
|
```
|
|
537
539
|
|
|
538
540
|
| Field | Type | Default | Description |
|
|
@@ -543,6 +545,8 @@ hygiene:
|
|
|
543
545
|
| `delete_merged_branches` | boolean | `true` | `false`: lane branches of closed issues are reported, never deleted. |
|
|
544
546
|
| `max_host_load_ratio` | number in (0,1] | `0.8` | Near-ceiling trigger relative to the `engine` admission thresholds: load/core at or above ratio × `max_load_per_core`, or free memory/tmp at or below the minimum ÷ ratio. |
|
|
545
547
|
| `auto_gc` | boolean | `true` | `false` disables GC in `forgedock orchestrate`; `forgedock gc` and `forgedock doctor --fix` still work. |
|
|
548
|
+
| `schedule` | duration | unset | e.g. `6h`, `30m`, `2d`. `doctor --fix` and `init` install a systemd user timer (cron fallback) that runs `forgedock gc --apply` (owned scope only) with no batch running. Unset or `auto_gc: false`: no timer. |
|
|
549
|
+
| `min_free_gb` | number | `5` | Free disk (GB) on the worktree root and `~/.forge` below which orchestrate runs GC before an admission and refuses heavy steps (image builds) if GC cannot free enough. `0` = off. Doctor warns below it. |
|
|
546
550
|
|
|
547
551
|
Invalid values fall back to the default. `forgedock gc --older-than <d>` overrides every TTL for that run. Resources of a live lane (its ledger owner is alive) are always skipped.
|
|
548
552
|
|
|
@@ -838,7 +842,7 @@ issue_watch:
|
|
|
838
842
|
| `version` | `x.y` | No | Target version from the milestone title or a `version:x.y` label. |
|
|
839
843
|
| `lane` | string | No | Pin the lane; never a default branch. Default: the issue's own lane. |
|
|
840
844
|
| `max_issues` | integer | No | Total claims; at N the watch drains and exits. Default: none (forever). |
|
|
841
|
-
| `max_inflight` | integer | No | Claims in flight at once. Default 4
|
|
845
|
+
| `max_inflight` | integer | No | Claims in flight at once. Default 4; in `batch` mode, `parallel`. |
|
|
842
846
|
| `until` | ISO time | No | Stop claiming at this time, drain and exit. |
|
|
843
847
|
| `mode` | string | No | `per-issue` (default), `batch` or `release` (pool, then cut themed releases). |
|
|
844
848
|
| `parallel` | integer | No | K of the batch in `batch` mode. Default 4. |
|
|
@@ -968,6 +972,7 @@ Settings of the core work-on (`bin/lean/`) that change its contract.
|
|
|
968
972
|
```yaml
|
|
969
973
|
lean:
|
|
970
974
|
repro_test: prefer # off | prefer (default)
|
|
975
|
+
repro_quality: shadow # off | shadow (default) | enforce
|
|
971
976
|
precheck:
|
|
972
977
|
max_minutes: 10 # optional pre-PR check round budget in minutes (1-120)
|
|
973
978
|
fix_model: claude-sonnet-5-5 # optional model of fresh fix-round sessions (default: the reviewer model)
|
|
@@ -977,6 +982,7 @@ lean:
|
|
|
977
982
|
mode: shadow # off | shadow (default) | on: light-lane eligibility (#4448; lane wiring #4450)
|
|
978
983
|
max_lines: 40 # upgrade to the full lane above this many non-test diff lines
|
|
979
984
|
max_files: 2 # max predicted / changed non-test files
|
|
985
|
+
source: investigation # investigation (default) | text: eligibility from the investigation's predicted files and size, or (kill-switch) from the issue text (#5426)
|
|
980
986
|
sequence:
|
|
981
987
|
regenerate: pnpm --filter @x/db db:generate # optional snapshot generator after a deterministic renumber
|
|
982
988
|
base_merge_union_globs: "src/index.ts, **/messages.ts" # optional #4588: append-only files, both sides' added lines kept
|
|
@@ -988,6 +994,7 @@ lean:
|
|
|
988
994
|
| Field | Type | Required | Description |
|
|
989
995
|
|-------|------|----------|-------------|
|
|
990
996
|
| `repro_test` | string | No | `prefer` (default): on an issue labelled `bug` or `type:bug`, the plan step must freeze a `repro_test` in the contract (`{"path","id","command"}`) when the bug is testable. Before review, the engine runs `scripts/acceptance-red-green.sh` for that command on the host in every verify mode: one targeted test, red on the base (head's changed test files overlaid) and green on head. A test that ran but is not red on the base and green on head fails the precheck as `conformance.unimplemented` (it blocks in shadow too) and goes back to the builder for one in-session fix round. A head the harness could not run at all (timeout, missing runner or dependencies) ends `needs-human` with the recoverable code `env.repro_unrunnable`, not a builder round: the batch runner's recovery lane reruns it through the repo's own toolchain (see docs/OUTCOME-CODES.md). The harness runs with the lane env (`TMPDIR`, toolchain) and the workspace dependency trees, and a repro test file that is new on head is run against the base sources. A bug that is not testable (specs, docs, workflows, environment) records `"repro_test":"none"` with a one-line `repro_test_reason` and the lane continues as before. `off` gives exactly the previous contract and precheck. Each proof emits a `REPRO_RED_GREEN` run-log event (`base`, `head`) and adds a trajectory decision. |
|
|
997
|
+
| `repro_quality` | string | No | `shadow` (default): after a repro_test is red on the base and green on head, the engine checks it deterministically (0 LLM calls) and records `repro_quality` on the run's `RUN_TERMINAL` event (`behavioural`, `patch_echo`, `mutation_survivor`, `none`) plus a `REPRO_QUALITY` run-log event. `patch_echo`: every assertion only compares literals the same diff introduced; the reviewer prompt then asks for an explicit accept or reject. `mutation_survivor`: 1-3 targeted mutations of the fix's added lines (flipped condition, early return, dropped call) all left the repro green; the tree is restored after each. `enforce` blocks a `mutation_survivor` (`conformance.mutation_survived`, kind `repro_mutation_survivor`); `off` skips the check. Flip to `enforce` only after the false-positive rate is under 5% on a replay of recent lanes. |
|
|
991
998
|
| `precheck.max_minutes` | number | No | Total budget in minutes (1–120) of one round of pre-PR check commands (#4331). The flat form `lean.precheck_max_minutes` also works and wins. When unset, `verify.precheck_total_seconds` applies (default 600 s). Check commands run change-scoped (a learned command with a test-map entry runs only when its globs match the changed files; unmapped commands always run), concurrently up to the host worker cap under one heavy slot, each timed (`ms` in the `PRECHECK_COMMANDS` run-log event). Commands not started when the budget runs out are recorded `deferred-to-ci` (an anomaly, not a failure) and left to CI. |
|
|
992
999
|
| `fix_model` | string | No | Model of fresh fix-round sessions (#4363; `engine.lean_fix_model` is also read). Default: the reviewer model (`engine.lean_reviewer_model`, else Sonnet). Fix rounds for precheck, CI, docs, structure, enumerating-test and sequence-number failures, and conformance or review FAILs whose failures all cite a `file:line`, run in a fresh session (no resume of the builder's transcript) whose prompt carries only the round's failure output, the capped `git diff <base>...HEAD`, the frozen contract and the issue title and summary (under 60K characters). A fresh session that makes no commit gets one resume of the original builder session in the same round. Other rounds (block or contract corrections, CI unavailable, base-sync conflicts, failures without a file:line) resume the builder as before; round limits (`verify.max_rounds`, the one review retry) are unchanged. The run log's `PHASE_ATTEMPT_USAGE` records `mode: "fresh"\|"resume"` on each fix-round attempt. Plan and build sessions keep the builder model. |
|
|
993
1000
|
| `builder_routing` | string | No | `on` (default) or `off` (#4394). After the contract is frozen, the lane is classed from its deliverable paths only: `risk` (any path with a built-in risk word such as auth, billing, payments, session, secret or migration, or matching a `review.risk_paths` glob), `docs-config-test` (every path is a test, doc or config file; lockfiles count as code), `small` (at most 2 non-test deliverables) or `large` (more, or none). `docs-config-test` and `small` build on the mid tier (`builder_mid_model`); `risk` and `large` build on the top model (`--model`, else the CLI default). The plan and contract-correction calls always run on the top model. A failed validate round on the mid tier (`precheck`, `ci_red`, `merge_ci`) escalates the lane once: that fix round and every later builder call, fresh fix sessions included, run on the top model. Escalation adds no round. Conformance or review fix rounds do not escalate and keep `fix_model`. `off` keeps every builder call on the top model, as before, and still records the class. The run log gets `BUILDER_ROUTE {mode, class, tier, model, risk}` and `BUILDER_ESCALATED {from, to, trigger}`, and `RUN_TERMINAL` gets `builder_tier`, `builder_class`, `builder_escalated` and `builder_model`. `forgedock stats --tiers` reports merge, conformance and post-merge-rework rates, first-pass yield and cost per tier (`mid`, `mid->top`, `top`) and class, from local run logs. Target-repo risk areas (for example detection code) belong in `review.risk_paths`. A diff that relaxes a rule in a declared `review.risk_paths` path (a new accept/rescue/allow branch or a removed deny) must add a negative test (`conformance.unimplemented` `relaxation_untested` otherwise) and always gets the independent verifier, even with `review.verifier: off` (#5237). |
|
|
@@ -995,6 +1002,7 @@ lean:
|
|
|
995
1002
|
| `light.mode` | string | No | `off`, `shadow` (default) or `on` (#4448). `bin/lean/light.mjs` decides whether an issue qualifies for the light lane: a repro, steps to reproduce, expected or actual behaviour or a code block in the body; 1 to `max_files` predicted non-test files; no `size:M`/`size:L` label; no predicted path with a built-in risk word or matching `review.risk_paths`; not an `investigate(` issue, a post-deploy issue (`post-deploy`/`awaiting-promotion` label, or only post-deploy checklist items) or a decision issue (`decision`, `needs-decision`, `product-decision`, `rfc` or `adr` label, or a `decision(`/`rfc(`/`adr(` title). A missing repro or file prediction is `ambiguous`, left to a cheap classifier. `off` is never eligible; `shadow` reports the verdict without changing the lane; `on` lets an eligible issue run light. The lane wiring is #4450. A light lane posts a `FORGE:LITE` receipt on the issue (outcome light or upgraded, diff stat, red/green repro, gates, true cost from the #4407 per-session deltas, eligibility reason, upgrade reasons), and the batch efficiency report ends with a `lanes:` line: the light/upgraded/full split with cost and the upgrade rate, upgraded ÷ (light + upgraded) (#4452). A predicted file over `maintenance.hotspot.file_lines` is a hard `hotspot` reason, and every evaluated signal (repro, named files, churn, hotspot, risk path, `docs`/`config`/`chore` labels, size) is recorded in the `LIGHT_ELIGIBILITY` event's `signals` without changing the verdict (#5209). `forgedock stats --depth` reports outcomes per verdict and signal and whether the #5052 promotion criterion is met; flipping `mode: on` stays a config decision. The flat form `lean.light_mode` also works and wins. |
|
|
996
1003
|
| `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. |
|
|
997
1004
|
| `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. |
|
|
1005
|
+
| `light.source` | string | No | `investigation` (default) or `text` (#5426; the kill-switch, today's text heuristic). With `investigation`, eligibility is computed from what the investigator predicts, not from `namedPaths(body)`: the first builder call is investigation-only and writes `investigation.md` and `.forge-lean/triage.json` (`files`, `size`, `risk`, `decision_needed`; the `### Affected Files` section is the fallback). `bin/lean/fastforward.mjs` feeds those into the same `light.mjs` rules (at most `max_files` non-test files, size S, no risk path, no hotspot, no flagged risk or decision; the investigator's confirmation replaces the text repro requirement) and the text verdict stays only as a `pre_text_*` shadow signal. Invalid, already-fixed and blocked verdicts close as before. With `mode: on`, an eligible issue fast-forwards: the investigation session resumes for one implement session, then the deterministic light gates run, then merge; the trajectory and the `FORGE:LITE` receipt name the skipped stages (plan, contract freeze, multi-session review) and why. A gate failure upgrades to the full lane (#4450), and an ineligible issue continues in the same session with the contract step. With `mode: shadow`, the lane is unchanged and a `FASTFORWARD_ELIGIBILITY` event (`shadow: true`) is logged after the plan session. `forgedock stats --depth` reports the fast-forward eligibility rate and the merge, defect and revert rates of fast-forwarded, upgraded and full lanes. Promotion stays a config decision. |
|
|
998
1006
|
| `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
1007
|
| `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. |
|
|
1000
1008
|
| `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). |
|
|
@@ -1028,8 +1036,12 @@ Each alert line names the event, the rate, the sample size (`count/sample` lanes
|
|
|
1028
1036
|
|
|
1029
1037
|
### Phase ledger (#4908)
|
|
1030
1038
|
|
|
1039
|
+
Setup overlaps the plan session (#5434): deps install, heavy shims and `env.setup` run in the background and are awaited before implement, so `deps_install` is only the residual wait. The run log gets `LANE_SETUP_TIMING` (`step`, `ms`) per sub-step (including the pack-to-session gap: `pack_pitfalls`, `pack_gh_reads`, `pack_compile`, `prompt_assembly`, `cli_init`) and `FIRST_SESSION` (`ms` from lane start to the first model session). The runner option `contextWaitSeconds` (default 5, 0 = wait without bound) caps how long the plan waits for hotspots and the context pack.
|
|
1040
|
+
|
|
1031
1041
|
No configuration. Every lane records start and end of the engine phases it reaches, so a lane's wall time is attributed instead of guessed: `queue_wait`, `sandbox_start` (claim, worktree, toolchain), `deps_install`, `validate`, `plan`, `implement`, `precheck`, `review`, `ci_wait`, `base_sync`, `merge`, each with `model_ms` and `usd` where model calls ran in it. A lane's phases sum to its `wall_ms`; `queue_wait` precedes the lane clock and is added by the batch runner. The ledger is the `phases` object on each `log.jsonl` outcome row and on `RUN_TERMINAL`, and `phase_<id>_ms|_model_ms|_usd` fields in `FORGE:TELEMETRY`. The batch report prints a `phases` line (p50/p90 per phase, largest share of wall time, `n/a` without ledger data) and `forgedock stats` prints a `Lane wall time by phase` table. The efficiency lines also list merged issues with no acceptance probe declared (`unprobed merged issues`).
|
|
1032
1042
|
|
|
1043
|
+
Inside `sandbox_start` (#5435) each step (`fetch`, `claim`, `resume_probe`, `salvage_cleanup`, `warm_claim`, `scratch_setup`, and inside the cold add `sparse_plan`, `git_worktree_add` (add + checkout, including any post-checkout hook) and `sparse_checkout`, `worktree_add`, `toolchain`) is timed: a `SANDBOX_STEP` event per step (the lane fetch overlaps the claim's GitHub writes and the resume probe's `gh pr list` and `git ls-remote` run in parallel, so the steps need not sum to the phase) in the run log and a `steps` object (ms) on the `sandbox_start` entry of the ledger, so the dominant startup cost is measured. Without the pool, the cold add no longer runs the repo's post-checkout hook (hooks are disabled for the lane's `git worktree add`, sparse checkout and read-tree calls only; commits keep their hooks). The budget is `sandbox_start` p50 ≤ 3 s (`sandboxStartBudget` in `phaseledger.mjs`); `bin/lean/sandbox-budget.test.mjs` asserts it over a bench run's `log.jsonl` when `FORGE_BENCH_LOG` points at one. Local lanes can keep warm worktrees: set `FORGE_LOCAL_WARM_TREES=N` (1 to 4, default off) and a fresh lane claims a pooled worktree under `<worktree root>/warm/` instead of a cold `git worktree add`. The claim moves the tree to the lane branch at the base sha and verifies `HEAD` against that sha, so a stale pool is never handed out; any failure falls back to the cold add, and the pool is refilled after each claim.
|
|
1044
|
+
|
|
1033
1045
|
## `verify` (OPTIONAL)
|
|
1034
1046
|
|
|
1035
1047
|
Verify-by-CI for the core work-on path (forge#4167). It moves a lane's heavy verification (type-checks, test suites, docker test containers) off the host and onto CI runners, and it catches CI-class failures (lock files, suite wiring, hangs, formatting) before the lane merges into staging. Write it as a block-style section: `parseForgeYaml` does not read inline `{ ... }` maps.
|
|
@@ -1048,6 +1060,10 @@ verify:
|
|
|
1048
1060
|
flaky: "memory-erasure,e2e-pdf" # optional; known-flaky CI job names: reported, never block or feed the builder
|
|
1049
1061
|
post_merge: pnpm -r typecheck # optional; run on the merged tree at base-sync before the push (default: the lane's scoped typecheck)
|
|
1050
1062
|
duplicate_exports: false # optional; turn off the same-app duplicate-export check (default true)
|
|
1063
|
+
|
|
1064
|
+
lean:
|
|
1065
|
+
enumerating:
|
|
1066
|
+
mechanical: false # optional; kill switch for the engine's own enumerating-test edits (default true; #5480): a model session fixes them instead
|
|
1051
1067
|
invariants: # optional block list; repo-wide check commands that always run before the PR
|
|
1052
1068
|
- pnpm check:registry
|
|
1053
1069
|
guard_command: # optional; per-extension command for the guard gate's base test files
|
|
@@ -1076,6 +1092,7 @@ verify:
|
|
|
1076
1092
|
| `invariants` | list | No | Block list of cheap repo-wide check commands (#4585), e.g. the suites that list every table, export, key or namespace (cross-tenant registry, export and purge coverage, i18n status, boundary tests). They run in the pre-PR check round in every verify mode, whichever tests the test map selected: never scoped away by `.forge/test-map.json`, deduplicated against the learned commands, and subject to the same round budget and per-command timeout. A failure goes to the builder in the precheck fix round like a failed declared check. The plan and implement prompts also carry an invariants checklist built from the list (a new table, export or key must join every registry that enumerates its kind). `forgedock check` and the light lane run them too. Absent: nothing changes. |
|
|
1077
1093
|
| `guard_block` | boolean | No | Default `true` (#5239). `invariants` are the repo's pre-merge guard set: they also run on the merged tree after a base-sync (before the push), and one still failing after the fix rounds ends the lane needs-human `ci.red` instead of opening or merging the PR. Before spending a builder round, a failing invariant is run once on the merge base: if it fails there too the base is already red, so the lane ends `deferred` with `base.red` (never needs-human, retried after 900 s), the commit that last changed the files the failure names is found with `git log`, and the issue it belongs to (closing keyword, `issue-N` branch, or last `(#N)` in the message) gets a `FORGE:BASE_RED` comment and is reopened if closed; with no issue number a tracking issue is filed. `false`: failing invariants stay advisory as before. No effect without `invariants`. |
|
|
1078
1094
|
| `guard_command` | map | No | Guard gate (#4693) test-file command per extension (#4792), e.g. `".py": "scripts/pytest {path}"` for a repo whose tests need a managed environment. Consulted before the contract's validate commands and the hard-coded `node --test` / `python -m pytest -q` fallbacks. `{path}` is replaced by the repo-relative path of the guard's base copy (`<name>__guardbase.<ext>`); a template without `{path}` gets it appended. Runs from the worktree root. Keys may be written with or without the leading dot. Absent: unchanged. |
|
|
1095
|
+
| `sandboxes` | map | No | Test sandboxes (#5450): throwaway services a lane's validate commands need. One entry per name, written on one line: `postgres: { image: postgres:16, init: "make migrate DB_URL=$SANDBOX_URL", ttl: 30m }`, `redis: { image: redis:7 }`, `api: { compose: docker-compose.test.yml, service: api, needs: [postgres, redis] }`, `http-replay: { fixtures: tests/fixtures/http/, for: integration }`. Optional `port` and `ready` (a command run in the container until it exits 0) override the postgres/redis defaults. A frozen contract validate entry declares `env: ["postgres"]`; only then is a sandbox created, once per lane, with unique container names (`forge-sbx-<lane>-<name>`), ephemeral loopback ports and `forgedock.*` labels, registered in the lane ledger so teardown and `forgedock gc` reclaim it. Validate commands get `SANDBOX_<NAME>_URL` (a `fixtures` entry: `SANDBOX_<NAME>_DIR`, an absolute path); `init` runs on the host with `SANDBOX_URL`. A name with no entry, or a host without Docker, ends the lane `needs-human` (never a skip; no-Docker uses `env.tool_missing` so the lane is placed where Docker runs). A `fixtures` entry also exports `SANDBOX_<NAME>_MODE` (`replay`, or `record` with `record: true` or `FORGE_SANDBOX_RECORD=1`); an `http*` entry also exports `SANDBOX_HTTP_REPLAY_DIR`/`_MODE`. Each lane's image sandboxes join their own network `forge-sbx-<lane>-net`. `forgedock init --minimal` writes a commented proposal detected from compose files, migrations and test markers. Images are checked or pulled once per batch process (lanes share the cache). Each sandbox adds a `FORGE:SANDBOX {name, kind, ms, cost_usd}` line to the lane decisions. Operators: `forgedock sandbox up <name>... | down | ls`. Absent: no sandbox is ever created. |
|
|
1079
1096
|
| `check_run` | boolean | No | Default `false` (no Checks API call, behaviour unchanged). `true`: after each push of a reviewed head (PR open, base-sync, merge-time fix round) the engine posts one completed `forgedock/verify` check run on that head (forge#4270), `success` iff every deterministic gate the lane already ran passed: declared check commands, undeclared package edges, docs freshness, contract scope, validate ids, requirement status, hotspot growth, amendments. The output carries each gate's id, pass/fail and evidence as JSON; the run log records a `VERIFY` event. Report only: ForgeDock never makes it required and never waits on it (it is ignored by its own CI waits); requiring it is the repository's branch-protection choice. Creating check runs needs a token that may (a GitHub App with `checks: write`); a Checks API failure is logged as an anomaly and never fails the lane. |
|
|
1080
1097
|
| `post_merge` | string | No | Command run in the lane worktree on the merged tree after each base-sync merge, before the push (forge#4406). Default: the typecheck rows of the lane's change-scoped checks (`bin/lean/checks.mjs`), in `local` and `hybrid` mode only; `ci` mode runs no host typecheck unless `post_merge` is set. A failure resumes the builder with the output, up to `max_rounds` rounds, and the fixed head is re-reviewed; still failing is a trajectory anomaly and CI stays the gate. |
|
|
1081
1098
|
| `duplicate_exports` | boolean | No | Default `true`: at hand-off and after each base-sync merge, names the lane newly exports that another non-test module of the same app or package (nearest `package.json`/`pyproject.toml`/`setup.py`/`go.mod`/`Cargo.toml`) already declares go back to the builder once ("rename or reuse", both paths); one left over is an anomaly (forge#4406). Re-exports, default exports and names 3+ other modules declare (framework conventions) are ignored. `false` turns the check off. |
|
|
@@ -1538,8 +1555,16 @@ topology:
|
|
|
1538
1555
|
| `consumer_sweep.budget_seconds` | integer | No | Wall-clock budget for the sweep (default `60`). When it runs out the sweep stops with `BUDGET_EXCEEDED`, reports the partial result, and never fails, in either mode |
|
|
1539
1556
|
| `test_runners` | map (path prefix → runner) | No | Default unset (no runner enforced). For repos whose validate commands need a managed runner (uv, poetry, pnpm workspace). The lean engine checks it at contract freeze (`testRunnerProblems`, `bin/lean/preflight.mjs`): a validate command that touches a configured path prefix without containing that prefix's runner string is reported as a contract problem, instead of failing later as `contract.invalid_command` / `env.tool_missing`. Paths in the command are relative to the runner's cwd. Write it as a block-style map: `parseForgeYaml` does not read inline `{ ... }` maps. |
|
|
1540
1557
|
| `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. |
|
|
1558
|
+
| `verify.baselines` | map (glob → command) | No | Default unset (#5448). Baseline suites validate runs whenever a changed path matches the glob, e.g. `baselines:` with `"shared/content/**": make stealth-baseline`; each distinct command runs once, a non-zero exit fails the gate (`conformance.regression`). The contract's `regression` set (existing tests of callers, shared modules, sibling configs) is folded into `validate` at freeze. A post-deploy requirement needs a registered check id and `local_infeasible_why`; a check-less one is rejected at freeze unless it needs an owner or read-only prod data, and development work is never deferrable as prod-only. |
|
|
1541
1559
|
| `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. |
|
|
1542
1560
|
| `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`. |
|
|
1561
|
+
| `pages.enabled` / `pages.routes` | bool / list | No | Page gate (#5428). Default on only when the repo tracks Next `app/**/page.*` files; `enabled: false` turns it off, and `routes` globs add non-Next page files. A diff touching a public page needs `page_gate` {design_spec, seo, geo} in the contract (checked by `validateContract`), and `page_missing`-class precheck rows (`page_design_missing`, `page_visual_missing`, `page_metadata_missing`, `page_canonical_missing`, `page_structured_data_missing`, `page_sitemap_missing`, `page_forbidden_pattern`, `page_link_broken`, `page_lint_failed`) fail as `conformance.unimplemented`. Read by `readEnvConfig`, checked by `bin/lean/pagegate.mjs`. |
|
|
1562
|
+
| `pages.require` / `pages.icp_doc` | list / path | No | Default `[design, seo_intent, geo]`. `icp_doc` names the repo's ICP doc the SEO brief must cite. `design` also needs a 390 and 1440 screenshot in the result's `page_gate.screenshots`; `design` and `seo-geo` become review domains and `/review-pr-staging` Phase 1H blocks. |
|
|
1563
|
+
| `pages.sitemap` / `pages.metadata_patterns` / `pages.canonical_patterns` / `pages.structured_data_patterns` / `pages.forbid_patterns` / `pages.lint` | lists / command | No | Regex and glob overrides of the built-in Next defaults (sitemap files, `metadata`/`generateMetadata`, `canonical`, JSON-LD, `[[null]]`/raw-JSON/dead-end patterns on added page lines). A generated sitemap is justified in the result as `page_gate.sitemap_justification`. `lint` is a repo command given the page files; non-zero fails. |
|
|
1564
|
+
| `docs.required_for` | string or list | No | Default unset (#5419): the docs gate is off, so library/CLI repos are unchanged. Kinds of user-facing surface that need user docs: `api`, `mcp`, `dashboard`, `cli`, `sdk`. Built in: Next route handlers (`api`) and `app/**/page.*` under a `dashboard` path (`dashboard`); other kinds need `docs.surfaces`. Read by `readEnvConfig`, checked by `bin/lean/docsgate.mjs`. |
|
|
1565
|
+
| `docs.paths` / `docs.registries` | list | No | Globs of the docs pages and of their registration files (nav, sitemap, `llms.txt`). A diff touching a surface with no changed file under either, and no `docs: [{surface, justification}]` in the result file, fails `docs_missing` (`conformance.unimplemented`). `paths` defaults to `docs/**`. The planner is told to add an R-docs requirement naming them. |
|
|
1566
|
+
| `docs.surfaces` | map (kind → globs) | No | Repo globs for each kind's surface files. |
|
|
1567
|
+
| `docs.link_prefixes` / `docs.link_check` | list / command | No | Default prefix `/docs`. Each internal `href="/docs/..."` or `docsHref` link the diff adds must resolve: `link_check` gets the links as arguments and a non-zero exit fails `docs_link_broken`; without it a docs file under `paths` must serve the link. With `docs.required_for` set, `docs` is also a review domain (reviewer check for undocumented or contradicting docs), `forgedock docs gate --milestone T --repo o/r` blocks closing a milestone with user-facing children and no merged `docs` child, and `/review-pr-staging` Phase 1G blocks undocumented user-facing changes. |
|
|
1543
1568
|
| `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`. |
|
|
1544
1569
|
|
|
1545
1570
|
**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`
|
package/docs/EVENTS.md
CHANGED
|
@@ -33,6 +33,7 @@ call, no consumer required. With no configuration the events go only to a local
|
|
|
33
33
|
| `release.promoted` | A probed fix reached the default branch (`forgedock probe` sweep: a recorded pass or fail, so once per fix, only for issues declaring `forge-probe`). | `fix`, `default_branch` |
|
|
34
34
|
| `regression.detected` | A windowed post-deploy check failed and filed a regression issue (`forgedock probe --due`, daemon timer; `issue` is the monitored follow-up). | `subject`, `metric`, `detail` |
|
|
35
35
|
| `experiment.verdict` | `forgedock stats --experiment <id> --emit-event` found targets `met` or `missed` (`inconclusive` is not emitted; plain `stats` never emits). | `experiment`, `verdict`, `detail` |
|
|
36
|
+
| `watch.dead` | An `issue-watch` heartbeat is older than 3 passes: the process is gone (`forgedock issue-watch watchdog` or `forgedock status`; once per dead heartbeat). | `watch`, `repo`, `reason`, `age_s` |
|
|
36
37
|
|
|
37
38
|
## Local sink
|
|
38
39
|
|
package/docs/ISSUE-WATCH.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
```
|
|
6
6
|
forgedock issue-watch run [--name <w>] [--repo owner/repo] [--once] [--interval <s>] [--dry-run]
|
|
7
7
|
forgedock issue-watch status [--name <w>] [--repo owner/repo]
|
|
8
|
+
forgedock issue-watch install [--name <w>] [--repo owner/repo] [--interval <s>]
|
|
9
|
+
forgedock issue-watch watchdog
|
|
8
10
|
```
|
|
9
11
|
|
|
10
12
|
`--name` defaults to the only watch in forge.yaml, else `default` (every trusted issue, no caps). `--once` does one pass. `--interval` is the seconds between passes (default 300).
|
|
@@ -51,13 +53,13 @@ The lane follows the repo rule: a milestone issue goes to `milestone/<slug>` (fo
|
|
|
51
53
|
|
|
52
54
|
- `max_issues: N`: total claims over the watch's lifetime. At N the watch **drains**: no new claims, retry and verify only. When nothing is inflight and no merge is mid-verification it exits with a summary.
|
|
53
55
|
- `until: <ISO time>`: the same, at that time.
|
|
54
|
-
- `max_inflight` (default 4): claims in flight at once.
|
|
56
|
+
- `max_inflight` (default 4; in `mode: batch` the watch's `parallel`): claims in flight at once.
|
|
55
57
|
- With neither `max_issues` nor `until` the watch runs forever: it keeps claiming, retrying (a deferred lane, exit 75, is relaunched up to 3 times) and verifying merges (see [Merge verification](#merge-verification)).
|
|
56
58
|
|
|
57
59
|
## Modes
|
|
58
60
|
|
|
59
61
|
- `mode: per-issue` (default): one `forgedock run-issue` per claim.
|
|
60
|
-
- `mode: batch`: claims are `--add`ed to one long-lived `orchestrate` batch, so its K (`parallel:`), the `Depends on` DAG (claims are ordered dependencies first), the supervisor and the report apply. When the batch writes its report the watch starts a new one with the next claims.
|
|
62
|
+
- `mode: batch`: claims are `--add`ed to one long-lived `orchestrate` batch, so its K (`parallel:`), the `Depends on` DAG (claims are ordered dependencies first), the supervisor and the report apply. When the batch writes its report the watch starts a new one with the next claims. If another running (not reported, not cancelled) batch of the same repo and lane exists, claims are `--add`ed to it instead of starting a new one. A slow `orchestrate` start (no batch dir within 60 s) never stops the watch: the claims are kept in a `pendingStart` record, later passes adopt the batch when it appears, and after 10 minutes without one the claims are released. An error in any pass is logged, saved as `passError` in `status.json`, shown by `issue-watch status`, and the next pass runs (with `--once` the process still exits non-zero).
|
|
61
63
|
|
|
62
64
|
- `mode: release`: see [Release mode](#release-mode).
|
|
63
65
|
|
|
@@ -120,7 +122,7 @@ A closed issue is not taken on trust. When a claimed issue closes (in `per-issue
|
|
|
120
122
|
5. the merge commit is on the lane (`compare` reports `behind` or `identical`);
|
|
121
123
|
6. no check on the merge commit failed (report-only `forgedock/verify` is ignored). While those checks run, verification waits up to 60 minutes and then fails.
|
|
122
124
|
|
|
123
|
-
All pass: the issue counts as **verified**, and a `FORGE:WATCH_VERIFY` comment records the evidence. Any fails: the issue is **unverified**. It is reopened with `needs-human` and a "merge NOT verified" comment that lists the evidence and the failed check. Nothing is reverted; a human decides between a revert, a follow-up fix and accepting the merge. An issue that closed with no merged lane PR (invalid, already fixed, decomposed) counts as **closed unmerged**, never as verified.
|
|
125
|
+
All pass: the issue counts as **verified**, and a `FORGE:WATCH_VERIFY` comment records the evidence. Any fails: the issue is **unverified**. It is reopened with `needs-human`, `workflow:merged` is replaced by `workflow:merged-unverified` (so the open issue does not look merged; best effort: the label is created if missing, and a failed swap never stops the reopen or `needs-human`), and a "merge NOT verified" comment that lists the evidence and the failed check. Nothing is reverted; a human decides between a revert, a follow-up fix and accepting the merge. An issue that closed with no merged lane PR (invalid, already fixed, decomposed) counts as **closed unmerged**, never as verified.
|
|
124
126
|
|
|
125
127
|
## Status
|
|
126
128
|
|
|
@@ -152,3 +154,10 @@ issue_watch:
|
|
|
152
154
|
- **Run**: the watch posts a `FORGE:RELEASE_PLAN` comment (theme, reasons, included, pulled and excluded issues, policy) on `tracker:` (default: the first issue of the set), tags the set (milestone `release/<theme>-<date>` for a milestone target, else label `release:<theme>-<date>`), and starts one `orchestrate` batch. When the batch reports it opens the deploy PR (lane to the default branch) once. **The watch never merges it**; promotion stays human-only.
|
|
153
155
|
- **Roll over**: issues left out stay pooled and keep their age. `max_issues` and `until` stop new releases.
|
|
154
156
|
- `forgedock issue-watch run --name <w> --dry-run` prints `would cut: <theme> (N issues, score S; ...)`, the triggers, the theme scores and each issue's theme, and writes nothing.
|
|
157
|
+
|
|
158
|
+
## Resilience, supervision and DEAD detection (#5465)
|
|
159
|
+
|
|
160
|
+
- **Retry.** A transient `gh` failure (TLS handshake timeout, connection reset, DNS, HTTP 5xx or 429, secondary rate limit) is retried 3 times with doubling backoff (2 s, 4 s, 8 s) inside the same call. A call that still fails fails its pass only: the pass is logged and recorded as `passError`, and the next pass runs. A 4xx is never retried.
|
|
161
|
+
- **Exit state.** Whenever `run` stops (crash, SIGTERM/SIGINT, `--once`) `status.json` gets `phase: exited`, `exitReason` and `exitedAt`; it is never left as `running`. A restart resumes it.
|
|
162
|
+
- **Supervision.** `forgedock issue-watch install --name <w>` writes a systemd user unit `forgedock-issue-watch-<w>.service` (`Restart=on-failure`, run from the current directory so `forge.yaml` is found) and a 60 s watchdog timer, or a launchd agent (`KeepAlive` on failure) on macOS. A finished (`done`) or stopped watch exits 0 and stays down.
|
|
163
|
+
- **DEAD.** A heartbeat older than 3 × `heartbeatEveryMs` (+60 s grace) is shown as `state: DEAD` by `issue-watch status` and in a `issue-watch` section of `forgedock status`. `issue-watch watchdog` (the install timer) and `forgedock status` post a `watch.dead` event once per dead heartbeat to `events.webhook_url` (see EVENTS.md).
|
|
@@ -65,4 +65,4 @@ Grading is deterministic: the diff paths and added lines, never an LLM. The scor
|
|
|
65
65
|
|
|
66
66
|
## Published scorecard
|
|
67
67
|
|
|
68
|
-
Scorecards live in `docs/eval/published/adversarial-<date>.md`.
|
|
68
|
+
Scorecards live in `docs/eval/published/adversarial-<date>.md`. Latest: [`adversarial-2026-11-11.md`](published/adversarial-2026-11-11.md) (#5370). If a lane closes an issue as invalid, it never pushes its branch, and the harness grades that as no change.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Adversarial benchmark scorecard (#5292)
|
|
2
|
+
|
|
3
|
+
- Run date: 2026-11-11
|
|
4
|
+
- Model: claude-opus-5-5
|
|
5
|
+
- Corpus revision: adversarial-v1@670b715+257314ab
|
|
6
|
+
|
|
7
|
+
| Metric | full | control |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| Wrong issues implemented (lower is better) | 1 of 12 invalid | 2 of 12 invalid |
|
|
10
|
+
| Duplicate implementations created | 1 | 0 |
|
|
11
|
+
| Integration points missed | 0 | 0 |
|
|
12
|
+
| Oracle pass rate | 1 (n=3) | 1 (n=3) |
|
|
13
|
+
| Cost (USD, sum) | 7.9842 | 5.2216 |
|
|
14
|
+
| Wall time (ms, sum) | 6335037 | 1391871 |
|
|
15
|
+
|
|
16
|
+
- Harness: ForgeDock 1.54.1 + the #5370 fix for unpushed lane branches. Full arm: `forgedock run-issue`, light lane off, local execution. Control: `claude -p` with the corpus `control_prompt` as written ("Fix this issue…"), no web tools.
|
|
17
|
+
- Wall time: 105.6 min (full) vs 23.2 min (control). Cost ratio: 1.53×.
|
|
18
|
+
|
|
19
|
+
## Per issue
|
|
20
|
+
|
|
21
|
+
| Issue | Kind | Full lane | Control |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| `adv-valid-1293` | valid | merged, oracle pass, $0.82, 9.3 min | ok, oracle pass, $0.34, 2.1 min |
|
|
24
|
+
| `adv-valid-1304` | valid | merged, oracle pass, $0.51, 5 min | ok, oracle pass, $0.27, 1.7 min |
|
|
25
|
+
| `adv-valid-1308` | valid | merged, oracle pass, $0.47, 16.5 min | ok, oracle pass, $0.23, 1.9 min |
|
|
26
|
+
| `adv-wp-chunked-tail` | wrong-premise | invalid, no change, $0.2, 3.3 min | ok, changed code, $0.22, 0.6 min |
|
|
27
|
+
| `adv-wp-one-empty` | wrong-premise | invalid, no change, $0.18, 3.1 min | ok, no change, $0.22, 0.5 min |
|
|
28
|
+
| `adv-wp-first-true-default` | wrong-premise | invalid, no change, $0.17, 3.2 min | ok, no change, $0.19, 0.3 min |
|
|
29
|
+
| `adv-wp-batched-strict` | wrong-premise | invalid, no change, $0.19, 2.4 min | ok, no change, $0.21, 0.4 min |
|
|
30
|
+
| `adv-wp-sliding-window-short` | wrong-premise | invalid, no change, $0.19, 2.5 min | ok, changed code, $0.26, 0.6 min |
|
|
31
|
+
| `adv-dup-chunks` | duplicate | invalid, no change, $0.3, 2.8 min | ok, no change, $0.21, 0.4 min |
|
|
32
|
+
| `adv-dup-flatten-once` | duplicate | invalid, no change, $0.17, 2.3 min | ok, no change, $0.2, 0.7 min |
|
|
33
|
+
| `adv-dup-nth-default` | duplicate | invalid, no change, $0.19, 2.7 min | ok, no change, $0.21, 0.4 min |
|
|
34
|
+
| `adv-dup-consecutive-pairs` | duplicate | merged, changed code, $0.7, 10.7 min | ok, no change, $0.2, 0.3 min |
|
|
35
|
+
| `adv-af-triplewise` | already-fixed | invalid, no change, $0.16, 2.3 min | ok, no change, $0.25, 1.2 min |
|
|
36
|
+
| `adv-af-sum-of-squares` | already-fixed | invalid, no change, $0.18, 2.5 min | ok, no change, $0.26, 0.5 min |
|
|
37
|
+
| `adv-af-polynomial-eval` | already-fixed | invalid, no change, $0.2, 2.2 min | ok, no change, $0.22, 0.4 min |
|
|
38
|
+
| `adv-int-take-until` | integration | merged, implemented, $0.61, 6.7 min | ok, implemented, $0.27, 2 min |
|
|
39
|
+
| `adv-int-count-runs` | integration | merged, implemented, $0.68, 6.3 min | ok, implemented, $0.27, 1.4 min |
|
|
40
|
+
| `adv-int-minmax-by` | integration | merged, implemented, $0.72, 6.8 min | ok, implemented, $0.45, 3.3 min |
|
|
41
|
+
| `adv-int-lstrip-all` | integration | merged, implemented, $0.65, 7.5 min | ok, implemented, $0.34, 2.4 min |
|
|
42
|
+
| `adv-int-span-by` | integration | merged, implemented, $0.69, 7.4 min | ok, implemented, $0.38, 2.1 min |
|
|
43
|
+
|
|
44
|
+
The integration rows show "implemented" because the corpus has no oracle for them. They are graded on the `must_touch` paths (`more.py`, `more.pyi`, `docs/api.rst`), and both arms touched all three in every row.
|
|
45
|
+
|
|
46
|
+
## Findings
|
|
47
|
+
|
|
48
|
+
1. **Valid bugs (3):** both arms fixed all three; the upstream oracle tests passed. The full lane cost 2.1× ($1.80 vs $0.84) and took 5–8× longer. Every stage after investigation added cost and caught nothing.
|
|
49
|
+
2. **Wrong-premise traps (5):** the full lane refused all five with evidence, at about $0.19 and 3 min each. The control changed code on two (`adv-wp-chunked-tail`, `adv-wp-sliding-window-short`): it "fixed" behaviour that is correct at the base.
|
|
50
|
+
3. **Duplicates (4):** the control refused all four. The full lane refused three and **merged one** (`adv-dup-consecutive-pairs`). Its investigation found `recipes.pairwise` but reasoned that the wrapper is deprecated (`.. deprecated:: 11.0.0`), returned CONFIRMED and added a new public `pairs()` over `itertools.pairwise`. The right outcome was to close and point at `itertools.pairwise`. The library deprecated its wrapper because the stdlib already provides the function.
|
|
51
|
+
4. **Already shipped (3):** both arms refused all three.
|
|
52
|
+
5. **Integration (5):** both arms touched every integration point; neither missed one.
|
|
53
|
+
|
|
54
|
+
**Net:** the full lane implemented 1 of 12 invalid issues and the control 2 of 12, for 1.53× the cost and 4.5× the wall time. The value is concentrated in investigation: it caught both wrong premises the control shipped. The later stages added cost on trivial valid work without changing any outcome. That is the case for #5426 (investigation decides pipeline depth).
|
|
55
|
+
|
|
56
|
+
**Limits:** n=20 on one small, well-documented library with a single model and a single run per arm and issue, so one row changes a rate by 8 percentage points. The control prompt asks for a fix, as a real user would. Long-run effects (maintainability, auditability of the per-issue record) are not measured by this corpus.
|
|
57
|
+
|
|
58
|
+
Reproduce: docs/eval/adversarial-bench.md.
|
package/package.json
CHANGED
|
@@ -176,8 +176,9 @@ export async function runArm({ arm, issue, corpus, cfg, run = benchDefaultRun, t
|
|
|
176
176
|
await git(run, ["fetch", "-q", "origin", `refs/pull/${pr}/head`], src);
|
|
177
177
|
head = SHA_RE.test(String(v.stdout).trim()) ? String(v.stdout).trim() : await git(run, ["rev-parse", "FETCH_HEAD"], src);
|
|
178
178
|
} else if (res?.branch) {
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
// A lane that ends before pushing (e.g. closed invalid) names a branch that never reached the remote: no diff to grade.
|
|
180
|
+
const f = await run("git", ["fetch", "-q", "origin", res.branch], { cwd: src });
|
|
181
|
+
if (f.code === 0) head = await git(run, ["rev-parse", "FETCH_HEAD"], src);
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
if (!head) return row; // no PR and no branch: nothing to grade; oracle_pass stays false
|
package/scripts/hotspots.sh
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
# Config file (#5163, forge.yaml is often gitignored so a lane worktree has none): --config, then $FORGE_CONFIG, then ./forge.yaml;
|
|
10
10
|
# output config_source is the file read, or null (defaults used).
|
|
11
11
|
# Config: forge.yaml maintenance.hotspot {enabled, file_lines, growth_lines, exclude_globs}; defaults true/2000/150/[] (lockfiles are always excluded)
|
|
12
|
-
# (also when forge.yaml or yq is missing); maintenance.generated_paths (forge#4519)
|
|
13
|
-
# bot-owned files, default [].
|
|
12
|
+
# (also when forge.yaml or yq is missing); maintenance.generated_paths (forge#4519) and its alias maintenance.generated
|
|
13
|
+
# (#5470): shell globs of generated, bot-owned files, merged, default [].
|
|
14
14
|
# Output (stdout, one JSON object):
|
|
15
15
|
# {"enabled","file_lines","growth_lines","generated_paths","config_source",
|
|
16
16
|
# "files":[{path,lines,commits_90d,hotspot,over,generated,excluded,base_lines,growth}]}
|
|
17
17
|
# lines = `wc -l` of the working-tree file (0 when missing); commits_90d = `git rev-list --count --since=90.days HEAD`;
|
|
18
18
|
# hotspot = lines × commits_90d; over = lines > file_lines; generated = linguist-generated set by .gitattributes, a
|
|
19
|
-
# match of a generated_paths glob, or `@generated` / `DO NOT EDIT` in the first 5 lines of the working-tree file;
|
|
19
|
+
# match of a generated_paths glob, a `generated/` path segment (#5470), or `@generated` / `DO NOT EDIT` in the first 5 lines of the working-tree file;
|
|
20
20
|
# excluded = generated, linguist-vendored, or a match of an exclude_glob (shell pattern, `*` crosses `/`). Without --base no blob is read and
|
|
21
21
|
# base_lines/growth are null; with --base they are the line count at git merge-base(<ref>, HEAD) (0 when absent there)
|
|
22
22
|
# and lines - base_lines. enabled:false prints files:[] (generated_paths still set) and does no per-file work.
|
|
@@ -44,8 +44,10 @@ if [ -f "$CONFIG_FILE" ] && command -v yq >/dev/null 2>&1; then
|
|
|
44
44
|
printf '%s' "$c" | jq -e 'type == "object"' >/dev/null 2>&1 && CFG="$c"
|
|
45
45
|
g=$(yq -o=json '.maintenance.generated_paths // []' "$CONFIG_FILE" 2>/dev/null) || g=""
|
|
46
46
|
printf '%s' "$g" | jq -e 'type == "array"' >/dev/null 2>&1 && GEN_CFG="$g"
|
|
47
|
+
g2=$(yq -o=json '.maintenance.generated // []' "$CONFIG_FILE" 2>/dev/null) || g2=""
|
|
48
|
+
printf '%s' "$g2" | jq -e 'type == "array"' >/dev/null 2>&1 && GEN_CFG=$(jq -c -n --argjson a "$GEN_CFG" --argjson b "$g2" '$a + $b')
|
|
47
49
|
fi
|
|
48
|
-
GEN_CFG=$(printf '%s' "$GEN_CFG" | jq -c '[.[] | strings | select(length > 0)]')
|
|
50
|
+
GEN_CFG=$(printf '%s' "$GEN_CFG" | jq -c '[.[] | strings | select(length > 0)] | reduce .[] as $x ([]; if index($x) then . else . + [$x] end)')
|
|
49
51
|
CFG=$(printf '%s' "$CFG" | jq -c '
|
|
50
52
|
def pos($d): if type == "number" and . > 0 then floor else $d end;
|
|
51
53
|
{ enabled: (.enabled != false), file_lines: (.file_lines | pos(2000)), growth_lines: (.growth_lines | pos(150)),
|
|
@@ -117,6 +119,7 @@ for p in "$@"; do
|
|
|
117
119
|
commits=$(cat "$T/c.$i" 2>/dev/null); case "$commits" in ''|*[!0-9]*) commits=0 ;; esac
|
|
118
120
|
generated=false; excluded=false
|
|
119
121
|
if git check-attr linguist-generated -- "$p" 2>/dev/null | grep -qE ': (set|true)$' || glob_hit "$p" "$GEN_GLOBS" \
|
|
122
|
+
|| case "$p" in generated/*|*/generated/*) true ;; *) false ;; esac \
|
|
120
123
|
|| { [ -f "$p" ] && head -n 5 "$p" 2>/dev/null | grep -qE '@generated|DO NOT EDIT'; }; then generated=true; excluded=true; fi
|
|
121
124
|
if [ "$excluded" = false ] && git check-attr linguist-vendored -- "$p" 2>/dev/null | grep -qE ': (set|true)$'; then excluded=true; fi
|
|
122
125
|
if [ "$excluded" = false ] && glob_hit "$p" "$GLOBS"; then excluded=true; fi
|
package/scripts/hotspots.test.sh
CHANGED
|
@@ -56,7 +56,19 @@ eq "attr generated" "$(q '[.files[] | .generated]')" '[true,false,false,false]'
|
|
|
56
56
|
OUT="$(bash "$S" hdr.py late.py)"
|
|
57
57
|
rm -f hdr.py late.py
|
|
58
58
|
eq "header generated" "$(q '[.files[] | [.generated,.excluded]]')" '[[true,true],[false,false]]'
|
|
59
|
+
# #5470: a `generated/` path segment marks the file generated; the same growth in a hand-written file does not
|
|
60
|
+
mkdir -p web/app/docs/generated/hands web/app/docs/hand generated notgenerated
|
|
61
|
+
lines web/app/docs/generated/hands/page.tsx 6607; lines web/app/docs/hand/page.tsx 6607; lines generated/top.ts 2500; lines notgenerated/x.ts 2500
|
|
62
|
+
OUT="$(bash "$S" --base main -- web/app/docs/generated/hands/page.tsx web/app/docs/hand/page.tsx generated/top.ts notgenerated/x.ts)"
|
|
63
|
+
eq "generated/ segment is generated" "$(q '[.files[] | [.generated,.excluded]]')" '[[true,true],[false,false],[true,true],[false,false]]'
|
|
64
|
+
eq "generated/ segment growth reported" "$(q '[.files[0].growth,.files[1].growth]')" '[6607,6607]'
|
|
65
|
+
rm -rf web generated notgenerated
|
|
59
66
|
if [ "$HAVE_YQ" = 1 ]; then
|
|
67
|
+
# #5470: maintenance.generated is an alias of generated_paths; both merge, duplicates drop
|
|
68
|
+
printf 'maintenance:\n generated: ["a.json", "b.json"]\n generated_paths: ["b.json", "c.json"]\n' > forge.yaml
|
|
69
|
+
OUT="$(bash "$S" big.py)"; eq "generated key merged" "$(q '.generated_paths')" '["b.json","c.json","a.json"]'
|
|
70
|
+
printf 'maintenance:\n generated: nope\n generated_paths: ["c.json"]\n' > forge.yaml
|
|
71
|
+
OUT="$(bash "$S" big.py)"; eq "bad generated key falls back" "$(q '.generated_paths')" '["c.json"]'
|
|
60
72
|
printf 'maintenance:\n hotspot:\n file_lines: 100\n growth_lines: 5\n exclude_globs: ["dist/*", "*.lock"]\n' > forge.yaml
|
|
61
73
|
OUT="$(bash "$S" dist/bundle.js small.py big.py)"
|
|
62
74
|
eq "config thresholds" "$(q '[.file_lines,.growth_lines]')" '[100,5]'
|
|
@@ -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 ]
|