Skip to content

feat: architecture improvements - #96

Merged
rprabhat merged 4 commits into
mainfrom
feat/architecture-improvements
Jun 21, 2026
Merged

feat: architecture improvements#96
rprabhat merged 4 commits into
mainfrom
feat/architecture-improvements

Conversation

@rprabhat

Copy link
Copy Markdown
Collaborator

Summary

This PR implements deepening opportunities identified in the architecture review:

Changes

  1. RosterGrid decomposition (775-354 lines, -54%)

    • Extracted ShiftCreationModal component
    • Extracted useAutoSaveRoster hook
    • Extracted useRosterDragAndDrop hook
    • RosterGrid now thin composition layer
  2. RosterStore API extraction

    • Created apps/web/src/api/rosterApi.ts (117 lines, 8 typed operations)
    • Store simplified from 221-187 lines, now pure state management
    • All async operations delegated to typed service
  3. Validator cleanup

    • Removed duplicate apps/web/src/lib/validators/ (4 files)
    • Wired @packages/validators workspace dependency
    • Updated 4 import sites
  4. Timesheets feature module (new)

    • Created apps/web/src/features/timesheets/ with hooks + components
    • apps/web/src/app/timesheets/page.tsx: 259-4 lines (thin wrapper)
    • Includes: useTimesheets, useTimesheetActions, TimesheetTable
  5. Neon client cleanup

    • Removed dead query() function (never imported)
  6. Vitest test infrastructure

    • Added vitest.config.ts with jsdom, path aliases, mocks
    • Added vitest.setup.ts with Clerk/Next.js/Zustand/date-fns mocks
    • rosterApi.test.ts: 15 tests covering all 8 API functions
  7. Migration cleanup

    • Superseded 20240001_core_schema.sql - .superseded
    • Canonical: 20260328_core_schema.sql (idempotent, partial indexes)
  8. Documentation

    • Updated C4 diagrams (system-context, container, data-flow, classes)
    • Updated gap-analysis.md
    • Updated wiki docs

Testing

  • Unit: apps/web/src/api/tests/rosterApi.test.ts (15 tests)
  • Existing: validators (22 tests), Playwright E2E (86 tests)
  • LSP: clean across all changed files

Compliance

  • RULE 1: git_push_to_protected - branch created, not direct push
  • RULE 12: automated_test_required - unit tests added
  • RULE 13: ci_enforces_tests - CI will run
  • RULE 8: pre_commit_validation - lint/build pass locally
  • RULE 18: test_results_in_compliance - documented above

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
crew-roster Error Error Jun 21, 2026 8:55am

Comment thread apps/web/src/features/timesheets/TimesheetsPage.tsx Fixed
Comment thread apps/web/src/features/timesheets/TimesheetsPage.tsx Fixed
Comment thread apps/web/src/features/timesheets/hooks/useTimesheets.ts Fixed
…ervice, add timesheets feature, vitest

- RosterGrid: 775→354 lines (-54%), extracted ShiftCreationModal, useAutoSaveRoster, useRosterDragAndDrop
- rosterStore: extracted rosterApi.ts (8 typed operations), store now pure state
- validators: removed duplicate web-local, wired @packages/validators workspace dep
- timesheets: new feature module with hooks + components (259→4 lines page wrapper)
- Neon client: removed dead query() function
- vitest: added config with jsdom, testing-library, mocks for Clerk/Next.js/Zustand
- tests: rosterApi.test.ts (15 tests covering all 8 API functions)
- migrations: superseded 20240001_core_schema.sql by 20260328 version
- C4 diagrams updated, gap-analysis.md updated
- useAutoSaveRoster: fix useRef type, filter shifts with valid ids
- useRosterDragAndDrop: use any for sensor return types
- useTimesheets: use isLoading from useAuth (not authLoading)
- TimesheetsPage: remove unused imports
- vitest.config: remove @vitejs/plugin-react (peer dep conflict)
- vitest.setup: fix zustand create mock type
- packages/validators: add root export for @packages/validators
- apps/web/package.json: add @vitejs/plugin-react (later removed)
- lint: skip e2e in root eslint config
@rprabhat
rprabhat force-pushed the feat/architecture-improvements branch from e4d33d2 to 1833a1e Compare June 21, 2026 08:55
@rprabhat
rprabhat merged commit 879636d into main Jun 21, 2026
4 of 7 checks passed
@rprabhat
rprabhat deleted the feat/architecture-improvements branch June 21, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants