Repository navigation
Evict _project_store_cache on user deletion - #159
Merged
Merged
Conversation
DELETE /users/me popped the user's entry from _store_cache but not from the separate _project_store_cache, so the stale cached ProjectStore kept the deleted user's bin projects in memory. ProjectStore serves and writes wholly from memory, so the next project write for that user id rewrote bin-projects.json with the deleted data. Pop both caches on deletion and add a regression test proving deleted projects do not reappear on disk after a subsequent write. Fixes #156 Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
3 tasks
A failed or partial rmtree previously left the caches populated beside a half-deleted directory, so the next write could resurrect deleted data. Popping first also narrows the stale-cache window. Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
The secret tests reload app.config and app.main with PROXY_SECRET set and previously left that state behind, causing 403s in any later test sending x-user-id. Reload both modules without the secret on teardown. Verified: test_proxy_middleware.py followed by test_user_deletion.py passes with this fixture alone (belt-and-braces patch removed) and fails without it. Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
Drops the redundant routes.settings patch (routes imports the same settings object) and clears the store caches on teardown as well as setup, so the test user id cannot leak into later tests. Signed-off-by: Jason Madigan <jason@jasonmadigan.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
DELETE /users/meevicted_store_cachebut not_project_store_cache, so a stale in-memoryProjectStoresurvived deletion; the next project write for that user id rewrotebin-projects.jsonwith the deleted user's projects. Both caches are now popped on deletion, before thermtreeso a failed or partial delete cannot leave stale caches behind.test_proxy_middleware.pynow restores secretlessapp.config/app.mainmodules after its reload tests, instead of leaving a configured secret that 403s later tests sendingx-user-id. The deletion tests keep aproxy_secretpin as belt-and-braces.Test evidence
pytest tests/(backend): 292 passed. New tests fail without the fix (stale cache entry, resurrected project on disk) and pass with it. Proxy pollution fix verified both ways: proxy tests followed by deletion tests pass with the restore fixture alone (pin removed) and fail without it.ruff check backend/: clean.Closes #156