veza/docs/archive/V0_601_RELEASE_SCOPE.md
senke 83ed4f315b
Some checks failed
Backend API CI / test-unit (push) Failing after 0s
Backend API CI / test-integration (push) Failing after 0s
Frontend CI / test (push) Failing after 0s
Storybook Audit / Build & audit Storybook (push) Failing after 0s
chore(release): v0.602 — Payout, Dette Technique & Tests E2E
- Stripe Connect: onboarding, balance, SellerDashboardView
- Interceptors: auth.ts, error.ts extracted, facade
- Grafana: dashboards enriched (p50, top endpoints, 4xx, WS, commerce)
- E2E commerce: product->order->review->invoice
- SMOKE_TEST_V0602, RETROSPECTIVE_V0602, PAYOUT_MANUAL
- Archive V0_602 scope, V0_603 placeholder, SCOPE_CONTROL v0.603
- Fix sanitizer regex (Go no backreferences)
- Marketplace test schema: product_licenses, product_images, orders, licenses
2026-02-23 22:32:01 +01:00

171 lines
8.9 KiB
Markdown

# V0.601 Release Scope — Phase 6 : Production Readiness & Commerce
**Statut** : En planification
**Phase** : 6 — Production & Commerce
**Prérequis** : v0.503 (taguée)
**Date cible** : TBD
**Estimation** : ~6 sprints (30 jours ouvrés)
**Précédente** : [v0.503](archive/V0_503_RELEASE_SCOPE.md)
---
## 1. Objectif
Rendre la plateforme prête pour un déploiement production fiable (blue-green, monitoring), finaliser la boucle commerce (reviews, factures, remboursements), implémenter OAuth Discord/Spotify, et réduire la dette technique structurante (découpage fichiers, consolidation migrations).
---
## 2. État actuel (pré-v0.601)
| Composant | État | Détail |
|-----------|------|--------|
| **Déploiement** | ⚠️ Rolling simple | Pas de blue-green, pas de rollback rapide |
| **Monitoring** | ⚠️ Prometheus + alertes | Pas de dashboards Grafana prêts |
| **Commerce** | ⚠️ Checkout + promos | Pas de reviews, factures, remboursements |
| **OAuth** | ⚠️ Google, GitHub | Discord, Spotify non implémentés |
| **Hyperswitch** | ⚠️ Mode test | Production mode non activé |
| **Dette** | ⚠️ Fichiers > 1000 LOC | handler.go (track) ~1463 LOC, interceptors.ts ~1207 LOC |
| **Migrations** | ⚠️ 113+ fichiers | Pas de baseline consolidée |
---
## 3. Lots
### Lot INF1 — Infrastructure Production
**Objectif** : Déploiement blue-green et monitoring opérationnel.
| # | Tâche | Fichiers impactés | Effort |
|---|-------|--------------------|--------|
| INF1-01 | Blue-green deployment — configurer HAProxy/Caddy pour deux backends (blue/green), health checks, bascule manuelle ou automatique | `config/haproxy/`, `config/caddy/`, `docker-compose.prod.yml`, scripts deploy | L |
| INF1-02 | Dashboards Grafana — créer 3 dashboards : API (latence, erreurs, throughput), Chat (connexions WS, messages/s), Commerce (orders, checkout) | `config/grafana/dashboards/` | M |
| INF1-03 | Alertmanager — configurer notifications (email/webhook Slack) pour les alertes Prometheus critiques | `config/alertmanager/` | S |
| INF1-04 | Graceful shutdown — s'assurer que le backend Go et le stream server gèrent SIGTERM (drain connexions, fin des jobs en cours) | `cmd/api/main.go`, `veza-stream-server/src/main.rs` | M |
| INF1-05 | Health check enrichi — `GET /api/v1/health` retourne status DB, Redis, RabbitMQ (degraded si un service down) | `internal/handlers/health.go` | S |
### Lot COM1 — Commerce Finalisation
**Objectif** : Reviews produits, factures PDF, remboursements. Payout reporté si Stripe Connect complexe.
| # | Tâche | Fichiers impactés | Effort |
|---|-------|--------------------|--------|
| COM1-01 | **Reviews produits** — migration `product_reviews`, CRUD, notation 1-5, commentaire, GET /products/:id/reviews, affichage moyenne | `migrations/`, `internal/handlers/`, `internal/models/`, frontend ProductDetail | M |
| COM1-02 | **Factures PDF** — génération PDF par commande (template, numéro facture, items, total, TVA), GET /orders/:id/invoice, téléchargement | `internal/services/invoice_service.go`, lib PDF (gofpdf ou similar), frontend OrdersView | M |
| COM1-03 | **Remboursements** — POST /orders/:id/refund (vendeur/admin), appel Hyperswitch refund API, webhook refund, mise à jour order + révocation licence | `internal/handlers/`, `internal/services/`, Hyperswitch client | M |
| COM1-04 | **Hyperswitch production** — config pour passer en mode live (HYPERSWITCH_LIVE_MODE), validation webhook signature stricte, documentation | `internal/config/`, `internal/services/hyperswitch/` | S |
| COM1-05 | **MSW + Stories** — handlers commerce enrichis, stories ProductReviews, InvoiceDownload, RefundButton | `apps/web/src/mocks/`, `apps/web/src/features/` | S |
### Lot AUTH1 — OAuth Discord & Spotify
**Objectif** : Implémenter les providers OAuth manquants (actuellement stub).
| # | Tâche | Fichiers impactés | Effort |
|---|-------|--------------------|--------|
| AUTH1-01 | OAuth Discord — config provider, scopes (identify, email), callback, mapping user Discord → Veza | `internal/services/oauth_service.go`, config, frontend OAuthButton | M |
| AUTH1-02 | OAuth Spotify — config provider, scopes (user-read-email), callback, mapping | Idem | M |
| AUTH1-03 | Tests — vérifier flux register/login via Discord et Spotify | `internal/services/oauth_*_test.go` | S |
| AUTH1-04 | FEATURE_STATUS — mettre à jour OAuth Discord/Spotify de "non implémenté" à "opérationnel" | `docs/FEATURE_STATUS.md` | S |
### Lot CLN1 — Dette Technique Structurante
**Objectif** : Réduire la complexité des fichiers les plus longs et consolider les migrations.
| # | Tâche | Fichiers impactés | Effort |
|---|-------|--------------------|--------|
| CLN1-01 | **Découper handler.go** (~1463 LOC) — extraire en sous-handlers : track_crud_handler.go, track_social_handler.go, track_search_handler.go, track_analytics_handler.go. Garder facade. | `internal/core/track/` | L |
| CLN1-02 | **Découper interceptors.ts** (~1200 LOC) — extraire par responsabilité : auth interceptor, error interceptor, retry interceptor, logging. | `apps/web/src/services/api/` | M |
| CLN1-03 | **Consolidation migrations** — script `scripts/squash_migrations.sh` générant une baseline SQL à partir des 113 migrations. Documenter dans `docs/MIGRATIONS.md`. Ne PAS supprimer les migrations existantes. | `scripts/`, `docs/MIGRATIONS.md` | M |
| CLN1-04 | **Audit console.log** — remplacer les `console.log` en production par le logger frontend. Garder uniquement les logs intentionnels. | `apps/web/src/` | S |
### Lot QA1 — Tests & Documentation
**Objectif** : Valider l'ensemble, mettre à jour la documentation.
| # | Tâche | Fichiers impactés | Effort |
|---|-------|--------------------|--------|
| QA1-01 | Tests E2E commerce — upload → achat → review → facture → remboursement (si applicable) | `veza-backend-api/internal/integration/` ou Playwright | M |
| QA1-02 | Smoke test v0.601 — checklist 25+ features E2E | `docs/SMOKE_TEST_V0601.md` | S |
| QA1-03 | Mise à jour PROJECT_STATE.md, FEATURE_STATUS.md, CHANGELOG.md | `docs/` | S |
| QA1-04 | Archiver V0_601_RELEASE_SCOPE.md, créer placeholder V0_602_RELEASE_SCOPE.md | `docs/archive/`, `docs/` | S |
| QA1-05 | Rétrospective v0.601 | `docs/RETROSPECTIVE_V0601.md` | S |
| QA1-06 | Tag v0.601 | Git | S |
---
## 4. Hors scope v0.601
| Élément | Version cible |
|---------|---------------|
| Payout vendeurs (Stripe Connect) | v0.602 (si COM1 trop chargé) |
| Migration React 19 | v0.602 |
| Go Live (streaming vidéo) | v0.703 |
| 2FA SMS / Passkeys | v0.104 |
| IaC (Terraform/Pulumi) | v0.801 |
---
## 5. Fichiers impactés (récapitulatif)
### Backend Go (nouveau)
| Fichier | Action |
|---------|--------|
| `internal/services/invoice_service.go` | Nouveau — génération PDF |
| `internal/handlers/track_crud_handler.go` | Nouveau — extrait de track_handler |
| `internal/handlers/track_upload_handler.go` | Nouveau |
| `internal/handlers/track_hls_handler.go` | Nouveau |
| `internal/handlers/track_waveform_handler.go` | Nouveau |
| `migrations/114_product_reviews.sql` | Nouveau (ou numéro suivant) |
### Backend Go (modifier)
| Fichier | Action |
|---------|--------|
| `internal/handlers/health.go` | Enrichir health check |
| `internal/core/track/handler.go` | Réduire à facade |
| `internal/services/oauth_service.go` | Ajouter Discord, Spotify |
| `internal/handlers/marketplace_handler.go` | Reviews, refund |
| `cmd/api/main.go` | Graceful shutdown |
### Frontend (nouveau/modifier)
| Fichier | Action |
|---------|--------|
| `apps/web/src/services/api/interceptors.ts` | Découper |
| `apps/web/src/features/commerce/` | Reviews, Invoice, Refund UI |
| `apps/web/src/mocks/handlers-commerce.ts` | Enrichir |
### Infra
| Fichier | Action |
|---------|--------|
| `config/haproxy/` | Blue-green config |
| `config/grafana/dashboards/` | 3 dashboards |
| `config/alertmanager/` | Notifications |
| `scripts/squash_migrations.sh` | Nouveau |
---
## 6. Critères d'acceptation globaux
- [ ] Déploiement blue-green opérationnel (documenté, testé)
- [ ] 3 dashboards Grafana déployés et alimentés
- [ ] Reviews produits : création, affichage, moyenne
- [ ] Facture PDF téléchargeable par commande
- [ ] Remboursement initiable (vendeur/admin), webhook traité
- [ ] OAuth Discord et Spotify fonctionnels
- [ ] handler.go (track) < 500 LOC (logique extraite)
- [ ] interceptors.ts < 400 LOC (découpage)
- [ ] Script squash migrations documenté
- [ ] Tag v0.601 créé
---
## 7. Risques
| Risque | Mitigation |
|--------|------------|
| Stripe Connect / Payout trop complexe | Reporter en v0.602, focus sur reviews/factures/remboursements |
| Génération PDF lourde | Utiliser lib légère (gofpdf), génération async si besoin |
| Blue-green nécessite 2x ressources | Documenter option "rolling" si ressources limitées |
| OAuth Discord/Spotify quotas API | Documenter limites, rate limiting côté provider |