Skip to content

fix: preserve Markdown exports for retired documentation - #143

Merged
steipete merged 5 commits into
mainfrom
steipete/markdown-publish-f9a625
Aug 31, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/markdown-publish-f9a625

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Related: openclaw/openclaw#133404 — retiring historical implementation plans exposed broken Markdown exports at otherwise valid browser aliases.

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.

What Problem This Solves

Fixes an issue where readers requesting a retired documentation URL as Markdown receive 404, or HTML despite Accept: text/markdown, when the old source page has been removed. The HTML alias even advertises that broken Markdown alternate. A bodyless HTTP redirect is not sufficient for readers such as plain curl -fsS that do not follow redirects automatically.

Why This Change Was Made

Resolve internal alias chains against published page descriptors at build time and carry the terminal Markdown target in the existing R2 HTML alias metadata. On a direct Markdown miss, the Worker serves the whole canonical document through its existing canonical asset/cache path. There are no hand-maintained stub pages, copied alias bodies, request-time redirect manifests, or new cache policies.

R2 preparation validates targets. Upload selection and metadata comparison account for metadata-only changes and page/locale partial publishes, including translation targets switching to or from English fallback. Real Markdown pages retain precedence; HTML destinations, anchors, locale rules and compatibility prefixes remain covered. Hosting guidance describes the actual R2/Worker rollout and current Worker cache behavior.

The clean Linux proof also exposed a stale test-machine profile: its 120 GB disk was below the current runner image's 400 GB minimum, so provisioning failed before execution. The existing aws.rootGB value is corrected to the documented 400 GB default, without changing provider, CPU class, credentials or application configuration.

User Impact

Old internal page URLs remain usable by Markdown readers without -L: the first GET response is 200 text/markdown with exact canonical bytes; HEAD is 200 without a body. The whole document is returned even for section-targeted aliases. Existing real pages and browser routing stay available. Invalid internal redirect graphs fail the build instead of publishing dangling targets.

This changes the documentation publisher only. It does not retire additional source pages, change OpenClaw runtime/config/schema behavior, publish packages, or alter locale source ownership.

Evidence

Verified candidate: 1b8abb4eecfb3062442f18e9acb0235c46b7657b.

  • Production baseline: /refactor/database-first.md returned 404 while /reference/database-schemas.md returned 200; negotiating Markdown on the former browser URL returned HTML. The final regression fails against unchanged publisher main with 404 !== 200; the intermediate bodyless redirect independently failed with 308 !== 200.
  • Real builder → R2 preparer → Worker coverage checks exact first-response bytes, GET/HEAD, all three Markdown Accept types, alternate links, HTML queries/anchors, source precedence, translated targets/English fallback, base and /docs variants, dotted terminal pages, chains, path validation and metadata refresh with cached canonical Markdown.
  • A counterfactual mirror without the two retiring source stubs initially failed with ENOENT; it now passes using fixture-only precedence examples. No actual source page was deleted for that proof.
  • CI exposed an integration mismatch: the HTML-freshness repair landed on main and deliberately bypasses the Worker cache for HTML. CI tested that merged policy while this branch still expected HTML HIT. The initial minute-rollover diagnosis was incomplete; pinning the clock did not fix CI. The final candidate preserves main's policy, removes the obsolete clock mock, seeds a stale HTML cache entry, and requires fresh R2 HTML (MISS) alongside cached canonical Markdown (HIT).
  • npm test: 75 passed locally and again on clean Linux; zero failures/skips/cancellations. The earlier local preview built 30 pages, not the full corpus.
  • Exact-head Docs Code CI passed: script syntax, helper tests, Worker bundle validation, shell build, shell smoke and visual smoke. Exact-head CodeQL passed. Wrangler bundle validation is not a TypeScript typecheck claim.
  • Fresh isolated Codex autoreview of the complete integrated candidate against f81f18964c3088119a19cd60c8db3825dae00fd4: scoped-clean at the configured P0 blocking threshold.
  • Final merge-tree sanity after the upstream dotted-HTML cache repair: npm test passed 76/76 on GitHub merge tree 5298acc61fb65a8c26c3019d6c90aabddcbe3d6a (base b48f8cd16fd237dddcd479a3a1f3df3eb5893952, unchanged PR head). The added upstream test passes alongside all alias tests. Build/upload scripts and dependencies are unchanged; intervening content changes are limited to the docs map, Control UI page and sync metadata.
  • Fresh AWS/Linux proof, Node 24.20.0 and npm 11.19.0: make docs-check built 30,573 pages, prepared 85,632 R2 objects, and passed full-site smoke with the exact matching OpenClaw source checkout. Full generated-artifact → Worker verification exercised 10,110 aliases through 40,356 GET/HEAD requests, requiring first-response 200, Markdown MIME, Vary, no Location, exact canonical bytes and empty HEAD bodies. Explicit .md covered every alias; 42 dotted aliases retain the existing non-negotiation policy and were reported separately.
  • The bounded source index contains 17,945 records for source 0b392310b92d90bd37b884c4469b0ec799ad2521. The clean run used provider aws, lease cbx_76858b99cc81, run run_b20f1206d343, and exited 0; independent inspection confirms the lease is released. No Actions credential hydration or R2 upload occurred in this proof.
  • The handoff's interrupted local full render is not counted as passing proof. The earlier full Linux run predates main's cache-policy change; the fresh run above replaces it rather than claiming production equivalence.

Representative commands:

npm test
node --test --test-name-pattern='central aliases serve exact canonical Markdown in the first response after source retirement' scripts/docs-site/markdown-redirect.test.mjs
make docs-check

Production/tooling delta: +189/-40 (net +149 lines), after replacing the old per-rule redirect writers with one graph owner. This growth carries the previously missing Markdown representation across build, publication and request handling, including partial-publish correctness. Tests/test support: +585 lines; hosting documentation: +14 net lines. Test-provisioning configuration changes one existing value (120 → 400 GB), net zero lines; no option is added.

Production rollout verified on 2026-08-31 UTC: full R2 publication uploaded 20,434 changed objects and deleted 143 obsolete manifest-tracked objects from the 85,634-object artifact. Matching Worker deployment succeeded without host cutover. The intervening heads changed no build/router code from this repair. All 24 live route variants passed explicit .md and all three negotiated Markdown types, GET/HEAD, exact canonical bytes, Vary: Accept, no Location, and unchanged HTML destinations. Ordinary URLs were used without cache-busting or following redirects. Plain curl -fsS without -L returned the complete 71,584-byte canonical database-schema document. This opens the dependent source-retirement gate; real source objects and their normal cache lifetime still need verification after retirement.

Several earlier green runs skipped both upload and Worker deployment. The publication-liveness follow-up repairs that starvation separately. General Accept quality parsing, dotted-alias negotiation and base-prefixed canonical routing remain outside this Markdown-alias repair.

@steipete
steipete marked this pull request as ready for review August 30, 2026 23:19
@steipete
steipete requested a review from a team as a code owner August 30, 2026 23:19
@steipete
steipete force-pushed the steipete/markdown-publish-f9a625 branch from fb7bd52 to 1b8abb4 Compare August 31, 2026 00:24
@steipete
steipete merged commit 8d0159a into main Aug 31, 2026
6 checks passed
@vincentkoc
vincentkoc deleted the steipete/markdown-publish-f9a625 branch September 25, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant