401 lines
No EOL
10 KiB
Markdown
401 lines
No EOL
10 KiB
Markdown
# Chat Conversation
|
||
|
||
Note: _This is purely the output of the chat conversation and does not contain any raw data, codebase snippets, etc. used to generate the output._
|
||
|
||
### User Input
|
||
|
||
# đ **PHASE 6 â FULL SYSTEM VALIDATION & PRE-RELEASE HARDENING**
|
||
|
||
Tu démarres maintenant **Phase 6**, aprÚs finalisation de :
|
||
|
||
* **API Contract Final (Phase 5)**
|
||
* **OpenAPI 3.1 complĂšte**
|
||
* **API Frontend Integration Guide**
|
||
* **API stability tests + micro-E2E API flow**
|
||
|
||
Lâobjectif est dâobtenir un projet **Veza Backend API** entiĂšrement prĂȘt pour :
|
||
|
||
* lâintĂ©gration complĂšte du frontend,
|
||
* la mise en staging,
|
||
* et la livraison dâune **Release Candidate (RC1)**.
|
||
|
||
Phase 6 consiste en une **validation transversale complĂšte**, au-delĂ de lâAPI :
|
||
services, repos, migrations, monitoring, jobs, cohérence transactionnelle, performance minimale, sécurité.
|
||
|
||
---
|
||
|
||
# đŻ OBJECTIF GLOBAL PHASE 6
|
||
|
||
Garantir que **tout le backend est cohĂ©rent, performant, vĂ©rifiable, audit-proof**, et prĂȘt Ă ĂȘtre gelĂ© pour une release RC1.
|
||
|
||
Phase 6 comprend :
|
||
|
||
1. **Full Contract Validation**
|
||
Vérifier que *chaque endpoint* implémenté respecte exactement :
|
||
|
||
* OpenAPI 3.1 (schémas, erreurs, enveloppes)
|
||
* API Contract Final (types, naming, constraints)
|
||
* API Frontend Guide (formes attendues cÎté client)
|
||
|
||
2. **Cross-Layer Consistency**
|
||
VĂ©rifier que tous les layers respectent lâAPI contract :
|
||
|
||
* handlers
|
||
* services
|
||
* repositories
|
||
* validators
|
||
* models
|
||
|
||
3. **System-Wide Regression Detection**
|
||
DĂ©celer toute incohĂ©rence introduite depuis Phase 1â5 :
|
||
|
||
* migrations manquantes / incohérentes
|
||
* sentinel errors non propagées correctement
|
||
* inconsistances transients (jobs schedulés, cleanup)
|
||
* performance dégradée sur certains services (bitrate adaptation, playlist ops)
|
||
|
||
4. **Security Hardening**
|
||
|
||
* Vérifier tout JWT, refresh, scopes, RBAC, forbidden cases
|
||
* Sâassurer quâaucune fuite dâexistence (404 vs 403) nâexiste
|
||
* Vérifier exhaustivement les path parameters (UUID validations)
|
||
* Vérifier upload / multipart security (DoS surfaces)
|
||
|
||
5. **Transaction & Consistency Review**
|
||
Inspecter :
|
||
|
||
* Playlist operations (multi-track reorder)
|
||
* Playback analytics batch operations
|
||
* Track upload + HLS generation interactions
|
||
* Cleanup jobs (session cleanup, token cleanup)
|
||
* Room & chat token lifecycle
|
||
|
||
6. **Performance Budget Check**
|
||
(Rapide mais indispensable)
|
||
|
||
* Latence handler †5ms local
|
||
* JSON parsing stable et sans allocations inutiles
|
||
* Repos SQLite tests †150ms
|
||
* Aucun handler nâeffectue dâopĂ©ration O(NÂČ) inutile
|
||
|
||
7. **System-Level Tests & Acceptance Criteria**
|
||
Créer un pack de tests :
|
||
|
||
```
|
||
tests/system/
|
||
TestSystem_AuthAndRefresh
|
||
TestSystem_UploadAndTranscode
|
||
TestSystem_PlaylistAndTracks
|
||
TestSystem_Comments
|
||
TestSystem_RoomAndChatToken
|
||
TestSystem_AdminEndpoints
|
||
```
|
||
|
||
Ces tests utilisent SQLite + mocks pour services externes.
|
||
|
||
---
|
||
|
||
# âïž **1. MISSION DĂTAILLĂE**
|
||
|
||
## A. VĂ©rification de conformitĂ© OpenAPI â Code
|
||
|
||
Pour chaque endpoint :
|
||
|
||
* comparer handler â DTO â OpenAPI â actual runtime
|
||
* détecter :
|
||
|
||
* champs en trop
|
||
* champs manquants
|
||
* valeurs incorrectes
|
||
* erreurs HTTP non conformes
|
||
* enveloppes JSON incorrectes
|
||
|
||
Produire un tableau :
|
||
|
||
```
|
||
Endpoint | Issue | Severity | Fix
|
||
```
|
||
|
||
## B. Validation JSON & Structs
|
||
|
||
Analyser tous les DTOs dans :
|
||
|
||
```
|
||
internal/dto/
|
||
internal/models/responses.go
|
||
internal/handlers/common.go
|
||
```
|
||
|
||
Objectifs :
|
||
|
||
* snake_case strict
|
||
* json tags cohérents
|
||
* aucun champ inutile exposé au client
|
||
* `omitempty` utilisé intelligemment
|
||
* structures uniformes dans toutes les réponses success/error
|
||
|
||
## C. Security Hardening Review
|
||
|
||
Inspecter :
|
||
|
||
* Refresh token logic
|
||
* Invalid token behavior
|
||
* Expired token behavior
|
||
* Missing/invalid scopes
|
||
* Playlist privacy leaks
|
||
* Chat token misuse
|
||
* Session hijacking protections
|
||
|
||
Corriger toute anomalie.
|
||
Un commit = un fix.
|
||
|
||
## D. Transaction & Consistency Review
|
||
|
||
Auditer :
|
||
|
||
* Playlist operations (add/remove/reorder)
|
||
* Track upload â session â HLS
|
||
* Comment parent/child correctness
|
||
* Room creation/join flows
|
||
* Playback analytics (intersections, aggregations, comparisons)
|
||
|
||
Ces couches doivent **toujours** respecter lâAPI Contract Final.
|
||
|
||
## E. Tests systĂšme
|
||
|
||
Créer le dossier :
|
||
|
||
```
|
||
tests/system/
|
||
```
|
||
|
||
Utiliser un runner dédié :
|
||
|
||
```
|
||
go test -v ./tests/system
|
||
```
|
||
|
||
Chaque test doit :
|
||
|
||
* exécuter un workflow complet
|
||
* vérifier la conformité JSON avec les schémas
|
||
* vérifier les codes HTTP corrects
|
||
* ĂȘtre indĂ©pendant (SQLite in-memory)
|
||
* ĂȘtre court et stable
|
||
|
||
## F. Mise Ă jour des documents
|
||
|
||
Tu dois mettre Ă jour :
|
||
|
||
* `API_CONTRACT_FINAL.md` (ajustements finaux)
|
||
* `API_FRONTEND_GUIDE.md` (exemples complets / correction)
|
||
* `API_STABILITY_REPORT.md`
|
||
* `POST_REMEDIATION_REPORT.md` (Phase 6)
|
||
* `CHANGELOG.md`
|
||
|
||
Et créer :
|
||
|
||
```
|
||
SYSTEM_VALIDATION_REPORT.md
|
||
SECURITY_REVIEW_FINAL.md
|
||
PERFORMANCE_BUDGET_REPORT.md
|
||
```
|
||
|
||
---
|
||
|
||
# âïž **2. METHODOLOGIE EXĂCUTIVE**
|
||
|
||
### Ătape 1
|
||
|
||
Scanner toute lâAPI (handlers/services/dto/models).
|
||
|
||
### Ătape 2
|
||
|
||
Générer la liste exhaustive des incohérences.
|
||
|
||
### Ătape 3
|
||
|
||
Proposer un ordre optimal de rĂ©solution P0 â P2.
|
||
|
||
### Ătape 4
|
||
|
||
Appliquer les correctifs :
|
||
**1 commit = 1 problĂšme = 1 justification.**
|
||
|
||
### Ătape 5
|
||
|
||
Exécuter les tests systÚme.
|
||
|
||
### Ătape 6
|
||
|
||
Corriger jusquâĂ obtenir **0 regression**.
|
||
|
||
### Ătape 7
|
||
|
||
Produire les rapports finaux Phase 6.
|
||
|
||
---
|
||
|
||
# âïž **3. DĂMARRAGE**
|
||
|
||
Commence maintenant en :
|
||
|
||
1. Scannant toutes les routes déclarées (cmd/api/main.go, router.go)
|
||
2. Comparant immĂ©diatement **OpenAPI â handlers**
|
||
3. Produisant une liste P0/P1/P2
|
||
4. Appliquant le premier fix
|
||
|
||
---
|
||
|
||
# đ **PHASE 6 STARTS NOW â CONTINUE**
|
||
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `find . -maxdepth 3 -not -path '*/.*'`*
|
||
|
||
*Viewed [swagger.yaml](file:///home/senke/Documents/veza/veza-backend-api/docs/swagger.yaml) *
|
||
|
||
*Viewed [router.go](file:///home/senke/Documents/veza/veza-backend-api/internal/api/router.go) *
|
||
|
||
*Viewed [swagger.json](file:///home/senke/Documents/veza/veza-backend-api/docs/swagger.json) *
|
||
|
||
*Viewed [API_CONTRACT_FINAL.md](file:///home/senke/Documents/veza/veza-backend-api/API_CONTRACT_FINAL.md) *
|
||
|
||
*Viewed [auth.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/auth.go) *
|
||
|
||
*Searched filesystem*
|
||
|
||
*Viewed [common.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/common.go) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
### User Input
|
||
|
||
|
||
|
||
*Viewed [main.go](file:///home/senke/Documents/veza/veza-backend-api/cmd/api/main.go) *
|
||
|
||
*Listed directory [dto](file:///home/senke/Documents/veza/veza-backend-api/internal/dto) *
|
||
|
||
*Viewed [login_request.go](file:///home/senke/Documents/veza/veza-backend-api/internal/dto/login_request.go) *
|
||
|
||
*Semantic searched codebase*
|
||
|
||
*Viewed [response.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/response.go) *
|
||
|
||
*Viewed [register_request.go](file:///home/senke/Documents/veza/veza-backend-api/internal/dto/register_request.go) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Viewed [profile_handler.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/profile_handler.go) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Listed directory [track](file:///home/senke/Documents/veza/veza-backend-api/internal/core/track) *
|
||
|
||
*Viewed [handler.go](file:///home/senke/Documents/veza/veza-backend-api/internal/core/track/handler.go) *
|
||
|
||
*Viewed [response.go](file:///home/senke/Documents/veza/veza-backend-api/internal/response/response.go) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Viewed [playlist_handler.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/playlist_handler.go) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Viewed [chat_handler.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/chat_handler.go) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Listed directory [handlers](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers) *
|
||
|
||
*Viewed [marketplace.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/marketplace.go) *
|
||
|
||
*User accepted the command `swag init -g cmd/api/main.go --parseDependency --parseInternal`*
|
||
|
||
*User accepted the command `/home/senke/go/bin/swag init -g cmd/api/main.go --parseDependency --parseInternal`*
|
||
|
||
*Viewed [swagger.yaml](file:///home/senke/Documents/veza/veza-backend-api/docs/swagger.yaml) *
|
||
|
||
*Viewed [swagger.yaml](file:///home/senke/Documents/veza/veza-backend-api/docs/swagger.yaml) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
### User Input
|
||
|
||
commit ca
|
||
|
||
*User accepted the command `git status`*
|
||
|
||
*User accepted the command `git add . && git commit -m "feat(api): remediate missing openapi spec and annotate handlers"`*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `go build ./internal/core/track/...`*
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `go build ./internal/core/track/...`*
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `git add . && git commit -m "refactor(track): enforce unified api response envelope"`*
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `go build ./internal/handlers/...`*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Listed directory [errors](file:///home/senke/Documents/veza/veza-backend-api/internal/errors) *
|
||
|
||
*Viewed [errors.go](file:///home/senke/Documents/veza/veza-backend-api/internal/errors/errors.go) *
|
||
|
||
*Viewed [codes.go](file:///home/senke/Documents/veza/veza-backend-api/internal/errors/codes.go) *
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `go build ./internal/handlers/...`*
|
||
|
||
*Viewed [marketplace.go](file:///home/senke/Documents/veza/veza-backend-api/internal/handlers/marketplace.go) *
|
||
|
||
*User accepted the command `go build ./internal/handlers/...`*
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `go build ./internal/handlers/...`*
|
||
|
||
*User accepted the command `/home/senke/go/bin/swag init -g cmd/api/main.go --parseDependency --parseInternal`*
|
||
|
||
*Edited relevant file*
|
||
|
||
*Edited relevant file*
|
||
|
||
*User accepted the command `git add . && git commit -m "refactor(marketplace): enforce unified api response envelope"`* |