feat(gating): socle — LicenseProvider + matrice d'entitlements + useEntitlement #297
Labels
No labels
autopilot:pending-human
source:analyste
source:defenseur
source:human
source:medic
status:approved
status:blocked
status:in-progress
status:needs-clarification
status:needs-fix
status:ready
status:review
status:triage
type:bug
type:feature
type:infra
type:refactor
type:schema
type:security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: maximus/Simpl-Resultat#297
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
LicenseProvider (Context partage) + matrice d'entitlements TS + hook useEntitlement synchrone. C'est le socle : tout le gating s'y branche.
Fichiers concernes
src/contexts/LicenseContext.tsx(creer) — provider modele sur ProfileContext (createContext<T|null>, useReducer, hook qui throw). Charge edition + info 1x, expose { status, edition, features, info, refresh, submitKey }.src/main.tsx(modifier) — monter LicenseProvider AU-DESSUS de ProfileProvider (licence = machine-level, survit au remount BrowserRouter key=refreshKey).src/shared/entitlements.ts(creer) — FeatureKey (kebab-case), ENTITLEMENTS, isEntitled() pur fail-closed Free.src/hooks/useEntitlement.ts(creer) — useEntitlement(f): { allowed, ready }.src/hooks/useIsPremium.ts+useIsPremium.test.ts(modifier) — lire le context ; migrer le mock du test.src/components/settings/LicenseCard.tsx(modifier) — consommer le context.src/services/entitlements.test.ts(creer).Depends on
Criteres d'acceptation
{ allowed, ready }(ready = status==="ready"), PAS un boolean.if (edition === "free") return falseAVANT l'override features[].Review caveats (/review-spec — a respecter)
./useLicense(vi.mock) — le refactor le casse ; migrer vers le mock du context.Decisions prises en planification
Spec source
spec-decisions-feature-gating.md + spec-plan-feature-gating.md (racine, force-add ; verdict /review-spec jaune, corrections integrees).
Corrections /review-spec a integrer :
useEntitlementretourne{ allowed, ready }(pas un boolean) — sinon flash upsell au boot (Sidebar/tuiles/profils/routes).isEntitledfail-closed en Free :if (edition === 'free') return falseavant l overridefeatures[]— une cle copiee downgrade en free (machine-binding) mais expose ses features signees (CWE-863).useIsPremium.test.ts: il mocke./useLicense, casse par le refactor vers le context.reports-advanced). Voir spec-plan § Revision — Synthese.