Repository navigation
fix: preserve Markdown exports for retired documentation - #143
Merged
Merged
Conversation
steipete
marked this pull request as ready for review
August 30, 2026 23:19
steipete
force-pushed
the
steipete/markdown-publish-f9a625
branch
from
August 31, 2026 00:24
fb7bd52 to
1b8abb4
Compare
This was referenced Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 plaincurl -fsSthat 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.rootGBvalue 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 is200 text/markdownwith 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./refactor/database-first.mdreturned 404 while/reference/database-schemas.mdreturned 200; negotiating Markdown on the former browser URL returned HTML. The final regression fails against unchanged publisher main with404 !== 200; the intermediate bodyless redirect independently failed with308 !== 200./docsvariants, dotted terminal pages, chains, path validation and metadata refresh with cached canonical Markdown.ENOENT; it now passes using fixture-only precedence examples. No actual source page was deleted for that proof.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.f81f18964c3088119a19cd60c8db3825dae00fd4: scoped-clean at the configured P0 blocking threshold.npm testpassed 76/76 on GitHub merge tree5298acc61fb65a8c26c3019d6c90aabddcbe3d6a(baseb48f8cd16fd237dddcd479a3a1f3df3eb5893952, 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.make docs-checkbuilt 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.mdcovered every alias; 42 dotted aliases retain the existing non-negotiation policy and were reported separately.0b392310b92d90bd37b884c4469b0ec799ad2521. The clean run used provideraws, leasecbx_76858b99cc81, runrun_b20f1206d343, and exited 0; independent inspection confirms the lease is released. No Actions credential hydration or R2 upload occurred in this proof.Representative commands:
npm testnode --test --test-name-pattern='central aliases serve exact canonical Markdown in the first response after source retirement' scripts/docs-site/markdown-redirect.test.mjsProduction/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→400GB), 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
.mdand all three negotiated Markdown types, GET/HEAD, exact canonical bytes,Vary: Accept, noLocation, and unchanged HTML destinations. Ordinary URLs were used without cache-busting or following redirects. Plaincurl -fsSwithout-Lreturned 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.