Skip to content

docs: add deterministic drift checks - #1096

Merged
brokemac79 merged 3 commits into
mainfrom
codex/csw-114-doc-drift-checks
Aug 10, 2026
Merged

brokemac79 merged 3 commits into
mainfrom
codex/csw-114-doc-drift-checks

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a deterministic, read-only documentation drift checker
  • validate local links and GitHub-style anchors through parsed Markdown
  • validate documented pnpm commands, workflow names, and repository paths
  • bind high-risk production prose to selected Wrangler and target-repository config values
  • run the checker in the existing static-check lane with focused fixtures

Problem

CSW-114 found that documentation drift was being caught only by manual audits. The repository had no deterministic gate for case-sensitive paths, stale commands, missing anchors, renamed workflows, or selected production configuration claims. That allowed confirmed stale statements to persist across scheduler, publication, repair, and contributor documentation.

Implementation

  • scripts/check-docs.mjs inventories tracked/staged repository paths and checks evergreen Markdown without treating unrelated untracked files as valid targets
  • markdown-it supplies CommonMark-aware tokens for links, images, reference definitions, headings, inline code, fenced code, and indented code
  • config/documentation-sync.json declares selected source-to-prose contracts for production publication settings and target close policy
  • test/check-docs.test.ts proves passing and failing fixtures for path case, anchors, directory READMEs, multiline locations, code spans/blocks, pnpm commands, workflows, untracked files, config claims, escaped heading text, and full URI-scheme syntax
  • check:docs is included in the existing check:static CI path
  • confirmed drift exposed by the checker is corrected in the same PR

Current-main reconciliation

After #1095 merged, the two original drift-check commits were replayed onto current main 2f547841c459886f78c5e3d3d28ebf781f2d78be. Conflicts were limited to publication prose changed by #1092/#1094. Resolution preserved source fallback values 4/24/48 and production values 8/32/40, and updated the new sync manifest from obsolete fixed-50 expectations to current minimum/base/maximum 8/32/40 claims. No workflow file, gate, queue, deployment, or production-state change is included.

Validation

At exact head 9ee3ce44a1aa43e6165ca886b729e3ac5873fe1b:

  • corepack pnpm install --frozen-lockfile — pass, pnpm 11.10.0
  • corepack pnpm run check:docs — pass; Documentation checks passed.
  • node --test test/check-docs.test.ts — pass, 12/12
  • changed-file oxfmt --check — pass
  • changed-file oxlint — pass
  • corepack pnpm run check:active-surface — pass
  • corepack pnpm run check:dashboard-queue-boundary — pass
  • corepack pnpm run check:limits — pass
  • corepack pnpm run build — pass
  • docs generation and focused site test — pass; 54 pages, 1/1
  • git diff --check origin/main...HEAD — pass

The aggregate local check:static reaches the existing Windows checkout CRLF formatter baseline across hundreds of untouched files; all changed files format cleanly. Hosted Linux CI is the authoritative aggregate static/check run for this exact head.

Real Behavior Proof

  • Claim: the new mandatory static check reads the actual repository, exits cleanly when documentation and selected config claims agree, and deterministically rejects representative drift.
  • Exercised surface: exact public-PR checkout, frozen dependency installation, pnpm run check:docs, tracked/staged inventory, parsed Markdown validation, command/path validation, current 8/32/40 config manifest, and all focused fixtures.
  • Scenario/fixture: the current repository plus isolated temporary repositories covering valid and invalid links, anchors, code syntax, commands, workflows, paths, URI schemes, and config claims.
  • Command/environment: Crabbox provider=aws, run run_ea6fde619f0a, lease cbx_20eb68741e5a (swift-hermit-f818), c7a.8xlarge, Ubuntu 26.04 target; exact public-PR checkout via --fresh-pr 1096; no secrets.
  • Observed result: exact head asserted; frozen install passed; the repository check printed Documentation checks passed.; focused tests passed 12/12; Crabbox exited 0 and stopped the lease.
  • Artifact/trace: focused fixtures are committed in test/check-docs.test.ts; exact trace:
CRABBOX_PHASE:assert-head
PROOF_HEAD=9ee3ce44a1aa43e6165ca886b729e3ac5873fe1b
CRABBOX_PHASE:install
Done in 1.8s using pnpm v11.10.0
CRABBOX_PHASE:docs-check
Documentation checks passed.
CRABBOX_PHASE:fixture-suite
tests 12 | pass 12 | fail 0
CRABBOX_PHASE:assert
PROOF_RESULT=PASS
provider=aws run=run_ea6fde619f0a lease=cbx_20eb68741e5a slug=swift-hermit-f818 exit=0
  • Limits: no external URL crawl, production-secret access, workflow dispatch, queue mutation, deployment, or production-state change. The manifest intentionally covers selected high-risk config claims rather than inferring policy or ownership. The one provider-qualified proof used the repository-resolved Crabbox provider; no alternate backend was selected.

Review closeout

Rebase review found one actionable P2: external URI schemes containing RFC-valid +, ., or - characters could be misclassified as repository-relative links. The scheme matcher now accepts [a-z][a-z0-9+.-]*: and a dedicated fixture covers all three characters. Focused proof was rerun at 12/12.

Dirty-patch review confirmed the URI fix and coverage. Final committed review against origin/main reported the checker, configuration manifest, tests, and documentation updates internally consistent with no actionable correctness regressions.

OpenClaw Bay impact

No Bay behavior or contract changes. This PR adds a read-only repository checker and binds existing publication/dashboard prose to current configuration; it does not change the Bay route, six-lane projection, stage mapping, public fields, navigation, or observer-only control boundary. No Bay code, documentation, screenshot, or runtime proof update is required.

Risks and rollout

  • the checker is read-only, but adding it to check:static intentionally blocks future CI when covered docs drift
  • Maintainer decision: Martin explicitly approved integrating the CSW-114 stack in the current conversation, including this narrow mandatory gate; its selected documentation/configuration drift failures are intended and accepted
  • diagnostics include file, line, kind, and target/reason
  • markdown-it is a new development-only dependency used by the static checker
  • no workflow files, gates, queues, deployment, or production state are changed

Related work

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Comment thread scripts/check-docs.mjs Fixed
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 8:35 AM ET / 12:35 UTC.

ClawSweeper review

What this changes

This PR adds a Markdown-aware documentation drift checker, selected configuration-to-prose contracts, fixtures, and a new static-check command.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for a maintainer decision on whether selected production values should become a permanent static CI contract; no discrete implementation defect was found in the current-head patch.

Priority: P3
Reviewed head: 9ee3ce44a1aa43e6165ca886b729e3ac5873fe1b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation and current-head proof are solid, with the remaining blocker being deliberate CI-policy scope rather than a demonstrated patch defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides an exact-head Crabbox terminal trace showing a fresh public checkout passed check:docs and all 12 focused fixtures.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides an exact-head Crabbox terminal trace showing a fresh public checkout passed check:docs and all 12 focused fixtures.
Evidence reviewed 6 items Checker behavior: The new checker inventories tracked files, parses Markdown links and anchors, validates documented commands and paths, and checks declared configuration claims without writing repository state.
Static-gate scope: The branch adds check:docs to the existing check:static selector, making documentation drift a CI-gating automation behavior.
Configuration-lock decision: The manifest both derives prose values from source and requires fixed current values such as publication capacity 8/32/40, so a future configuration change fails even if its prose is updated.
Findings None None.
Security None None.

How this fits together

Repository documentation and selected operational configuration feed a read-only static checker. Its result joins the existing static CI lane and can block changes whose declared documentation contracts drift.

flowchart LR
  Docs[Repository documentation] --> Parser[Markdown-aware checker]
  Config[Selected operational configuration] --> Manifest[Declared prose contracts]
  Manifest --> Parser
  Parser --> Static[Static check command]
  Static --> CI[CI pass or drift report]
Loading

Decision needed

Question Recommendation
Should the new static check enforce the literal publication and close-policy values in config/documentation-sync.json, or only verify that declared prose reflects the current source values? Keep source-to-prose verification only: Remove fixed operational expectations and let declared prose interpolate the current source values, preserving drift detection without freezing policy values.

Why: This choice permanently changes what CI is allowed to reject. VISION.md directs agents to avoid pinned-text tests where review can provide the needed judgment, while the PR proposes selected value locks.

Before merge

  • Resolve merge risk (P1) - The manifest's fixed expectations turn selected operational values into CI policy locks, so future configuration changes can fail even after their documentation is updated.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed scope 14 files; 997 added, 28 removed The PR adds a repository-wide checker and changes the static CI path alongside documentation updates.
Checker coverage 567 implementation lines; 255 focused test lines The parser has substantial bespoke behavior with dedicated fixture coverage.
CI integration 1 new check:docs command added to check:static This makes future documentation and selected configuration drift merge-blocking.

Merge-risk options

