Add intelligent cache revalidation#8
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds “cache-first” automatic cache revalidation for session search/lookup, using conditional GET (ETag/Last-Modified) with persisted check metadata, backoff, and jitter; it also updates normalization to handle Build 2026’s structured location field.
Changes:
- Implement persisted cache revalidation metadata (
checkedAt,nextCheckAt, failure backoff) and conditional GET behavior. - Update cache warmup behavior (
ensureCache) to fetch missing caches and revalidate due caches while keeping stale caches usable on failure. - Extend normalization/contracts/tests to support
locationas a structured displayValue object, and improve CLI status output/documentation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/test/normalize.test.ts | Adds regression coverage for location provided as a displayValue object. |
| cli/test/cache.test.ts | Introduces tests for automatic cache revalidation, conditional GET, and failure backoff behavior. |
| cli/src/output/format.ts | Enhances status output to include “checked age” and failure indication. |
| cli/src/data/normalize.ts | Uses shared display-value extraction for location to support structured shapes. |
| cli/src/data/cache.ts | Adds revalidation scheduling (jitter/backoff), conditional GET handling, and failure recording. |
| cli/src/contracts.ts | Extends RawSession.location typing and adds cache revalidation metadata fields/types. |
| cli/src/commands/common.ts | Updates cache initialization to fetch missing caches and revalidate due caches. |
| cli/README.md | Documents the new cache-first revalidation behavior and network-friendly checks. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pdebruin
approved these changes
May 7, 2026
pdebruin
left a comment
Collaborator
There was a problem hiding this comment.
Solid improvement that addresses the cache staleness, partial-failure, and error-surfacing gaps we identified in review.
What works well:
- Adaptive revalidation intervals (20min active → 6h stable → 1d dormant) — right fit for event lifecycle
- Backoff with jitter on failures prevents hammering a down endpoint
- Stale cache remains usable on failure (graceful degradation)
- Good test coverage (337 lines, covers the key scenarios)
- location field fix handles real Build 2026 data shape
LGTM — approve and merge.
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
refreshprogress logging that shows local cache state, remote check type, and whether JSON was downloadedlocationnormalization and trim extracted display valuesValidation
cd cli && npm test -- --runcd cli && npm run buildrefresh --event build-2026against the live endpoint: first run downloaded and cached 156 sessions; second run returned 304 with no JSON download