When we migrated did:web:malpercio.dev to pds.obsign.org, was there a step to create a password? I'm attempting an oauth login and I don't think I have a password set (at least from peeking at the accounts table). should did:web account support sovereign sessions, passwordless, just as did:plc accounts have access to?
Assistant
I'll dig into how the migration flow handles password creation and how auth works for did:web accounts.
Assistant
User
um, here's my live did.json document, I do have a #device key:
You're right — I was wrong about that. I inferred the live document's shape from the hermetic migration test's modeled document (didweb_migration_test.rs:462), which only carries #atproto + #atproto_pds. Your real one has the #device anchor. That changes the picture materially: the hard prerequisite is already satisfied, and this is now purely a server-side gap.
Let me check what the verification path would actually need.
Assistant
User
You're looking at the wrong linear tool, there's another that you can use. I don't know why it is like this. I think what we should do is accept only the exact {did}#device, match what create_did.rs does, and reject outright as malformed. Since custos-hosted did:webs have some complications at the moment, let's hide them from the wallet flows and allow users to only select into the two self-hosted flows, until a time when they are needed and we've had more time to think about it. how does all that sound to you, does it sound like a reasonable and secure selection?
Assistant
Let me find the right Linear tool and check what the wallet currently exposes for did:web.
Assistant
Found it — the Linear tool is on the 202234c8-… server, not the plugin:linear:linear one (my stored note about that was stale; I'll fix it). Before I answer on the plan, one thing I want to check, because it may complicate the "hide it from the wallet" part:
Assistant
User
here is the result for my account. is this field even returned on the
User
[Request interrupted by user]
User
here is the result for my account. is this field even returned on the GET accounts admin endpoint?
it appears to be null, I had no data returned from the query. we should add the flag. I also meant to ask you about the bytes. I very clearly have blobs, I can see them in bsky, and they did migrate over originally. I am not sure why it is now showing a count of 0
Assistant
Two things here — the flag (settled) and the blobs (not settled, and more urgent). Let me take the blob question properly.
Assistant
Phase 1 — evidence before hypotheses. Let me trace what totalBytes actually computes and compare it against the other blob accounting paths.
Assistant
The two queries are byte-identical — the admin listing and account_storage_bytes run the same SQL, counting every ownership row regardless of ref_count/temp_until. So this isn't a filter artifact: it means there are zero blob_owners rows for your DID. Let me find out why.
Assistant
User
here is the result:
0|0|REDACTED|0
If the blobs aren't already in the mirror, I certainly have them in icluod
Assistant
Repo present, zero blobs anywhere — no ownership rows and no physical rows. So this is the branch where the bytes are gone from the PDS, not merely unlinked. Let me check what recovery paths actually exist before saying anything about which to use.
Assistant
Two things matter a lot here. First, the good news — then a dependency that ties this back to the earlier thread.
Assistant
User
[Image: image/webp]
User
I'm running the restore right now. attached is a screenshot of the logs
Assistant
This is decisive, and there's something time-critical in it. Let me confirm the mitigation before explaining.
Assistant
User
[Image: image/webp]
User
restore complete, ran your recommended query. attached a screenshot of the reconcile failed logs. start filing issues as needed please
Assistant
Root cause found: repo error: list records: record not found. That's the MST holding a key whose record block isn't in the block store — the imported repo is incomplete. Let me confirm the exact origin before writing it up.
Assistant
Confirmed exactly. In list_records_json, the MST enumeration succeeds and yields (key, cid), then the record lookup returns None:
let value: Option<Ipld> = repo.get_raw(&full_key).await...?;
let value = value.ok_or(RecordError::NotFound)?; // records.rs:487
So the MST node blocks are all present, but at least one record leaf block referenced by the tree is missing from the block store. Your imported repo is structurally intact and content-incomplete. That has been true since the first GC pass after account creation (02:18:57Z, ~27 min after 01:51:43), so it dates from the import itself, not from anything afterward.
Let me file these.
Assistant
Labels confirmed (there's even a did:web one). Filing all four.
did:web sovereign sessions, with your policy decisions recorded
Let me persist the production state that isn't in the repo:
Assistant
Filed and recorded. Where things stand:
Safe now: your 534 blobs are restored and pinned. The pin holds because reconcile errors before reaching the release loop, so nothing re-arms the grace clock.
Still live: MM-473 is unfixed, so reconcile still throws every 30 minutes and that manual pin is currently the only thing protecting those blobs. I've written that into memory so it doesn't get lost — if someone fixes MM-472 without MM-473, the pin stays load-bearing; if MM-473 is fixed first, reconcile pins them properly and the manual pin becomes redundant.
Worth checking, and I haven't verified it: the missing record block should also break com.atproto.repo.listRecords for the page containing that record, and possibly . If it does, that's user-visible right now, not just a GC problem. A quick against the collections in your repo would confirm — I predicted it from the code path but didn't test it.
User
let's do the checking on listRecords and getRepo, I'd like to verify the root cause since we're talking about my account here heh
Assistant
Good instinct — let's verify rather than trust my inference. These are public endpoints, so I can check directly.
Assistant
describeRepo works — expected, since list_collections only walks MST keys and never reads a record block. Now the real test: listRecords reads each record's block, which is exactly where GC dies. Let me sweep every collection.
Assistant
zsh didn't word-split the parameter (unlike bash), so that ran as one giant URL. Re-running under bash:
Assistant
Confirmed, and it's broader than one record — four collections 500. Let me get the precise extent and check the CAR export.
Assistant
getReposucceeds — 200, 3.3 MB. That's a surprise worth chasing: if record blocks were genuinely absent, I'd expect the CAR export to notice. Let me find out whether export tolerates missing blocks or proves they're present.
Assistant
build_car reads every reachable CID — including every record block — and errors on any failed read (car_export.rs:352). collect_reachable_cids gathers record CIDs from the full MST walk. So getRepo returning 200 proves every record block is present and readable. That contradicts "missing block," so let me test the alternative.
Assistant
Assistant
Corrected MM-473 and raised it to Urgent — the original framing was wrong in a way that mattered, and the real bug is worse in scope than the one I'd described.
Where this landed
Your repo is intact. No records lost, no blocks missing. The only thing you actually lost was the 534 blobs, and those are restored and pinned.
The bug is general, not yours. It's a read-path defect in list_records_json that fires on any account whose MST topology puts a collection boundary in the wrong place. Four of your 78 collections hit it. Nothing about did:web or migration is involved — I'd assumed the import was at fault and that was wrong.
User
Please run your test!
Assistant
CAR downloaded (3,347,975 bytes — matches the earlier response exactly). Now the probe.
Assistant
Memory reminds me nix develop --impure -c doesn't work — it needs a script file.
Assistant
Sandbox blocked nix's fetcher cache (~/.cache/nix is outside the writable set). Retrying with the sandbox disabled — you can manage this with /sandbox.
Assistant
Type annotation needed on the turbofish — quick fix.
Assistant
Over-scan confirmed — and far worse than "one entry past." Let me get the summary section rather than the tail.
Assistant
Definitive. Hypothesis (1), prefix over-scan, confirmed — and the shape is more alarming than "one entry."
Collection
Real
entries_prefixed yielded
Leaked
community.lexicon.calendar.rsvp
1
2
computer.aetheros.id/self
coop.hypha.spores.social.takenFlower
1
2
dev.cocore.account.profile/self
dev.cocore.compute.termsAcceptance
Assistant
Done — root cause is nailed down, working tree is clean (throwaway probe removed), and MM-473 now carries the full reproduction.
What the test established
Confirmed:atrium_repo::mst::Tree::entries_prefixed does not bound its range correctly. Asking for one collection's prefix returned keys from entirely different collections — usually one leaked key, but in the worst case an entire MST subtree of 774 entries that the three collections sorting immediately after the prefix. That non-adjacency is what rules out a simple off-by-one and points at node-boundary handling.
User
/model
model
claude-fable-5
User
Is there anything else we should do to confirm root cause before I have another session start in on the linear issues?
Assistant· claude-fable-5
Good question to ask before handoff. The behavioral root cause is confirmed, but there are three cheap checks that would complete the chain and save the next session real time: (1) find the actual defect in atrium-repo 0.1.8's source — we've proven the symptom, not the line; (2) check whether upstream already fixed it (the fix might be a version bump, which changes MM-473's shape entirely); (3) preserve the reproduction artifact, since the scratchpad is session-scoped and the live repo's MST topology drifts with every write.
We have the vendored source locally:
Assistant· claude-fable-5
There it is — the actual defect, at mst.rs:1070 of the vendored crate:
if let Some(kp) = t.key.get(..prefix.len()) {
match kp.cmp(prefix) { /* Equal → push, Greater → break */ }
}
// falls through to:
list.push(e.clone()); // ← meant for Tree entries
When a leaf's key is shorter than the prefix, t.key.get(..prefix.len()) returns None, the comparison is skipped entirely, and the leaf falls through to the unconditional intended for subtree pointers. The comment above it even states the right rule — "if the key is shorter than the prefix, it is always lexicographically lesser" — but the guard does the opposite of skipping: it exempts short keys from filtering.
Assistant· claude-fable-5
That was worth doing — the three checks each changed something. Root cause is now confirmed at the source-code level, not just behaviorally:
1. Found the exact defect line. 0.1.8, (mst.rs ~1070): a leaf key than the prefix makes return , which skips the comparison and falls through to the unconditional meant for subtree pointers. The comment above it even states the correct rule. This retrodicts all four collections and every one of the 774 leaked keys — including the "skipped collections" oddity, which turned out to be nothing to do with node boundaries: keys are 41 chars against a 40-char prefix, so they hit the comparison and broke the scan; the leaked / keys are all ≤37 chars and dodged it. — which makes the regression test trivial (one long-named collection + one short key like in a ), no MST topology engineering as MM-473 originally implied.
User
interesting to know the bug exists upstream. I thought other pdses and tools around the ecosystem were using atrium-repo as well. I'll get another session going on MM-472
Assistant· claude-fable-5
Right — that's what makes the upstream report the highest-leverage follow-up in MM-473. Let me quickly quantify the exposure:
Assistant· claude-fable-5
Published exposure is smaller than you'd guess: one crates.io reverse dependency (skyfeed) and ~6.6k total downloads. But that undercounts — git-pinned consumers (which is how a lot of the Rust atproto hobbyist ecosystem depends on things) don't appear in crates.io stats. Two things narrow the real-world blast radius:
Only entries_prefixed / keys_prefixed callers are affected. Full walks (entries()) and keyed gets are fine — and the bug needs a later key in the tree shorter than the query prefix, so it's topology-dependent per repo.
The reference TypeScript PDS (what bsky.social and most self-hosters run) shares no code with atrium-repo, so the bulk of the network is untouched.
The uncomfortable part for other consumers: most of them won't have ezpds's accidental fail-closed behavior. Our strip/re-concat mangled the leaked keys into non-resolving nonsense, which is why we got 500s instead of corruption. A typical caller consuming output directly gets — foreign records presented as members of the queried collection, no error anywhere. That's a stronger reason to file upstream promptly than our own 500s were.
okay, we've merged the three blob related fixes, and gc looks stable. anything else we should check before we remove the manual fix?
Assistant· claude-fable-5
Good instinct to pause here, because there's a subtlety that changes the whole question: there's nothing left to remove — and something else has already quietly happened instead. Let me verify the pieces, including what I can probe on prod directly.
The key mechanic: your manual UPDATE wrote temp_until = NULL — the same value a successful reconcile writes. Now that reconcile completes (post-MM-473), each pass authoritatively recomputes every row: referenced blobs get re-pinned on their own merits, and — this is the important part — owned-but-unreferenced rows get released by reconcile's own release loop, manual pin notwithstanding. A pinned row looks "permanent," and the release loop's job is exactly to grace-clock permanent rows that lost their references. So the pin stopped being load-bearing the moment the first post-deploy reconcile succeeded; anything the MST doesn't reference is already on the normal 6-hour path regardless. Let me check what that implies on the live server:
Assistant· claude-fable-5
Assistant· claude-fable-5
Done. Summary of where this lands:
Answer to your question: nothing to check before removal, because there's no removal. The pin wrote the same NULL reconcile writes, and reconcile — now that it completes — recomputes every row's fate each pass. The live census proves it's already inert: 8 restore-surplus blobs (owned, but referenced by no record) were released and collected through the pin, dropping the count 540 → 532. The MST is back in authoritative control, which is the designed steady state. The account row needs no further hand-editing.
What stands between here and "incident closed":
Mirror bucket refill — the only leg still unverified. The incident emptied the bucket, the restore only refilled the volume. Check on and/or a bucket count ≈ 532+. Until then, iCloud remains the sole second copy — the exact exposure the incident began with.
Memory corrected. Bottom line on the health readout:
Healthy: reconcile green with the new error channel confirming it, GC stable, firehose retention normal, everything the two urgent fixes were supposed to restore is restored.
Outstanding, in order:
Mirror bucket — still the one unverified leg. Grep yesterday's Railway logs for the blob mirror: uploaded burst post-restore, or count bucket objects (≈540 expected). Until confirmed, iCloud remains the only second copy.
Next release carries MM-474's fields to prod — the blobUnownedCount / uploadedBlobCount cross-checks become possible there; staging has them now if you want the early look.
Watch for one swept: N pass ~2h from now — expected restore-surplus collection, not a problem; errors staying 0 through it is the thing to glance at.
And with the operational thread fully wound down, MM-475 (did:web sovereign sessions + the wallet's Custos-hosted-shape hiding) is the remaining open item from this whole arc — the "keep a password on the account" interim is still what's bridging the gap it closes.
User
I think we're good on the mirror:
2026-07-25T08:03:59.593244Z INFO pds::blob_mirror: blob mirror pass complete uploaded=0 deleted=534 errors=0
2026-07-25T13:50:29.277077Z INFO pds: blob restore-on-boot complete: volume and mirror bucket agree
2026-07-25T13:50:29.277148Z INFO pds: blob-mirror sweep started interval_secs=300 bucket="obsign-blobstore-backup-el8vsu"
2026-07-25T17:45:43.907674Z INFO pds::blob_mirror: blob mirror pass complete uploaded=233 deleted=0 errors=0
2026-07-25T17:50:46.040979Z INFO pds::blob_mirror: blob mirror pass complete uploaded=300 deleted=0 errors=0
2026-07-25T21:21:31.790277Z INFO pds: blob restore-on-boot complete: volume and mirror bucket agree
2026-07-25T21:21:31.790351Z INFO pds: blob-mirror sweep started interval_secs=300 bucket="obsign-blobstore-backup-el8vsu"
Assistant· claude-fable-5
That log timeline is exactly the confirmation needed — and it tells the whole incident story in six lines:
Time (UTC)
Event
08:03
deleted=534 — the mirror propagating the GC destruction (the incident)
13:50
boot; "volume and mirror bucket agree" — vacuously true: both empty of the 534
17:45–17:50
uploaded=233, then uploaded=300 — your iCloud restore landing, swept into the bucket across two 5-min passes
21:21
v0.8.4 boot; "volume and mirror bucket agree" — the attestation that matters
The 21:21 line is the strong evidence: restore-on-boot runs before the listener binds and found nothing to reconcile in the bucket→volume direction, and the health snapshot's covers the volume→bucket direction — nothing left to upload. Both directions clean = bucket matches volume.
Assistant· claude-fable-5
Incident closed. Full arc, for the record: read-path bug (atrium-repo over-scan) → reconcile permanently failing → fail-open sweep destroyed 534 blobs → mirror propagated the destruction → iCloud restore → both fixes shipped in v0.8.4 → GC green, bucket re-verified against the volume at boot. Memory now records the closure with the log evidence, plus the two benign residuals (MM-474 fields arrive on prod with the next release; a one-time swept: N surplus pass is expected and harmless).
What's left from this saga is exactly one item: MM-475 — did:web sovereign sessions, the #device authority lookup, and hiding the Custos-hosted shapes in the wallet. It's fully specified in the issue from our earlier decisions, and it's what lets you eventually drop the password that's currently bridging the recovery-path gap. Ready when you are.
User
475 just landed in main, let's take a look
Assistant· claude-fable-5
Both route integrations preserve the load-bearing properties. Let me check the remaining two pieces — the ADR amendment and the wallet screens:
Assistant· claude-fable-5
User
we're up, but too soon for the health check I think. I'm about to try an oauth session now.
v0.8.5 confirmed up, and even this early snapshot closes one item: blobUnownedCount: 0, blobUnownedBytes: 0 — the MM-474 integrity readout is live on prod and reads clean. Every physical blob row has an owner. Also worth noting: blobCount held at 540 across all of yesterday's GC passes, which means the restore-surplus sweep I predicted never had anything to collect — every restored blob is MST-referenced, and the 540-vs-532 gap is simply other accounts' media. Tidier than forecast. The sweeps are exactly right at 152s uptime; each runs its first pass one full interval after boot.
User
Hm, did we miss something with the wallet implementation? I've updated, but there is no option to scan a QR code with the did:web identity
Assistant· claude-fable-5
Good catch — the server side landed, but the wallet's consent surface may still carry its own method gate. Let me look.
Assistant· claude-fable-5
No tests pin the current gate. This is a two-line fix — let me make it on a fresh branch and verify:
Assistant· claude-fable-5
Now the changelog fragment, then verification. First let me check whether the harness has a did:web identity scenario to verify against:
Assistant· claude-fable-5
Checks green — 434 files 0 errors, 158/158 tests. Now the browser verification:
Assistant· claude-fable-5
Fix verified and cleaned up. Summary:
What was missed:+page.svelte:730 gated the onsignin prop — the "Sign in to an app" entry to the entire consent-approval surface (QR scan + typed code) — on did:plc:. MM-475 rewired the server and the onboarding screens but never touched this gate on the identity-detail screen, so the flow it unlocked was unreachable for exactly the accounts it unlocked it for. Everything beneath the button was already method-agnostic: the Rust consent commands never inspect the DID method, and resolves did:web documents (the import flow depends on it).
User
please do
Assistant· claude-fable-5
All done, and the Linear side handled itself:
PR #444 — commit a432ce5b on mm-475-didweb-signin-entry, pushed, PR open with the verification evidence and the judgment call documented.
Linear: the GitHub integration auto-attached #444 to MM-475 and flipped it Done → In Review the moment the PR opened — exactly the behavior noted in memory, and correct here (the issue genuinely has an open follow-up). It'll return to Done on merge; no manual state change needed.
Once CI is green and you merge, staging picks it up immediately — but since this is a wallet change, the build that matters for your phone is the TestFlight lane (push to main triggers ios-testflight.yml). So the sequence to your OAuth test is: merge → TestFlight build lands → update the app → tap your did:web:malpercio.dev identity → → scan the consent QR → biometric approve. That approval is the live end-to-end proof of the entire MM-475 stack — wallet envelope → server authority lookup against your real → session minted.
User
It worked! I got a session on tangled.org
Assistant· claude-fable-5
That's the whole arc closed — and there's a satisfying symmetry in the proof: a live tangled.org login, via wallet consent, against your real did.json, with the server fetching malpercio.dev/.well-known/did.json and matching your #device key on production. The exact flow that started this conversation as "I don't think I have a password and the OAuth login fails."
What just got proven end-to-end, in one tap: wallet QR scan → biometric → device-key-signed envelope → authorized_signing_keys live fetch → #device predicate match → consent approved → authorization code → tangled session. Every policy decision you made (exact {did}#device, live resolution, hosting gate) executed on the happy path for the first time.
Updating the record:
Assistant· claude-fable-5
Memory updated. One decision remains, and it's yours whenever you want it:
The interim password. It's done its job — it was the second key to the door while sovereign login couldn't serve did:web. Now that the passwordless path is proven on prod, you can return the account to its pure-sovereign posture:
railway run --service pds sqlite3 "$EZPDS_DATA_DIR/pds.db" "UPDATE accounts SET password_hash = NULL WHERE did = 'did:web:malpercio.dev';"
(One-line SQL because no route un-sets a password — resetPassword only ever sets one.) The trade-off, stated once: NULL removes the phishable credential and makes your #device key + domain the whole story, but sovereign login becomes the only unlock — if the wallet's device key and your domain's ever disagree, there's no password fallback. Given the key is escrowed and the recovery flows exist, dropping it is the design-intended state; keeping it a while longer costs nothing but purity. No urgency either way.
Short answer
No — there was no password step, and there couldn't have been. The wallet's migration createAccount request literally has no password field:
// A migration account may carry no password (OAuth-only); store NULL then.
So did:web:malpercio.dev landed with password_hash = NULL, exactly as your peek at accounts suggested. That's by design for did:plc accounts, because they have a passwordless path. did:web doesn't.
Why the OAuth login is failing
There are exactly two ways to complete /oauth/authorize, and your account qualifies for neither:
★ Insight ─────────────────────────────────────
The gate isn't arbitrary caution — it's structural. Both passwordless paths verify the approval signature against fetch_current_plc_state(...).rotation_keys, i.e. plc.directory's authoritative audit log, explicitly not the cached DID doc. did:web has no rotation-key concept and no audit log, so there is simply nothing for that code to call. The gate is where the abstraction ran out, not a policy decision that was written down.
─────────────────────────────────────────────────
Immediate unblock:requestPasswordReset → resetPassword works on a NULL-password account (no passwordless guard in either route; update_password_hash is a plain UPDATE). Note the admin repair route refuses this deliberately — admin_account_repair.rs won't mint a reset token for a passwordless account, on the reasoning that it bootstraps a login path a key-sovereign account intentionally lacks. The user-facing email flow has no such guard. Setting a password gets you logged in today, at the cost of adding a phishable credential to an identity that didn't have one.
Should did:web get sovereign sessions?
Yes, and the pieces are already half-built — but only for one of the two did:web shapes. The blocker isn't philosophy, it's that your specific account's DID document has no key you hold.
For newly minted did:web, ADR-0022 already mandates the anchor, and create_did.rs:443 enforces it at promotion:
if !has_key("device", device_multibase) {
return Err(... "did:web document does not publish the device key as #device");
}
and the wallet composes it — composeDidWebDocument in did-web.ts:31 emits #device alongside #atproto.
Your account never went through that path. Migration-mode createAccount never inspects the document, and the hand-edited malpercio.dev/.well-known/did.json carries only #atproto (Custos-held) + #atproto_pds. So today there is no key in your DID document that you control — the only private key referenced by it lives on the PDS. A did:web sovereign session verified against that document would authenticate Custos to itself.
The design work is genuinely two decisions, and they're yours to make:
1. What is the authority root for a did:web approval? The natural answer is "a #device verification method in the document fetched live over HTTPS (SSRF-hardened client, never the did_documents cache)" — the structural mirror of "a key in the authoritative PLC rotation set, never the cached doc." That's a legitimate root, but weaker in kind: no tamper-evident log, no ordered key hierarchy, no 72-hour override. ADR-0022 already names that asymmetry ("did:web recovery is domain control plus escrowed keys") and insists method-specific paths stay gated so did:web never inherits PLC claims.
2. What about Custos-hosted did:web? This one has a real circularity problem. POST /v1/did-web/document (did_web_hosting.rs) lets an account rewrite its served document, authed by authenticate_account_owner — a session token. If sovereign-session verification then read that same served document, a stolen session could install an attacker #device key and mint "sovereign" sessions from it. For did:plc the equivalent attack is impossible: rewriting the rotation set requires a signature from an existing rotation key, and plc.directory is outside Custos entirely. My recommendation is to scope any did:web sovereign session to self-hosted documents only in v1, or require that the #device VM be immutable once set on a Custos-hosted doc.
Recommendation for you specifically: password reset now to unblock the OAuth login, and separately add a #device VM (your wallet device key) to malpercio.dev/.well-known/did.json so the account is ready the moment the server-side path exists. Adding it is harmless today — nothing reads it — and it's the prerequisite for ever dropping the password again.
Want me to file this as a Linear issue against the ezpds project? Linear writes need the plugin:linear:linear MCP, which isn't authorized in this session — you'd need to connect it from an interactive session first. I can draft the issue body meanwhile, or write it up as a design plan in docs/design-plans/ instead.
Confirmed from your document — and that makes the gap much narrower than I described. Two useful details from it:
zDnae… on both VMs is the multicodec p256-pub prefix, so #device is a P-256 key — exactly what crypto::verify_did_key_signature already accepts.
#device (zDnaeY2jnoij…) is yours; #atproto (zDnaexXYs4Ua…) is the Custos-held repo signing key. That distinction turns out to be the whole security argument below.
The change is one lookup, not a subsystem
I traced the full path. Signature verification in sovereign_session.rs:148 is already method-agnostic — it parses a did:key: URI and verifies P-256 or secp256k1. The only PLC-specific step is the authority lookup immediately after:
let plc = fetch_current_plc_state(&state.http_client, &state.config.plc_directory_url, &request.did).await?;
if !plc.rotation_keys.iter().any(|key| key == &request.signing_key) { ... }
oauth_consent.rs:311 has the identical shape. And the did:web counterpart primitive already exists — resolve_web_did_document (resolution.rs:238) does a live, SSRF-guarded, cache-bypassing HTTPS fetch of the document. That is the structural mirror of fetch_current_plc_state: authoritative source, never the cache.
The wallet side needs nothing. sovereign_login_impl (sovereign_session.rs:181) never inspects the DID method — it resolves the per-DID device key, discovers the PDS, signs the canonical envelope. Point it at did:web:malpercio.dev today and it would produce a valid request that the server rejects at the gate.
So the feature is: extract authorized_signing_keys(state, did) -> Result<Vec<String>, ApiError> into identity/ (both routes need it, and routes may not import each other), dispatch on method, delete the two is_plc_did gates.
★ Insight ─────────────────────────────────────
One non-obvious wrinkle: PLC stores rotationKeys as did:key:z… URIs, and the comparison above is plain string equality against request.signing_key. But a DID document's verificationMethod carries bare publicKeyMultibase (zDnaeY2jnoij…, no did:key: prefix). The did:web arm has to render format!("did:key:{}", multibase) before comparing, or every request fails with a confusing signing_key_not_current_rotation_key. Small, but it's the kind of thing that eats an afternoon.
─────────────────────────────────────────────────
Two decisions worth getting right
1. Only #device counts — never "any verificationMethod." Your document is the proof. #atproto's private key lives on Custos. If the authority set were every VM in the document, Custos could sign its own sovereign-session envelope and mint a full-access session for your account with no key of yours involved. That inverts the entire point. create_did.rs already encodes this instinct for newly-minted did:web — it requires #device specifically (create_did.rs:443) — so scoping the authority set to #device keeps one rule across both paths.
2. Custos-hosted did:web needs a gate; self-hosted doesn't.POST /v1/did-web/document lets an account rewrite its own served document, authed by a session token. If verification then read that served document, a stolen session could install an attacker #device key and bootstrap "sovereign" sessions from it — a privilege escalation with no key compromise. did:plc has no such hole: rewriting the rotation set requires a signature from an existing rotation key, and plc.directory is outside Custos entirely.
Yours is self-hosted (the document is served from malpercio.dev, only #atproto_pds points at Custos), so you're unaffected either way — but the general feature isn't. My recommendation: resolve strictly via resolve_web_did_document (live fetch, never the cache — the cache is writable by that same route), and for Custos-hosted did:web either refuse sovereign sessions in v1 or make #device immutable once set.
Answering the question you actually asked
Yes — did:web should have it, and ADR-0022 already implies it ("the document publishes the wallet device key alongside Custos's reserved #atproto key"). What ADR-0022 does not say is that anything consumes that key, and nothing does. It's currently a monitoring anchor and a promotion-time assertion, nothing more. The gate in sovereign_session.rs isn't a considered rejection of did:web — it's where the abstraction stopped, back when did:plc was the only method.
The honest caveat: this is weaker than the PLC version in kind, not just degree. Domain compromise is identity compromise, there's no tamper-evident log, and no 72-hour override. ADR-0022 already commits to that asymmetry, so the work is making sure the wallet's language around a did:web sovereign session doesn't inherit PLC's recovery promises.
If you want it built
The interesting part is small enough that I'd rather you write it than me. I'd prepare crates/pds/src/identity/authority.rs with the shared plumbing — the did:plc arm lifted verbatim from the current code, the did:web fetch wired to resolve_web_did_document, the did:key: rendering handled, and both routes switched over — and leave the policy itself for you:
/// Which keys in a did:web document may authorize a sovereign session or an OAuth
/// consent approval for `did`.
///
/// Security-critical: `#atproto`'s private key is Custos-held, so including it would
/// let this server authenticate as the account it hosts.
fn did_web_authorized_keys(document: &Value, did: &str) -> Vec<String> {
todo!()
}
Roughly 8 lines. The judgment calls in it are yours: whether to accept only the exact {did}#device id or any VM whose fragment is device; whether to require type == "Multikey" and controller == did the way create_did.rs does; and whether a document with multiple#device-shaped entries should authorize all of them or be rejected outright as malformed. That last one is the interesting one — permissive means a partially-compromised document still has a valid key in it, strict means a hand-edit typo locks you out of your own account.
Say the word and I'll set up the seam plus the test scaffold. Separately, I still can't file this in Linear — the plugin:linear:linear MCP needs authorizing from an interactive session — but I can draft the issue body or write it up as a design plan under docs/design-plans/ alongside ADR-0022.
Memory corrected. On your plan — the three code decisions are right, and the fourth needs one change to actually be a security control.
The three code decisions: yes
Exact {did}#device only. This is the one that matters most, and your own document shows why: #atproto (zDnaexXYs4Ua…) is Custos-held. Any policy admitting more than #device hands this server the ability to sign its own sovereign-session envelope for your account. Exact-id matching also makes the duplicate case degenerate — two VMs sharing an id is already a DID Core violation, so you're rejecting documents that were malformed regardless.
Match create_did.rs's predicate. Agreed. One difference in shape worth knowing: has_key at create_did.rs:432verifies a key it already knows, so it compares publicKeyMultibase against an expected value. The authority lookup discovers the key, so it extracts that field instead. Same type == "Multikey" and controller == did checks, same id construction — just the last step inverted.
Reject on multiple. Fail-closed is correct here. You noted the trade-off yourself — a hand-edit typo could lock you out — but that failure is loud, recoverable by fixing the document, and doesn't touch the escrowed device key. The permissive alternative fails silently in the direction of "attacker key still works."
The hosting decision: right call, wrong layer
Hiding the Custos-hosted shapes in the wallet is a sensible product decision. It is not a security boundary, and the plan currently treats it as one.
enable_managed_hosting is already a plumbed parameter on both flows — migrate.rs:263 and lib.rs:754 — so hiding it means the wallet stops passing true. POST /v1/did-web/hosting remains a live, session-authed route on the server. Any client that isn't your wallet can still enable it, and any account that already enabled it stays enabled. If sovereign sessions ship without a server-side check, the circular path is open for those accounts regardless of what the wallet renders.
So: keep the wallet change (it's the right default), and add the gate in did_web_authorized_keys — refuse to return any key when did_web_hosting_enabled_at IS NOT NULL.
★ Insight ─────────────────────────────────────
The gate turns out to be exact rather than a heuristic, which is unusually clean. POST /v1/did-web/document already refuses unless hosting is enabled (did_web_hosting.rs:135 — "Only edit the document Custos actually serves"). So did_web_hosting_enabled_at IS NULL isn't a proxy for "the doc can't be rewritten by a session token" — it is that condition, exactly. The two states line up with no gap in either direction, which means the gate can be justified in one sentence in the ADR rather than defended as a conservative approximation.
─────────────────────────────────────────────────
That also gives you a clean upgrade path later: making #device immutable across a /v1/did-web/document edit would let you drop the gate and support all four shapes, without redesigning anything.
One thing to check before I build
Is did:web:malpercio.dev already flagged as Custos-hosted? If that migration ran with enable_managed_hosting = true, did_web_hosting_enabled_at is set on your account row — and the gate we just agreed on would refuse sovereign sessions for the exact account you're trying to unlock. It's not externally observable (your DNS points at your own host, so Custos never serves the document even if the flag is on; the flag is pure DB state).
Two ways to settle it: GET /v1/admin/accounts?q=malpercio with your admin token, or a direct read of did_web_hosting_enabled_at on prod. If it is set, the fix is a one-line {"enabled": false} POST — you'd be turning off something that was never doing anything anyway.
Proposed scope
Assuming that comes back NULL, here's what I'd build:
Delete the is_plc_did gates in sovereign_session.rs:114 and oauth_consent.rs:252; both switch to the shared lookup. Their existing rejected() / approval_rejected() helpers already collapse every failure to one opaque message, so no new enumeration surface.
Wallet: stop offering the two Custos-hosted shapes.
ADR-0022 amendment recording the #device-only policy, the hosting gate and its exactness, and the deferral.
Changelog fragment (changelog.d/) — both routes are shipped surfaces, so the gate will demand one.
Want me to file this in Linear (team MM, project ezpds, Wave 3: Key Sovereignty seems right) and start on it? And do you want me to write the did_web_authorized_keys policy body given you've now specified it precisely, or still leave that one for you?
No — that field isn't returned. AdminAccountRow (accounts.rs:901) carries exactly did, handle, created_at, lifecycle, blob_bytes, flagged, and did_web_hosting has zero occurrences in either accounts.rs or admin_list_accounts.rs. Your output is the complete row — it tells us nothing about the flag either way.
Two ways to actually read it
Direct DB read (definitive):
railway run --service pds sqlite3 "$EZPDS_DATA_DIR/pds.db" "SELECT did_web_hosting_enabled_at FROM accounts WHERE did = 'did:web:malpercio.dev';"
Or probe it through the API, which works if getting a shell is annoying. POST /v1/did-web/document checks hosting before it validates the document, and both checks are before any write:
So sending {"document": {}} with your owner credential fails at :135 with "managed did:web hosting is not enabled for this account" if the flag is NULL, or at :148 with "document is missing an \id`"if it's set. Two distinct messages, and the request cannot mutate anything — it dies four lines beforerewrite_did_document`. The catch is that this route wants account-owner auth (wallet session or full-access token), not your admin token, so the DB read is probably less work.
This gap is worth closing
The operator console can't see whether an account is Custos-hosted at all. That's a mild annoyance today and a real one the moment this flag starts gating sovereign sessions — you'd have an account silently refused a login path with no way to see why from the admin surface. Adding didWebHosting: bool to the listing row is a few lines (one more correlated scalar in the existing per-row subquery pattern) and I'd fold it into the same change rather than filing it separately.
★ Insight ─────────────────────────────────────
Worth noticing why the field was never there: the listing was built around lifecycle, storage, and moderation flags — the things an operator acts on. did_web_hosting_enabled_at was, until this conversation, a pure serving toggle with no security meaning, so it had no reason to surface. Promoting it to an auth gate changes its category, and the observability has to follow. That's the general shape of the risk here: the gate is cheap to add and easy to forget to make visible.
─────────────────────────────────────────────────
One unrelated thing I noticed in your row: totalBytes: 0. That's blob bytes only, so it's correct if the account has no media — but if you expected images or video to have come across in the migration, that's worth a second look at the blob drain leg independently of any of this.
Once you've read the flag, tell me what it says and I'll file the Linear issue and start on did_web_authorized_keys — including whether you want to write the policy body yourself.
Phase 1 findings. I'm not proposing a fix yet — the evidence doesn't yet distinguish two very different situations.
What totalBytes: 0 actually means
Every blob read path an operator can reach reads the same table, blob_owners:
So totalBytes: 0 tells us precisely one thing: there are no blob_owners rows for your DID. It says nothing about whether the bytes exist on disk — and neither will listBlobs or listMissingBlobs, which will both report "nothing / everything missing" from the same empty table.
★ Insight ─────────────────────────────────────
This is the sharpest thing the investigation turned up, independent of your case: there is no operator-reachable read path that distinguishes "ownership rows lost" from "bytes destroyed." The physical blobs table and the filesystem are only ever consulted through an ownership join. blob_scrub walks the directory for orphans, but by its definition an orphan is a file with no blobs row — and blob_gc deletes the physical row and the file together when the last owner goes, so that path never catches this. Diagnosing this at all required a DB shell.
─────────────────────────────────────────────────
Also: bsky rendering your images is not evidence
Blob embeds are served from cdn.bsky.app, which caches aggressively and independently of your PDS. Images can render in the app long after the origin lost the bytes. I'd set that observation aside entirely as a signal.
Two hypotheses, one decisive query
Your account's createdAt is 2026-07-25 01:51:43 — hours old.
H-A (benign, and I think more likely): this account row is new — re-migrated or re-created today — and the blob drain leg didn't run or didn't complete against this row. Blobs were never in this row's ownership, nothing was lost, and the drain simply needs re-running.
H-B (a real bug): the drain ran, but the ownership rows aged out and GC reclaimed them. The mechanism is concrete. uploadBlob stamps every new ownership row with temp_until = now + temp_ttl_secs (default 6 hours, config.rs:486). Only blob_gc's reconcile makes a row permanent, and it does that by walking the MST — but collect_referenced_blob_cids returns an empty map, not an error, when repo_root_cid IS NULL (blob_gc.rs:225). An account with uploaded blobs is a GC candidate via blob_owners regardless of whether it has a repo (blobs.rs:260). So blobs uploaded to a repo-less account look unreferenced on every pass, their 6-hour clock runs out, and the sweep deletes the ownership row, the physical row, and the file. GC runs every 30 minutes.
The standard migration order (importRepo → drain) is safe from this. An interrupted, reordered, or retried migration is not.
Three queries settle it:
railway run --service pds sqlite3 "$EZPDS_DATA_DIR/pds.db" "SELECT (SELECT COUNT(*) FROM blobs WHERE account_did='did:web:malpercio.dev'), (SELECT COALESCE(SUM(size_bytes),0) FROM blobs WHERE account_did='did:web:malpercio.dev'), (SELECT repo_root_cid FROM accounts WHERE did='did:web:malpercio.dev'), (SELECT COUNT(*) FROM blob_owners WHERE account_did='did:web:malpercio.dev');"
Physical count > 0, owners = 0 → bytes are intact, ownership was lost. Recoverable, and reconcile should even re-adopt them on its next pass once the repo references them (upsert_owner_referenced adopts referenced-but-unowned stored blobs).
Both 0, repo_root_cid set → H-B is live; the bytes are gone from the DB. Next question is whether [blob_mirror] is configured in prod, because the bucket copy plus Litestream are then the recovery path.
Both 0, repo_root_cid NULL → the migration didn't complete at all; re-run the drain.
Give me that row and I'll take it from there. Holding off on any code until we know which of these we're in — including the didWebHosting flag addition, which I'd rather land in the same change as whatever observability this turns out to need.
Diagnosis confirmed, and it's the bad branch: repo_root_cid is set so the repo imported fine, but there are zero physical blobs rows — the bytes aren't merely unlinked from ownership, they're not in the database at all.
Your iCloud backup is the right recovery path
restore_blob_backup(did) walks the manifest and uploadBlobs each file back, and the module notes it's trustless — restored bytes re-hash to the same CID, so records never need rewriting (blob_backup.rs:6). Your repo records keep pointing at the same CIDs and simply start resolving again. Check the Media Backup screen first for the manifest's blob count — that tells you immediately whether the backup predates the loss.
Restoring now is safe. The failure mode I described only bites a repo-less account: uploadBlob stamps a 6-hour temp_until, and only reconcile makes a row permanent by walking the MST. Your repo_root_cid is set and those records reference the blob CIDs, so the next GC pass (≤30 min) pins every restored blob permanent. You are not re-arming the trap.
Don't count on the mirror
If [blob_mirror] is configured, it likely won't help: a bucket key whose blobs row is gone is deleted on the next pass (blob_mirror/mod.rs:27). The refusal tripwire only fires when the blobs table is wholly empty, which it isn't on a multi-account server. Worth a bucket listing before assuming, but plan around iCloud.
The part that ties back to the did:web thread
SessionProvider::full_access_client is "the seam every authenticated wallet operation on a Custos-hosted identity goes through" (session_provider.rs:12). Its ladder is: valid access JWT → refresh via refreshSession → NeedsUnlock → biometric sovereign login. And restore_blob_backup sits on that seam, with its own SessionExpired variant telling the frontend to "run the biometric sovereign login and retry (restore only)" (blob_backup.rs:74).
Sovereign login is the thing the server refuses for did:web.
★ Insight ─────────────────────────────────────
So the recovery path for this account is alive only while the refresh chain from the migration survives. When it lapses, the wallet hits NeedsUnlock, sovereign login 401s on the is_plc_did gate, and the restore becomes unreachable — for an account whose only other credential is a password it doesn't have. The gate we started this conversation discussing as a login inconvenience is actually sitting between you and your own backup. That's a much stronger argument for the did:web authority work than "OAuth is annoying," and it also argues for keeping a password set on this account until that ships, purely as a second key to the door.
─────────────────────────────────────────────────
So: run the restore while the session still works. That's the one time-sensitive action here.
Still open: was there a bug, or did the drain never run?
Recovery doesn't depend on this, but whether there's a defect to fix does. The two candidates remain "GC swept them" versus "the drain never completed against this account row," and the logs settle it:
A pass with deleted > 0 around the migration window confirms GC reclaimed them and there's a real bug: the sweep in run_blob_gc is global (list_expired_temp_owners across all accounts) and isn't gated on whether that account's reconcile succeeded, so a repo-less or reconcile-failing account's fresh uploads age out and get destroyed. If the logs show nothing, the drain simply never ran and there's no defect — just an incomplete migration.
Either way I'd also run listMissingBlobs against the account to quantify how many blobs the repo expects; that's your restore target count and your verification that the restore was complete.
Where that leaves the work
Three things now, in dependency order rather than the order we found them:
Restore from iCloud (you, now, while the session lives).
did:web authority lookup — now load-bearing for recovery, not just login. Unchanged in design from what you specified: exact {did}#device, create_did.rs's predicate, reject on duplicates, hosting-gated server-side.
Observability + the GC question — didWebHosting on the admin listing, plus a way to distinguish "ownership lost" from "bytes gone" without a DB shell, plus whatever the logs say about the sweep.
Want me to file these as three Linear issues (team MM, project ezpds) and start on #2? And tell me what the log grep says — if it's the GC path, that's a fourth issue and a more urgent one than any of these, since it would affect every migrating account.
The logs confirm it, and there's an immediate problem: the restore you're running right now is on track to be deleted the same way in about six hours.
Run this once the restore finishes
railway run --service pds sqlite3 "$EZPDS_DATA_DIR/pds.db" "UPDATE blob_owners SET temp_until = NULL WHERE account_did = 'did:web:malpercio.dev';"
That is safe and sufficient: the sweep selects on temp_until IS NOT NULL AND temp_until < datetime('now') AND ref_count = 0 (blobs.rs:249), so clearing temp_until removes those rows from it permanently. And nothing will re-arm the clock, because reconcile is failing before it reaches the release loop. It needs no deploy and no restart. Re-run it if more blobs land after. (Don't try EZPDS_BLOBS_GC_INTERVAL_SECS=0 — config validation rejects zero; you'd need an absurdly large value and a restart.)
What the logs prove
Your account was created at 01:51:43, temp_ttl_secs defaults to 6 hours, and the passes line up exactly:
expired=534 deleted=534 errors=1 — first pass past 01:51 + 6h
08:03:48+
blob_mirror: deleted bucket object with no blob row × many
The chain:
errors=1 on every pass is one account's reconcile_account throwing. collect_referenced_blob_cids is its first call and propagates with ?, so neither the pin loop nor the release loop runs — which is why reconciled=0 every time. That account is yours.
uploadBlob stamped all 534 blobs with temp_until = now + 6h (upload_blob.rs:168).
Phase 2's sweep is global and is not gated on whether that account's reconcile succeeded — list_expired_temp_owners scans every account regardless.
At 07:58 the deadline passed. 534 ownership rows expired; you were the sole owner, so the physical rows and the files went with them.
The mirror then faithfully propagated those row deletions to the bucket.
★ Insight ─────────────────────────────────────
The defect isn't the grace period or the sweep — both are reasonable. It's that reconcile and sweep don't share a failure domain. Reconcile is the only thing that protects a blob, it failed loudly every 30 minutes for hours, and the sweep ran anyway and destroyed the data it was supposed to protect. The pass even logged "blob GC pass complete." A skipped account must exempt that account from the sweep in the same pass; fail-open is the wrong default when the failure mode is irreversible deletion.
─────────────────────────────────────────────────
Worth noting your iCloud backup is now the only copy — the mirror bucket was cleaned out at 08:03. That's why the pin above matters more than it otherwise would.
The root cause underneath
Reconcile is still failing, so we need the actual error:
That line carries error and did verbatim. Since repo_root_cid is set, the throw is coming from Repository::open, list_collections, or list_records_json — which raises a question I can't answer yet and don't want to overstate: whether the imported repo itself is intact.importRepo persists reachable blocks, so a walk that errors may indicate the MST is incomplete. Your records may be fine and the failure narrow, but that error message is the next thing I need.
Filing
I'd file four, and the first is severity-1 — it will destroy blobs for any account whose repo walk errors, on any migration:
blob_gc sweep must skip accounts whose reconcile failed this pass (data-loss).
Repo walk fails for did:web:malpercio.dev — root cause of the reconcile error; may also mean repo damage.
Blob observability — every operator-facing blob read goes through blob_owners, so "ownership lost" and "bytes destroyed" are indistinguishable without a DB shell; plus errors=1 for hours never escalated.
did:web sovereign sessions + the didWebHosting admin field, as scoped earlier.
Want me to create those in Linear now (team MM, project ezpds, Wave 7: Hardening for #1–3)? I can start on #1 immediately — it's a small, well-understood change to run_blob_gc, and it's the one that shouldn't wait.
sync.getRepo
listRecords
Suggested order
MM-472 — small, well-understood, and it converts this failure mode from silent irreversible loss into recoverable disk leak for every account, not just yours. Highest value per line changed.
MM-473 — needs investigation first (which record, and whether the source data is still fetchable), and it's the thing actually broken on your account today.
MM-474 / MM-475 — MM-474's sweep-error reporting is what would have caught this six hours early.
I'd start on MM-472 now if you want it. It's a contained change to run_blob_gc — thread the failed-DID set out of phase 1 and filter phase 2 against it — plus the regression test described in the issue.
One note on process: the linear-workflow skill would normally move an issue to In Progress and set up the branch when work starts. Say the word on MM-472 and I'll run that properly rather than jumping straight into edits.
The prediction held in all four cases, exactly at the boundary. That settles the important part:
Your data is fine — there is no missing block
getRepo exports every record block successfully, which proves they're all present. The failure is a read-path bug, not data loss.
The mechanism, in list_records_json:
let strip = |key: &str| key.strip_prefix(&prefix).unwrap_or(key).to_string();
// ...
let full_key = format!("{prefix}{rkey}");
let value = repo.get_raw(&full_key).await?.ok_or(RecordError::NotFound)?;
The prefixed MST scan yields one entry past the end of the collection. That key doesn't carry the prefix, so strip's unwrap_or(key) silently returns it whole, and the re-concatenation builds a nonsense key (<prefix><a-whole-other-key>). get_raw finds nothing → NotFound → 500.
The limit boundary is the proof: at limit == count, entries.len() = count+1 > limit, so truncate(limit)discards the bad entry and the call succeeds. One higher, it survives truncation and gets resolved. Four for four.
★ Insight ─────────────────────────────────────
The unwrap_or(key) fallback is what turned a benign over-scan into a 500. Had it filtered non-matching keys, the extra entry would have been dropped harmlessly. Had it used the original key instead of rebuilding one, get_raw would have succeeded — and returned a record from a different collection, which is worse. The mangled key is accidentally protective: it fails loudly instead of silently serving foreign data. Fixing this means filtering on strip_prefix's None, not "fixing" the concatenation.
─────────────────────────────────────────────────
And this is what killed your blobs: blob_gc pages with RECORD_PAGE_SIZE = 100, which is always > count for these collections, so reconcile hit the bad entry on every single pass.
What I have not yet nailed down
Two sub-hypotheses remain, and the limit test can't separate them — both predict the same boundary:
Prefix over-scan — entries_prefixed yields the first entry of the next collection (atrium-repo side).
In-collection descent bug — the entry belongs to this collection, but get_raw's keyed descent can't reach it while entries_prefixed can.
Either way it's a read bug and your records are intact, so this doesn't change the reassurance. Settling it needs the actual key, which no HTTP surface exposes — the way to get it is to parse the 3.3 MB CAR locally with repo-engine and compare the MST entries against what listRecords returns per collection. That's a small throwaway test, and I'd like to do it before anyone writes a fix, since the two point at different files.
Let me correct the issue, because it currently claims data loss:
The two issues compound into something severe. MM-473 alone is four 500ing endpoints. But MM-473 + MM-472 means: any account that trips this read bug has blob_gc reconcile fail on every pass, and six hours later every one of its blobs is deleted, along with the mirror copies. That's the path that ran on your account. Both are Urgent for that reason — MM-472 because it converts a read bug into irreversible deletion, MM-473 because it's the trigger and it's live right now on four of your collections for any client that calls them.
Loose end
I'd like to settle which of the two sub-hypotheses is right before anyone writes a fix, because they live in different files — over-scan is atrium-repo's entries_prefixed, descent is get_raw. The check is a throwaway test that parses the CAR you already have exported, enumerates MST entries per collection, and prints the offending key. A foreign key contains a second /, so it's immediately obvious which one it is.
That's maybe twenty minutes and it de-risks the fix. Want me to run it? After that I'd suggest MM-472 first regardless of the answer — it's independent of which sub-hypothesis holds, and it's the one that turns this class of bug from data loss into a recoverable disk leak.
3
4
fm.teal.alpha.actor.status/self
dev.cocore.compute.paymentAuthorization
5
779
774 keys
That last row is the interesting one. Asking for dev.cocore.compute.paymentAuthorization/ returned 774 foreign keys spanning fm.teal.alpha.feed.play/… through garden.goals.profile/self — a contiguous run that skips the collections sorting immediately after it (provider, receipt, termsAcceptance). That's not "one entry past the end"; it's an entire MST subtree being yielded by mistake. entries_prefixed in atrium-repo isn't bounding its range correctly when the prefix range ends at a node boundary.
★ Insight ─────────────────────────────────────
The unwrap_or(key) fallback is now clearly the difference between a 500 and a silent data-integrity breach. With it, the reconstructed key is nonsense and the request fails closed. Without it — had the code passed the original key to get_raw, as the "obvious" optimization would — all 774 of those foreign records would have resolved successfully and been returned to the caller as members of dev.cocore.compute.paymentAuthorization. A listRecords call would have served someone else's collection under the wrong NSID, with valid CIDs, and nothing would have errored. The bug that cost you 534 blobs is the same line that prevented a much quieter and worse one.
─────────────────────────────────────────────────
Cleaning up the throwaway and recording the verdict:
skipped
Confirmed: your repo is complete. 6,409 MST entries, every record block readable, getRepo exports all 3.3 MB.
Discovered along the way: the unwrap_or(key) fallback that produces the 500 is the only thing standing between this bug and a silent data-integrity breach. I verified directly against your repo that every leaked key resolves fine when passed verbatim — so the "obvious" fix of reusing the original key would have returned 774 foreign records to callers as members of the wrong collection, with valid CIDs and no error at all. I've written that into the issue as an explicit "do not fix it this way," because it's exactly the change a reviewer would suggest.
Recommended order
MM-472 — independent of all this, and it's what converts a read bug into irreversible deletion. Small, well-scoped, testable.
MM-473 — filter on strip_prefix's None rather than unwrap_or, breaking on the first non-matching key. That's correct, preserves fail-closed, and stops a limit=100 call from walking 100 entries on a 5-record collection. Then report upstream and audit the other entries_prefixed call sites.
MM-474 / MM-475 as scoped earlier.
Two caveats on what I did not check. My 78-collection sweep only tested page one, so a collection with more than 100 records could be over-scanning on its final page without showing up — the fix makes that moot, but the regression test should cover it. And I haven't audited the other entries_prefixed call sites; list_collections walks unprefixed so it's safe, but I didn't check the rest.
Want me to start on MM-472? I'd run the linear-workflow skill to move it to In Progress and branch from a fresh origin/main first.
push
if let Some
This retro-explains every observation exactly. Check the leaked keys against their prefix lengths:
Prefix (len)
Leaked key (len)
Shorter?
community.lexicon.calendar.rsvp/ (32)
computer.aetheros.id/self (25)
✓
coop.hypha.spores.social.takenFlower/ (37)
dev.cocore.account.profile/self (31)
✓
dev.cocore.compute.termsAcceptance/ (35)
fm.teal.alpha.actor.status/self (31)
✓
dev.cocore.compute.paymentAuthorization/ (40)
all 774: fm.teal.alpha.feed.play/3… (37), garden.goals.* (≤37)
✓
And the skipped-collections mystery dissolves: dev.cocore.compute.provider/3… is 41 chars — longer than the 40-char prefix, so it hit the comparison, compared Greater, and broke the scan in its node. The short fm.teal/garden keys live in other nodes where every key dodged the filter. It's not node-boundary handling at all — it's purely key length vs. prefix length. A healthy collection is simply one whose trailing neighbors happen to have long keys. 774-for-774 accounted for.
Now the second check — has upstream already fixed this?
atrium-repo
Node::entries_with_prefix
shorter
key.get(..prefix.len())
None
push
provider/…
fm.teal
garden
The trigger is key length vs. prefix length, full stop
zz.a/self
MemoryBlockStore
2. Checked upstream. No escape hatch: 0.1.8 (2026-03-26) is the newest release and main's entries_with_prefix is byte-identical — still broken. So the local defensive fix is mandatory and the upstream report is a real deliverable, not a courtesy. Also noted keys_prefixed delegates to entries_prefixed, so the call-site audit must cover both.
3. Preserved the reproduction. The frozen CAR (the live MST drifts with every write), full probe output with all 774 leaked keys, and a provenance README are in linear-export/mm-473-artifacts/ — gitignored, since it's your repo data in a public repo. All of this went onto MM-473 as a comment, and memory is updated.
Remaining gaps, deliberately left to the fixing sessions (already written into the issues): the page-1-only limitation of my 78-collection sweep, the entries_prefixed/keys_prefixed call-site audit, and the actual upstream filing. Nothing else about the root cause is inferred anymore — a fresh session can start MM-472 or MM-473 from the issue text alone without re-deriving anything.
One handoff tip: point the next session at MM-472 and MM-473 explicitly and mention the linear-workflow skill — branch from fresh origin/main, and MM-472 first, since it's independent of the atrium details and is what turns this bug class from data destruction into a disk leak.
entries_prefixed
silently wrong results
Everything the MM-472 session needs is in the issue (mechanism, fix direction, regression-test spec, the prod log evidence), and MM-473's comment carries the short-key repro any upstream filing can borrow verbatim. One reminder for whoever lands MM-472 or MM-473 first: the manual temp_until = NULL pin on your account is the only thing protecting the restored blobs until either fix deploys — it's recorded in memory and in MM-472, so it should surface naturally, but it's worth keeping in your own head too.
Good hunting on MM-472.
Pick option 2 (errors counter) — and I'd push back on the implementer's recommended option 1, because it subtly breaks the doctrine it claims to reuse.
The crate's "staleness is the alarm" convention distinguishes two states: a whole-pass failure (couldn't list candidates, couldn't list expired owners → early return, timestamp untouched) versus a completed pass with partial errors (per-account skip, counted in stats.errors). The existing sweeps freeze the timestamp only for the first. Option 1 as worded — freeze on any errors > 0 — merges the two, and our own incident shows why that's wrong: your account's reconcile failed on every pass for 6 hours, and with MM-473 unfixed it would fail for days or weeks. Under option 1, one chronically broken account makes blob_gc_last_run_timestamppermanently stale. The staleness alarm becomes a constant condition the operator learns to ignore — which destroys its value as the acute "GC is wedged" signal, for exactly the sweep where wedging matters most. Chronic alarms are worse than no alarms; they take the working doctrine down with them.
The counter keeps each signal meaning one thing: timestamp = "the pass runs to completion," errors > 0 = "it's skipping someone — go find out who." That's alertable without ambiguity, and post-MM-472 the skipped state is exactly what an operator needs to notice, since a skipped account is now silently leaking disk instead of silently losing data.
Two supporting points for the implementing session:
This isn't scope creep — it's a transfer from MM-474. Item 2 of MM-474 ("make errors > 0 distinguishable in sweep_status/metrics, per-sweep errors counter") is exactly this, and I flagged it there as the highest-value item. Pulling it into the MM-472 PR is right because it's the operator-facing half of the same fix: the code change converts deletion into a leak, the counter is what makes the leak visible. If they take option 2, they should drop a comment on MM-474 noting item 2 shipped with MM-472 so the next session doesn't re-implement it. The rest of MM-474 (physical-vs-owned divergence, didWebHosting) stays put.
Keep the existing whole-pass freezes unchanged. The early-return paths should still leave the timestamp stale — that acute signal stays intact, which is also the answer to option 3: "both" isn't louder, it's the same conflation as option 1 plus a counter.
Option 4 is defensible if they want the minimal reviewable diff — the deletion risk is gone either way — but the counter is one instrument, one sweep_status field, one /v1/admin/health line, and one AGENTS.md table row. Small enough to belong with the fix whose consequences it reports.
Verified — HealthSweepRun (relay_client.rs:1346) is not deny_unknown_fields; only RepoRefSubject is. The compat claim holds.
Review: PR #437 — Never sweep the blobs of an account whose reconcile failed (MM-472)
Overview
Implements exactly what MM-472 scoped, plus the errors-counter observability we settled on in the option-2 discussion: a HashSet of DIDs whose reconcile errored, checked before each sweep candidate; blob_gc_errors_total; errors on SweepRun → /v1/admin/health; pass-level log downgraded from info "complete" to warn "incomplete" when work was skipped. 199 additions, 7 files, changelog fragments present.
This is correct and I'd merge it. I verified the mechanism against the sweep's WHERE clause and the incident's failure shape; the exclusion sits at the right point (before sweep_expired_owner, so neither the ownership row, the physical row, nor the file can be touched), and the shared-bytes argument in the PR body is sound — a skipped account's surviving row means no CID it owns can lose its last owner, so delete_blob_if_unowned is inert for other owners too.
Especially good
The test is real. Verified in both directions per the PR body, and the false-negative catch — breaking A's walk via a blobs-stored CID rather than another account's root, because blocks is globally content-addressed — is exactly the trap; the comment explaining it will save the next person. All referenced helpers (get_owner, seed_account_with_repo, gc_state, add_blob) exist.
Doctrine preserved precisely. Whole-pass early returns still leave the timestamp stale (acute signal), partial errors record with a fresh timestamp + nonzero errors (chronic signal). The admin_health doc comment even keeps the route's no-verdicts rule intact.
Generalizing errors onto shared SweepRun rather than a blob-GC-only field, with now() defaulting to 0 so the other five sweeps compile untouched — right call, and it pre-plumbs labeler_watch/blob_scrub adoption.
Per-DID skip tally instead of 534 log lines per pass; the rationale comment cites why.
Findings (all minor)
blob_gc_errors isn't exercised in the rendered-names pinning test (metrics.rsrendered_names_match_prometheus_conventions). That test exists to catch _total suffix drift, and this counter's rendered name is precisely what operators will write alert rules against. One .add(1, &[]) + one contains("blob_gc_errors_total") assertion. The existing test only samples representative instruments, so this is consistent-but-improvable rather than a break.
Doc wording overstates what errors counts. AGENTS.md says "errors counts accounts and blobs the pass skipped" and the health-field doc says "items that pass skipped." In the code, a skipped account contributes 1 (its reconcile failure) regardless of blob count — the incident account would report errors: 1, not 534; per-blob skip counts live only in the warn log. Either tighten the wording ("reconcile failures plus individual sweep errors") or add skipped blob counts into the tally — I'd tighten the wording; the account count is the more actionable number anyway.
stats.errors mixes two failure kinds — reconcile failures and sweep_expired_owner failures — in one counter. That's fine (both mean "pass left work undone"), but worth one clause in the names::BLOB_GC_ERRORS doc so nobody later assumes it's purely the skip count.
Checked and clean
No ticket refs in .rs or AGENTS.md prose; changelog fragment filenames match the gate's convention.
Wire compat confirmed (above), and the health-route test covers the new field including the fresh-timestamp-with-errors case.
No security or performance concerns; the HashSet and per-DID map are bounded by candidate count.
Deploy note in the PR body correctly keeps the manual temp_until = NULL pin load-bearing until this ships — matches what's recorded in MM-472 and memory.
Verdict: approve. Items 1–2 are worth a small follow-up commit before merge; neither blocks. And once deployed, remember the account still reconcile-fails every pass until MM-473 lands — blob_gc_errors_total will tick 1/pass and blobGc.errors: 1 in health is the expected steady state, not a regression.
Audit independently confirmed: exactly three entries_prefixed call sites in the workspace, and the two untouched ones pass "", where the upstream bounds check degenerates to key.get(..0) == Some("") → always Equal → a plain full walk. No keys_prefixed callers at all. The PR's claim holds.
Review: PR #438 — Bound listRecords to the requested collection's key range (MM-473)
Overview
Replaces the strip_prefix(..).unwrap_or(key) closure with a three-way classify — Take (prefix stripped), Skip (sorts before the range), Stop (sorts past it) — applied in both traversal branches, plus two regression tests and a changelog fragment. 135 additions, 2 files.
Correct, and I'd merge it. I verified the load-bearing pieces independently:
The Stop shortcut is sound, not just plausible. For any key k > prefix that doesn't carry the prefix, the first differing byte position falls within prefix.len(), and that position decides the comparison against every key of the form prefix + suffix — so k sorts after all possible members and ascending order guarantees nothing further can match. This also correctly handles the "abc/" vs "abc0" adjacency ('/' = 0x2F sorts before '0'): a prefix-carrying key can never appear after a Stop key.
Both branches are covered. The reverse branch materialises the stream in ascending order before reversing, so break on Stop during collection is equally valid there.
Fail-closed is genuinely preserved. A leaked key now never reaches the resolve loop at all (filtered at classify), and a legitimate member's full_key = prefix + rkey reconstructs the original key exactly. The property MM-473 flagged as must-not-lose — never resolving a foreign key verbatim — holds by construction.
has_more/cursor now derive from a clean set, fixing the secondary defect MM-473 named.
Especially good
The tests attack the mechanism (short keys flanking a long-named collection), not the incident's topology — consistent with the probe finding that key length, not node structure, is the trigger. Sweeping limit 1..=8 × both directions × value-identity assertions is exactly the "never a foreign record" guarantee, and the cursor test covers the pagination half.
The performance framing in the comment is accurate and worth having: a 5-record collection's page previously walked limit entries of whatever followed it; now it's bounded by the collection plus pre-range yields.
Findings (minor)
The two empty-prefix call sites deserve a one-line warning comment.list_missing_blobs.rs:153 and check_account_status.rs:151 are safe only because"" degenerates the broken upstream bounds check into a full walk. Nothing at those sites says so. The next person who narrows one to a real prefix reintroduces this bug with no test in that crate to catch it — a comment like "empty prefix only: entries_prefixed is unreliable for non-empty prefixes, see list_records_json" closes that trap for one line each.
"Fixes MM-473" will auto-close the ticket, but the upstream report is still outstanding. The PR body acknowledges it; make sure it lands somewhere that survives the close — its own small ticket, or a checklist item on MM-474 — so it doesn't evaporate on merge. The report is worth filing: other atrium-repo consumers won't have the accidental fail-closed mangling and would get silently wrong results.
Nit: Scan::Take(String) allocates per entry, same as the old strip; fine. And strip_prefix yielding Some("") for a hypothetical key exactly equal to "collection/" would produce an empty rkey — impossible in a valid atproto MST, not worth guarding.
Interaction with PR #437 — one deploy note
Once both merge and deploy, your account's reconcile starts succeeding again: the next GC pass pins all 534 restored blobs permanent (temp_until cleared by upsert_owner_referenced), the manual temp_until = NULL pin becomes redundant rather than load-bearing, and blobGc.errors in /v1/admin/health should read 0. If it doesn't within one GC interval (~30 min) of deploying this, something else is still failing on that account — that's the post-deploy check I'd do. I'll update the incident memory once you've confirmed it.
Verdict: approve. Item 1 is the only change I'd actually ask for pre-merge; items 2–3 are bookkeeping and taste.
Confirmed — the .bru files carry per-field response docs, and the diff doesn't touch bruno/. That's the one real finding.
Review: PR #441 — Distinguish blob ownership loss from byte loss (MM-474)
Overview
Three additive read-side surfaces, no migration: uploadedBlobCount/uploadedBlobBytes on per-account storage (from blobs.account_did, the V039 first-uploader column), blobUnownedCount/blobUnownedBytes on admin health (physical rows no blob_owners row claims), and didWebHosting on the account listing. Six tests, spec + AGENTS.md updated. 376 additions, 10 files.
Correct, and I'd merge after one fix. Verified independently: the NOT EXISTS probe rides idx_blob_owners_cid (V039), so no table-scan concern; the admin-companion's health/listing structs are not deny_unknown_fields (only RepoRefSubject is), so the new fields are wire-safe; /v1/admin/health and /v1/admin/accounts aren't in provisioning-api-spec.md, so updating only the storage section there is complete, not an omission.
The design calls are right
uploaded* over "physical" — agreed; the column literally records the uploader, and calling it physical would invite reading it as a corrected ownership count, which the doc comments correctly warn against.
Both placements — agreed, and the asymmetry is real: the unowned pair is the alarm (baseline ~0 structurally, because delete_blob_if_unowned drops row and owner together — no threshold tuning), while the per-account pair is the diagnostic. The PR body's observation that the unowned alarm fires without the sweep having stopped is exactly the property the incident lacked.
The tests hit the precise incident shape — delete ownership rows under a live account, assert the ownership view zeroes while the uploader view holds — plus the benign-sharing direction that keeps the readout from being misread as a fault detector.
Findings
Bruno response docs are now stale — the repo rule requires updating them (root AGENTS.md: "changing any route (…response shape…), update the corresponding .bru"). Three files carry per-field docs blocks that no longer match: account_storage.bru (missing uploadedBlobCount/uploadedBlobBytes), admin_health.bru (missing blobUnownedCount/blobUnownedBytes), admin_list_accounts.bru (missing didWebHosting). bruno-parity passed because it checks paths only — this is precisely the gap AGENTS.md says the manual rule covers. Only real ask before merge.
One honest-limitation clause worth adding (nit, doc-comment level): the uploader witness reads 0/0 in the incident's own end state too — when blob GC does the destroying, physical rows die with their last owner, so both witnesses zero. What the pair makes HTTP-legible is the diagnosis: owned=0, uploaded>0 → ownership loss; owned=0, uploaded=0 → bytes gone (the SQL-shell conclusion we drew by hand on 2026-07-25). The current comments describe the first case; one sentence naming the second would stop an operator from reading uploaded=0 as "nothing was ever here."
Bookkeeping, not this PR: "Closes MM-474" is right (all three items land: 1 here, 2 via #437's SweepRun::errors, 3 here), but #438's outstanding atrium-repo upstream report must not be parked on MM-474's checklist or it dies with the close — confirm it has its own ticket.
Checked and clean
SQL: user input still bound, never spliced; the new select column follows the FLAGGED_SQL derived-bool pattern; did_web_hosting isn't part of the sort key or cursor, so pagination is untouched.
No new routes → no new .bru files needed; changelog fragment reads well; no ticket refs in .rs/AGENTS.md prose; extra per-request query on an admin-only endpoint is fine.
The db/AGENTS.mdserver_stats.rs row update and the routes-table updates keep the docs honest, including the ~0-baseline reasoning.
Verdict: approve once the three .bru docs blocks are updated (item 1). Items 2–3 are a nit and a reminder.
One post-merge note for the console follow-up (the PR flags it's JSON-only for now): when the Brass Console renders blobUnownedCount, its threshold judgment belongs client-side per the no-verdicts rule — "nonzero across two consecutive sweeps" is the alarm condition the doc comments imply, not "nonzero once," since a value observed mid-pass is legitimately transient.
All green, and the census settles the question definitively — including one number that proves the pin is already inert:
The four collections: 200 at limit=100. MM-473 confirmed fixed on prod, which means reconcile completes.
Owned blobs: 532 — down from 540 at deploy time. That drop is the proof. Eight blobs the restore uploaded that no repo record references were released by reconcile's own release loop and collected — straight through the manual pin. The release loop's job is to grace-clock "permanent" rows that lost their references, and a manually-pinned row is indistinguishable from a permanent one. So the pin hasn't been protecting anything since the first successful post-deploy reconcile; the MST is now the sole authority over every row, which is exactly the designed steady state. (Those 8 are the expected restore surplus — the iCloud manifest can hold blobs whose records no longer exist — and they remain in iCloud if ever wanted.)
So: there is no removal step
The UPDATE wrote temp_until = NULL — the identical value a legitimate reconcile pin writes. There's no marker to delete, no state to revert, and re-arming clocks by hand would just recreate work reconcile redoes every 30 minutes anyway. The pin didn't need lifting; it dissolved. My earlier "do not lift it blind" caution assumed unreferenced rows were protected only by the pin — the 540→532 drop shows reconcile releases them regardless, so that concern is moot.
What's actually left before calling the incident closed
Two checks, both admin-side (I don't hold the admin token):
The mirror bucket — the one unhealed leg. The incident deleted the off-volume copies (deleted bucket object with no blob row × 534), and the restore only refilled the local volume. blob_mirror should have re-uploaded everything since; verify via /v1/admin/health's blobMirror sweep entry plus a bucket object count ≈ total physical blobs (or blob_mirror_synced_total having jumped by ~500 post-restore). Until that's confirmed, iCloud is still the only second copy — which is the same single-copy exposure the incident started from.
Steady-state health readout, one glance: blobGc.errors: 0 holding across passes, blobUnownedCount: 0, and on the account's storage endpoint the new uploadedBlobCount ≈ blobCount (they should roughly agree now; a wild divergence would be the MM-474 signal firing).
Optional third if you want belt-and-braces: listMissingBlobs from the wallet's session should return empty — "every record-referenced blob is present," the converse direction of the census I just ran.
Updating the incident memory to match reality:
blobMirror
/v1/admin/health
One health glance: blobGc.errors: 0 holding, blobUnownedCount: 0, uploadedBlobCount ≈ blobCount on your account's storage endpoint (the MM-474 fields exist precisely for this comparison now).
Memory is updated — the incident note now records the pin as resolved-by-supersession with the 540→532 evidence, and lists the mirror check as the last close-out item, so any future session picks up the right state instead of the stale "do not lift" warning.
Tell me the mirror numbers when you have them and I'll close out the incident note entirely. And separately from the operational thread: MM-475 (did:web sovereign sessions) is now the only unstarted issue from this saga — worth queueing, since the "keep a password set" interim is still the thing standing between your account and a repeat of the recovery-path lockout we mapped earlier.
This output answers some questions and catches one thing I got wrong last turn — plus it reveals the MM-474 check can't actually be run on prod yet.
First, a correction to my census claim
I compared two different measures: health's blobCount: 540 is server-wide physical rows, my listBlobs census of 532 is one account's ownership rows. Nine accounts live on this server; the other 8 physical blobs are presumably other accounts' media. Nothing was "collected through the pin" — blobCount is still 540 and swept: 0 confirms no deletions. The conclusion stands unchanged (the pin is inert; reconcile's release loop governs unreferenced rows by code-level mechanics), but the 540→532 "evidence" I cited was a category error, and the actual surplus sweep is still ahead of you — more on timing below.
What the output shows
blobGc: {swept: 0, errors: 0}, fresh timestamp — the MM-472 signal working as designed, and reconcile genuinely green. This is the readout that was impossible during the incident.
No blobUnownedCount/blobUnownedBytes under storage — meaning prod is running v0.8.4, which predates PR #441. Merging to main deploys staging; production moves only on a release (set-version → just release → deploy-production). So the unowned-blob check — the one remaining MM-474 verification — waits for the next release, or can be run against staging now.
blobMirror: {swept: 0} is consistent with a refilled bucket but doesn't prove it. The per-pass snapshot only says the last pass had nothing to upload; the refill would have happened yesterday, under 0.8.3, in the hours after your restore. And the cumulative blob_mirror_synced_total counter won't help either — OTel counters are process-local, and this process is only 4.3 hours old. Two ways to actually confirm: grep yesterday's Railway logs for the blob mirror: uploaded burst around the restore window, or count bucket objects directly (should be ≈540).
blobScrub: null — no integrity pass since boot. Low urgency: restored files were CID-verified at upload time (store_blob hashes the bytes), so their integrity was proven on the way in.
What to expect in the next few hours — don't be alarmed by it
Timeline: v0.8.4 booted 4.3h ago, first GC pass ran ~30min after boot. That pass was the first successful reconcile for your account, and its release loop grace-clocked any restored blob no record references (temp_until = release + 6h). Those clocks expire roughly 2 hours from now. So a near-future blobGc pass may report swept: N for some small N, with blobCount dropping by the same amount — that's the restore surplus being collected correctly, with errors: 0 alongside. That pass, if it comes, is the system's final word that authoritative GC has fully resumed. If instead swept stays 0 forever, it just means every restored blob is referenced — equally fine.
Let me fix the memory record to match reality:
blobMirror {swept: 0, errors: 0}
Dual-copy redundancy is restored; the incident's last open leg is closed.
One pedantic note so it doesn't nag later: 233 + 300 = 533 uploads against 534 deletions. Almost certainly a pass between 17:50 and 21:21 carried the last one, or two manifest entries deduped to one CID — and the 21:21 "agree" makes it moot either way (whatever the volume holds, the bucket now matches). The only scenario it can't rule out is a blob missing from both — which is precisely blob_scrub's row-without-file check, and scrub hasn't run this boot. If you want the final belt-and-braces, let a scrub pass run (or trigger one) and confirm flagged: 0; a wallet-side listMissingBlobs returning empty says the same thing from the reference direction.
Closing out the memory record:
The 18-line file was cleanly deleted (it was exactly 18 lines), with no dangling importers — not dead code. Review complete.
Faithful to every decision we specified, and the security-critical properties all held up under inspection. This is the right shape: one new module, two routes losing their duplicated gate, policy enforced server-side, UI deferral honest about why.
Properties verified against the merged code
Ordering preserved on both routes. Sovereign: syntax → freshness → local-account gate → signature → authority. Consent: pending-row binding → signature → authority. An unsigned or invalid probe still triggers no outbound fetch on either path.
Hosting gate fires before any network I/O, and the route test proves it the strong way — the mock PLC mounts nothing and plc.verify() passes, plus the nonce is asserted unspent. Gate polarity correct (enabled → refused).
Predicate parity with create_did.rs — type/controller/exact-id all enforced, each covered by a unit test, including the two cases I most wanted: #atproto is never authority, and duplicate #device entries fail closed rather than resolving by array order.
Opaque-rejection posture intact.Unauthorized collapses into the routes' existing single messages; Lookup propagates with its own status — the same deliberate fail-closed-with-status posture the PLC path always had, now documented on the enum.
Cache untouchable. Both arms resolve live, with the why-per-method comment (rotationKeys authority semantics; the cache is writable by /v1/did-web/document).
The malformed-DID fallthrough is safe: did:plc:tooshort fails is_plc_did, doesn't match did:web:, lands in unsupported_did_method — it can never drift into the web arm.
Wallet: 4 shapes → 2, deferral stated on-screen with a reason ("We would rather offer nothing than offer that" — exactly the honest-never-hype register), didWebHosting frozen to 'self' with the un-deferral path documented in a comment, plumbing retained. ADR-0022 amendment records the policy, the gate's exactness, and the deferral, matching what we decided verbatim.
Findings (follow-ups, nothing blocking)
crates/pds/AGENTS.md is now stale — the one gap. The routes table still describes sovereign_session.rs as "signed by a key in the hosted DID's authoritative current PLC rotationKeys," the oauth_consent module comment's counterpart in the table likewise, and the identity/ module table doesn't list authority.rs at all. Nothing gates this (docs-check covers generated pages, not AGENTS.md), so it'll silently mislead the next session that loads it. Small PR or fold into the next dream-routine pass.
Asymmetry worth one sentence somewhere: the consent route (unlike sovereign, which has the local-account pre-gate) will run web_authority for a DID with no local account — the hosting probe finds no row, returns false, and the fetch proceeds. An attacker with a pending consent request and their own keypair can thus induce a fetch of https://<their-domain>/.well-known/did.json. Not a new class — resolveDid already offers arbitrary did:web resolution unauthenticated, the fetch is SSRF-hardened and rate-limited, and the pre-change PLC path had the same shape (fetch for any claimed DID) — but a local-account pre-check on the approve path would cost one indexed query and remove the asymmetry.
The acknowledged test gap (no route-level did:web happy path, since did_web_document_url hardcodes https://) is reasonable given the unit coverage — but it makes the live verification the actual happy-path test, which brings me to:
The verification that closes this arc
Once this ships in the next release, did:web:malpercio.dev is the perfect live subject — your did.json already carries #device, and we confirmed did_web_hosting_enabled_at is NULL. The wallet's "Unlock identity" biometric flow against prod is the end-to-end proof. If it mints a session: MM-475 verified, and the interim password can come off the account — at which point every thread from this conversation (the OAuth lockout that started it, the blob incident it uncovered, and the recovery-path dependency that made this urgent) is actually, fully closed.
null
For the OAuth attempt, what success looks like: consent page offers the wallet path → biometric approve → the server does a live fetch of https://malpercio.dev/.well-known/did.json, extracts #device, and authorizes. Two things to know going in:
The most likely failure mode is a key mismatch, and it's silent by design. Every rejection is the same opaque 401, so if it fails, the reason is only in the server log — grep for approval rejected / sovereign session proof rejected; the WARN line carries reason, account_did, and signing_key_did. The decoder ring: signing_key_not_authorized = the wallet signed with a device key whose did:key: doesn't match your published zDnaeY2jnoij… multibase (plausible if the #device you hand-added during migration predates or differs from the key the wallet currently holds for that DID); no_device_verification_method = predicate mismatch on the document itself (yours passes on paper — Multikey, controller = DID, exact id — so this would surprise me); did_web_hosting_enabled = the hosting flag got set somewhere (we verified NULL, so also unlikely).
Your did.json fetch has to succeed from the PDS's network — a Lookup failure surfaces with its own status rather than a 401, so a 5xx-ish error means "couldn't fetch your document," not "rejected."
If it works, the arc is closed, and the last cleanup is the interim password — one wrinkle there: no route un-sets a password (resetPassword only ever sets one; the admin repair route deliberately refuses to touch passwordless accounts), so returning to password_hash = NULL is a one-line prod SQL when you're ready.
Go for it — and if it 401s, paste the WARN line.
discover_pds
The fix: delete the gate — onsignin={() => goTo('oauth_consent_approval')} — plus a changelog fragment. Nothing else needed.
Verified:
svelte-check: 434 files, 0 errors · unit tests: 158/158
Browser harness (rekey-mixed scenario): the did:web identity now shows Sign in to an app, and tapping it loads the consent screen with both the QR-scan and typed-code paths, zero console errors — screenshot above
Regression direction: the did:plc identity keeps the button and all its plc-only actions (Change handle, Repair hosting endpoint, Rotate signing key) — untouched
One deliberate judgment call to flag: the button now renders for every identity, including a hypothetical Custos-hosted did:web, which the server would refuse with its opaque 401 at approval time. That's consistent with the merged design ("hiding shapes in a client is a sensible default but never the boundary" — the server gate is the enforcement), and the wallet can't currently create hosted did:webs anyway. If you'd rather the wallet pre-hide it for hosted ones, that needs a capability/hosting probe and I'd call it not worth it now.
The change is sitting on branch mm-475-didweb-signin-entry (from fresh origin/main), working tree otherwise clean. Want me to commit, push, and open the PR? Once it's deployed — or honestly, once you rebuild the app locally with this one-liner — your OAuth attempt is unblocked.
Sign in to an app
#device
did.json
And if the 401 decoder ring turns out to be needed after all: signing_key_not_authorized in the server log means the published zDnaeY2jnoij… multibase doesn't match the device key the wallet holds for that DID — the one failure mode we couldn't rule out from here.
did.json
Worth savoring the full circle of this session: it opened with "my OAuth login fails and I don't think I have a password," detoured through discovering your 534 blobs had been silently destroyed by a GC bug triggered by an upstream MST library defect, recovered everything from iCloud, shipped five fixes (MM-472 through 475 plus the wallet follow-up), hardened the sweep against the entire failure class, made ownership-loss operator-visible, and ended with the thing you originally wanted — a working OAuth session — built on a passwordless auth path that didn't exist this morning. And it landed on tangled.org, the same site whose login 500'd two weeks ago from the missing-sub bug. Good session.