Closes Phase 3 of the v1.0.8 OpenAPI typegen migration. With the four
feature-service migrations (B2 dashboard, B3 profile, B4 playlist,
B5 track, B6 partial auth) landed, the four remaining importers of
the legacy typescript-axios output were all consuming pure model
types — easily portable to the equivalent orval-generated models
under src/services/generated/model/.
Type imports re-pointed (4 sites):
- src/types/index.ts — VezaBackendApiInternalModelsUser /
Track / TrackStatus / Playlist
- src/types/api.ts — same trio (Track / TrackStatus / User)
- src/features/auth/types/index.ts — TokenResponse +
ResendVerificationRequest
- src/features/tracks/types/track.ts — Track / TrackStatus
Same shapes, sourced from openapi.yaml — orval and the legacy
generator were emitting structurally-identical interfaces because
swaggo's spec is the common source. Verified by `npm run typecheck`
clean and 1187/1188 tests green (1 skipped is the long-standing
ResetPasswordPage flake).
Cleanup performed:
1. `git rm -rf apps/web/src/types/generated/` — 198 files / ~23k LOC
of auto-generated typescript-axios output gone.
2. `npm uninstall @openapitools/openapi-generator-cli` — drops the
~150 MB Java-bundled dependency tree from node_modules.
3. `apps/web/scripts/generate-types.sh` — collapsed from a two-step
"[1/2] legacy / [2/2] orval" pipeline to a single orval call.
4. `apps/web/scripts/check-types-sync.sh` — now diffs only
`src/services/generated/`. The "regenerate two trees" complexity
is gone.
5. `.husky/pre-commit` — message updated to point at the new tree.
Knock-on: the pre-commit hook should run noticeably faster (no Java
JVM spin-up to invoke openapi-generator-cli on every commit), and a
fresh `npm install` is leaner.
Not yet removed (still active under hand-written services):
- services/api/{auth,users,tracks,playlists,queue,search,social}.ts
— these wrap features/<feature>/api/* services and remain in use
by 2-15 callers each. They live in the orval-driven world (their
underlying calls go through orval mutator) and don't import the
legacy types, so they're safe parallel surfaces. Consolidation
punted to v1.0.9 once all auth/queue endpoints are annotated and
the remaining authService 5/9 functions ship.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 0 of the OpenAPI typegen migration. Locks in the existing
check-types-sync.sh (which was committed but never wired) so we stop
accumulating drift between veza-backend-api/openapi.yaml and
apps/web/src/types/generated/ before we migrate to orval (Phase 1).
Three enforcement points:
1. Pre-commit hook (.husky/pre-commit)
Replaces the naked generate-types.sh call with check-types-sync.sh,
which regenerates and fails if the working tree differs. Skippable
via SKIP_TYPES=1 (already documented in CLAUDE.md) for emergency
commits and for environments without node_modules.
2. CI gate (.github/workflows/frontend-ci.yml)
New "Check OpenAPI types in sync" step before lint/build. Catches
PRs that touched openapi.yaml without regenerating types.
Expanded the paths trigger to include veza-backend-api/openapi.yaml
and docs/swagger.yaml so spec-only edits still run the check.
3. Makefile target (make openapi-check)
Local convenience — same check as CI/hook, callable without staging
anything. Pairs with existing `make openapi` (regenerate spec from
swaggo annotations).
No spec or type file changes in this commit — pure plumbing.
Refs:
- AUDIT_REPORT.md §9 item #8 (OpenAPI typegen, deferred v1.0.8)
- Memory: project_next_priority_openapi_client.md
- /home/senke/.claude/plans/audit-fonctionnel-wild-hickey.md Item 2 Phase 0
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two bugs in .husky/pre-commit made lint+typecheck+tests silently no-op:
1. cd recursion: `cd apps/web && ...` repeated 4× sequentially.
After the 1st cd the CWD is apps/web, so `cd apps/web` again tries
to enter apps/web/apps/web and errors out. Fix: wrap each step in
a subshell `(cd apps/web && ...)` so the cd is scoped.
2. Lint grep false positive: `grep -q "error"` matched the ESLint
summary line "(0 errors, K warnings)" — blocking commits even
when lint was clean. Fix: `grep -qE "\([1-9][0-9]* error"` —
matches only the summary with N>=1 errors.
With (1) alone, the hook would block any commit because of bug (2).
Both fixes land together to keep the hook usable.
Before: 3/4 steps no-op'd, and the 4th (lint) would have always
blocked if anything had ever triggered it.
After: all 4 steps run, and only actual errors block.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Added optional test check to pre-commit hook
- Runs unit tests only (fast, not E2E)
- Can be skipped with SKIP_TESTS=1 environment variable
- Blocks commits with failing tests
- Provides helpful error messages and tips
- Keeps pre-commit hook fast by only running unit tests
- Install husky as dev dependency
- Create pre-commit hook to run type generation script
- Ensures types are always up-to-date with backend API before commit
- Hook runs from apps/web directory to execute generate-types.sh