Skip to content

Fix redirects not written or deployed for isolated builds - #3746

Open
cotti wants to merge 1 commit into
mainfrom
worktree-fix-isolated-build-redirects
Open

Fix redirects not written or deployed for isolated builds#3746
cotti wants to merge 1 commit into
mainfrom
worktree-fix-isolated-build-redirects

Conversation

@cotti

@cotti cotti commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Why

Redirects defined in _redirects.yml for docs-builder's own docs (and any other isolated/per-docset build) were silently discarded. IsolatedBuildService.Build called GenerateAll with the discard operator (_ = await), so the GenerationResult.Redirects map was thrown away and redirects.json was never written to disk. Even if it had been, the docs-preview-local.yml workflow had no step to push it to the CloudFront KeyValueStore.

What

  • IsolatedBuildService.Build: captures the GenerateAll result and writes redirects.json to the output directory, resolving each redirect's relative file paths to absolute URL paths using the configured --path-prefix
  • assembler deploy update-redirects: gains a --no-delete flag that skips the KVS reconciliation delete pass — only PUTs the new entries. This is required for per-docset isolated deploys, which only know about their own redirects and must not wipe other repos' entries from the shared KVS
  • docs-preview-local.yml: adds a "Deploy redirects to CloudFront KVS" step after the S3 upload, running on pushes to main, that invokes assembler deploy update-redirects --no-delete preview

How

The URL resolution in IsolatedBuildService.ToAbsoluteUrl mirrors FileNavigationLeaf.DetermineUrl: strips .md, strips trailing /index, and treats a bare index path as the path-prefix root. Cross-repo redirects (containing ://) are skipped since the isolated build has no cross-link resolver to follow them.

Isolated builds (e.g. docs-builder's own docs) were discarding the
GenerationResult from GenerateAll with `_ = await`, so redirects.json
was never produced and redirects defined in _redirects.yml had no effect.

- Capture GenerateAll result in IsolatedBuildService.Build and write
  redirects.json with path-prefix-resolved absolute URLs
- Add --no-delete flag to `assembler deploy update-redirects` so
  per-docset deploys only PUT new entries without wiping other repos'
  KVS redirects
- Add Deploy redirects step in docs-preview-local.yml to push
  docs-builder's redirects.json to the CloudFront KVS on push to main

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant