Skip to content

Commit 0559e03

Browse files
authored
docs: add deterministic drift checks (#1096)
* docs: add deterministic drift checks * fix: preserve escaped heading text in doc anchors * fix: accept standard URI schemes in docs links
1 parent 2f54784 commit 0559e03

14 files changed

Lines changed: 997 additions & 28 deletions

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Documentation-only changes should also classify new pages as active, proposed,
4545
compatibility-only, or historical. Active runbooks need a role owner, owning
4646
source, last-verified revision, and concrete update triggers; see the
4747
[documentation index](docs/README.md#document-lifecycle).
48+
Run `pnpm run check:docs` while editing documentation; the full `pnpm run check`
49+
gate runs it again through the static-check path.
4850

4951
## Create or Update a Pull Request
5052

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ lease without checking out or pushing the state repository. The queue retries
439439
publication independently, so a cancelled publisher does not rerun Codex. The
440440
source fallback uses adaptive minimum/base/maximum values of 4/24/48; production
441441
overrides them with 8/32/40 and enables direct
442-
publication plus up to eight concurrent size-8 batches. The Durable Object
443-
validates each artifact's workflow run, queue tuple,
442+
publication plus up to 8 concurrent size-8 batches. The Durable Object validates
443+
each artifact's workflow run, queue tuple,
444444
target, decision digest, file inventory, sizes, and SHA-256 hashes before a
445445
publisher receives write tokens.
446446
Publication leases reserve the bounded publisher lane's maximum queue wait;

‎config/documentation-sync.json‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"version": 1,
3+
"sources": [
4+
{
5+
"path": "dashboard/wrangler.toml",
6+
"expect": {
7+
"EXACT_REVIEW_PUBLICATION_MIN_CONCURRENT": "8",
8+
"EXACT_REVIEW_PUBLICATION_BASE_CONCURRENT": "32",
9+
"EXACT_REVIEW_PUBLICATION_MAX_CONCURRENT": "40",
10+
"EXACT_REVIEW_PUBLICATION_BATCHING_ENABLED": "1",
11+
"EXACT_REVIEW_DIRECT_PUBLICATION_ENABLED": "1",
12+
"EXACT_REVIEW_PUBLICATION_BATCH_SIZE": "8",
13+
"EXACT_REVIEW_PUBLICATION_BATCH_MAX_CONCURRENT": "8",
14+
"EXACT_REVIEW_PUBLICATION_FRESH_LANE_ENABLED": "1",
15+
"EXACT_REVIEW_PUBLICATION_FRESH_LANE_MAX_ITEMS": "2",
16+
"EXACT_REVIEW_TARGET_RATE_PER_HOUR": "300",
17+
"EXACT_REVIEW_TARGET_BURST": "30"
18+
},
19+
"claims": [
20+
{
21+
"document": "README.md",
22+
"text": "production overrides them with {{EXACT_REVIEW_PUBLICATION_MIN_CONCURRENT}}/{{EXACT_REVIEW_PUBLICATION_BASE_CONCURRENT}}/{{EXACT_REVIEW_PUBLICATION_MAX_CONCURRENT}} and enables direct publication plus up to {{EXACT_REVIEW_PUBLICATION_BATCH_MAX_CONCURRENT}} concurrent size-{{EXACT_REVIEW_PUBLICATION_BATCH_SIZE}}"
23+
},
24+
{
25+
"document": "docs/scheduler.md",
26+
"text": "production overrides them to {{EXACT_REVIEW_PUBLICATION_MIN_CONCURRENT}}, {{EXACT_REVIEW_PUBLICATION_BASE_CONCURRENT}}, and {{EXACT_REVIEW_PUBLICATION_MAX_CONCURRENT}}"
27+
},
28+
{
29+
"document": "docs/scheduler.md",
30+
"text": "preparation is enabled for up to {{EXACT_REVIEW_PUBLICATION_BATCH_MAX_CONCURRENT}} concurrent size-{{EXACT_REVIEW_PUBLICATION_BATCH_SIZE}} batches"
31+
},
32+
{
33+
"document": "docs/scheduler.md",
34+
"text": "including {{EXACT_REVIEW_PUBLICATION_FRESH_LANE_MAX_ITEMS}} fresh-lane members per batch"
35+
},
36+
{
37+
"document": "docs/live-dashboard.md",
38+
"text": "Production overrides publication minimum, base, and maximum capacity to {{EXACT_REVIEW_PUBLICATION_MIN_CONCURRENT}}, {{EXACT_REVIEW_PUBLICATION_BASE_CONCURRENT}}, and {{EXACT_REVIEW_PUBLICATION_MAX_CONCURRENT}}"
39+
},
40+
{
41+
"document": "docs/live-dashboard.md",
42+
"text": "production enables up to {{EXACT_REVIEW_PUBLICATION_BATCH_MAX_CONCURRENT}} concurrent size-{{EXACT_REVIEW_PUBLICATION_BATCH_SIZE}} batches"
43+
},
44+
{
45+
"document": "docs/limits.md",
46+
"text": "production overrides them to {{EXACT_REVIEW_PUBLICATION_MIN_CONCURRENT}}, {{EXACT_REVIEW_PUBLICATION_BASE_CONCURRENT}}, and {{EXACT_REVIEW_PUBLICATION_MAX_CONCURRENT}}"
47+
},
48+
{
49+
"document": "docs/limits.md",
50+
"text": "production now admits {{EXACT_REVIEW_PUBLICATION_BATCH_MAX_CONCURRENT}} preparation batches"
51+
},
52+
{
53+
"document": "docs/limits.md",
54+
"text": "durable {{EXACT_REVIEW_TARGET_RATE_PER_HOUR}}-review/hour budget with a {{EXACT_REVIEW_TARGET_BURST}}-item burst"
55+
},
56+
{
57+
"document": "docs/scheduler.md",
58+
"text": "total review admission target: {{EXACT_REVIEW_TARGET_RATE_PER_HOUR}} items/hour across the fleet"
59+
},
60+
{
61+
"document": "docs/scheduler.md",
62+
"text": "with a {{EXACT_REVIEW_TARGET_BURST}}-item burst"
63+
}
64+
]
65+
},
66+
{
67+
"path": "config/target-repositories.json",
68+
"expect": {
69+
"generic_fallbacks.0.apply_close_rules.issue.0": "implemented_on_main",
70+
"generic_fallbacks.0.apply_close_rules.pull_request.0": "implemented_on_main",
71+
"generic_fallbacks.0.apply_close_rules.pull_request.1": "mostly_implemented_on_main"
72+
},
73+
"claims": [
74+
{
75+
"document": "docs/target-repositories.md",
76+
"text": "generic `openclaw/*` issues can auto-close only for `{{generic_fallbacks.0.apply_close_rules.issue.0}}`; PRs can auto-close for `{{generic_fallbacks.0.apply_close_rules.pull_request.0}}` or age-gated `{{generic_fallbacks.0.apply_close_rules.pull_request.1}}`"
77+
}
78+
]
79+
}
80+
]
81+
}

‎dashboard/wrangler.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ EXACT_REVIEW_PENDING_SOFT_LIMIT = "600"
7373
# takes effect. Interactive exact-event reviews keep their independent lane.
7474
EXACT_REVIEW_TARGET_RATE_PER_HOUR = "300"
7575
EXACT_REVIEW_TARGET_BURST = "30"
76-
# Keep each mutation lease at 8 while allowing four isolated workflows to prepare
76+
# Keep each mutation lease at 8 while allowing eight isolated workflows to prepare
7777
# concurrently. Final commits still cross the single state-writer coordinator.
7878
# A full-window publish moves ~2k paths and observed ~40 min; the drain lease
7979
# must outlive it or the ack lands after expiry and the cycle makes no progress.
@@ -84,8 +84,8 @@ EXACT_REVIEW_STATE_REPO = "openclaw/clawsweeper-state"
8484
EXACT_REVIEW_STATE_REF = "state"
8585
EXACT_REVIEW_PUBLICATION_BATCH_SIZE = "8"
8686
EXACT_REVIEW_PUBLICATION_BATCH_MAX_CONCURRENT = "8"
87-
# Reserve two members for recent protocol-v2 tuples that still match the
88-
# queue's current source revision. The other six members keep draining FIFO.
87+
# Reserve 2 members for recent protocol-v2 tuples that still match the
88+
# queue's current source revision. The other 6 members keep draining FIFO.
8989
EXACT_REVIEW_PUBLICATION_FRESH_LANE_ENABLED = "1"
9090
EXACT_REVIEW_PUBLICATION_FRESH_LANE_MAX_ITEMS = "2"
9191
EXACT_REVIEW_PUBLICATION_FRESH_LANE_MAX_AGE_MS = "900000"

‎docs/README.md‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,18 @@ Review the relevant pages in the same change when any of these surfaces move:
154154
- workflow retirement or replacement: every command example and compatibility
155155
page that names the workflow
156156

157-
The current index and lifecycle labels are human-reviewed. Follow-on automated
158-
checks validate links, documented commands, and selected configuration-derived
159-
claims; they do not decide policy or production ownership.
157+
## Automated drift checks
158+
159+
`pnpm run check:docs` validates exact-case relative links and Markdown anchors,
160+
documented package scripts, workflow files, repository source paths, and the
161+
selected configuration-derived claims in
162+
`config/documentation-sync.json`. It runs through the existing static check and
163+
CI path. Add a manifest claim when volatile production configuration is quoted
164+
as a concrete value in prose. Stage newly added files before running the check
165+
so its repository inventory matches the proposed commit rather than unrelated
166+
untracked workspace contents.
167+
168+
The check deliberately does not crawl external URLs, infer policy, assign
169+
ownership, or treat historical proof commands and paths as current contracts.
170+
The index, lifecycle labels, and whether a configuration claim should become
171+
policy remain human-reviewed.

‎docs/limits.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Codex and does not deduct these control-plane workflows from `workers.max`.
240240

241241
Legacy state-repository publication once limited exact-review preparation to
242242
four concurrent size-8 batches. Canonical Worker publication removes that
243-
shared Git writer constraint, so production now admits eight preparation
243+
shared Git writer constraint, so production now admits 8 preparation
244244
batches (up to 64 publication members) while retaining the Durable Object's
245245
transactional SQLite ownership boundaries.
246246

‎docs/live-dashboard.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Production overrides publication minimum, base, and maximum capacity to 8, 32,
350350
and 40, while source fallback values are 4, 24, and 48. The controller records
351351
failure, cooldown, recovery, and demand telemetry and scales within the
352352
production range. The publication lane also
353-
exposes `batches` and `direct`: production enables up to eight concurrent size-8
353+
exposes `batches` and `direct`: production enables up to 8 concurrent size-8
354354
batches, reserves two fresh-lane members per batch, and enables direct
355355
publication with retry/batch fallback. Document effective production values from
356356
`dashboard/wrangler.toml`, not only fallback constants in

‎docs/repair/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ Each cluster job:
136136
4. Runs Codex with repo-local policy prompts and JSON output schema in a read-only sandbox when a planning pass is needed. Adopted automerge/autofix PR repairs skip this read-only model pass after live hydration and emit a generic fix artifact directly.
137137
5. Writes structured run artifacts under `.clawsweeper-repair/runs/`.
138138
6. Reviews the worker artifact with deterministic safety checks.
139-
7. Executes credited fix artifacts through `scripts/execute-fix-artifact.ts` when the fix gate is open: repair a writable contributor branch first, treating same-repo head branches as writable even when GitHub reports `maintainer_can_modify=false`; otherwise raise a narrow replacement PR, copy source labels, add non-bot source PR authors as replacement co-authors, and close the uneditable source PR after the replacement push succeeds.
140-
8. Applies guarded close/comment and explicit merge actions through `scripts/apply-result.ts`.
139+
7. Executes credited fix artifacts through `src/repair/execute-fix-artifact.ts` when the fix gate is open: repair a writable contributor branch first, treating same-repo head branches as writable even when GitHub reports `maintainer_can_modify=false`; otherwise raise a narrow replacement PR, copy source labels, add non-bot source PR authors as replacement co-authors, and close the uneditable source PR after the replacement push succeeds.
140+
8. Applies guarded close/comment and explicit merge actions through `src/repair/apply-result.ts`.
141141
9. Publishes a sanitized result ledger back to `openclaw/clawsweeper-state`
142142
under `results/`, `jobs/openclaw/closed/`, `repair-apply-report.json`, and
143143
`notifications/`; the external dashboard and Discord notification dedupe
@@ -179,7 +179,7 @@ maintainer comment router. The command matrix, accepted authors and mentions,
179179
idempotency behavior, execution switch, and recovery procedure are canonical in
180180
[Operations: Maintainer Comment Routing](operations.md#maintainer-comment-routing).
181181
The trusted PR state contract and label behavior are canonical in
182-
[Auto-Updating ClawSweeper PRs](auto-update-prs.md#maintainer-commands).
182+
[Auto-Updating ClawSweeper PRs](auto-update-prs.md).
183183

184184
Keep these boundaries visible from the entry point:
185185

‎docs/repair/internal-features.md‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ job. That is the primary duplicate-PR guard.
5656

5757
Path: `.clawsweeper-repair/runs/<run>/cluster-plan.json`
5858

59-
Created by `scripts/plan-cluster.ts`. It hydrates the listed GitHub refs,
59+
Created by `src/repair/plan-cluster.ts`. It hydrates the listed GitHub refs,
6060
linked refs, labels, bodies, comments, PR files, PR reviews, PR review
6161
comments, checks, and current `main` state. The Codex worker receives this as
6262
its live evidence bundle.
@@ -65,11 +65,11 @@ its live evidence bundle.
6565

6666
Path: `.clawsweeper-repair/runs/<run>/result.json`
6767

68-
Created by `scripts/run-worker.ts` via `codex exec` using
68+
Created by `src/repair/run-worker.ts` via `codex exec` using
6969
`schema/repair/codex-result.schema.json`. The worker can recommend actions and fix
7070
artifacts, but it must not mutate GitHub directly.
7171

72-
`scripts/review-results.ts` validates the result before any follow-up lane
72+
`src/repair/review-results.ts` validates the result before any follow-up lane
7373
trusts it.
7474

7575
Long Codex calls emit periodic `[clawsweeper repair] ... still running` log
@@ -171,7 +171,7 @@ stale-head worker without cancelling the active run's gate cleanup.
171171

172172
## Creating Implementation PRs
173173

174-
Script: `scripts/execute-fix-artifact.ts`
174+
Script: `src/repair/execute-fix-artifact.ts`
175175

176176
This is the PR creation and branch repair engine.
177177

@@ -215,7 +215,7 @@ Generated ClawSweeper PRs are marked by:
215215
- branch prefix: `clawsweeper/`
216216
- committed repair job metadata for the branch cluster id
217217

218-
The `clawsweeper` label is a reporting hint from `scripts/tag-clawsweeper-targets.ts`,
218+
The `clawsweeper` label is a reporting hint from `src/repair/tag-clawsweeper-targets.ts`,
219219
not a PR identity boundary.
220220

221221
Current operational gotcha: OpenClaw's PR queue policy can close PRs when the
@@ -307,7 +307,7 @@ label.
307307

308308
## Applying Comments, Closures, And Merges
309309

310-
Script: `scripts/apply-result.ts`
310+
Script: `src/repair/apply-result.ts`
311311

312312
This script owns safe GitHub mutations from reviewed worker results.
313313

@@ -341,7 +341,7 @@ instead of merging.
341341

342342
## Post-Flight Finalization
343343

344-
Script: `scripts/post-flight.ts`
344+
Script: `src/repair/post-flight.ts`
345345

346346
Post-flight watches the PRs that `execute-fix-artifact` opened or repaired.
347347
It waits for merge readiness, validates merge preflight, and either:
@@ -532,7 +532,7 @@ instead of leaving duplicate crustacean notes.
532532

533533
## Label Backfill
534534

535-
Script: `scripts/tag-clawsweeper-targets.ts`
535+
Script: `src/repair/tag-clawsweeper-targets.ts`
536536

537537
This script labels ClawSweeper-created or ClawSweeper-tracked PRs/issues in the
538538
target repo. It helps downstream tools and maintainers distinguish generated
@@ -549,9 +549,9 @@ truth.
549549

550550
Scripts:
551551

552-
- `scripts/sweep-openclaw-jobs.ts`
553-
- `scripts/promote-stuck-jobs.ts`
554-
- `scripts/requeue-job.ts`
552+
- `src/repair/sweep-openclaw-jobs.ts`
553+
- `src/repair/promote-stuck-jobs.ts`
554+
- `src/repair/requeue-job.ts`
555555

556556
These scripts manage the ClawSweeper backlog:
557557

@@ -565,8 +565,8 @@ inventory and dispatch pressure.
565565

566566
## Dashboard Publishing
567567

568-
Workflow: `.github/workflows/publish-results.yml`
569-
Script: `scripts/publish-result.ts`
568+
Workflow: `.github/workflows/repair-publish-results.yml`
569+
Script: `src/repair/publish-result.ts`
570570

571571
Publishing turns raw run artifacts into durable, sanitized summaries. It updates
572572
the README dashboard, per-cluster markdown reports, and aggregate JSON ledgers.

‎docs/scheduler.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ a 403/429 or
8888
explicit rate-limit failure records a 15-minute cooldown, while GitHub 5xx
8989
failures record a 5-minute cooldown. Demand and recovery signals scale effective
9090
capacity within the production range. Production batch
91-
preparation is enabled for up to eight concurrent size-8 batches, including two
91+
preparation is enabled for up to 8 concurrent size-8 batches, including 2
9292
fresh-lane members per batch. Direct publication is also enabled and falls back
9393
to the retry/batch path when the direct result is retryable. Apply/comment sync
9494
remains per-target serialized. See [`docs/limits.md`](limits.md) for effective values and

0 commit comments

Comments
 (0)