chore(review): 1103 세션 owner 조치 브랜치를 합친다

Refs: docs/reviews/2026-11-03-maturity-review/README.md 09-03 09-11

# Conflicts:
#	docs/manual/02-decision-tables.md
This commit is contained in:
DongHyeonka
2026-11-04 21:40:51 +09:00
23 changed files with 3066 additions and 9 deletions
@@ -1,3 +1,19 @@
/**
* 1103/09-11. The owner of the session moves it; nothing else does.
*
* - `unauthenticated` → `authenticated`: a sign-in completed (after
* `beginSignIn`, often on the page load that returns from the sign-in).
* - `authenticated` → `recovery-pending`: the credential stopped working
* (a server 401, a failed refresh) and the owner can still try to restore it.
* - `authenticated` → `unauthenticated`: `signOut`, or a 401 nothing can
* restore.
* - `recovery-pending` → `authenticated` | `unauthenticated`: a recovery ended,
* the owner's own or `recover()`'s (see there).
* - any → `integration-failed`: the owner cannot work at all.
*
* Every change of state or subject notifies subscribers once, and each one
* fences server state, so a token refresh for the same user changes neither.
*/
export type SessionState =
| "authenticated"
| "unauthenticated"
@@ -27,6 +43,16 @@ export type SessionGateway = Readonly<{
* to keep existing owners working; the transport races the signal either way,
* and a recovery that answers after the request already ended is observed but
* never turned into a user-visible sign-out.
*
* 1103/09-11. The state is moved before the promise settles:
*
* - `"restored"`: the state is `authenticated`, with its subject.
* - `"no-session"`: the state is `unauthenticated` (or
* `integration-failed`). Never `recovery-pending`: the screen would keep
* offering a recovery that already said no. Presentation shows sign-in
* after this answer whatever the owner reports, until it next notifies.
* - rejects: the owner could not tell (network, timeout). The state is left
* as it was, so the user can try again.
*/
recover(
context?: CredentialOperationContext,