Repository navigation
Clear cached search results after a background metadata sync - #1673
Merged
Paul Lizer (paullizer) merged 1 commit intoOct 6, 2026
Merged
Conversation
Routes clear the search cache when a metadata change is saved, but the chunk merge now finishes in the background. A search that ran during the sync could cache the old values and keep serving them for the cache lifetime (300 seconds by default) after the sync completed. After a pass that changed chunks, the worker now clears cached results for the document's workspace and every user or group with an approved share. Refs #1657 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment on lines
+31
to
+35
| from utils_cache import ( | ||
| invalidate_group_search_cache, | ||
| invalidate_personal_search_cache, | ||
| invalidate_public_workspace_search_cache, | ||
| ) |
This was referenced Oct 6, 2026
Paul Lizer (paullizer)
added a commit
to paullizer/simplechat
that referenced
this pull request
Oct 7, 2026
Port microsoft#1658 (merged into Development as 900a3e4, including hardening commit 9c156a4) and its follow-up microsoft#1673 (df3879c) to the React V2 branch. Re-implemented against V2's strict update_document(), group projection fence, content screening and native group/public document APIs rather than cherry-picked. - Mirrored metadata (title, authors, file name, classification, tags) is projected by a durable background sync. The request is recorded in the settings container before the save, the save carries its token, and a worker merges only the changed fields in key-paged batches of 500. The worker never writes to the document. - Access-control lists are projected synchronously and fail closed. Group revocations go through the projection fence before the save, grants after it. Re-approving an approved share repairs its search access. - Native group/public receipts add search_sync. Metadata projection failures no longer produce document_propagation_incomplete; strict group edits on multi-chunk documents no longer fail on the fence etag. - Legacy routes save every field in one update_document() call and drop propagate_tags_to_chunks(), which is removed. Errors are fixed messages. - Blob tag refresh moves to the worker, best effort and conditioned on the blob ETag. After a pass that changed chunks, the worker clears cached search results for the workspace and every approved share recipient. - React and classic workspace UIs show a notice while the index updates. - Harnesses that exercised the per-chunk loop now drive the sync worker. Refs microsoft#1657 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.
Summary
Follow-up to #1658 (merged as
900a3e431). The React v2 port surfaced this gap during its review.Routes clear the search cache when a metadata or tag change is saved, but since #1658 the chunk merge finishes in the background. A chat or search that runs during the sync can cache the old chunk values and keep serving them for the cache lifetime (
search_cache_ttl_seconds, 300 seconds by default; caching is on by default) after the sync completes. That's most noticeable on exactly the large documents #1658 targets, where the sync takes longest.run_document_search_metadata_sync()clears cached search results for:shared_user_ids) or group (shared_group_ids) with an approved share, since recipients cache their own results.[DOCUMENT_SEARCH_SYNC]and never fail the sync.functions_documents.pynow importsutils_cachedirectly. It was already a transitive import throughfunctions_search, so the import graph is unchanged.Refs #1657. The React v2 port has the same invalidation.
Validation
python -m pytest functional_tests/test_document_search_metadata_sync.py functional_tests/test_document_metadata_chunk_sync_batching.py functional_tests/test_data_management_search_write_fence_authorization.py -q: 28 passed (addstest_worker_clears_cached_search_results_for_the_owner_and_approved_recipients)python functional_tests/test_codeql_import_cycle_lazy_imports.py: 2/2python functional_tests/test_logging_tag_standardization.py: passedpython functional_tests/test_file_sync_tag_definition_application.py: passedpython functional_tests/route_tests/test_route_blueprint_policy_inventory.py: 6/6python functional_tests/route_tests/test_route_unauthenticated_policy_contract.py: 4/4python functional_tests/route_tests/test_route_policy_test_coverage.py: 2/2python functional_tests/test_docs_site_quality.py: 6/6python functional_tests/test_docs_app_surface_coverage.py: 7/7python scripts/check_xss_sinks.py --base-sha 900a3e431 --head-sha HEAD application/single_app/functions_documents.py: passedpython scripts/check_broken_access_control.py --base-sha 900a3e431 --head-sha HEAD application/single_app/functions_documents.py: passedpython -m py_compile application/single_app/functions_documents.pyandgit diff --check: cleanNotes
0.261.053, with a release notes entry. The fix docdocs/explanation/fixes/DOCUMENT_SEARCH_METADATA_SYNC_FIX.mdis updated.