Skip to content

LVT-227 Scope Redis cache resets to Lovat keys - #2

Open
benstein wants to merge 2 commits into
mainfrom
codex/lvt-227-remove-unsafe-redis-flushing
Open

LVT-227 Scope Redis cache resets to Lovat keys#2
benstein wants to merge 2 commits into
mainfrom
codex/lvt-227-remove-unsafe-redis-flushing

Conversation

@benstein

Copy link
Copy Markdown
Contributor

What changed

  • Removed the cache reset from normal server startup. Startup now connects to Redis, schedules jobs, and begins listening without deleting keys.
  • Namespaced every Lovat Redis operation behind REDIS_KEY_PREFIX.
  • Added an explicit npm run cache:reset command that scans and deletes only Lovat-owned keys, clears cache metadata, and repeats the scoped scan to cover concurrent writes.
  • Isolated the example local Redis configuration on logical database 1.
  • Added unit and real-Redis CI coverage proving foreign and existing Lovat keys survive startup.

Linear: LVT-227

Areas affected

  • Server
  • Dashboard
  • Collection
  • Website
  • Shared documentation, CI, or deployment

Contracts and data

  • No API, report-schema, authentication, deep-link, season-metric, or database contract changed
  • Every affected producer and consumer was updated together
  • Tenant and source-team visibility was reviewed
  • No credentials, production data, or private scouting notes are included

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.
  • Independent code review completed with no Critical or Important findings.

Deployment

  • GitHub Actions now starts Redis 7 for the server integration test.
  • REDIS_KEY_PREFIX is optional and defaults to lovat:; environments can set a more specific namespace.
  • The example local REDIS_URL uses logical database 1.
  • No database migrations or release-version changes are required.

@railway-app

railway-app Bot commented Aug 31, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @benstein does not have access to the Railway project.

In order to get automatic PR deploys, please add @benstein to your workspace on Railway.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T18:46:18.045999Z 269dab8 PR opened
🔒 Security Review Completed 2026-08-31T18:49:38.819071Z 269dab8 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant