fix(docs): remove prefetched.files optimization to fix stale file data #5709
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.
Link to Devin run: https://app.devin.ai/sessions/97c785c20bfd40f592b8d50a107c09db
Requested by: kenny@buildwithfern.com
Short description of the changes made
Removes the
prefetched.filesoptimization increateCachedDocsLoaderImpl.getFiles()and always callsgetFiles(config)(domainKey)directly.What was the motivation & context behind this PR?
Since Tuesday Dec 3, we've been seeing
mdx_unresolved_file_idserrors wherefile:IDs in markdown don't match available files infilesV2. The previous revert (#5706) removedloadDocsBranch/loadDocsResponsebut did NOT remove theprefetchPromiseoptimization.Root cause:
batchGetCommonMetadatareads directly from KV viakvMgetand does NOT respectrevalidateTagcache invalidation. Whenloader.getFiles()was called, it returnedprefetched.filesif non-null, bypassing thegetFilesfunction which hasunstable_cacheTag(domainKey, "getFiles"). This caused stale file data to be served after revalidation.By always calling
getFiles()which hasunstable_cacheTag, we ensure file resolution respectsrevalidateTaginvalidation.How has this PR been tested?
getFilespath; other prefetch optimizations (metadata, config, root, etc.) remain intactmdx_unresolved_file_idserrors stop occurringHuman review checklist
batchGetCommonMetadatadoesn't respectrevalidateTaggetFiles()has its own caching viaunstable_cacheTag)mdx_unresolved_file_idserrors stop