Maintainer options:

  1. Keep source-to-prose verification only (recommended)
    Before merge, remove the literal config locks so the new static lane detects stale prose without rejecting an intentional configuration update.
  2. Accept configuration locking
    Merge with the declared expectations only after the owner confirms that each listed value is an intended CI-enforced policy contract.
  3. Pause for policy ownership
    Leave the PR open if no owner can confirm the long-term enforcement scope of the new static gate.

Technical review

Best possible solution:

Retain the parser and source-to-prose checks, but land fixed configuration expectations only if the responsible maintainer explicitly wants those values governed as static CI policy.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds a new validation capability rather than repairing a reported runtime bug; its current-head terminal trace does show the checker and fixtures running successfully.

Is this the best way to solve the issue?

Unclear: the parser and proof are coherent, but a maintainer must decide whether literal configuration expectations are appropriate CI policy rather than source-to-prose validation alone.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2f547841c459.

Labels

Label justifications:

  • P3: This is a low-urgency documentation and developer-workflow capability rather than a current user-facing regression.
  • merge-risk: 🚨 automation: Adding check:docs to check:static changes which documentation and configuration edits can pass CI.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides an exact-head Crabbox terminal trace showing a fresh public checkout passed check:docs and all 12 focused fixtures.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact-head Crabbox terminal trace showing a fresh public checkout passed check:docs and all 12 focused fixtures.

Evidence

What I checked:

  • Checker behavior: The new checker inventories tracked files, parses Markdown links and anchors, validates documented commands and paths, and checks declared configuration claims without writing repository state. (scripts/check-docs.mjs:81, 9ee3ce44a1aa)
  • Static-gate scope: The branch adds check:docs to the existing check:static selector, making documentation drift a CI-gating automation behavior. (package.json:111, 9ee3ce44a1aa)
  • Configuration-lock decision: The manifest both derives prose values from source and requires fixed current values such as publication capacity 8/32/40, so a future configuration change fails even if its prose is updated. (config/documentation-sync.json:7, 9ee3ce44a1aa)
  • Existing validation boundary: Current main already has a focused limits checker that derives expectations from config and checks selected documentation, making the intended division of responsibility important before adding another permanent gate. (scripts/check-limits.ts:60, 2f547841c459)
  • Current-main provenance: The affected documentation and publication configuration were recently maintained through the merged documentation baseline and navigation work. (docs/README.md:1, 2f547841c459)
  • Real behavior proof: The PR body records an exact-head Crabbox run that installed the public PR checkout, ran check:docs, and passed all 12 focused fixtures. (test/check-docs.test.ts:91, 9ee3ce44a1aa)

Likely related people:

  • Martin Cleary: Martin authored the two most recent merged commits affecting the documentation baseline and navigation that this checker targets. (role: recent area contributor and merger; confidence: high; commits: 2f547841c459, 9c32c14c65b0, 50f90eac14f7; files: docs/README.md, README.md, dashboard/wrangler.toml)
  • Peter Steinberger: History across the documentation, dashboard, package, and script surfaces shows sustained prior work in this area. (role: adjacent long-running contributor; confidence: medium; commits: a3469c99f6a8, 23409c1b3801; files: README.md, dashboard/wrangler.toml, package.json)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-10T10:57:23.375Z sha 9161431 :: found issues before merge. :: [P3] State the OpenClaw Bay impact
  • reviewed 2026-08-10T12:18:31.236Z sha 9ee3ce4 :: found issues before merge. :: [P3] State the OpenClaw Bay impact
  • reviewed 2026-08-10T12:26:44.707Z sha 9ee3ce4 :: needs maintainer review before merge. :: none

@brokemac79
brokemac79 force-pushed the codex/csw-114-doc-architecture branch from e3614fe to 8842fb8 Compare August 10, 2026 11:53
Base automatically changed from codex/csw-114-doc-architecture to main August 10, 2026 12:02
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 10, 2026
@brokemac79
brokemac79 force-pushed the codex/csw-114-doc-drift-checks branch from 9161431 to 9ee3ce4 Compare August 10, 2026 12:08
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Aug 10, 2026
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

1 similar comment
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@brokemac79
brokemac79 marked this pull request as ready for review August 10, 2026 12:37
@brokemac79
brokemac79 requested a review from a team as a code owner August 10, 2026 12:37
@brokemac79
brokemac79 merged commit 0559e03 into main Aug 10, 2026
33 checks passed
@brokemac79
brokemac79 deleted the codex/csw-114-doc-drift-checks branch August 10, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants