From 7a4d9b492f787b5c0f7882c6d3187489d2d4d243 Mon Sep 17 00:00:00 2001 From: Sylvain Duchesne Date: Wed, 12 Aug 2026 15:56:07 +0200 Subject: [PATCH] =?UTF-8?q?refactor:=20une=20application=20ne=20fournit=20?= =?UTF-8?q?pas=20sa=20propre=20identit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configure() acceptait un champ currentUser publié. Il faisait manier à l'appelant ce que la cible ne lui remettra jamais : en amont, session_start reçoit un identifiant qui VIENT du portefeuille qu'une personne a ouvert. Et il rouvrait la porte qu'on venait de fermer : renseigné, il fait sauter la barrière en page de tête — exactement le comportement retiré au commit précédent. Un commentaire disait « rien de ce qu'expédie une application ne fait ça » ; c'est une note, pas un mécanisme, et une exception nommée cesse d'en être une dès qu'elle est publiée. Personne ne s'en servait — aucun test, aucun harnais, aucun exemple. Un symbole gardé parce qu'il était déjà là n'est pas une décision. Le chemin interne subsiste pour les harnais qui pilotent la surface sans navigateur, mais il n'est plus atteignable depuis la surface publiée. --- .../concepts/app-contract/contract_polyfill-surface.md | 1 - docs/api-contract.md | 1 - packages/polyfill/src/shared-wallet/bootstrap.ts | 7 ++++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.project/concepts/app-contract/contract_polyfill-surface.md b/.project/concepts/app-contract/contract_polyfill-surface.md index 6168935..372306a 100644 --- a/.project/concepts/app-contract/contract_polyfill-surface.md +++ b/.project/concepts/app-contract/contract_polyfill-surface.md @@ -31,7 +31,6 @@ export interface EventuallyConfig { getSession?: () => Promise; // resolve the session (a thunk) normalizeId?: (id: string) => string; sharedWallet?: SharedWalletConfig; // { fileUrl, password, importUrl? } - currentUser?: PrincipalId; debugAccessLog?: boolean; init?: (...args: any[]) => any; initNg?: (...args: any[]) => any; diff --git a/docs/api-contract.md b/docs/api-contract.md index c25a13c..e4c8c15 100644 --- a/docs/api-contract.md +++ b/docs/api-contract.md @@ -30,7 +30,6 @@ export interface EventuallyConfig { normalizeId?: (id: string) => string; pointerGuard?: { attempts?: number; baseMs?: number; maxStepMs?: number }; sharedWallet?: SharedWalletConfig; // the gate's, § 2bis - currentUser?: PrincipalId; debugAccessLog?: boolean; init?: (...args: any[]) => any; initNg?: (...args: any[]) => any; diff --git a/packages/polyfill/src/shared-wallet/bootstrap.ts b/packages/polyfill/src/shared-wallet/bootstrap.ts index f24fd03..dfd4a3c 100644 --- a/packages/polyfill/src/shared-wallet/bootstrap.ts +++ b/packages/polyfill/src/shared-wallet/bootstrap.ts @@ -85,8 +85,6 @@ export interface EventuallyConfig { * itself. Disappears with the gate: upstream a user opens their own wallet. */ sharedWallet?: SharedWalletConfig; - /** Initial current user; may also be set later via {@link setCurrentUser}. */ - currentUser?: PrincipalId; /** * Turn on the OFF-by-default document access log (see {@link ./access-log}): * every real read/write is printed, prefixed by the active identity, to @@ -135,7 +133,10 @@ let caps = new CapRegistry(capsHolder); export function configure(c: EventuallyConfig): void { cfg = c; - currentUser = c.currentUser ?? null; + // Not taken from the config: an application never supplies its own identity — upstream + // it comes FROM the wallet a person opened. Accepting one here would also let a caller + // skip the barrier on a top-level page, which is the one thing it exists to prevent. + currentUser = null; setAccessLog(c.debugAccessLog ?? false); // The session wiring is part of the same act — see {@link EventuallyConfig}. Omitted // only by unit suites that never touch the registry; those get the same