fix(ui): migrate the pre-rebrand analytics window preference forward - #8753
Conversation
…legacyKey fallback app.analytics.tsx called useLocalStorage with no third legacyKey argument, unlike its rebrand siblings app.runs.tsx and app.workbench.tsx. The storage key was renamed from gittensory.analytics.windowDays to loopover.analytics.windowDays in the same rebrand commit (75450f1) that added the legacyKey migration elsewhere, so a returning user who had picked a 30d/90d window silently reverted to the 7-day default. Pass gittensory.analytics.windowDays as the legacy key: the hook reads it once when the new key is absent, adopts the value, and backfills the new key, exactly like the runs/workbench view preferences. Regenerates scripts/branding-drift-baseline.json (branding-drift:update) for the one intentional legacy-key reference this adds, so branding-drift:check stays green. Closes JSONbored#8699
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 05:25:31 UTC
Review summary Nits — 2 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Visual previewClick any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. Scroll previewA short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8753 +/- ##
=======================================
Coverage 93.80% 93.80%
=======================================
Files 797 797
Lines 79517 79517
Branches 24097 24097
=======================================
Hits 74593 74593
Misses 3556 3556
Partials 1368 1368
Flags with carried forward coverage won't be shown. Click here to find out more. |









Closes #8699
What
app.analytics.tsxcalleduseLocalStorage<AnalyticsWindowDays>(ANALYTICS_WINDOW_STORAGE_KEY, DEFAULT_ANALYTICS_WINDOW_DAYS)with no thirdlegacyKeyargument. The key was renamed from"gittensory.analytics.windowDays"to"loopover.analytics.windowDays"in the rebrand commit (75450f1d5) that gaveapp.runs.tsxandapp.workbench.tsxtheir one-timelegacyKeymigration — this file was missed. Any returning user who had picked a 30d/90d analytics window before the cutover silently reverted to the 7-day default.How
apps/loopover-ui/src/routes/app.analytics.tsxnow passes"gittensory.analytics.windowDays"as the thirduseLocalStorageargument, matching theapp.runs.tsx/app.workbench.tsxpattern exactly. The hook already implements the one-time fallback: if the new key is absent it reads the legacy key, adopts the value, and writes it forward to the new key (leaving the legacy key in place).Because the fix intentionally introduces one new
"gittensory"string intoapp.analytics.tsx(the pre-rebrand storage key itself — the same intentional historical referenceapp.runs.tsx/app.workbench.tsxalready carry),scripts/branding-drift-baseline.jsonis regenerated vianpm run branding-drift:updatein this same commit, exactly as the branding-drift checker's own guidance instructs for a legitimate legacy-key reference. Without it,branding-drift:checkfails on the 0 → 1 count increase for this file.Deliverables
useLocalStoragecall for the analytics window preference includes the"gittensory.analytics.windowDays"legacy key.apps/loopover-ui/src/routes/app.analytics.test.tsx: seedslocalStorage["gittensory.analytics.windowDays"] = "30", mountsProductAnalytics, and asserts the toggle group shows 30d selected (data-state="on", 7d"off"), the dashboard is fetched for?days=30, andlocalStorage["loopover.analytics.windowDays"]is backfilled with"30"— mirroring the migration tests used for the runs/workbench keys inuse-local-storage.test.ts. A companion test pins the no-keys case: 7d default, and no value invented under either key.scripts/branding-drift-baseline.jsonregenerated (npm run branding-drift:update) for the intentional legacy-key reference;npm run branding-drift:checkgreen.Before / after
On unfixed
main(fix stashed), the new migration test fails exactly as the issue describes — the seeded 30d preference is ignored and the default wins:With the fix:
ui:typecheck,ui:lint(eslint + prettier) on the changed files,branding-drift:check, andgit diff --checkall green.UI Evidence
/app/analytics, served locally (vitedev, preview session per the contributor skill) withlocalStorageseeded the way a returning pre-rebrand user's browser looks:gittensory.analytics.windowDays = "30"and noloopover.*key. The operator-dashboard API is answered at the network boundary by a fixture so the page renders its loaded state. Look at the window toggle group: before, the stored 30d preference is ignored and 7d is active (the bug); after, the legacy value is migrated forward and 30d is active, with the dashboard fetched for?days=30. The UI is a dark-mode-only build, so the Light and Dark rows (captured under emulatedprefers-color-scheme) render identically by design.