Fix redirects not written or deployed for isolated builds - #3746
Open
cotti wants to merge 1 commit into
Open
Conversation
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>
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.
Why
Redirects defined in
_redirects.ymlfor docs-builder's own docs (and any other isolated/per-docset build) were silently discarded.IsolatedBuildService.BuildcalledGenerateAllwith the discard operator (_ = await), so theGenerationResult.Redirectsmap was thrown away andredirects.jsonwas never written to disk. Even if it had been, thedocs-preview-local.ymlworkflow had no step to push it to the CloudFront KeyValueStore.What
IsolatedBuildService.Build: captures theGenerateAllresult and writesredirects.jsonto the output directory, resolving each redirect's relative file paths to absolute URL paths using the configured--path-prefixassembler deploy update-redirects: gains a--no-deleteflag 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 KVSdocs-preview-local.yml: adds a "Deploy redirects to CloudFront KVS" step after the S3 upload, running on pushes to main, that invokesassembler deploy update-redirects --no-delete previewHow
The URL resolution in
IsolatedBuildService.ToAbsoluteUrlmirrorsFileNavigationLeaf.DetermineUrl: strips.md, strips trailing/index, and treats a bareindexpath as the path-prefix root. Cross-repo redirects (containing://) are skipped since the isolated build has no cross-link resolver to follow them.