chadtmiller.com/group-host
atmosphere group host
0
0
profile set and role grant change only what they are given
Merged Approved
This makes profile set/profile_set and role grant/role_grant change only what they are given. profile_set now plans an Edit, and edited merges the given fields into the record as it is. Null, "" and [] take a field away, and unset fields and blob references are kept. regrant now adds scopes and assignable roles once each, --undo takes them away, and the grant is dropped when nothing is named or nothing is left. The host and the CLI both read the current record before writing. The docs, the usage text and the tests were updated with the code, as AGENTS.md asks. I found nothing that must change.
Two small things, neither blocking:
- In
typed, the new_ if value.is_empty() => Value::Nullarm applies to every non-string, non-list, non-bool flag in every command. Before,--order ""onrule setwas a "wants JSON" error; now it sends null. It only matters for the commands that take such flags. - The host test and the CLI test don't have an avatar blob in the profile, so keeping a blob reference whole is only covered by the unit test in
protocol.rs. The PR body claims pictures survive. A test that sets an avatar and then runsprofile set --descriptionwould pin that down.
I did not check CI results.
Merged as 4920cc1
What changes
profile setandprofile_setchange only what they are given. The command and its tool read the profile as it is, set each field given, take away a field given empty ("", an empty list, ornull), and write the rest back unchanged, pictures included. Neither requires a display name or join policy any more. The host reads the record directly; the command reads it throughlistSpaceRecords, which keeps the blob references whole.role grantandrole_grantadd to a role's grant. The scopes and assignable roles given are added to what the role had, each once. With--undo(undo) they are taken away; with none named, or none left, the grant goes.Why
Replacing the record whole made
opensocial profile set riders --description …drop the avatar and every other field not repeated, and made adding one scope mean listing them all. Command lines usually edit the fields given (gh repo edit) and add or remove items in a list (gh pr edit --add-label), and an MCP client filling in a tool's parameters is the caller most likely to leave fields out.How it was checked
group-host-mcp: the plans for both tools,editedkeeping what is not given and taking away what is given empty, andregrantadding once, taking away, and dropping a grant left empty.group-hosttests/mcp.rs:profile_setkeeps the rest of the profile, and a field given empty is taken away.opensocialtests/commands.rs:profile setacross three calls,--topics ""taking topics away;role grantadding two scopes tomemberand--undotaking one back.harness/docs.mjs,harness/lexicons.mjs. The coverage gate is left to CI.Shortcomings
The read and the write are two steps, with no
swapRecordbetween them, so a change made in between is overwritten, as the console's settings page does today.rule setandrole setstill replace their record whole.🤖 Generated with Claude Code