Repository navigation
feat(messages): pin and unpin channel messages - #3993
kalvinnchau wants to merge 18 commits into
Conversation
53e0bd8 to
d20a459
Compare
26425fd to
3cccbb1
Compare
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord recommends changes on 3cccbb1 after a source-only review. Please fix the command retry and pin-state issues below and confirm whether the Pins UI belongs in the default app.
send pin (40010) and unpin (40011) commands from the message menu and the pinned panel when the relay advertises buzz-pins in nip-11. follow the relay-signed pin list (30623) per channel: read once by #d, then kept current by the channel subscription and its replay. show a pinned marker on rows, render message_pinned notices in the timeline, and add a pinned side panel that loads pins with edits applied and refreshes on a jittered 10 minute backstop. allow the command kinds in the broker, native, credential and app agent signers with a one-channel, one-message shape check, and add a pin tool for agents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- subscribe with a stable callback; a failed list read is retried only from the panel try again action - read watched pin lists again in one batched read after a reconnect, dropping unwatched lists - show existing pins and the pinned marker whenever the relay names its author; gate pin and unpin on command support only - reload panel rows on live edits and deletions of pinned messages - page edit and deletion overlays until every pinned message is settled - fold pinned messages with the session signing authority and agent owners - keep only rows the list still names while reloading or after a failure - register one replay listener for pin list updates - drop the unused message id from pin notices Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- read watched pin lists again when their channels start a catch-up head read, which covers a route that recovers while the socket stays up - try a failed list again when a channel is revisited - page edit and deletion overlays over every pin by until, judging page fullness by the relay count and deduping events that share a second; an extra e reference no longer settles a message - reload open panel rows on any deletion in the channel, since withdrawing an edit names only the edit - read pin lists and panel rows with strong consistency Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- page edit and deletion overlays by until and before_id, so one second holding a full page no longer stalls paging and hides older overlays - do not reload open pin rows when a reaction is removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- read relay pin lists with #h rather than #d, since nip-cl names a channel by h and a #d read misses system and unlisted channels Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- when the relay refuses a pin or unpin as too far from its clock, offer no retry and read the list again; a new command is signed only when the person pins or unpins again, since one signed by itself could undo another member's change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- classify a pin or unpin refused as too old, by the relay or by the desktop host before resending, from its error, whatever its delivery state, so an unanswered command retried and then refused stays unknown - offer no retry for it in the message status or the channel outbox; both explain the recovery and read the channel's list again - share the desktop host's too-old text as a constant - expect the thread profile fixture's pin list read by #h - note in the help guide that forum posts cannot be pinned Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- match the refusal without its nip-01 prefix and case-insensitively, since the transport strips the prefix and capitalizes the text it reports - build the relay refusal through acceptPublish in the tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
… refusals nip-pm no longer advertises pins in nip-11. hosts offer 40010/40011 where the relay names itself; a relay without nip-pm refuses them as `restricted: unknown event kind`. the broker answers that refusal for pin kinds as 400 with the relay text, like `invalid:`, so the outbox stores it; other kinds keep the unconfirmed 503. a refused pin shows why in place of retry on the message notice and in the outbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
the fixture relay names itself, so the message menu now offers pin to channel. the broker kinds list gains 40010 and 40011. the context menu may rise to stay in the viewport, so its top is checked against the clamped pointer. the floating test clicks the composer clear of the taller menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
the relay never echoes 40010/40011, so accepted pin commands stayed outstanding: unpin stayed disabled, reload restored them as unconfirmed, and 256 of them blocked every send. acceptance is now their final delivery; the relay-signed pin list reports the outcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a list change reloaded every pinned row, as did any deletion in the channel and any edit of a pin, and an aborted reload left its relay queries running. the panel now keeps loaded rows: a list change reads only new pins, an edit reloads the pin it names, and a deletion reloads only pins whose loaded edit it withdraws, since a deleted pin leaves the relay-signed list. live triggers settle for 250 ms, and one read runs at a time with triggers during it batched into the next. retry and the 10-minute backstop still reload every row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
a pin that is not in the loaded timeline, or has replies, opens as a thread tab, and the pinned panel stayed open below it, splitting the window into three columns. opening a pin now closes the panel first, as opening a message link closes the open channel panel. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
- the agent pin tool gives each command a random client-id, as nip-pm requires, so two commands in one second stay distinct events. - the pinned edit and deletion read names the channel by #h, as the message read does, so the relay's per-filter channel access applies to it. - pin lists are verified by the relay's explicit nip-11 self (workflowAuthority), never the contact key a host may use for relayAuthor. - a replayed pin list no longer counts as a thread reference that forces channel repair. - an open pinned panel reloads its rows when its channel catches up, since a cut replay may miss an edit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
3cccbb1 to
502d3aa
Compare
the relay's message_pinned system message showed every member a "pinned a message" row. it is no longer recognized, so the timeline drops it like any other unknown kind 40099 activity; the pins panel and the message marker show what is pinned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
|
🤖 Addressed the review on
Checks: |
a dm's message menu reads "pin to dm" and "unpin from dm", as does the pins panel's unpin button. a solo chat has one person, so its message menu and header offer no pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
pin lists are verified only by workflowAuthority since 502d3aa, so the fixture that set only relayAuthor never read its list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
wpfleger96
left a comment
There was a problem hiding this comment.
🤖 Two stale-state gaps in the new pin caches, both with inline notes. Neither loses relay data; each leaves the Pinned panel or the pin list showing old state until a later trigger repairs it. Everything else checked out: lists accepted only from the relay's NIP-11 self, overlay paging, the menu toggle, the pin tool, both hosts' refusal paths, and outbox completion on acceptance.
…list reads - an owner's edit of their agent's message applies only once the agent's owner is known. the pinned rows loader records the owner each fold used and reloads a pin whose author's owner changes, so a profile that loads after the pin no longer leaves the pre-edit text. - a pin list read asked for while one is running, as on catch-up or the reread after a too-old refusal, now runs once more after it, since the running read may predate the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Kalvin Chau <kalvin@block.xyz>
|
🤖 Thanks for the review. Both findings are fixed in f53d9d3, and I replied inline:
Each fix has a regression test that fails without it. Both threads are resolved. |
jedwards27
left a comment
There was a problem hiding this comment.
🤖 Review recommendation: changes needed — :bot: Jude’s code review agent
Reviewed: base 4820bfd318d46896d017af1ff21fc38033c315c6 → exact head f53d9d333ff220f809643438681824d5abfbd10a (high risk: signed relay pin commands, live lists, reconnect and user-visible recovery).
Author action (P2): In src/bundled/channels/pins-panel.tsx:137–140, a failed refresh with existing pinned rows renders an alert and stale rows, but no retry. The empty/error branch at lines 105–114 already offers Try again; the hook retains the rows on failure (src/features/messages/use-pins.ts:141–145). Offer an immediate retry in the stale-row alert and protect loaded rows → failed refresh → retry → updated rows at the panel/journey boundary. A Chromium browser journey at this clean head reached a loaded row, delivered an edit, modeled a 429 on refresh and confirmed the alert/stale row without a Retry button (temporary diagnostic control 1/1 passed; removed after recording). This is an observed recovery defect, not a request for evidence alone.
Other contracts checked: member-signed 40010/40011 commands and retry/refusal, relay-authorized 30623 list, catch-up and pin-row refresh. The prior missing workflowAuthority test fixture is fixed. The in-flight list/catch-up race is addressed by a queued post-flight read in src/features/relay/pins.ts:163–166,204–213,234–246; its regression failed at the earlier head and passed at this head. Owner-profile changes trigger affected row reload and subscription cleanup (src/features/messages/use-pins.ts:177–188,209–216). No additional systems defect established in the reviewed delta.
Validation at clean f53d9d3: pnpm check, pnpm build and full pnpm exec vitest run passed on isolated Blox (25,743 passed / 39 skipped, 1,200 files passed); focused changed tests 18/18 passed. GitHub required CI is green at this head. The browser journey above proves the missing action, not a fixed retry path.
Verification ownership / residual risk: Reviewer/native tooling could not compile Cargo on Blox because the configured registry lacked locked cookie 0.18.3; that is not an author defect. A live packaged Desktop and current Mobile pin/unpin/sync/reconnect run against a confirmed deployed pins-enabled relay is not established; release/verification owners should record artifact, app builds and results before merge. Source agreement with merged relay code does not prove deployment. No native or Mobile behavior is claimed here.
I’m leaving a comment rather than exercising GitHub’s Request changes state; the code change above is still needed before this review can recommend merge.
Summary
Channel members can pin and unpin messages, following NIP-PM (block/buzz#9712). The relay side is block/buzz#9729.
40010or40011with oneh, oneeand a freshclient-id. A retry resends the same signed event. The relay never echoes these commands, so the outbox completes one when the relay accepts it.30623event, read and subscribed by#h. Any list not signed by the relay's NIP-11selfkey is ignored. Watched lists are read again when a channel catches up after its route re-establishes.#h. Their edits and deletions are applied as the timeline applies them, using overlays paged with the relay's keyset cursor.invalid: event timestamp too far from server time, or the desktop host's own too-old check): the app does not offer Retry. It reads the list again and leaves any new command to the member.restricted: unknown event kind): the app says the community does not take pins, in place of Retry, on the message notice and in the outbox.restricted:refusal of a pin command as 400 with the relay's text. Other kinds keep their current answer.pinMCP tool. The desktop host's signing policy and the agent controller accept both kinds.docs/buzz-help.mddescribes the behavior.Scope
Validation
pins,use-pins,MessageManagement,OutboxStatus, native transport, broker authority and broker live publication.restricted: unknown event kind: pin kinds get 400 with the relay's text, and other kinds are unchanged. It fails without the broker change.acceptPublish. The full desktop flow was not exercised.src/bundled/channelsshowed intermittent timeouts in channel tests outside this change (CanvasView,ChannelMembersDialog,MemberAdministration,SoloWorkspaces,useConversationTabs.panels). They are not yet attributed and wait on CI.