Work on Linear issue MM-457: Suggested branch name:…
- User
Work on Linear issue MM-457:
Suggested branch name: malpercio/mm-457-phase-2-foreign-pds-session-provider-password-createsession
What
Several wallet features are built entirely on standard lexicons but are dark for foreign-hosted identities only because the session that drives them comes from Custos's
/v1/sessions/sovereign:- App passwords (
createAppPassword/listAppPasswords/revokeAppPassword) - Change handle (
updateHandle+ the wallet-signed alsoKnownAs op) - Identity removal (
requestAccountDelete/deleteAccount+ tombstone) - Blob restore (
restore_blob_backup'suploadBlobleg — backup works everywhere, restore doesn't)
SessionProvider::full_access_client'sNeedsUnlockcurrently has exactly one resolution: the biometric passwordlesssovereignLogin. Give it a second: on hosts without thesovereignSessionscapability (MM-454), the unlock cue routes to a passwordcreateSessionprompt (the machinerysource_login.rsalready uses transiently for claim/migration source login), persisting the resulting Bearer pair in the same versioned{did}:oauth-tokensrecord so refresh/rotation flows through the provider's existing ladder unchanged.Constraints
- ADR-0021 holds: identity ops need a full session; hosts may email-2FA (
AuthFactorTokenRequiredis already modeled inPdsClient::create_session). - The password is used once and never stored — identical posture to the claim flow.
- Per-feature graceful degradation stays honest: a host that refuses an operation (e.g. no app-password support) surfaces the server's answer, not a wallet guess.
Acceptance criteria
- A claimed bsky.social/reference-PDS identity can mint, list, and revoke app passwords; change handle; run account removal; and restore its blob backup — each behind the same biometric gates as the Custos paths.
SessionError::NeedsUnlockhandling in the frontend branches on host capability: sovereign login (Custos) vs password prompt (other), with 2FA handled.- Refresh, host-change discard, and coalescing behavior of
session_provider.rsare unchanged for Custos identities (existing tests stay green).
Broaden Obsign's market beyond Custos-hosted accounts: a user on the reference PDS, , or any spec-compliant PDS should get real, honest value from the wallet — Secure-Enclave root key, PLC monitoring + 72h override, user-held repo/media backup, self-held Shamir recovery — with Custos capabilities (escrow-assisted recovery, passwordless sovereign sessions, agents, wallet-confirmed consent) as the opt-in upgrade rather than a lock-in. Rescue and migration must never force a stressed user onto Custos.
- App passwords (
Assistant
I'll start by activating the Linear workflow skill, then explore the codebase.
Assistant
Now I have the full picture. Let me start with the backend.
★ Insight ─────────────────────────────────────- The provider's ladder reads a persisted record, not a login method — so a password
createSessioncan light up every downstream feature by writing the same{did}:oauth-tokensshape thatsovereignLoginwrites. No change tosession_provider.rsat all, which is exactly what AC 3 demands. source_login.rscurrently hands back anOAuthClient, which swallows the raw JWTs. To persist them I need to split its core: thecreateSession+ error-mapping + account-match guard becomes reusable, and the Bearer-client construction becomes the thin wrapper the two existing callers keep.- Capability probing has a subtlety already encoded in
pds_capabilities:reached: falsemeans we could not ask, not no sovereign sessions. Routing an offline Custos identity to a password prompt would be a lie, so unreached must fall back to the sovereign path.─────────────────────────────────────────────────
- The provider's ladder reads a persisted record, not a login method — so a password
Assistant
Now replace the tail of the old function (which still builds the client) with a plain return of the session.
Assistant
Now the new backend module.
Assistant
Now register the module and commands in
lib.rs.Assistant
Backend compiles. Running the new tests:
Assistant
Sandbox blocks httpmock's socket bind — that's the sandbox, not the code. Rerunning unsandboxed:
Assistant
All 662 wallet tests pass, including every
session_providertest untouched (AC 3). Now the frontend.★ Insight ─────────────────────────────────────- The strongest test here isn't "did createSession work" — it's the one that mints a session via password and then calls
SessionProvider::full_access_clientagainst an unroutable plc.directory. If the provider restores it with no network, the record shape is provably the one the ladder already understands. - The 157 "failures" were the sandbox denying
bind(127.0.0.1:0)to httpmock. Worth recognizing on sight: a uniform failure across every network-mocking test is environmental, and reading the first panic beats re-running.─────────────────────────────────────────────────
- The strongest test here isn't "did createSession work" — it's the one that mints a session via password and then calls
Assistant
Now wire the dialog into the root page and swap the screens' unlock calls.
Assistant
Now swap the four screens from
sovereignLogintounlockIdentity.Assistant
Now add the imports to each screen.
Assistant
Cancellation shouldn't render as an error. Let me check each catch site.
Assistant
Now the harness handlers so the browser harness can drive this.
Assistant
Now a unit test for the dispatcher.
Assistant
Now installing frontend deps so I can actually type-check and test.
Assistant
Now let me actually drive this in the browser harness to verify AC 2.
Assistant
Now force the locked state and open App Passwords.
Assistant
The locked state renders with the method-neutral copy. Now tap Unlock — on this bsky.social identity it must route to the password prompt, not biometrics.
Assistant
The dialog renders correctly with the host named and identifier prefilled. Now the 2FA branch:
Assistant
The 2FA branch advances rather than reading as a wrong password. Now completing the unlock should retry the original load:
Assistant
Now confirming a Custos-hosted identity is unchanged (AC 3):
Assistant
Verified: Custos identity → no dialog (sovereign route); foreign host → password prompt. Cleaning up and finishing the supporting deliverables.
Assistant
Now the AGENTS.md contract updates.
Assistant
Now the frontend contract entries for the new modules.
Assistant
Also adding the frontend IPC exports line and an invariant for the new error enum.
Assistant
Now the full verification sweep: fmt, clippy, ticket-ref, docs, changelog, tests.
Assistant
All gates green. Committing and opening the PR.
Assistant
- User
Coderabbit has several requested changes
Assistant
I'll fetch the full batch of review comments rather than triaging them piecemeal.
Assistant
Full batch fetched — 7 unresolved threads, from two sources. Here's my triage before I touch anything:
# Thread Claim Classification Action 1–4 password_unlock.rs:493/537/575/610 (CodeQL)"Hard-coded cryptographic value" — the "hunter2"test passwordFalse positive Assistant
Now the test for the overlapping-request path.
Assistant
The test passes, but let me be precise about what it actually covers — it exercises propagation through
unlock.ts, not the component line that holds the slot. Renaming it honestly:Assistant
Now verifying the real component in the harness — the native dialog, focus trap, and the overlapping-request fix.
Assistant
Native dialog opens modally with the password field focused. Now testing the focus trap and the background inertness the
<div>overlay never had:Assistant
Focus trap and inert background confirmed (
:modalmatches; focusing a background button is refused). Now Escape-to-cancel:Assistant
Escape didn't reach the hidden pane. Testing the same code path the browser uses (
cancel→close) directly:Assistant
The sheet is still in the DOM after
close()— theonclosehandler isn't clearingpending. Let me diagnose rather than guess:Assistant
Synthetic
closedoes trigger the handler, so the wiring is correct — my earlier probe polluted the state by reopening the dialog. Re-testing cleanly:Assistant
Real
close()still leaves the sheet mounted while a synthetic one clears it. Let me pin down whether the handler runs at all:Assistant
That's the real finding: in this engine
HTMLDialogElement.close()fires neitherclosenorcancel— even for a freshly-attached native listener. My component depended oncloseto settle the caller, so an Escape dismissal would strand the promise: the exact bug class CodeRabbit flagged, reintroduced through a different door. Making the dismissal path not depend on those events:Assistant
Now an Escape keydown — the path that's actually reliable:
Assistant
Escape now settles cleanly. Now the overlapping-request fix, against the real component (importing the live module from the dev graph):
Assistant
Overlapping request confirmed fixed against the real component. Verifying the happy path still works after the rewrite:
Assistant
That last run was driven by my console call, which has no reload attached. Testing the actual UI path:
Assistant
Full UI path works. Running the gates and shipping: