LVT-227 Scope Redis cache resets to Lovat keys - #2
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 269dab8d9b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }: CacheResetDependencies): Promise<number> => { | ||
| let deletedRedisKeys = await resetRedis(); | ||
| await deleteMetadata(); | ||
| deletedRedisKeys += await resetRedis(); |
There was a problem hiding this comment.
Prevent cache writes after the final reset scan
When cache:reset runs while requests are still in flight, this final scan does not cover writes that occur after its SCAN cursor reaches zero. For example, a request already executing the schema-mismatch recovery path in analysisFunction.ts:113-121 can finish its calculation after both scans and rewrite the Redis value without recreating the CachedAnalysis row that deleteMetadata removed; subsequent data changes then cannot discover and invalidate that stale key. The reset can therefore report success while leaving an untracked cache entry unless writes are blocked or the server is guaranteed to be stopped.
Useful? React with 👍 / 👎.
What changed
REDIS_KEY_PREFIX.npm run cache:resetcommand that scans and deletes only Lovat-owned keys, clears cache metadata, and repeats the scoped scan to cover concurrent writes.Linear: LVT-227
Areas affected
Contracts and data
Verification
env REDIS_TEST_URL=redis://127.0.0.1:6397/0 npm test: 8 tests passed against an isolated Redis instance; no skips.npm run build: passed.npm run lint: passed with 76 existing warnings and no errors../scripts/check-structure.sh: passed.Deployment
REDIS_KEY_PREFIXis optional and defaults tolovat:; environments can set a more specific namespace.REDIS_URLuses logical database 1.