feat(cli): support visibility on channels update#1350
Open
tlongwell-block wants to merge 1 commit into
Open
Conversation
Visibility (open/private) was a create-time-only field: `channels create` took `--visibility`, but `channels update` only handled name/description/ttl, so there was no way to flip a channel's visibility after creation from the CLI. The plumbing already existed below the CLI: `buzz_sdk::build_update_channel` accepts a `visibility` arg and emits the `["visibility", v]` tag on the kind:9002 edit-metadata event, and the relay validates the value, gates it behind owner/admin auth, applies the DB update, invalidates the visibility/accessible-channel caches, and emits a visibility_changed event. The CLI just hardcoded `None` and exposed no flag. Wire `--visibility <open|private>` through `channels update` as a clap ValueEnum (matching `channels create`), so invalid values are rejected at parse time, and thread it into build_update_channel. Visibility is also included in the no-op guard and its error message. Live-tested against a real channel: open->private->open, each flip confirmed via the stored kind:9002 visibility tag. Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
--visibility <open|private>tobuzz channels update, so a channel's visibility can be flipped after creation from the CLI. Previously visibility was a create-time-only field:channels createtook--visibility, butchannels updateonly handled name/description/ttl.Why it's small
The plumbing below the CLI already existed:
buzz_sdk::build_update_channelalready accepts avisibilityarg, validatesopen|private, and emits the["visibility", v]tag on the kind:9002 edit-metadata event (crates/buzz-sdk/src/builders.rs:572). Already covered by SDK tests (:2069,:2086).side_effects.rsalready validates the tag value, gates it behind owner/admin auth, applies the DB update, invalidates the visibility/accessible-channel caches, and emits avisibility_changedevent (:382-397,:424-437,:1075-1107).The CLI just hardcoded
Nonefor that arg and exposed no flag. This PR wires the flag through — no SDK or relay changes.Change
lib.rs: addvisibility: Option<ChannelVisibility>to theUpdateclap variant (value_enum, so invalid values are rejected at parse time with[possible values: open, private]— matchingchannels create).channels.rs: thread it intocmd_update_channel, include it in the no-op guard + error message, and pass it tobuild_update_channel.No
publicalias — held toopen|privateto matchcreate, the SDK, and relay validation (one vocabulary).Testing
cargo test -p buzz-cli -p buzz-sdk— green (135 + 205).cargo clippy -p buzz-cli— clean.cargo fmt -p buzz-cli --check— clean.f5bf2e54-...), each flip confirmed via the stored kind:9002visibilitytag on the relay:Review
Planned and diff-reviewed with Wren; independently confirmed not already wired by Max.