Skip to content

fix(cache): skip expired sqlite vary entries during lookup#5095

Merged
mcollina merged 1 commit intonodejs:mainfrom
trivikr:sqlite-cache-store-cache-miss
Apr 24, 2026
Merged

fix(cache): skip expired sqlite vary entries during lookup#5095
mcollina merged 1 commit intonodejs:mainfrom
trivikr:sqlite-cache-store-cache-miss

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 24, 2026

This relates to...

Fixes: #5094

Rationale

SqliteCacheStore#findValue() iterates rows ordered by deleteAt ASC. If the first candidate is expired, it returned undefined immediately instead of continuing to scan later candidates. That makes lookups incorrect for URLs with multiple Vary variants.

Changes

Change SqliteCacheStore#findValue() to skip expired rows during lookup instead of aborting the scan.

Features

N/A

Bug Fixes

Fix SqliteCacheStore#get() returning a cache miss when an earlier expired Vary variant precedes a later valid variant for the same URL/method.

Breaking Changes and Deprecations

N/A

Status

Assisted-by: openai:gpt-5.4

Assisted-by: openai:gpt-5.4
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.13%. Comparing base (2a6f9c7) to head (aa26a17).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5095   +/-   ##
=======================================
  Coverage   93.13%   93.13%           
=======================================
  Files         110      110           
  Lines       35816    35816           
=======================================
+ Hits        33356    33358    +2     
+ Misses       2460     2458    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 67ca48c into nodejs:main Apr 24, 2026
34 of 35 checks passed
@trivikr trivikr deleted the sqlite-cache-store-cache-miss branch April 24, 2026 05:33
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.

SqliteCacheStore returns a cache miss when an earlier expired Vary variant precedes a valid one

3 participants