test(data): per-scenario state isolation to bound the read fan-out
@data oscillated 15-20/21 because the persistent test wallet accumulated data across scenarios, growing the read fan-out. Add a cheap per-scenario reset (resetDataState): a single SPARQL DELETE on the shim anchor graph clears the account records, so allAccounts() collapses and the fan-out is bounded to what the current scenario re-provisions (accounts recreated lazily). O(1) on one graph — not a fan-out delete (which saturated the browser before). Called in the @data Before hook, time-boxed so it can't starve the broker login budget. Test-infra only — product model, boundary and app read path untouched. Note: not yet re-measured to stable-green — the broker was degraded during the bounded validation window (DNS/timeout flakiness). To re-measure when the broker is stable. knowledge_data-layer-broker updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
type: knowledge
|
||||
summary: Couche @data — Playwright pilote Chromium (profil persistant) qui s'authentifie au broker NextGraph réel chargeant harness-ng.tsx en iframe ; cycle de vie wallet automatisé (création + login bootstrap), bridge window.__testData, fallback mock
|
||||
last_checked: 2026-07-03
|
||||
last_checked: 2026-07-05
|
||||
---
|
||||
|
||||
# Couche `@data` (broker réel)
|
||||
@@ -50,9 +50,17 @@ Cucumber → Playwright (Chromium, profil persistant)
|
||||
`ensureCurrentUser()` avant `joinEvent` (sinon participation écrite sans user → jetée en
|
||||
lecture, ne fait jamais l'aller-retour) et attendent (`waitForFunction`) que la participation
|
||||
soit relue.
|
||||
- **Caveat wallet persistant** : le wallet partagé **accumule** les docs per-entité à chaque run
|
||||
(seed + inscriptions). Le fan-out de lecture (`listEntityDocs`) parcourt tous les docs de tous
|
||||
les comptes → ralentit et fait *timeouter* les steps quand le wallet est pollué. Pour une suite
|
||||
fiable, repartir d'un wallet **frais** (supprimer `.playwright-profile/` → recréation
|
||||
automatique) ; le seed connecté est volontairement **allégé** (peu de docs) car chaque
|
||||
`docCreate` est un aller-retour broker sériel ~2s.
|
||||
- **Caveat wallet persistant + isolation par scénario (T03.j)** : le wallet partagé **accumule**
|
||||
le registre de comptes émulé et les docs per-entité à chaque scénario/run. Le fan-out de lecture
|
||||
(`listEntityDocs` = `allAccounts()` → 1 SELECT/compte) parcourt tous les docs de tous les comptes
|
||||
→ ralentit et fait *timeouter* les steps quand le wallet est pollué. Ce registre vit **côté
|
||||
broker** : supprimer `.playwright-profile/` ne le nettoie PAS (re-sync depuis le broker) et force
|
||||
une re-auth lente — mauvais levier. À la place, le `Before` @data appelle
|
||||
`window.__testData.resetDataState()` : **UN** SPARQL DELETE sur le graphe ancre (private-store)
|
||||
qui efface tous les records `urn:ng-eventually:shim:Account` → `allAccounts()` s'effondre à vide →
|
||||
le fan-out se **borne** à ce que le scénario courant reprovisionne (comptes recréés paresseusement
|
||||
par `ensureAccount`). O(1) sur UN graphe — **pas** un delete en fan-out (qui saturait le navigateur,
|
||||
cf. T03.i `authClearParticipation` retiré). Borné à ≤10s (`Promise.race`) pour ne pas disputer le
|
||||
budget 60s du `Before` (login broker déjà lent). Infra de test uniquement — ne touche ni la lib ni
|
||||
le modèle produit ni le chemin de lecture applicatif. Le seed connecté reste **allégé** (peu de
|
||||
docs) car chaque `docCreate` est un aller-retour broker sériel ~2s.
|
||||
|
||||
Reference in New Issue
Block a user