Skip to content

fix(channels): read the channel type from the first t tag - #958

Merged
loganj merged 1 commit into
mainfrom
loganj/channel-labels-read
Oct 13, 2026
Merged

loganj merged 1 commit into
mainfrom
loganj/channel-labels-read

Conversation

@loganj

@loganj loganj commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🤖

Summary

The relay is adding channel labels: short tags such as workspace that group channels and let a client find a channel (block/buzz#8175). On a labeled channel, buzz-app could not archive, delete or leave the channel, edit its details, or change member roles. Each of these failed with "Malformed channel t state".

This PR fixes that before any channel gets labels. Channels without labels behave as before.

Details

  • The relay writes a channel's type as the first t tag on the channel's metadata event, and each label as another t tag after it. buzz-app read the type with a check that allowed only one t tag.
  • The new channelTypeTag helper reads the type from the first t tag. Channel lifecycle settings (which channel details also use) and member administration now call it. The first t tag must still be a [name, value] pair.
  • No write changes. buzz-app's channel edits send no t tags, and the relay keeps a channel's labels when an edit has none.
  • More buzz-app support for labels, creator lookup and system channels will come in later PRs.

Testing

  • New unit tests: lifecycle settings and member roles on a channel whose metadata has the type, two labels, the creator and the creation time. Both tests fail on main.

The relay is adding channel labels (block/buzz#8175). It writes them as
more t tags after the channel type tag on channel metadata. buzz-app read
the type with a check that allows only one t tag, so archive, delete,
leave, channel details and member roles failed on a labeled channel with
"Malformed channel t state".

Read the type from the first t tag, as NIP-CL defines. Later t tags are
labels. The first t tag must still be a [name, value] pair.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <[email protected]>
@loganj
loganj force-pushed the loganj/channel-labels-read branch from c4bdbea to 053dfef Compare October 13, 2026 17:25
@loganj
loganj marked this pull request as ready for review October 13, 2026 17:57
@loganj
loganj requested a review from a team as a code owner October 13, 2026 17:57

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Carl, an automated reviewer, commenting via Wes's GitHub account.

No blockers at 053dfef (base main @ bef8e4d).

  • The change matches the relay contract in block/buzz#8175: group_state_identity_tags writes the type as the first t tag, then labels, and labels may not equal a channel type name. So the first t tag is the type, and the existing some(t == "dm") checks elsewhere can't be fooled by a label.
  • buzz-app's 9002 writes (detailsTemplate, lifecycle archive) send no t tags, and the relay keeps labels when an edit has none. No write-side changes are needed.
  • Other 39000 type reads (discovery.ts, store.ts, buzz-mcp/tools.ts) use the first-match tag() helper and already handle labels. The only other single-t check is the kind:30078 recipe decode in native.ts, which doesn't involve labels. I found no 39000 t parsing on the Rust side.
  • The strictness on a malformed first t tag is unchanged, and the new tests cover the labeled cases plus that rejection.

Validation: read the diff and the relay PR, and traced the callers. CI is green at this head. I didn't run the tests locally. One dependency to note: this assumes #8175 lands with the tag order it has now.

@loganj
loganj merged commit 0b68a18 into main Oct 13, 2026
41 of 43 checks passed
@loganj
loganj deleted the loganj/channel-labels-read branch October 13, 2026 18:43
wpfleger96 pushed a commit that referenced this pull request Oct 13, 2026
…nsole

* origin/main: (115 commits)
  test(navigation): isolate the keyboard retry session gate (#981)
  fix(codex): log failed idle terminal clean instead of swallowing it (#878)
  feat(agents2): set the clicked conversation's session apart in agent tabs (#846)
  fix(channels): read the channel type from the first t tag (#958)
  feat(shell): allow sidebar collapse on all pages (#845)
  fix(mentions): select an exact member name on Space without waiting for the directory (#935)
  test(agents): complete local activity test binding (#980)
  Improve composer attachment previews and eager uploads (#948)
  fix(inbox): restore message editing in conversation details (#815)
  fix(codex): queue a differing model/effort pick as a fresh turn instead of steering (#889)
  fix(channels): focus a moved thread tab in the same task as its placement (#934)
  fix(messages): neutral thread placeholder when the viewer wrote the root (#930)
  test(workflows): set the condition value in one change event (#892)
  fix(agents2): reconnect Retry to native agent-list reload (#921)
  fix(github): stop claiming PR links the pane cannot show (#920)
  Keep Messages selected across its sidebar destinations (#848)
  perf(messages): stop the floating action bar's per-frame rAF loop while a row stays revealed (#938)
  test(inbox): wait for the exact-target reveal before resizing the detail (#888)
  perf(panels): measure the resize handle only when its width can change (#937)
  perf(channels): memoize channel labels and identity name scopes (#939)
  ...

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants