fix(ui): resolve the slop/duplicate trend legends' latest week per series - #8779
Conversation
…ries latestWeekWithSignal found the single most recent week with ANY signal and the card reused that one week for both legends. The two rates are independently nullable, so when the newest signal-bearing week had one series null, that legend silently showed no band / an em-dash even when an earlier week held real data for it. The lookup is now parameterized by series and each legend resolves its own latest signal-bearing week; lockstep-null data (today's backend shape) renders identically. Closes JSONbored#8667
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-26 04:49:25 UTC
Review summary Nits — 4 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 preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. Scroll preview
A 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.
|


Closes #8667
Problem
latestWeekWithSignal(apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card-model.ts) finds the single most recent week with either signal present, andslop-duplicate-trend-card.tsxreuses that one sharedlatestweek for BOTH legends —latest?.slopBandLabel/latest?.slopFlagRatePcton the slop side andlatest?.duplicateFlagRatePcton the duplicate side.SlopDuplicateTrendWeektypes the two rates as independently nullable, so if the most recent signal-bearing week has one series populated and the othernull, the null series' legend silently renderslatest: —/ no band even when an earlier week holds real data for it. Latent today (the backend generator's sharedopenPullRequestsdenominator gate keeps both series' null-ness in lockstep), but the helper is written generically and its own type signature permits divergence — a waiting defect for any backend change or new caller.Fix
latestWeekWithSignalis now parameterized by series ("slop" | "duplicate") and scans for that series' own most recent non-null week. The card resolveslatestSlopandlatestDuplicateindependently and each legend reads only its own result. For lockstep-null data (today's production shape) both lookups return the same week the old code returned, so rendered output is unchanged — only the divergent-null case is corrected.Tests (new coverage for a branch that had none)
Added to
apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card.test.tsx, red onmainbefore the fix:null/duplicate-populated and an earlier week at 40%/bandelevated; asserts the slop legend showslatest band: elevated, notlatest: —latest: —null/slop-populated, earlier week duplicate 25%; assertslatest: 25%renderslatest: —latestWeekWithSignal(weeks, series)assertions: divergent weeks resolve to different weeks per seriesexpected '2026-06-09' to be '2026-06-02'nulleven when the other series has data;[]returnsnullFull file run: 10/10 passing; whole
apps/loopover-uisuite: 88 files / 623 tests passing;tsc --noEmitclean; eslint/prettier clean on all changed files;git diff --checkclean.apps/**is codecov-excluded; the new tests exercise the previously zero-coverage divergent-null-per-series branch directly per the issue's coverage requirement.UI Evidence
The
/app/maintainerconsole's "Slop + duplicate trend" card, served locally (vitedev, preview session per the contributor skill) withGET /v1/app/maintainer-dashboardanswered at the network boundary by a fixture in the issue's divergent-null shape — the only way to exercise this branch, since it is unreachable with today's lockstep backend data: the newest signal-bearing week has a real duplicate rate (12.5%) but anullslop rate, while the latest week with real slop data (40%, bandelevated) is two weeks older. Look at the slop legend: before, it renderslatest: —(the shared week's null) as if there were no recent slop signal; after, it renderslatest band: elevatedin the warning tone from its own latest signal week. The duplicate legend (latest: 12.5%) and both chart panels are identical in both columns. The UI is a dark-mode-only build, so the Light and Dark rows (captured under emulatedprefers-color-scheme) render identically by design.