Commit graph

7 commits

Author SHA1 Message Date
senke
a66aeade45 chore(web): drop legacy openapi-generator-cli — orval is the single source (v1.0.8 B9)
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>
2026-04-26 00:02:58 +02:00
senke
4ee8c38536 feat(ci): enforce OpenAPI type sync — drift prevention (v1.0.8 P0)
Some checks failed
Veza CI / Backend (Go) (push) Failing after 0s
Veza CI / Frontend (Web) (push) Failing after 0s
Veza CI / Rust (Stream Server) (push) Failing after 0s
Frontend CI / test (push) Failing after 0s
Security Scan / Secret Scanning (gitleaks) (push) Failing after 0s
Veza CI / Notify on failure (push) Failing after 0s
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>
2026-04-23 20:33:13 +02:00
senke
172581ff02 chore(cleanup): remove orphan code + archive disabled workflows + .playwright-mcp
Triple cleanup, landed together because they share the same cleanup
branch intent and touch non-overlapping trees.

1. 38× tracked .playwright-mcp/*.yml stage-deleted
   MCP session recordings that had been inadvertently committed.
   .gitignore already covers .playwright-mcp/ (post-audit J2 block
   added in d12b901de). Working tree copies removed separately.

2. 19× disabled CI workflows moved to docs/archive/workflows/
   Legacy .yml.disabled files in .github/workflows/ were 1676 LOC of
   dead config (backend-ci, cd, staging-validation, accessibility,
   chromatic, visual-regression, storybook-audit, contract-testing,
   zap-dast, container-scan, semgrep, sast, mutation-testing,
   rust-mutation, load-test-nightly, flaky-report, openapi-lint,
   commitlint, performance). Preserved in docs/archive/workflows/
   for historical reference; `.github/workflows/` now only lists the
   5 actually-running pipelines.

3. Orphan code removed (0 consumers confirmed via grep)
   - veza-backend-api/internal/repository/user_repository.go
     In-memory UserRepository mock, never imported anywhere.
   - proto/chat/chat.proto
     Chat server Rust deleted 2026-02-22 (commit 279a10d31); proto
     file was orphan spec. Chat lives 100% in Go backend now.
   - veza-common/src/types/chat.rs (Conversation, Message, MessageType,
     Attachment, Reaction)
   - veza-common/src/types/websocket.rs (WebSocketMessage,
     PresenceStatus, CallType — depended on chat::MessageType)
   - veza-common/src/types/mod.rs updated: removed `pub mod chat;`,
     `pub mod websocket;`, and their re-exports.
   Only `veza_common::logging` is consumed by veza-stream-server
   (verified with `grep -r "veza_common::"`). `cargo check` on
   veza-common passes post-removal.

Refs: AUDIT_REPORT.md §8.2 "Code mort / orphelin" + §9.1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 20:33:40 +02:00
senke
12f873bdb8 fix(husky): pre-commit cd recursion + lint-grep false positive
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>
2026-04-20 20:20:40 +02:00
senke
be06ce90f8 implicit: implement Implicit 10.3 - add optional test check to pre-commit hook
- 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
2026-01-16 14:18:41 +01:00
senke
9a0e1c4680 implicit: implement Implicit 9.2, 10.1, 10.2 - env validation and pre-commit hooks
- Implicit 9.2: Verified env validation already implemented (Zod schema with clear errors)
- Implicit 10.1: Added type checking to pre-commit hook (blocks on errors, allows warnings)
- Implicit 10.2: Added linting to pre-commit hook (blocks on errors, allows warnings)
- Pre-commit hook now runs: type generation, type checking, linting
- Prevents commits with TypeScript or linting errors
- Provides helpful error messages and tips
- Note: Pre-existing TypeScript errors in codebase will block commits until fixed
2026-01-16 13:04:49 +01:00
senke
b8cad69e3a api-contracts: add type generation to pre-commit hook
- 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
2026-01-15 17:00:30 +01:00