⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.
Context
apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card-model.ts:48-57's
latestWeekWithSignal finds the single most recent week with either signal present:
export function latestWeekWithSignal(weeks: SlopDuplicateTrendWeek[]): SlopDuplicateTrendWeek | null {
for (let index = weeks.length - 1; index >= 0; index -= 1) {
const week = weeks[index];
if (!week) continue;
if (week.slopFlagRatePct !== null || week.duplicateFlagRatePct !== null) return week;
}
return null;
}
slop-duplicate-trend-card.tsx:29,54-67 reuses this single latest result for BOTH the slop-flag
legend (latest?.slopBandLabel, latest?.slopFlagRatePct) and the duplicate-flag legend
(latest?.duplicateFlagRatePct). SlopDuplicateTrendWeek types both slopFlagRatePct and
duplicateFlagRatePct as independently nullable — so if the most recent week with any signal has
one series populated and the other null, the legend for the null series silently renders "—"/no
band even when an earlier week actually had real data for that series.
This is currently latent, not actively firing: today's backend generator
(src/services/maintainer-slop-duplicate-trend.ts) computes both rates from the same
openPullRequests denominator gate, so in practice the two series' null-ness stays in lockstep for
real production data. It is still a real, narrowly-scoped defect in a reusable helper that is
written generically and whose own type signature permits independent nullability — a latent bug
waiting for the backend generator to change (or a different caller to reuse this model), not a
hypothetical one.
Requirements
- Compute the "latest week with signal" independently per series (one lookup for
slopFlagRatePct, one for duplicateFlagRatePct), rather than one shared latest reused for
both legends.
- Do not change the current rendered output for real production data where both series' null-ness
stays in lockstep (this must remain a behavior-preserving fix for today's data shape, only
correcting the latent divergent-null case).
Deliverables
All Deliverables above are required in the same PR.
Test Coverage Requirements
apps/** is excluded from codecov/patch gating, but apps/loopover-ui's own local vitest
coverage thresholds apply — the new test must exercise the divergent-null-per-series branch
directly, which has zero coverage today.
Expected Outcome
Each series in the slop/duplicate trend card independently reflects its own most recent
signal-bearing week, so a future change to the backend's null-generation logic (or a different
future caller of this model) cannot silently hide real data behind the other series' null value.
Links & Resources
apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card-model.ts:48-57
apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card.tsx:29,54-67
src/services/maintainer-slop-duplicate-trend.ts (the backend generator whose current denominator
gate happens to keep both series' null-ness in lockstep today)
Context
apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card-model.ts:48-57'slatestWeekWithSignalfinds the single most recent week with either signal present:slop-duplicate-trend-card.tsx:29,54-67reuses this singlelatestresult for BOTH the slop-flaglegend (
latest?.slopBandLabel,latest?.slopFlagRatePct) and the duplicate-flag legend(
latest?.duplicateFlagRatePct).SlopDuplicateTrendWeektypes bothslopFlagRatePctandduplicateFlagRatePctas independently nullable — so if the most recent week with any signal hasone series populated and the other
null, the legend for the null series silently renders "—"/noband even when an earlier week actually had real data for that series.
This is currently latent, not actively firing: today's backend generator
(
src/services/maintainer-slop-duplicate-trend.ts) computes both rates from the sameopenPullRequestsdenominator gate, so in practice the two series' null-ness stays in lockstep forreal production data. It is still a real, narrowly-scoped defect in a reusable helper that is
written generically and whose own type signature permits independent nullability — a latent bug
waiting for the backend generator to change (or a different caller to reuse this model), not a
hypothetical one.
Requirements
slopFlagRatePct, one forduplicateFlagRatePct), rather than one sharedlatestreused forboth legends.
stays in lockstep (this must remain a behavior-preserving fix for today's data shape, only
correcting the latent divergent-null case).
Deliverables
slop-duplicate-trend-card-model.tsexposes two independent "latest week with signal"lookups (or a single function parameterized by which series to check), one per series.
slop-duplicate-trend-card.tsxuses the correct per-series "latest" result for each legend,not one shared
latestobject.weeksarray where the last signal-bearing week has one seriesnulland an earlier week has that series populated, asserting the legend/band for that series
reflects the earlier week's value — not "no signal".
continue to pass unchanged.
All Deliverables above are required in the same PR.
Test Coverage Requirements
apps/**is excluded fromcodecov/patchgating, butapps/loopover-ui's own local vitestcoverage thresholds apply — the new test must exercise the divergent-null-per-series branch
directly, which has zero coverage today.
Expected Outcome
Each series in the slop/duplicate trend card independently reflects its own most recent
signal-bearing week, so a future change to the backend's null-generation logic (or a different
future caller of this model) cannot silently hide real data behind the other series' null value.
Links & Resources
apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card-model.ts:48-57apps/loopover-ui/src/components/site/app-panels/slop-duplicate-trend-card.tsx:29,54-67src/services/maintainer-slop-duplicate-trend.ts(the backend generator whose current denominatorgate happens to keep both series' null-ness in lockstep today)