Remove every automatic timezone-setting mechanism (task 7f685179) #282

Merged
approver_agent merged 1 commits from task/remove-automatic-timezone_7f685179-af49-4a8a-9931-edec86d91904 into dev 2026-09-30 07:22:57 -04:00
Owner

Maestro task 7f685179-af49-4a8a-9931-edec86d91904 — feature "Manual application timezone control".

Done-condition: nothing sets the application timezone except an admin explicitly saving it; the manual admin PATCH still persists.

Removed

  • API reported-zone adoption: adopt_reported_timezone deleted; routes_panel._household_clock(database) takes no Request, reads stored settings only; PANEL_TIMEZONE_HEADER / X-NestQuest-Timezone removed from core/const.py and the panel route.
  • Integration reporting: NestQuestApiClient has no household_timezone; _headers() is Bearer only (snapshot, complete, SSE); client_from_entry and the coordinator no longer pass hass.config.time_zone.
  • Admin PWA auto-set: no Intl.DateTimeFormat detection, no automatic PATCH on load, no once-only ref; the timezone field is unchanged as a manual control.
  • timezone_configured marker: removed from core/settings.py, core/const.py, core/settings_store.py, the admin GET/PATCH model and admin/src/api/settings.ts. A stored document that still carries the key loads harmlessly; PATCHing it is now a 422 unknown field.
  • Scheduler docstrings reworded from "adoption" to "settings write"; its re-plan / pre-sweep re-check machinery is kept (it has no production caller for settings_changed now; its tests drive it through a locked update_settings write).

Tests

  • New: panel timezone headers (X-NestQuest-Timezone, X-NestQuest-Time-Zone, X-Timezone, Time-Zone) leave settings unchanged on snapshot and complete, and never replace a stored zone; a fresh install's empty zone stays empty across panel/admin reads with no settings document written; default admin settings have no timezone_configured; a manual timezone PATCH (zone and "") persists and is returned; a legacy stored key is ignored.
  • Removed/replaced the adoption and marker round-trip tests in test_api_household_clock.py, test_api_client.py, test_coordinator.py, test_sse_subscription.py, test_api_admin_settings.py, and the admin auto-set tests.
  • The 9 new done-condition tests fail against base 6e25c9e and pass here.

Checks

  • TZ=UTC uv run pytest -q → 2174 passed
  • cd admin && npm test → 313 passed (16 files); npm run build ok
  • cd frontend && npm run build → bundle byte-identical (no card source change, nothing committed)
  • No schema change or migration.

🤖 Generated with Claude Code

Maestro task `7f685179-af49-4a8a-9931-edec86d91904` — feature "Manual application timezone control". **Done-condition:** nothing sets the application timezone except an admin explicitly saving it; the manual admin PATCH still persists. ## Removed - **API reported-zone adoption:** `adopt_reported_timezone` deleted; `routes_panel._household_clock(database)` takes no `Request`, reads stored settings only; `PANEL_TIMEZONE_HEADER` / `X-NestQuest-Timezone` removed from `core/const.py` and the panel route. - **Integration reporting:** `NestQuestApiClient` has no `household_timezone`; `_headers()` is Bearer only (snapshot, complete, SSE); `client_from_entry` and the coordinator no longer pass `hass.config.time_zone`. - **Admin PWA auto-set:** no `Intl.DateTimeFormat` detection, no automatic PATCH on load, no once-only ref; the timezone field is unchanged as a manual control. - **`timezone_configured` marker:** removed from `core/settings.py`, `core/const.py`, `core/settings_store.py`, the admin GET/PATCH model and `admin/src/api/settings.ts`. A stored document that still carries the key loads harmlessly; PATCHing it is now a 422 unknown field. - Scheduler docstrings reworded from "adoption" to "settings write"; its re-plan / pre-sweep re-check machinery is kept (it has no production caller for `settings_changed` now; its tests drive it through a locked `update_settings` write). ## Tests - New: panel timezone headers (`X-NestQuest-Timezone`, `X-NestQuest-Time-Zone`, `X-Timezone`, `Time-Zone`) leave settings unchanged on snapshot and complete, and never replace a stored zone; a fresh install's empty zone stays empty across panel/admin reads with no settings document written; default admin settings have no `timezone_configured`; a manual timezone PATCH (zone and `""`) persists and is returned; a legacy stored key is ignored. - Removed/replaced the adoption and marker round-trip tests in `test_api_household_clock.py`, `test_api_client.py`, `test_coordinator.py`, `test_sse_subscription.py`, `test_api_admin_settings.py`, and the admin auto-set tests. - The 9 new done-condition tests fail against base `6e25c9e` and pass here. ## Checks - `TZ=UTC uv run pytest -q` → 2174 passed - `cd admin && npm test` → 313 passed (16 files); `npm run build` ok - `cd frontend && npm run build` → bundle byte-identical (no card source change, nothing committed) - No schema change or migration. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
overseer added 1 commit 2026-09-30 07:02:47 -04:00
The application timezone is now only ever set by an admin saving it:

- API: drop adopt_reported_timezone; the panel household clock reads the
  stored settings only and ignores any timezone request header.
- Integration: stop reporting Home Assistant's time_zone in an
  X-NestQuest-Timezone header (snapshot, completion and SSE requests).
- Admin app: remove the browser-zone detection and the automatic PATCH
  on load; the timezone field stays a manual control.
- Remove the timezone_configured marker from the core settings, the
  settings store and the admin settings API. A stored document that
  still carries the key loads harmlessly (unknown keys are ignored).

Tests replace the adoption expectations with proofs that a panel
timezone header never changes the stored settings, a fresh install's
empty zone stays empty with no settings write, the admin settings carry
no timezone_configured, and a manual admin timezone PATCH persists.

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 2db780e3ee into dev 2026-09-30 07:22:57 -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#282