feat(home): surface FreshnessBadge + fail-closed staleness gate (F4)#3173
Open
0motionguy wants to merge 1 commit into
Open
feat(home): surface FreshnessBadge + fail-closed staleness gate (F4)#31730motionguy wants to merge 1 commit into
0motionguy wants to merge 1 commit into
Conversation
Flip the FreshnessBadge default from hidden to visible — readers
can now tell a 5-min-fresh batch from a 4h-stale one at a glance
without opening the route. The hide flag stays available via
`NEXT_PUBLIC_HIDE_FRESHNESS_BADGES=true`.
Add a fail-closed staleness gate on the homepage rankings card:
when `lastUpdatedAt` is older than `MAX_PUBLIC_STALENESS_MIN`
(default 30min, configurable via NEXT_PUBLIC_MAX_PUBLIC_STALENESS_MIN),
LiveTopTable renders a "data refreshing" banner instead of the
ranking rows. Rankings come back as soon as the next worker tick
lands and the data is fresh again.
This implements the user-added hard rule from the ULTRA improvement
plan: "no publicly stale batches across TrendingRepo." Stale
batches do not reach users.
Files:
- src/lib/public-staleness.ts (new) — classifyPublicStaleness()
helper, returns { isFresh, ageMs, thresholdMs }.
- src/components/shared/FreshnessBadge.tsx — flip default visibility.
- src/components/home/LiveTopTable.tsx — guard rankings render on
classifyPublicStaleness(); show banner when stale.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Jun 15, 2026
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
FreshnessBadgedefault from hidden to visible — readers can tell fresh from stale at a glance. Opt-out viaNEXT_PUBLIC_HIDE_FRESHNESS_BADGES=true.LiveTopTable: when data is pastMAX_PUBLIC_STALENESS_MIN(default 30min), render a "data refreshing" banner instead of the rankings. No publicly stale batches reach users.Files
src/lib/public-staleness.ts(new) —classifyPublicStaleness()helper returning{ isFresh, ageMs, thresholdMs }.src/components/shared/FreshnessBadge.tsx— flip default visibility.src/components/home/LiveTopTable.tsx— guard rankings render onclassifyPublicStaleness(); show banner when stale.Why now
ULTRA improvement plan Phase 4.1 always-ship row F4. Independent of deep-crawl deltas — the
FreshnessBadgecomponent is already implemented behind an env flag, and the staleness gate is the user's "no publicly stale batches" rule.Test plan
pnpm tsc --noEmitclean (existing.next/typeserrors unrelated)/after worker ticks —FreshnessBadgerenders next to "showing X / Y" toolbar with current age label.NEXT_PUBLIC_MAX_PUBLIC_STALENESS_MIN=0or pass alastUpdatedAtmore than 30min old) → rankings table is replaced by "Data refreshing." banner.NEXT_PUBLIC_HIDE_FRESHNESS_BADGES=true(opt-out kept).Evidence
Phase 4.1 always-ship row from the ULTRA improvement plan. Companion to L1 PR #3172 (consensus stale-hide). Together they enforce: no stale row visible publicly anywhere on the homepage.
🤖 Generated with Claude Code