feat: shift tags on staff upcoming-assignments (Slice 2 of calendar sync payload) #242

Merged
owlburtoe merged 2 commits from feat/calendar-sync-slice-2-assignment-tags into main 2026-05-28 16:15:30 -04:00
Owner

Slice 2 of the Calendar Sync Payload enrichment (spec: docs/superpowers/specs/2026-05-28-calendar-sync-payload-design.md, Section B). Adds shift tags to the staff upcoming-assignments payload so later slices (iOS EventKit sync, ICS feed) can render tag suffixes/notes. Runs parallel to merged Slice 1 (#225); no schema change.

Changes

  • Backend (repositories.ts): UpcomingAssignmentSummary gains a required tags: string[]. Tags are bulk-loaded for the returned shift IDs through shift_tags → tags (reusing getTagsForShifts), ordered lower(name) ASC, name ASC, id ASC. Shifts with no tags return []. The deterministic ordering was added to getTagsForShifts itself, so the schedule-grid consumer (getShiftsByScheduleId) also gets stable tag order.
  • OpenAPI: tags added to StaffUpcomingAssignment as a required string array (empty when none).
  • Test: new TDD case in staff-upcoming-assignments.test.ts covering case-insensitive ordering, the name ASC tie-break (Mango before mango), and [] for untagged shifts.

Test plan

  • TDD: test written → failed (tags undefined) → implemented → green
  • Full backend DB suite: 1470/1470 passing (132 files, 0 failures)
  • Tag-related files in isolation: 107/107 (lifecycle-tagging, tags, schedule-imports)
  • pnpm tsc --noEmit clean
  • OpenAPI parses; tags present + required
  • check:runtime-contracts, check:migration-ordering pass

No migration. No frontend change (additive field). Renderer + parity fixture land with Slices 3/4A per the spec slice table.

Slice 2 of the Calendar Sync Payload enrichment (spec: docs/superpowers/specs/2026-05-28-calendar-sync-payload-design.md, Section B). Adds shift tags to the staff upcoming-assignments payload so later slices (iOS EventKit sync, ICS feed) can render tag suffixes/notes. Runs parallel to merged Slice 1 (#225); no schema change. ## Changes - **Backend** (`repositories.ts`): `UpcomingAssignmentSummary` gains a required `tags: string[]`. Tags are bulk-loaded for the returned shift IDs through `shift_tags → tags` (reusing `getTagsForShifts`), ordered `lower(name) ASC, name ASC, id ASC`. Shifts with no tags return `[]`. The deterministic ordering was added to `getTagsForShifts` itself, so the schedule-grid consumer (`getShiftsByScheduleId`) also gets stable tag order. - **OpenAPI**: `tags` added to `StaffUpcomingAssignment` as a required string array (empty when none). - **Test**: new TDD case in `staff-upcoming-assignments.test.ts` covering case-insensitive ordering, the `name ASC` tie-break (`Mango` before `mango`), and `[]` for untagged shifts. ## Test plan - [x] TDD: test written → failed (`tags` undefined) → implemented → green - [x] Full backend DB suite: 1470/1470 passing (132 files, 0 failures) - [x] Tag-related files in isolation: 107/107 (lifecycle-tagging, tags, schedule-imports) - [x] `pnpm tsc --noEmit` clean - [x] OpenAPI parses; `tags` present + required - [x] `check:runtime-contracts`, `check:migration-ordering` pass No migration. No frontend change (additive field). Renderer + parity fixture land with Slices 3/4A per the spec slice table.
Add tags[] to UpcomingAssignmentSummary, bulk-loaded through shift_tags ->
tags and ordered lower(name) asc, name asc, id asc. Shifts without tags
return []. Implements Slice 2 of the calendar sync payload spec (Section B).
docs(openapi): add required tags[] to StaffUpcomingAssignment
All checks were successful
Code Scanning / Gitleaks secret scan (pull_request) Successful in 5s
Code Scanning / Semgrep OSS source scan (pull_request) Successful in 32s
Security, Type Check & Runtime / Dependency Audit (pull_request) Successful in 9m38s
Security, Type Check & Runtime / Migration Guardrails (pull_request) Successful in 9m33s
Security, Type Check & Runtime / Backend Runtime Smoke (pull_request) Successful in 10m14s
Security, Type Check & Runtime / Type Check (pull_request) Successful in 10m15s
Release Artifacts / Validate release candidate (pull_request) Successful in 10m48s
Release Artifacts / Build and push Docker release images (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 14m34s
80ae4714bb
Sign in to join this conversation.
No description provided.