# Scheduling UI integration notes

Routes: `/seller/schedule`, `/seller/settings/schedule`, `/staff/schedule`.

- `packages/api-client/src/endpoints/scheduling.ts` uses canonical generated component types. No temporary handwritten scheduling response models remain. Endpoint exports and `api.scheduling` are registered by narrow patches; nav/layout ownership stays with the parent.
- Actual copy response uses `shift_count`, `copied`, `conflict_count`, `conflicts`, and nullable candidate `id`/`revision`. The UI previews real server candidates, blocks conflict commits, clears preview on date changes, and offers the copied week's navigation after commit. Preview is advisory: the API rechecks live source shifts at commit, not a reserved snapshot.
- Actual DELETE returns `{data:{deleted:true}}`; DELETE revision travels in JSON through `client.request`, not `client.delete` (which cannot send a body).
- Native store-local shift inputs reject DST gaps/folds. Unedited preexisting instants retain the original exact timestamp (including fractional seconds or an already-disambiguated fold). Revisions are opaque strings, never parsed/reformatted.
- Initial week selection waits for real store settings, not browser/UTC today. WorkWeek cutoff policy for selecting the initial label mirrors the API: first fold occurrence and spring-gap normalization forward. API remains authoritative for normalized week bounds.
- Shift edits clear publication; counts are computed from current shifts, not the historical publication's `shift_count`. The grid keeps final calendar-day pre-cutoff shifts visible, with their true date.
- Mutations capture `captureCommandGeneration()` synchronously in the exposed mutate/mutateAsync wrapper, before TanStack dispatch. They call `requireSelectedStore(storeId, exactCapability, generation)` before dispatch and after response/refetch. Thus A→B→A and same-store token replacement cannot produce stale success.
- `/my/schedule` never accepts a member ID. Ordinary staff team payloads are server-filtered by `schedule.view_drafts`; staff UI has no mutation affordances even for managers. Managers visiting the staff Team surface still receive their capability-authorized team payload; the staff UI additionally hides drafts. The current API offers no published-only query override for that manager case.

Verification performed: 23 targeted tests in seven files passed; web and api-client TypeScript checks passed; scoped ESLint passed. A full web suite run had 684 passes, 1 skipped, and one failure in sibling-owned `message-command-context.test.tsx` while its generation hardening was in progress; no scheduling failures. Parent owns real-browser/API E2E and final cross-agent suite.

```sh
npm run test --workspace=web -- scheduling.test.ts use-scheduling.test.tsx schedule-time.test.ts week-grid.test.tsx seller-schedule-client.test.tsx staff-schedule-client.test.tsx schedule-settings-client.test.tsx
npx tsc --noEmit -p web/tsconfig.json
npm run typecheck --workspace=@alqove/api-client
```
