Conversation
#889 drops the lookup memories on !rehash, but the dashboard's Folders and Lists pages change the library without one, so a folder removed there still left "invalid path" for five minutes. A remembered path is now checked against this request's own search_roots - the check it is judged by afterwards anyway - and falls through to the folder memory and the scan when outside them. The rehash call stays. The test that asserted the wrong answer now asserts the right one without a forget; three new tests drive the page's route. Comment worded so the scoped- folders guard does not count it as a call. Both changelogs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AP6LSxkr4n9dMFNSNMogmW
Collaborator
Author
|
Superseded by #910 (merged), the same check against the current roots. Closing. One nit on #910's version: |
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.
Fixes #901. Follow-up to #889, from my review there.
What was wrong
#889 drops the #886 lookup memories on
!rehash. But the dashboard's Folders and Lists pages change the library without a rehash:apply_folder_changes()/apply_list_changes()save the file and return, and the folder set is read from that file on every call, so the new roots are live on the very next request. A path remembered under the folder just removed is still on disk, passes the memory's own existence check, and is then refused byis_safe_path()against the new roots:Error: Invalid path.for a file the new configuration serves, for up toLOOKUP_HIT_TTL_SECONDS(5 minutes).What changed
dcc.py: a remembered path is trusted only if it is under one of this request's ownsearch_roots- the sameis_safe_path()check it is judged by a few lines later anyway. Outside them, the name memory falls through to the folder memory, and that to the scan. This holds however the roots change: the dashboard, a hand-editedlists.json, or a scan still in flight across a rehash that records its hit after the forget.test_a_path_from_a_root_that_is_gone_is_refused_rather_than_servedasserted the wrong answer, as the documented cost of not forgetting; it is now..._is_not_used_even_without_a_forgetand asserts the right one.Test
tests/test_a_folder_removed_on_the_dashboard_is_not_served_from_memory.py(3), through the real request path, changinglibrary.foldersthe way the page's save does (no rehash, no forget): a remembered file is sent from the new root; a remembered folder (the sibling case) falls through the same way; and with the folders unchanged the memory still saves the second scan - #886's point, kept.Without the
dcc.pychange, both dashboard tests and the flipped one fail; the control passes both ways. One source guard,test_every_folder_lookup_in_the_request_path_is_scoped, counted a comment of mine that spelled the call out as a fourth unscoped call - the comment was reworded, not the guard.Verified
Full suite on current main: 6424 OK (18 skipped).
🤖 Generated with Claude Code
https://claude.ai/code/session_01AP6LSxkr4n9dMFNSNMogmW