Decide quest-log overdue from the panel's own local clock #279

Owner

Maestro task fd1093b5-e6ae-47e6-aee9-1e8f5ee74e3f (UI Bugs).

Done condition: "That tasks will not show overdue until the due by time exceeds the local time. It is currently 7:15AM America/New_York Timezone. Tasks set at 8:15AM are showing overdue."

Cause

The kids' Quest Log card did not decide overdue itself. It rendered the API's per-instance overdue flag, which reaches it through sensor.nestquest_<slug>_quests_due_today → coordinator → /api/v1/panel/snapshot. The API sets that flag in core/snapshot.py (now.time() > due_moment), using the household clock that api/routes_panel.py::_household_clock resolves. At 07:15 EDT the UTC wall clock reads 11:15, so any path that leaves that clock on UTC makes an 08:15 quest overdue:

  • an API or integration older than 0.9.6
  • Home Assistant's time_zone set to UTC
  • a legacy stored zone that 0.9.6 adopted over

The repo can't tell us which of these the deployment hit.

Change

  • frontend/src/cards/quest-log.ts: the new _isOverdue(instance) marks an open quest overdue when its due_time (HH:MM) has arrived on the panel browser's local clock (_now.getHours()/getMinutes(), >=). With no due_time (or one that doesn't parse), a quest is never overdue. That matches the API, which only flags quests that have a due_time. _now is already a reactive state property refreshed every 60 s, so the meta line flips on the minute. The card no longer reads the API's overdue, and that field is unchanged for admin and automation consumers. The party board doesn't render overdue.

  • Rebuilt custom_components/nestquest/www/nestquest-cards.js. A rebuild compares byte-identical.

  • frontend/tests/render-quest-log.mjs: can pin the clock (now) and fire the card's own 60 s tick callbacks at later instants (advance_to, which reports ticks snapshots).

  • tests/test_panel_cards.py: the helper sets the node TZ. New test test_quest_log_overdue_follows_the_panel_local_clock runs in America/New_York with the Home Assistant zone set to UTC and the API reporting overdue: true:

    • 08:15 quest at 07:15: "Due by 8:15 AM"
    • at 08:15 and at 08:16 (after the card's tick): "Overdue · due 8:15 AM"
    • quest with no due time: "Due today" at all three times

    test_quest_log_meta_line_keeps_its_meta_class now pins the clock too.

Verification

  • On base 55b9ce9, both tests fail (08:15 quest reads Overdue at 07:15). I checked this in a throwaway worktree, then removed it.
  • TZ=UTC uv run pytest -q: 2172 passed, 1 skipped.
  • npx tsc --noEmit is clean.

Note: the header clock still formats in Home Assistant's time_zone (unchanged). If Home Assistant really is set to UTC, that clock will still show UTC time. That's out of scope here.

🤖 Generated with Claude Code

Maestro task `fd1093b5-e6ae-47e6-aee9-1e8f5ee74e3f` (UI Bugs). **Done condition:** "That tasks will not show overdue until the due by time exceeds the local time. It is currently 7:15AM America/New_York Timezone. Tasks set at 8:15AM are showing overdue." ## Cause The kids' Quest Log card did not decide overdue itself. It rendered the API's per-instance `overdue` flag, which reaches it through `sensor.nestquest_<slug>_quests_due_today` → coordinator → `/api/v1/panel/snapshot`. The API sets that flag in `core/snapshot.py` (`now.time() > due_moment`), using the household clock that `api/routes_panel.py::_household_clock` resolves. At 07:15 EDT the UTC wall clock reads 11:15, so any path that leaves that clock on UTC makes an 08:15 quest overdue: - an API or integration older than 0.9.6 - Home Assistant's `time_zone` set to UTC - a legacy stored zone that 0.9.6 adopted over The repo can't tell us which of these the deployment hit. ## Change - `frontend/src/cards/quest-log.ts`: the new `_isOverdue(instance)` marks an open quest overdue when its `due_time` (`HH:MM`) has arrived on the panel browser's local clock (`_now.getHours()/getMinutes()`, `>=`). With no `due_time` (or one that doesn't parse), a quest is never overdue. That matches the API, which only flags quests that have a `due_time`. `_now` is already a reactive `state` property refreshed every 60 s, so the meta line flips on the minute. The card no longer reads the API's `overdue`, and that field is unchanged for admin and automation consumers. The party board doesn't render overdue. - Rebuilt `custom_components/nestquest/www/nestquest-cards.js`. A rebuild compares byte-identical. - `frontend/tests/render-quest-log.mjs`: can pin the clock (`now`) and fire the card's own 60 s tick callbacks at later instants (`advance_to`, which reports `ticks` snapshots). - `tests/test_panel_cards.py`: the helper sets the node `TZ`. New test `test_quest_log_overdue_follows_the_panel_local_clock` runs in America/New_York with the Home Assistant zone set to UTC and the API reporting `overdue: true`: - 08:15 quest at 07:15: "Due by 8:15 AM" - at 08:15 and at 08:16 (after the card's tick): "Overdue · due 8:15 AM" - quest with no due time: "Due today" at all three times `test_quest_log_meta_line_keeps_its_meta_class` now pins the clock too. ## Verification - On base `55b9ce9`, both tests fail (08:15 quest reads Overdue at 07:15). I checked this in a throwaway worktree, then removed it. - `TZ=UTC uv run pytest -q`: 2172 passed, 1 skipped. - `npx tsc --noEmit` is clean. Note: the header clock still formats in Home Assistant's `time_zone` (unchanged). If Home Assistant really is set to UTC, that clock will still show UTC time. That's out of scope here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
overseer added 1 commit 2026-09-29 07:25:11 -04:00
The kids' Quest Log rendered OVERDUE from the API's per-instance
`overdue` flag, which is computed on whatever wall clock the API
resolves for the household. When that clock is UTC (HA `time_zone`
UTC, a pre-0.9.6 API/integration, or a stored zone adopted over),
an 8:15 AM quest reads OVERDUE at 7:15 AM America/New_York.

The card now marks an open quest overdue when its `due_time` wall
time has arrived on the panel browser's local clock (`_now`, a
reactive state ticking every 60 s; `>=` so it flips on the due
minute). With no `due_time` a quest is never overdue, matching the
API's rule. The API's `overdue` field is unchanged for admin and
automation consumers; the card simply no longer reads it.

The jsdom quest-log harness can now pin the clock (`now`) and fire
the card's own clock tick at later instants (`advance_to`), and the
Python helper sets the node process `TZ`.

Task: fd1093b5-e6ae-47e6-aee9-1e8f5ee74e3f

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
review_agent left a comment
Member

Independent Codex gpt-5.6-terra review completed for this exact commit.

Independent Codex gpt-5.6-terra review completed for this exact commit.
approver_agent merged commit 48eae05e1f into dev 2026-09-29 07:44:12 -04:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Maniacs_Mansion/NestQuest#279