fix(free-tier): never serve a Radar overlay older than the shipped catalog - #12215
Merged
diegosouzapw merged 2 commits intoSep 1, 2026
Conversation
maxmad64bis
force-pushed
the
fix/free-tier-overlay-freshness
branch
from
August 31, 2026 18:08
11faafb to
0c78567
Compare
maxmad64bis
force-pushed
the
fix/free-tier-overlay-freshness
branch
from
August 31, 2026 18:27
0c78567 to
d3f4f1c
Compare
…plyFeed under the cognitive ratchet Behaviour-preserving extraction of the baseline-only local-override branch added for the overlay-freshness fix; applyFeed drops back below the cognitive-complexity threshold (file back to the base's 3 violations).
diegosouzapw
merged commit Sep 1, 2026
33bdc38
into
diegosouzapw:release/v3.8.51
15 of 16 checks passed
7 tasks done
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…talog (diegosouzapw#12215) GET /api/free-tier/summary could answer from a Radar overlay built 2026-08-02 while the release ships a catalog curated 2026-08-30 (FREE_CATALOG_CURATED_AT) — totals computed from older data, still tagged catalogSource: radar-overlay. The route now refuses any overlay built before the shipped catalog and falls back to that catalog through the operator's local state. Tightens diegosouzapw#11550 using the generatedAt persisted by diegosouzapw#11435. Verified in a combined batch worktree: 174/174 focused tests across all 11 PRs of this batch (this PR's free-tier-summary-radar-overlay suite included), typecheck:core clean, check-file-size, check-changelog-integrity, check:cycles and check:docs-counts green. Thanks @maxmad64bis.
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
GET /api/free-tier/summarycould still answer from a Radar overlay built 2026-08-02 while this release ships a catalog curated 2026-08-30 (FREE_CATALOG_CURATED_AT). Totals were computed from older data and still taggedcatalogSource: radar-overlay. This PR refuses any overlay built before the shipped catalog and, when stale, answers from that catalog through the operator's local state.Related Issues
generatedAtpersisted by fix(radar): keep the feed's build date in the catalog cache #11435.Validation
npm run lintcheck:cycles/check:changelog-integrity/prettier --checkalso green (~500 suppressed pre-existing violations on the base)release/v3.8.51@63e4afanpx cross-env DISABLE_SQLITE_AUTO_BACKUP=true node --import tsx/esm \ --import ./open-sse/utils/setupPolyfill.ts --import ./tests/_setup/isolateDataDir.ts \ --test tests/unit/free-tier-summary-radar-overlay.test.ts # 15/15 passTests Added Or Updated
tests/unit/free-tier-summary-radar-overlay.test.ts(9 → 15):GEN_AT/FETCHED_ATanchored onFREE_CATALOG_CURATED_AT(+STALE_GEN_AT);pre-migration (generatedAt: undefined)updated fromradar-overlay/nulltobaseline/FREE_CATALOG_CURATED_AT(still assertsfetchedAtnot substituted).older → baseline,null → baseline,same-day 00:30Z → overlay,newer → overlay.computeFreeModelTotals({excludeTosAvoid})fallback fails red,getCatalogWithoutOverlay()passes green):not ok 14 — a tombstoned model must never come back …·not ok 15 — a locally disabled model must not be counted …Coverage Notes
Touches
src/app/api/free-tier/summary/route.ts,src/lib/radar/index.ts,src/lib/radar/applyFeed.ts— all covered by the 15 tests above (focused file per plan; full suite + 60% gate run in CI). No touched file loses coverage. Guard ismeta.generatedAt.slice(0,10) >= FREE_CATALOG_CURATED_AT(day-level, lexically safe even for+HH:MM); fallback exercises the empty-feedapplyFeedpath that now honourslocalOverridesfor baseline-only entries.Reviewer Notes
GET /api/radar/catalogkeeps its own contract ("this feed" + its date).overlayIsFresh = meta!==null && meta.generatedAt!==null && slice(0,10) >= FREE_CATALOG_CURATED_AT— unknown is stale, same-day is fresh.getCatalogWithoutOverlay()=applyFeed({ baseline, feed: [], localOverrides, tombstones }); flag-off path unchanged.isAuthenticated()is short-circuited (read-only, no known side effect).