chadtmiller.com/group-host
atmosphere group host
0
0
Refusals are answered as the caller's, and failures as the host's
Merged Approved
This pull turns directory refusals into a 400 InvalidOperation. It adds a host-wide turn for DID changes, moves the NotController check to right after the keys are read, and makes the smaller fixes listed in the body. I read the plc, recovery and migration diffs and the MCP change. I did not read the rest of the diff (handle, listRepos, createReport, move-host, docs and tests), and I did not run the tests or look at the checks.
not_published:downcast_ref::<Refused>()still finds the error under.context(...), since anyhow downcasts through context wrappers. The 4xx and non-4xx split reads correctly.- The turn: each guard is taken before
last_op/rotation_keysand held until publish, and early returns release it on drop. Inadd_recovery_keyandremove_recovery_keythe guard is declared before the earlyrefused(...)returns, so it is held through them. That is harmless. NotController: it now comes before the other checks, which matches what recovery.md says.
The shortcomings you list (one turn for the whole host, and last_op read failures still a 500) are reasonable for rare, short operations.
Merged as 8518915
Merging this pull closed these issues
What changes
A directory's refusal is the caller's, not a 500.
Directory::publishnow fails with aRefusedcarrying the directory's status and words, andplc::not_publishedanswers a 4xx refusal as 400InvalidOperationand anything else (a 5xx, no answer) as the host's 500.migrateComplete,addRecoveryKey,removeRecoveryKeyandupdateGroupHandleanswer through it, ascompleteImportalready answered such refusals; the three lexicons that list their errors listInvalidOperation. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdedoj46nlTwo changes to a group's DID at once both land. The directory holds a turn, taken from reading a DID's last operation until the next is published, by the recovery key methods,
updateGroupHandleandmigrateComplete. TwoaddRecoveryKeycalls at once now both succeed one after the other, where the second was refused as a fork and answered 500. A refusal that still comes (a steward changing the document meanwhile) isInvalidOperation, as above. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdfi6ljoi5A key change once the host holds no key is
NotController, whatever the key. The check moved from signing to right after the keys are read, soTooManyKeys,AlreadyAdded,HostKeyandUnknownKeyno longer come first, as recovery.md says. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdfgoom6fumigrateReceivesays what the source's getRepo answered. getRepo goes through the same request as the export's parts (ask_source), so a 404 or 500 isSourceUnreadable"…getRepo answered 404 Not Found", not "a repo that is not the group's". Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdef2valpvlistReposgives a cursor only on a full page, aslistRecordsdoes. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdfjdmzskgAn MCP body that is not JSON is a parse error: HTTP 400 with JSON-RPC
-32700and a null id, as MCP's HTTP transport allows; JSON that is not a message is still-32600. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdftrwr6olEach report has its own id.
Store::moderatereturns the event'sseq, andcreateReportanswers it asidin place of the time. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdemxgwu5pAn unreadable
describeServerkeeps no handle. Bringing an account here fails closed: when its server cannot say which domains it gives out, the handle is not kept as the account's own, and it gets its address here. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdege732scmove-hostgoes on past an account the directory fails on. Such an account isMoved::Failed(why), printed as "<handle>: not repointed: <why>", the rest are repointed, and the command exits with an error naming how many were not.move_hostanswers aReportof its lines and that count. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdeho4jvuldocs/design/recovery.md, docs/design/moving.md, docs/reference/mcp.md and docs/reference/cli.md say each of these.
How it was checked
New or extended tests, each failing before its fix:
migration::hands_over_only_what_names_the_destination: credentials with a key the directory cannot read are 400InvalidOperation. The test directory now checks rotation keys as PLC does (at most five, each a key it can read).recovery::makes_two_changes_at_once_one_after_the_other: twoaddRecoveryKeycalls joined, with the test directory slowing reads of the last operation so both read before either writes; both answer 200 and both keys are on the document. Without the turn, the second is refused.recovery::changes_nothing_once_the_host_holds_no_key:AlreadyAdded,HostKey,UnknownKeyandTooManyKeyscases all answerNotController.recovery::says_whose_trouble_an_operation_not_published_is: a 4xx refusal, a 5xx, and no answer at all.migration::takes_in_nothing_it_cannot_check: a getRepo answering 404.authority::keeps_the_writers_repo_hosts_tell_it_of: no cursor on a short page.assistants::says_what_it_cannot_do_as_json_rpc_does: a body that does not parse.moderation::takes_a_report_from_anyone: two reports, consecutive ids.import::keeps_no_handle_of_a_server_that_cannot_say_whose_it_is.move_host::moves_the_rest_past_an_account_the_directory_fails_on, throughgroup_host::runtoo.Ran locally: every test of
group-hostandgroup-host-mcp(interop with the reference PDS included),cargo fmt --check, clippy with warnings denied,node harness/lexicons.mjs,node harness/docs.mjs. The coverage gate is left to CI.Shortcomings
completeImportdo not take it: they make the last change a DID has here.last_opread (the directory down) is still a 500 in these methods, as the issue's main point was the publish refusal.🤖 Generated with Claude Code