AZ-001 — Localized shared preferences

Status

Done

Context

Read the epic contract, especially the inspected baseline and state/i18n decisions. The current English Home/NotFound/layout and async states use literal strings. TanStack Query owns server state; Zustand is installed but unused. AppProviders creates a query client, while frontend/src/test/test-utils.tsx independently wraps only the query provider. There is no actual shared preference or language-selection workflow yet.

Goal

Deliver language selection with persistent device preferences and isolated application providers, establishing state ownership before the MUI shell uses it.

Requirements

Non-goals

No user persistence/backend settings, account/login, MUI installation, navigation, cart/global domain state, translation of database content, generic store framework, or cross-tab sync engine.

Implementation guidance

Extend frontend/src/app/providers.tsx, query-client.ts, and src/test/ patterns; place small preference/i18n modules under the existing app/ responsibility. Keep storage adaptation separate from pure preference resolution so error handling is testable. Do not import backend/db modules. Use RTL for actual selection/rerender behavior, and frontend integration tests to prove the real API/query/page path still displays the database response. Test observable outcomes, not generated Redux action shapes. Keep compatible dependency resolutions in the lockfile.

Acceptance criteria

Verification

From root:

pnpm quality
pnpm --filter @foodtruck-order/frontend test
pnpm --filter @foodtruck-order/frontend test:coverage
pnpm --filter @foodtruck-order/frontend build

Add preference-resolution/storage unit cases and RTL language/fallback/provider integration cases. Manually check at 360×800 and 320px width, keyboard-only selection, refresh, browser language and storage denial; use the existing host startup from development §7. Existing complete-system CI still runs. No Docker reset is needed locally solely for translation/preference source changes.

Documentation

Update docs/techstack.md (Redux replaces unused Zustand; Query retained; i18n choice), docs/architecture.md (state boundaries), docs/development.md (keys/resources/preferences), and docs/test-strategy.md (provider isolation/parity tests). Update current-state/handover and task status using the DoD, with exact evidence and remaining hosted checks.

Dependencies

Implemented vertical-slice frontend, existing query/API boundary, RTL/Vitest/static gates. No AZ prerequisite.

Future considerations

AZ-007 adds per-account preferences without persisting user identity in localStorage. A fourth language requires resource registration and translations, not new store architecture.