[QA] 7-day mood trend not visible on PersonDetail despite feat(#168) #171

Closed
opened 2026-09-10 03:02:30 +00:00 by Mark · 0 comments
Owner

Finding

feat(#168) shipped an upgraded mood display with a 7-day trend indicator ("rising"/"stable"/"declining"). Source at PersonDetail.tsx:3077-3082:

{moodTrendInfo && (
  <p className="text-caption mt-1" ...>
    7-day: <strong>{moodTrendInfo.recent}</strong> ({moodTrendInfo.direction === "rising" ? "rising" : ...})
  </p>
)}

On a real Kindle, with 32 mood-tagged interactions spanning 6 months ending Sep 8 (yesterday), the single-number mood ("Average mood: 3/5") renders but the 7-day trend line is missing.

Reproduction

adb shell pm clear com.kin.prm
# Seed interactions with mood field set across the last 6 months
# Ensure at least 1 mood interaction in the last 7 days
# Open PersonDetail → Metrics tab
# Look for "7-day: X.X (rising/stable/declining)" — does not appear

Root cause hypothesis

PersonDetail.tsx:2966-2985 defines moodTrendInfo:

const moodTrendInfo = useMemo(() => {
  if (interactions.length === 0) return null;
  const scored = interactions
    .filter((i) => i.mood && i.date)
    ...
  if (scored.length < 2) return null;
  const now = scored[0].date.getTime();
  const seven = scored.filter((s) => now - s.date.getTime() <= 7 * DAY_MS);
  const thirty = scored.filter((s) => now - s.date.getTime() <= 30 * DAY_MS);
  const recent = avg(seven);
  const longer = avg(thirty);
  if (recent == null || longer == null) return null;

The now variable is set to the timestamp of the most recent mood interaction, not the actual current date. If my latest interaction is Sep 8 (yesterday), now = Sep 8 timestamp. Then seven filters to interactions within 7 days of Sep 8 — that's Sep 1-8. If I have interactions in that range, the trend should compute.

But the display shows only "Average mood: 3/5" — so the moodTrendInfo is either null or the conditional isn't matching.

Also possible: recent == null if no interactions are in the 7-day window relative to the latest mood interaction.

Suggested fix

  • Use the actual current date for now instead of scored[0].date
  • Or, if the design intent is to anchor on the latest interaction, document that and update test cases accordingly

Severity

Low — the basic mood display works. The 7-day trend is a UX enhancement. But it's advertised in the commit message and isn't surfacing.

Discovered by

Real-Kindle verification of #168 against a 6-month seeded romance arc (2026-09-10).

## Finding `feat(#168)` shipped an upgraded mood display with a 7-day trend indicator ("rising"/"stable"/"declining"). Source at `PersonDetail.tsx:3077-3082`: ```ts {moodTrendInfo && ( <p className="text-caption mt-1" ...> 7-day: <strong>{moodTrendInfo.recent}</strong> ({moodTrendInfo.direction === "rising" ? "rising" : ...}) </p> )} ``` On a real Kindle, with 32 mood-tagged interactions spanning 6 months ending Sep 8 (yesterday), the **single-number mood ("Average mood: 3/5") renders but the 7-day trend line is missing**. ## Reproduction ```bash adb shell pm clear com.kin.prm # Seed interactions with mood field set across the last 6 months # Ensure at least 1 mood interaction in the last 7 days # Open PersonDetail → Metrics tab # Look for "7-day: X.X (rising/stable/declining)" — does not appear ``` ## Root cause hypothesis `PersonDetail.tsx:2966-2985` defines `moodTrendInfo`: ```ts const moodTrendInfo = useMemo(() => { if (interactions.length === 0) return null; const scored = interactions .filter((i) => i.mood && i.date) ... if (scored.length < 2) return null; const now = scored[0].date.getTime(); const seven = scored.filter((s) => now - s.date.getTime() <= 7 * DAY_MS); const thirty = scored.filter((s) => now - s.date.getTime() <= 30 * DAY_MS); const recent = avg(seven); const longer = avg(thirty); if (recent == null || longer == null) return null; ``` The `now` variable is set to the timestamp of the **most recent mood interaction**, not the actual current date. If my latest interaction is Sep 8 (yesterday), `now` = Sep 8 timestamp. Then `seven` filters to interactions within 7 days of Sep 8 — that's Sep 1-8. If I have interactions in that range, the trend should compute. But the display shows only "Average mood: 3/5" — so the `moodTrendInfo` is either `null` or the conditional isn't matching. Also possible: `recent == null` if no interactions are in the 7-day window relative to the latest mood interaction. ## Suggested fix - Use the actual current date for `now` instead of `scored[0].date` - Or, if the design intent is to anchor on the latest interaction, document that and update test cases accordingly ## Severity Low — the basic mood display works. The 7-day trend is a UX enhancement. But it's advertised in the commit message and isn't surfacing. ## Discovered by Real-Kindle verification of #168 against a 6-month seeded romance arc (2026-09-10).
Mark 2026-09-13 15:11:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/kimi_agent_kin_app_sync#171
No description provided.