mirror of
https://github.com/block/buzz.git
synced 2026-11-24 10:12:19 +00:00
e21606bf968b561106d6ca7272d1c6be4031366d
3630 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e21606bf96 |
feat(cli): leave archived identities out of users get --name (#9752)
`buzz users get --name` now leaves out identities on the relay's NIP-IA archive list. `--include-archived` brings them back, each marked `"archived": true`. `--pubkey` lookups always return the profile and mark it when archived. - The list is read by `fetch_archived_snapshot`, the same reader as `buzz agents archived`, so only a kind:13535 event signed by the relay's NIP-11 `self` key (with the NIP-70 tag) counts. A profile that sets its own `archived: true` is not marked unless the signed list names it. - Fail open: if the list can't be read, can't be verified, or takes longer than 5s, results come back unfiltered with a JSON warning on stderr. The search never fails because of it. - Name searches and `--pubkey` lookups read the profiles and the archive list in parallel. A profile error returns at once as the usual single JSON error, without waiting for the archive read or printing its warning. `--owner` with no matching agents returns `[]` straight away. - Documented in the CLI README. Out of scope: the relay and `send`/`dm`. Related: [buzz-app#4021](https://github.com/block/buzz-app/pull/4021) --------- Signed-off-by: Will Pfleger <wpfleger@block.xyz> Co-authored-by: Hayt <211b96e6a2b7f45fd4047988976c7bbbeeda0c15f3ae7b32eec20834b5a55118@buzz.block.builderlab.xyz> |
||
|
|
51b0ea62be |
fix(mobile): skip the emoji picker when its opener is gone (#9820)
On iOS, opening the emoji picker from a context that had already been
unmounted threw `StateError('No ProviderScope found')` from
`ProviderScope.containerOf`. It threw after the picker had taken its
one-sheet-at-a-time guard, so every later emoji picker open in that
session was silently refused until the app restarted.
The message actions sheet hits this: its "+" tile opens the picker on
the long-pressed message row's context, which the timeline can rebuild
away while the sheet is open (the reported crash came from a phone in
landscape, tapping "+" in the quick reaction row).
`showEmojiPicker` now returns early, completing the caller's
`onDismiss`, when its context is no longer mounted, and the guard is
never taken. That tap still opens no picker (the message usually stays
on screen, but its row was rebuilt), so the user has to retry, but later
opens keep working.
### Validation
- Added [an iOS picker
test](https://github.com/block/buzz/blob/fix-ios-emoji-picker-dead-context/mobile/test/features/channels/emoji_picker_test.dart)
that opens the picker from a rebuilt-away context, then checks the
caller's dismissal runs and a later open from a live context still
presents the native sheet.
- Ran the fixed build in an iPhone 17 Pro simulator against a live
community: long-pressed a message, tapped "+" in the quick reaction row,
picked an emoji from the native sheet and saw the reaction land; then
repeated on a second message to confirm the picker opens again (with the
first pick under Frequently used). The simulator can't reproduce the
rebuilt-row race itself; the added test covers that.
### Regressions
None expected. The only behavior change is for an opener whose widget is
already gone, which previously threw and blocked the picker. Mounted
callers take exactly the same path as before.
Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
|
||
|
|
eae69483fd |
fix(push-gateway): retry, don't drop, a delivery replayed while its first attempt is in flight (#9802)
The relay gives up on a push gateway delivery call after 2 seconds and
retries the same `request_id` with a fresh NIP-98 event. A gateway send
can take much longer than that: an FCM token mint has a 15 second
deadline, and the APNs and FCM sends each have a 15 second timeout. A
retry that arrived while the first attempt was still sending hit the
request replay fence and got `404 invalid_grant`. The relay reads a 404
on a retry as "the earlier attempt already finished" and completes the
wake. If the first attempt then failed retryably, nothing ever sent the
wake, and the notification was silently lost.
This change makes the gateway tell an in-flight request apart from a
finished one:
- Admission records the request id as in flight. A terminal outcome
marks it finished, and a retryable outcome releases it, as before.
- A replay of an in-flight id now gets `503
{"status":"retry","retry_after_seconds":5}`. Nothing is sent and no
quota is charged, so the relay's existing 503 path retries with backoff.
- A replay of a finished id still gets 404, so the relay's existing
handling of a finished attempt is unchanged.
Postgres gets a `finished` column on
`push_gateway_delivery_request_replays` (gateway migration 0009,
mirrored in relay migration 0105). It defaults to `true`, and the
gateway writes `false` explicitly on admission. Rows written before this
migration, or by an older gateway during a rollout or rollback,
therefore keep today's behavior. The constant default adds the column
without rewriting the table.
### Validation
-
[`replay_while_first_attempt_is_in_flight_is_retried_not_dropped`](
|
||
|
|
7681371b94 |
fix(mobile): clear the Duo top edge in the Activity header (#9807)
## Summary On iPhone Duo, the Activity page's custom header put Close and the "Activity" title 8 points below the window's top edge. The Duo panes report no top safe area beside the strip, so the 8-point row padding was the only clearance. This happened on the cover display and in the inner display's wide layout. Other Duo pane headers already reserve 24 points above their 44-point controls (`FrostedAppBar` and the native bar in `IosNavigationBar.swift`). Activity now does the same: - `activity_page.dart`: on iOS with a Duo strip, the header row's top padding is `duoHeaderTopClearance` (24). Otherwise it stays `Grid.xxs` (8). The bottom padding stays 8. - `duo_toolbar.dart`: adds `duoHeaderTopClearance = 24`. - `frosted_app_bar.dart`: uses the constant in place of its literal `+ 24`. No value change. **Pareto:** better on the Duo cover and in the wide layout. No change on regular iPhones (no strip), Android, or the Duo inner display in portrait (no side strip; it already has an 82-point top inset). No new rebuild dependencies: `strip` was already read through `DuoToolbarScope.maybeStripOf`. ### Related issue None found. ### Testing - New widget test `Activity header clears the top edge on …` checks the header row's top edge on the Duo cover (466×678, right strip), the Duo wide layout (951×669), an iPhone (62-point top inset), and Android. It fails on `main` for both Duo cases (8, expected 24) and passes with this change. - `dart format --set-exit-if-changed .` and `flutter analyze`: clean. - `flutter test` (mobile): passes on macOS. - iOS 27.2 simulators, measured in points from the top edge: | Device / layout | Before | After | |---|---|---| | Duo cover, Close and title row | 8 | 24 | | Duo wide layout, title row (Close in the rail) | 8 | 24 | | iPhone 18 Pro | 70 | 70 | #### Before / after Captured on iOS 27.2 simulators. Before is `main` at `9c0bcd6239`, after is this branch at `4400d021b`. In each pair, before is on the left and after is on the right. Duo cover display: open Activity from the bell, hold, then Close. https://github.com/user-attachments/assets/5bda190c-cadf-44a8-9a8e-58bc68838e7b     🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Stephen Barnes <799470+smbarne@users.noreply.github.com> Co-authored-by: Stephen Barnes <799470+smbarne@users.noreply.github.com> |
||
|
|
9f49216f8b |
feat(test-client): add buzz-acceptance relay probe (#9767)
## Summary
Adds `buzz-acceptance`, a third binary in `buzz-test-client` (next to
`buzz-loadgen`). One run checks the relay's core jobs once against one
relay and exits. It is meant to run on a schedule (for example a
Kubernetes CronJob) or as a deployment step (for example an Argo
Rollouts `job` analysis against the canary Service).
Checks, in order:
| Check | Stages |
|---|---|
| `relay_info` | `nip11` (the response must be a NIP-11 document) |
| `connect_auth` | `ws_connect`, `nip42_auth` |
| `channel_create` | `create` (a private, per-run channel with a 1 h
TTL) |
| `publish` | `ok` |
| `fanout` | `connect_second`, `subscribe`, `publish`, `receive` |
| `history` | `req_eose` (the published event is in a fresh REQ, intact)
|
| `access_control` | `unauthenticated_rejected`,
`pubkey_mismatch_rejected` |
| `cleanup` | `connect`, `delete_channel` (on a fresh connection) |
`access_control` passes only on the relay's own denial reasons:
`auth-required:` for a write on a socket that sent the NIP-FI assertion
but skipped NIP-42 AUTH, and `invalid: event pubkey does not match
authenticated identity` for a write signed by another key. A closed
socket or any other reason fails the stage.
`fanout` reads the listener while the publish waits for its OK, so
`receive` measures delivery (publish → arrival on the second socket),
not the publisher's acknowledgement.
`fanout` and `history` verify the event they get back (`Event::verify`:
id and signature against its content). An event the relay corrupted
under its original id fails the stage.
A channel is never stranded on purpose. If the create times out or the
socket drops, the probe keeps the channel id and `cleanup` deletes it
over a fresh connection. A failed cleanup names the channel. The TTL
archives any channel a killed run leaves behind.
Output:
- A JSON report on stdout: each check's result, the stage that failed,
and each completed stage's duration.
- Optional DogStatsD metrics (`--statsd-addr`): `<prefix>.runs`,
`<prefix>.run.seconds`, `<prefix>.check.runs{check,result,stage}`,
`<prefix>.check.seconds{check,result}`,
`<prefix>.stage.seconds{check,stage}`. Every series also carries
`relay_version` (from NIP-11) and any `--tag k:v`.
- Exit code 0 when every check passed, 1 when a check failed, 2 when the
probe could not run or send its metrics.
A check whose prerequisite failed is reported as `skipped`, so each
failure is counted once, at its cause, and every run reports the same
set of checks.
### NIP-FI
On a relay that enforces NIP-FI, pass `--assertion-file` (a regular
file, at most 16 KiB; a FIFO or larger file fails the connection at
once). The probe reads the file before every connection and sends it as
`Nostr-Federated-Identity: Bearer …`. Another process (for example a
sidecar) keeps it fresh. How the assertion is minted is deployment
configuration and stays out of this repo.
## What got simpler
Nothing got simpler. This adds one binary. It reuses `buzz-ws-client`
and the crate's existing dependencies, and adds no new crate and no new
dependency (`clap` gains its `env` feature).
## Testing
- Unit tests drive the probe against a scripted relay: a publisher OK
that arrives 600 ms after delivery (`receive` stays under 300 ms), a
refusal with the wrong reason and a closed socket (both fail
`access_control`), an unanswered create and a socket lost after create
(both still delete that exact channel), and a failed cleanup (the error
names the channel). Also: metric lines and tags, one datagram per line,
stage timeout, assertion file limits, and an unreachable relay.
- `tests/e2e_acceptance.rs` runs in CI's Relay E2E lane against a live
relay. It runs the shared runner and the binary itself: exit 0 with JSON
and datagrams on a pass, exit 1 when a check fails, exit 2 when the
probe cannot run.
## Follow-ups (not in this PR)
- Image and CronJob / Rollouts wiring.
- Before the probe can gate a canary: a dial override that keeps the
canonical Host and signed relay URL (like `buzz-loadgen`'s
`connect_addr`).
- Before it can gate a promotion: a build identifier from the relay.
`relay_version` is the Cargo package version, which several image builds
can share.
- Confirm the delete took effect: read the channel back after
`delete_channel` returns `OK true`. This needs a stable relay read
contract for deleted channels. Until then the 1 h TTL bounds any channel
a silent delete failure leaves behind. The scheduled deployment can also
sweep stale probe channels at start.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz>
Signed-off-by: Luke Tornquist <tornquist@squareup.com>
Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
e95d7a9509 |
feat(relay): add pinned messages (nip-pm) (#9729)
## Summary Implements NIP-PM on the relay. A member signs one command to pin or unpin a message, and the relay publishes the channel's pins as one relay-signed list. The NIP is `docs/nips/NIP-PM.md`, added in #9712. - **Kinds.** `40010` pin and `40011` unpin commands (one `h`, one `e`, empty content) and the relay-signed `30623` pin list, one addressable event per channel, newest pin first. The list carries the channel in `d` and in `h`. - **Ordering.** Every writer of a channel's list takes that list's replacement lock, so pins, unpins and deletes of pinned messages apply one at a time. A command, the new list and the notice are stored in one transaction. - **Idempotency.** A command sent again answers `duplicate:` and is not applied again. Pinning a pinned message or unpinning an unpinned one is accepted and changes nothing. - **Validation.** The author must be able to post in the channel, and the channel must not be archived. A pin target must be a live message of that channel. A channel holds at most 250 pins. - **Deletes.** A delete by the author, the owner of the agent that wrote the message, a channel admin or a relay admin removes the message from the list in the deleting transaction and publishes the new list. A delete removes its messages first and then takes the list locks in channel order, rewriting each list once. Each list write records its timestamp, and a delete reads that first: a delete of a message that is not pinned locks only its own month of `events`, plus the list month when the channel has a list (#9743). The pin list itself cannot be deleted. - **Notice.** A pin that changes the list posts a `message_pinned` system message naming the member, the message and the command. - **Reads.** The list is readable by those who can read the channel. Clients read it with `#h`, which names the channel under NIP-CL, and each new list is delivered to `#h` subscribers. - **Configuration.** None. A relay running this build accepts the commands; it does not advertise pins in NIP-11. - **Threads.** A pin or unpin command cannot be the parent of a reply or the target of an edit or a vote. - **Account erasure.** Content cleanup removes a member's pin and unpin commands. One under an hour old keeps its ID, timestamp, kind and channel so that a resend stays a duplicate. The leader's periodic maintenance tick removes those records once the command is an hour old. `docs/operator-user-account-retention.md` describes this. ### Related issue N/A. #8809 is an earlier draft of message pins with a different event model. ### Testing - Postgres-backed store tests for the list writes: ordering, concurrent pins, resends, the limit, deletes, the lock order of a delete of several messages, the partitions a delete locks, the refusal to delete the list, erasure records and their expiry across communities. - Postgres-backed handler tests through ingest and REQ: the pin and unpin journey with notices and live delivery, who can read the list (private channel, DM and an unlisted channel read by a non-member), every refusal, a reply to a command, and deletes that rewrite the list. - `e2e_channel_pins` runs over WebSocket against a relay and is added to the relay integration job. - Run against a local relay started with no pins configuration: the end-to-end test. On an earlier revision, the periodic tick removed expired erasure records from an archived channel while leaving younger records, live commands and other kinds. - `cargo fmt --check`, clippy with warnings denied on the touched crates, and the file-size check. - `just test-unit`, which includes the buzz-db source-policy tests. --------- Signed-off-by: Kalvin Chau <kalvin@block.xyz> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> |
||
|
|
9c0bcd6239 |
Align Duo chat headers, inset Home selections, and fix received photo-stack swipes (#9795)
- In unfolded Duo portrait, place the live chat avatar and name together beside Back. Align the Messages and Activity headers with the status controls and keep the filters full width. - Center the stacked avatar and chat title over the sticky date with the Duo rail on either side. - Give Home selections rounder corners and a shared 12-point outer gutter for channels, DMs, and Solo chats. Preserve icon and label alignment. - Mirror drag distance and flick velocity for received photo stacks so a rightward swipe advances the stack. The combined release preview was installed and checked on a physical Duo. Widget tests cover the portrait header geometry, filter width, and return to landscape. ### Portrait layout references Cropped headers from the earlier Duo preview used as the design reference.   ### Simulator snapshots The fixtures use sample content and a 76-point right rail inset.   --------- Signed-off-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz> |
||
|
|
97bec174a4 |
fix(mobile): only dot channel-sent replies in the reader's threads (#9696)
## What changed Mobile matches block/buzz-app#3938. A reply someone sends with **Also send to channel** used to light the channel's attention dot and count toward the app icon badge for everyone in the channel, even people who never joined that thread. Now it follows the same rule as any other reply: - **Dot** if it mentions you, or it's in a thread you're part of (you started it, replied in it, or follow it). - **Bold only** otherwise, like a new top-level post. It no longer counts toward the app icon badge. Reading is unchanged. These replies are still marked read individually, as desktop reads them, so reaching the bottom of the channel doesn't silently mark them read on one device but not the other. ## How - The "is this one of my threads" check that already decides which ordinary replies count is now shared, and channel-sent replies go through it when deciding attention. - On mobile, "earns a dot" and "is read by reaching the bottom of the channel" were one flag. Dropping a channel-sent reply's priority would have also changed how it gets read, drifting from desktop. The dot now comes from its own field; every other kind of message gets exactly the same dot and read behavior as before. ## Tests New cases drive live events through the channel list. For each, they check the observed unread entry, whether its thread shows in Activity, the app icon badge, the channel list's bold vs dot, and reading: - reply sent to the channel in someone else's thread: bold, no dot, not in Activity, counts as ordinary unread on the icon (same as a top-level post) - same, but mentioning the reader: dot, in Activity - in a thread the reader follows: dot, in Activity - in a thread the reader started: dot, in Activity - in a thread the reader replied in: dot, in Activity In every case, a channel catch-up mark leaves the reply unread and its own read mark clears it. The "someone else's thread" case fails on `main` (it gets a dot). The pre-push mobile checks (format, analyze, full mobile test suite) passed on this head. ## Known gaps (not changed here) - Mobile only knows the threads you're part of from posts it has seen on this phone. A fresh install doesn't know about older threads you joined elsewhere, and a reply's first classification sticks even if later loading shows you joined that thread. Desktop looks these up on the relay. - Mobile has no explicit "Unfollow" for a thread you started or replied in (the menu only offers Follow there), so you can't silence one the way desktop can. This applies to all replies, not just ones sent to the channel. - A reply sent to the channel still counts as unread in a muted channel. That was already true before this change. No screenshots: no visual element changes, only which existing state (bold or dot) a channel shows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz> |
||
|
|
7f88572be8 |
docs: point community invite at buzz.communities (#9797)
## Summary Point the README's community invite at the Buzz community (`buzz.communities.buzz.xyz`) instead of the feedback community, and call it "Buzz community". ### Related issue N/A. No existing issue or PR found. ### Testing Docs only. `curl` on the new invite URL returns 200. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Diem Nguyen <diem@squareup.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
14e5ea7cc4 |
Mobile: refine section filters and ordering in Messages (#9796)
## Summary Give Messages sections a common options sheet for sorting, filtering and ordering. Active sections let people choose a time window. Channel and DM sections can reveal filtered rows in place with **Show more** and collapse them with **Show fewer**. Reordering saves a device-local order for the current account and community. Failed activity lookups keep affected channels visible. The recovery toast offers Retry and dismisses when activity loads. On iOS the sheet dims the Messages header along with the list. ### Related work #9707 explores a count-based disclosure. This change uses the section’s unread or activity filter. ### iOS snapshots | Section options with an active filter | Reorder sections | | --- | --- | |  |  | ### Rename a section Tap the emoji beside the name to open the picker. Set saves both fields, including an emoji-only change.  ### Activity recovery and section order Unfiled Solo chats support local **Show more** and **Show fewer**, including offline. Failed activity lookups retry automatically up to three times with jittered backoff while Messages is visible and connected. **Retry** stays available after that budget is exhausted. The notice dismisses on recovery. Reorder supports drag handles and keyboard arrow keys. Saving preserves the position of an empty Starred section and checks for a newer order. Each signing identity has its own saved order per relay. ### Testing Exercised filtering, reorder and dismissal in the iOS simulator. The preview was also tested on iPhone Air. At `6135e314f3`, Flutter analysis and the full pre-push mobile checks passed (5,613 tests passed, 71 skipped). Widget regressions cover offline Solo disclosure, retry exhaustion, route visibility, keyboard reorder, large text, and editor cancellation. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> |
||
|
|
5268caa866 |
feat(push-gateway): mint FCM tokens through AWS workload identity federation (#9692)
## Summary Block's GCP projects forbid service account keys, so the push gateway can now get its FCM access token by federating its AWS identity (Google workload identity federation), with no key file. - `BUZZ_PUSH_FCM_SERVICE_ACCOUNT_PATH` is renamed `BUZZ_PUSH_FCM_CREDENTIALS_PATH` (no deployment sets it yet). The file is dispatched on its JSON `type`: `service_account` keeps today's JWT flow; `external_account` is Google's standard AWS credential configuration, the file Block's `identity-federation-aws` Terraform module generates. - Only the minting step changed. `TokenSource` caching, refresh, backoff and the Rejected/Unavailable split are as they were. - A federated mint: AWS credentials (EKS Pod Identity, IRSA or static env keys; no EC2 metadata), a SigV4-signed STS `GetCallerIdentity` subject token, Google STS, then `generateAccessToken` for the FCM scope. One 15 s deadline covers the whole chain. - Faults: network errors, 5xx and 429 on any hop are Unavailable; other 4xx are Rejected. - Startup checks the file's shape and the AWS environment but calls neither AWS nor Google, so an outage can't stop the gateway from serving iOS. The first mint's result is logged once. - Helm: `android.fcmServiceAccount` is renamed `android.fcmCredentials`, mounted as `credentials.json`. ## Validation - New tests drive `TokenSource` against fake AWS, Google STS and impersonation servers: the full chain, each hop's failure classification, a failed refresh keeping a valid cached token, the overall deadline, and config rejection cases. - SigV4 known-answer tests use AWS's documented example credentials, checked against an independent implementation. Checked live against the dev Firebase project from a local AWS identity: the federated mint succeeds and FCM accepts the resulting token. Not yet run from a gateway pod. --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz> |
||
|
|
e2bbd8430c |
feat(mobile): report explicit diagnostic errors (#9673)
Step one of [mobile diagnostic
reporting](https://github.com/block/buzz/blob/main/docs/mobile-diagnostic-reporting.md),
second piece: the explicit error reports the spec lists, through the
reporter added in [#9613 diagnostic reporting
module](https://github.com/block/buzz/pull/9613). A build without a
destination (every build from this repository alone) still reports
nothing.
### What's in it
Each report carries its `operation` tag, the error's type and stack
trace, and no error text (the filter replaces it).
- **Event subscriber (`eventSubscriber`):** a subscriber that throws
while the relay session delivers a buffered batch is reported, and the
rest of the batch is still delivered. In a build without a destination
the error still surfaces as uncaught, so it fails the test that hit it
and prints in development, as before. Before, one throw dropped the rest
of the batch, and those events never came back because their delivery
keys were already recorded.
- **Relay frames (`relayFrame`):** a frame the socket can't decode, or
whose body isn't a JSON array, is reported instead of silently skipped.
- **Relay queries (`relayQuery`):** an HTTP query body that can't be
decoded, including the read-state snapshot.
- **Invalid-request rejections (`relayRejection`):** an `OK false` or
`CLOSED` whose reason starts with `invalid:`, reported as a fixed
`RelayInvalidRequest` with no relay text, including an `OK` with no
pending publish (a typing indicator, or a reply after a timeout).
Refusals the app handles as expected outcomes (an archived channel, an
Unarchive of a channel that is no longer archived, an open channel name
that is taken, an agent whose `policy:` refuses being added, a sole
owner's Leave refused as the last owner, a guest's Add Members refused
because only members can add people, an event whose timestamp is outside
the relay's window, so a wrong device clock does not report every
publish) are left out. The long-lived relay session, the short-lived
sockets (hosted admission, the self-hosted probe, one-shot publishes
such as agent registration and push tombstones) and the account
assertion requests made for a community's key (relay access and push
stop assertions) report frames and rejections the same way, except while
reports name a member other than the key they sign with. A removed or
inactive community's tombstone, or the probe of a community being
joined, then reports nothing rather than naming the wrong member. With
no member set (first run, or after the last community is removed) it
reports under the install identifier.
- **Account responses (`accountResponse`):** a Builderlab account
response that isn't a JSON object, or a 2xx exchange or `/v1/auth/me`
response missing its credential, subject or expiry. Non-2xx statuses are
expected outcomes and aren't reported.
- **Push gateway responses (`pushGatewayResponse`):** a malformed push
capability descriptor from the relay. A relay that leaves
`supported_extensions` out or sends none has no push and isn't reported,
and a fetch that finishes after a community switch has begun isn't
reported either, since it would name the next member. Push gateway
replies aren't reported yet.
- **Stored data (`storedData`):** a saved community list that can't be
read back.
- **Member on switch:** switching communities now looks the new member
up in storage, not in the provider's list, which can still be the
previous one while it reloads after sign-in. It reads storage before
tearing anything down, so a failed read leaves the switch unchanged and
retryable.
- **Filter:** also drops a report's additional data (`extra`). Nothing
sets it today.
- The spec's status line now says what is implemented.
- Event delivery moves from `relay_session.dart` into a part file,
unchanged apart from the subscriber guard, so the session stays under
its size limit.
### Regressions
None expected: each change only adds a report where an error was already
caught or skipped. The one behavior change is that a throwing event
subscriber no longer costs the rest of its batch.
### Validation
Added tests for each report site (relay session, socket frames, one-shot
publishes, read-state snapshot, closed-reason policy, account client,
push descriptor and capability provider, community storage), for the
relay session (member changed mid-request), one-shot sockets and
assertion requests reporting nothing while another member is set and
reporting with none set, for the member on switch and a switch whose
read fails then retries, and for the filter dropping additional data and
leaving a message-less event without one.
Full-app run on an iPhone 17 Pro simulator at
|
||
|
|
03d09e20e3 |
fix(mobile): keep the agent poster over a failed iOS player (#9693)
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz> |
||
|
|
47c9a672d7 |
perf(push-gateway): evict the oldest signed-call window without scanning (#9799)
The push gateway's signed-call limiter keeps one counter per attested key, capped at 100,000 keys. Once the map was full, every call from a key not already in it scanned the whole map (once to drop expired windows, again to find the oldest), all while holding the limiter's lock. Under heavy load from many new keys, that serialized each signed call behind a 100,000-entry scan. The limiter now keeps a queue of window starts, oldest first, and evicts from its front. A key whose window restarts leaves a stale entry behind, which eviction skips; the queue is compacted once stale entries make up half of it, so a call stays O(1) amortized. Rate-limit behavior is unchanged, except that a full map now drops one oldest window per new key instead of every expired window at once. The map and the queue share one copy of each key; the queue can reach about twice the map's entries before compaction, so memory stays bounded. Follow-up from #9562. ### Validation | 1,000 new keys on a full map (release build) | Time | | --- | --- | | Before | 277 ms (about 0.28 ms per call, under the lock) | | After | 0.11 ms | - [`a_full_map_drops_the_key_with_the_oldest_window`](https://github.com/block/buzz/blob/push-gateway-limiter-eviction/crates/buzz-push-gateway/src/signed_call_limiter.rs) checks that eviction picks the oldest window. - [`eviction_skips_a_restarted_window`](https://github.com/block/buzz/blob/push-gateway-limiter-eviction/crates/buzz-push-gateway/src/signed_call_limiter.rs) checks that eviction skips a stale entry and keeps a key whose window just restarted. - [`restarted_windows_do_not_grow_the_queue`](https://github.com/block/buzz/blob/push-gateway-limiter-eviction/crates/buzz-push-gateway/src/signed_call_limiter.rs) checks that compaction bounds the queue when one key keeps restarting its window. --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz> |
||
|
|
d647c9fd98 |
Refine iOS composer and transcribe recordings into drafts (#9574)
Refine the iOS composer with 40-point glass controls, native attachment menus, persistent emoji access, and selected-text formatting. The mic now transcribes recordings on device into an editable, unsent draft; Dictation has no five-minute recording cap or timer label, and its waveform fills the space between the controls. Voice note remains available in attachments with its five-minute cap. Unsupported devices fail before recording, and audio is retained until the draft is durably saved. Stopped dictation remains recoverable across editor teardown; failed retention and cleanup can be retried. Recovered transcripts are inserted only once across navigation or restart, preserving live exact mention bindings. Preserve selection handles over glass with animated avatars. Reduce the conversation fade to 100 points above the keyboard and transition continuously to 180 as the keyboard closes, without a first-frame jump when opening; Home is unchanged. Validation: 5,117 mobile tests and 27 crypto tests pass; analysis passes. Prior native suite on iPhone 16/iOS 26.5: 119 pass, one pre-existing expected failure, zero unexpected failures. Physical Air preview approved; simulator selection/dragging and attachment flows exercised. Fixed the native navigation test's timing race and a community-cache cleanup test that checked a parent directory before its asynchronous removal completed. Repository-wide `just ci` previously stopped in unchanged `buzz-test-client` load-generator tests; new-head hosted checks are pending. Snapshots: production composer in an iPhone Air simulator fixture with fictional conversation text; Photos snapshot retained from the attachment preview. | Composer | Attachments | Photos | | --- | --- | --- | |  |  |  | --------- Signed-off-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Signed-off-by: Tom Brow <tomb@squareup.com> Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz> Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz> |
||
|
|
a45f52a95c | fix(mobile): recognize agents without NIP-OA in Huddles (#8545) | ||
|
|
786726907c |
test(relay): cover member-cache invalidation routes and refill orders (#9748)
## Summary Add 54 cases that verify a relay cache refill cannot restore stale channel membership after invalidation. The cases cover stale grants and denials, reader and community isolation, and three orders in which reads can finish. The publish-wrapper cases exercise the local cache drop. The receiving handlers are tested separately. Both unit-test runners select the new cases. ### Related issue Test coverage for #9735 and #9742. ### Testing The read-cache lane passed all 26 tests on the reviewed tree. Both runners selected all three new tests. The draft will remain open while repository CI and human confirmation are pending. For manual verification, run `cargo test -p buzz-relay --lib state::tests::member_channel_invalidation_tests:: -- --nocapture` and expect three passes. Generated with Codex Signed-off-by: Brad Seiler <seiler@squareup.com> |
||
|
|
a79cbb4664 |
perf(mobile): stop re-scanning the unread backlog on channel list rebuilds (#9780)
## Summary Scrolling the mobile channel list hitched repeatedly after the app had been closed for a long time. To decide which rows are bold and which get a dot, the channel list read every unread message held in memory, for every channel, on every rebuild. After a long absence the unread catch-up holds up to 1000 messages per channel, so each list update cost more than a frame. This change makes a list rebuild independent of the backlog size: - A channel's messages stop being read once its bold and dot state is decided. - Each channel's result is reused until its messages or the read state change. A new message re-reads only its own channel; reordering or filtering the list re-reads nothing. Which rows end up bold or dotted is unchanged. ### Related issue N/A. None found. ### Testing Before (left) and after (right), same script on an iPhone 17 simulator: 200 channels each holding 1000 unread messages, a list update every 150 ms, and a scripted finger (the crosshair) dragging at a steady 420 px per second. https://github.com/user-attachments/assets/07b39b61-406f-4b4b-baca-69aa5be42db7 | | Before | After | |---|---|---| | Frames drawn in the 11-second drag | 279 | 499 | | Frames over 25 ms | 127 (46%) | 92 (18%) | | Median frame | 21.1 ms | 17.2 ms | | Worst frame | 116.8 ms | 65.2 ms | The recording uses scripted data in a debug build, which drops some frames even with no list updates, so the "after" side is not perfectly smooth. Whole frame after one list update, 200 channels, in a widget test on a Mac (not a phone): | Unread messages held per channel | Before | After | |---|---|---| | 0 | 13.3 ms | 12.7 ms | | 300 | 16.5 ms | 6.8 ms | | 1000 | 37.4 ms | 6.6 ms | - New tests in `channel_unread_test.dart` compare the new pass with a copy of the old full scan across a table of cases and 600 random steps of adds, deletions and read marks, and count messages read to guard the early exit and the reuse without timing. - `flutter analyze` and the mobile channel and home tests (2,983) passed with these two commits on `8827f986e43`. They were not rerun after the rebase onto current `main`, so CI is the check for that. - Not run on a phone or against a real community. Worth a close look in review: the reuse depends on every place that changes the stored unread messages marking that channel as changed. The new tests drive this through a stand-in, so they do not prove each real call site does it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: mtoohey <mtoohey@squareup.com> Signed-off-by: Matt Toohey <contact@matttoohey.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
ee4a6ed6b6 |
feat(mobile): restore the iOS share extension in the build (#9783)
Restores the iOS share extension target that #9489 unhooked from the Runner project because release builds couldn't sign it yet. Release signing for the extension's bundle identifiers is now configured, so this is a straight revert of that commit. No visible change beyond the extension reappearing in the iOS share sheet, as it did after #9433. Signed-off-by: Tom Brow <tomb@block.xyz>mobile-v1.5.0-rc.6 |
||
|
|
a303d7d5b5 |
fix(mobile): send Siri Bestie messages without confirmations (#9779)
Saying "Message my Bestie" to Siri (or running it from the Action button or Shortcuts) now sends the dictated message straight away. Siri no longer asks "Send … to <Bestie>?" before sending or shows a "Sent." dialog afterward. The Bestie's display name was looked up only to word that confirmation, so that lookup is gone too: the Flutter side no longer preloads the Bestie's profile or returns its name, and the bridge's `confirm` callback is removed. ### Regressions - A misheard message, or a Bestie changed on another device that this one hasn't synced yet, now sends without a chance to cancel. We accept that: the point of the shortcut is a hands-free send, and the message still appears in the Bestie DM, where it can be deleted. - This includes runs while the phone is locked and Shortcuts automations that supply the message: both send immediately, by design. - The community-switch guard stays: a Bestie looked up in one account or community still can't be sent to from another. - Nothing outside the Siri intent changes. ### Validation - The app code at this head (the last commit only touches a test) is built into a Buzz Dev development build installed on an iPhone 16e. The Siri flow itself has not yet been run on that build. - Updated [quick_send_test.dart](https://github.com/block/buzz/blob/tomb/siri-no-confirm/mobile/test/features/channels/quick_send_test.dart) for the `bestie` reply without a name. - No before/after captures: the change is in Siri's own UI, which can't be driven or recorded in the simulator. --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz> |
||
|
|
34c8f5c7a5 |
feat(mobile): add Dart notification body formatter (#9556)
Adds a pure Dart function, `notificationBody`, that turns a message's Markdown content into the plain-text notification body defined by [ADR 0002](https://github.com/block/buzz/blob/main/docs/adr/0002-notification-message-text.md). It is a port of the Swift `BuzzPushNotificationResolver.previewBody` in `BuzzPushKit`, which today is the only implementation. Android notifications will be built from the app's Dart code, as in the [Android push design](https://github.com/block/buzz/pull/9555), and will reuse this function so the body reads the same on both platforms. Nothing calls it yet and the Swift side is unchanged. Notes on the port: - The cap stays at 256 UTF-16 code units, the same as iOS (the fixtures set `maxLength` to 256). - Dart's regex engine differs from the ICU one the Swift code uses (`\s`, `.` and `$`), so the patterns spell those out to keep identical results. Trimming also matches Swift's `whitespacesAndNewlines`, which trims U+200B and keeps U+FEFF, where Dart's `trim` does the opposite for both. - Truncation counts whole characters (extended grapheme clusters) via `package:characters`. ### Validation - A table-driven test runs every case in `test-fixtures/notification-body.json` (47 cases) and checks the fixture's `maxLength` against the function's cap. - Added tests: 8 rows in the shared fixture pin the ICU details the port must match. U+000B and U+0085 beside a marker keep it, U+000B and U+000C inside a run keep its markers, U+200B is trimmed at the edges and doesn't count toward the cap, and U+FEFF at the edges is kept. The Swift fixture test runs them too and passes them unchanged. - Proved falsifiable: with code-span and fence handling disabled, 18 fixture cases fail; restored, all pass. - `just mobile-install mobile-check mobile-test` passes. ### Regressions None: new code that nothing calls yet. The Swift formatter is untouched. Its fixture test now also runs the 8 new rows and passes them unchanged. --------- Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> |
||
|
|
5e8fa368a4 |
fix(mobile): hand message action menu scrolling off to sheet dismissal (#9760)
## Summary On mobile, the message action menu is a modal bottom sheet whose body scrolls when the actions overflow (long menus, large text sizes). Before this change, dragging down inside the body only scrolled or bounced the content: the sheet itself could be pulled down only by its handle. Now a downward drag in the body carries on into pulling the sheet down once the content reaches its top, in the same touch, and the sheet can be dismissed that way. - **Handoff in both directions.** Drag updates are split between the content and the existing modal route. Dragging down past the top of the content moves the sheet; reversing without lifting restores the sheet first and then scrolls the content again. - **Release policy is the stock sheet's.** If the finger has displaced the sheet at release, downward velocity strictly above 700 px/s closes it; otherwise it closes when it has been pulled more than half its height, and settles open if not. Where the gesture began, and whether it scrolled content on the way to the top, does not matter. - **Guards against accidental dismissal:** - a release with the sheet not displaced by the finger never closes; - ballistic and programmatic scrolling cannot start a sheet drag, so a content fling that reaches the top after the finger lifted stops there; - carried scroll momentum is not added to the release velocity; - a slow return across the top that pulls the sheet less than half way settles open; - an upward release velocity keeps the sheet open. - **Unchanged:** handle and barrier behaviour, reactions, cancellation recovery, reduced motion, and the action/focus contracts. The handoff lives in a shared widget, `mobile/lib/shared/widgets/modal_scroll_handoff.dart`; `message_actions.dart` changes by three lines to use it. `docs/mobile-message-action-scroll.md` records the design contract and a manual native checklist. ### Related issue N/A. None found (searched issues and PRs for the message action menu dismissal and scroll). ### Testing Run at `558a79710`: - `just mobile-check`: passed (format; analyze: no issues). - `just mobile-test`: passed (5462 Flutter tests, 71 skipped; 27 crypto tests). - `just file-size-check`: passed. - Restoring the previous release rule fails 12 of the updated tests, including all four message action journey variants. Coverage: the message action journey (2x text scale, iOS and Android platform settings) drives the production sheet with timed pointer events; the shared widget tests cover the release table at several scroll offsets, pointer flicks on both platforms, parity with the stock sheet drag around both thresholds, trailing bounce on short menus, cancellation and interruption. **Simulator recordings.** Both videos are side-by-side captures from the iPhone 17 simulator (iOS 27.2, text size `accessibility-large` so the menu overflows). Each side replays the same touch script. Scroll-to-dismiss handoff. Left: base (`9bcb3e45a`), the body only bounces and the sheet never moves. Right: branch at `23c31e2e1`, the same touches pull the sheet down, restore it on reversal, and dismiss it on a slow drag past half and on a flick. https://github.com/user-attachments/assets/09b0cfc2-ed61-4822-8b35-b80d0f47e830 Scroll up slightly, then swipe down hard. Left: `23c31e2e1`, the menu settles back open after both swipes. Right: `558a79710` (branch head), the same touches close it, as a new touch and without lifting; the final slow return across the top stays open on both sides. https://github.com/user-attachments/assets/068faff4-a4d4-478f-aaf4-fc65c644632f **Limits of this validation:** - The touches were scripted synthetic touch events (linear motion, exact timing), not a human finger. - Both sides ran a dummy-data harness that calls the production `showMessageActions` for a placeholder message, not the real channel page. The harness is not part of this PR. - Android, a physical device, VoiceOver and reduced motion were not exercised natively; they are covered by widget tests only. - The right side of the first video was built from `23c31e2e1`, one commit before the branch head. `558a79710` changes only releases with a fast downward velocity after content was scrolled. The gestures in that video are slow or held releases and gestures that start at the top, which resolve the same way under both rules; this follows from the release rule and was not re-recorded. - A human has not yet confirmed the behaviour by hand. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Matt Toohey <contact@matttoohey.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> |
||
|
|
8d4b30176b | feat(cli): add many channel members per kind:9000 event (#9738) | ||
|
|
7e94503fe9 |
Stop using the unused delivery_log and subscriptions tables (#9746)
## Summary `delivery_log` and `subscriptions` came with the initial schema for a delivery feature that was never built. No code has ever written to them. This PR removes every reader, writer, partition-manager entry and deletion selection, so a follow-up contract migration can drop both tables (`docs/database.md` Rule 5: drop only after the release that stops using a table is fully deployed). - **Partition manager:** manages `events` only. It no longer creates or audits `delivery_log` partitions. - **User deletion:** the content, account and profile handlers no longer select, delete or recheck rows in either table. - **Community deletion:** both tables move from `EXPECTED_SCOPED_TABLES`/`PURGE_SCOPED_TABLES` to a new `RETIRING_SCOPED_TABLES` list. The catalog accepts each one present or absent. The purge deletes its rows only while it exists. `validate_approved_schema` accepts a frozen retiring table that has since been dropped, and no other missing table. Without this, every community deletion would fail its exact catalog check once the tables are gone. - **Docs:** a short "Retiring a tenant-owned table" section in `docs/database.md`, plus partition-monitoring and cleanup docs. The tables, their schema files, `.pgschemaignore` entries and the partition primary-key lint exception stay until the drop migration. ### Rollout 1. Deploy this release to every relay, deletion executor and operator CLI. Older binaries fail community deletion's exact catalog check after the drop. 2. Then ship the drop migration and remove the schema entries. Operators with external tooling that expects `delivery_log` to exist must update it first. The partition audit stops emitting `buzz_partition_audit_*` series with `table="delivery_log"`. Alerts keyed on that label will go quiet. ### What got simpler Two tables' worth of code paths are gone: partition management, the audit, and five deletion handlers stop special-casing them. The follow-up removes the tables and the `RETIRING_SCOPED_TABLES` entries. ### Testing On a remote workstation at `3675ff17`: `cargo fmt --check`, `clippy -D warnings` for buzz-db, buzz-deletion and buzz-relay (all targets), unit tests for buzz-db (lib and tests), buzz-deletion and buzz-relay bins, and `scripts/postgres-test-run.sh` for buzz-db partition/deletion/migration tests (294 passed) and all buzz-deletion Postgres tests (44 passed). The new tests cover: retiring tables purged and verified while present; a request inventoried before a real `DROP TABLE` still purges and verifies; `validate_approved_schema` tolerates only retiring tables vanishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Luke Tornquist <tornquist@squareup.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8827f986e4 |
mobile: follow desktop's unified sidebar workspaces (#9745)
Mobile Home now reads desktop's unified sidebar from block/buzz-app#3791 and shows the same workspaces, filings, icons and section order as the desktop sidebar. It is read-only while a unified record exists. ## What changed - **Reads desktop's records.** Mobile reads `channel-workspaces` and `channel-workspace-sort`. Until the unified record exists, it falls back to the legacy `channel-sections` and Solo groups, merging them the way desktop imports them (`expandWorkspaceRecord`, `importWorkspaceFallback`, `mergeLegacyWorkspaces`). Sort follows desktop's `meta.g` registers. - **Layout.** Sections are Starred, then the workspaces, Team, Solo and Direct messages, in desktop's `sectionOrder`. A workspace holds Team channels and Solo chats alike, and shows its icon: Unicode emoji as text, `:shortcode:` as the community's custom emoji, and nothing for an unknown shortcode. - **Read-only lock.** While a unified record exists, mobile hides rename, delete, move, New project and sort edits, and never publishes the legacy records desktop would ignore. That includes: - an edit queued before the lock; - a unified head arriving during a relay rate-limit wait (`mayPublish`); - a Team publish whose preflight read failed; - a New project or workspace pick opened before the lock (the chat is still created, without the filing). - **Recovery.** A foreground refresh with a pending legacy sort still applies a missed unified head. - **No All/Solo/Team filter.** Desktop removed its tabs in #3791, since workspaces now hold Solo and team chats together, so Home drops its chips too. The Messages header keeps its title and actions and no longer collapses on scroll. - **Filters.** The Unreads filter uses Solo's own unread state for Solo rows. - **NIP-44.** Decryption accepts the extended length prefix for payloads over 65535 bytes. A nostr-tools vector is included. ## Tests - `workspace_layout_interop_test.dart`: a table generated by running desktop's TypeScript from buzz-app `main` (11 layouts and 10 invalid records). It checks that mobile computes the same sections, assignments and order. - `sidebar_workspaces_journey_test.dart`: Home runs on the real sections and sort notifiers over the relay fixture. It starts on legacy sections, receives desktop's signed heads live, then checks the order, filings, icon, read-only sheet and Unreads. It also checks that only the filter choice is published. - `unified_sidebar_records_test.dart`: Team and sort publish nothing once a unified head is seen: before an edit, while one waits, or past a failed preflight. - `project_creation_test.dart`: the unified layout arrives while a workspace is being named. Nothing is written, and nothing is left to resume. - `solo_creation_tags_test.dart` and `me_sync_test.dart`: a project picked or a filing queued before the lock doesn't stop a new Solo chat from being created. Each new guard was mutation-checked: removing it fails its test. `flutter analyze` is clean and `flutter test` passes (5450). ## Not in this PR (open questions) - **Forums** stay hidden on Home, as before. Desktop shows them, so a forum filed into a workspace or starred on desktop doesn't appear on mobile. Should mobile add a Forums section? - **Filters** still use the legacy `channel-filter` record. Desktop prefers `channel-workspace-filter`. - **Solo creation without a unified record** still writes the legacy Solo groups, as before. - **Empty workspaces** are shown, as on desktop. Mobile rejects a unified record that carries `meta` without `filings`; desktop never writes that shape. - Built-in titles now match desktop: "Team" (was "Channels") and "Direct messages" (was "DMs"). ## How to test 1. On desktop (buzz-app with #3791), create two workspaces, give one an emoji icon, and file a Team channel and a Solo chat into it. Reorder the sections. 2. Open mobile Home in the same community. The sections, order, icon and filings should match desktop. 3. Open a workspace's options. You should see only Sort (disabled) and Show. Long-press a channel: there's no "Move to section…". 4. There is no All/Solo/Team filter row under the Messages title. 5. Change the order on desktop. Mobile should follow live, or after you foreground the app. Screenshots are in the comment below. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Wes <wesbillman@users.noreply.github.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Carl <32a2e2c9d428ee08902cab75d956da2c1d235a22d4766b0dd4138bf6e2e5db1d@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> |
||
|
|
bea77282da |
fix(mobile): open message actions only from a long press on the message (#9753)
## Why I find myself putting my finger down before scrolling and end up triggering the long press. Each time I think "but i wasnt touching anything?" ## Summary On mobile, the long-press recognizer covered the whole message row, so holding the empty space beside a bubble in a channel, DM or thread opened that message's actions. A hold now opens the actions only when it lands on a part of the message. - **Bubble and media:** a hold on the painted bubble or media opens the actions, as before. - **Other message parts:** the avatar, author line, edited marker, photo count label, reply footer and add-reaction button are marked as long-press targets around their own extent, so they still open the actions while the unused row width beside them stays inert. - **Empty space beside a message:** a hold there opens nothing and gives no haptic, and releasing it does not open the thread. A quick tap there still opens the thread. - **Unchanged:** swipe-to-reply still starts only on the bubble and media, and the screen-reader long press, the reaction tray's long press and the system rows' full-row hold behave as before. https://github.com/user-attachments/assets/2ede96b0-b9dd-49f3-926f-5cad32f7242e ### Related issue N/A. I searched issues and PRs for "long press" and found none for this; the closest is #8500 (action sheet opening while scrolling), which is a different problem. ### Testing Widget tests in `swipe_reply_tests.dart` cover a hold beside the bubble (no actions, no thread, no haptic, and a quick tap still opens the thread), a hold on each message part in channels and threads for own and other messages, attachment and gallery holds, the semantics long press, and that a swipe from the non-bubble parts starts no reply. Side-by-side recording on an iPhone 17 Pro simulator (iOS 27.2), `main` on the left and this branch on the right, running the same four 1.0 s holds at the same coordinates. The red ring marks the press point and was overlaid afterwards. Holding the empty space beside a message opens the action sheet on the left and nothing on the right; holding the bubble opens it on both sides. The recording was made at the first commit on this branch (`378dde654`), before the two follow-up commits, and uses a local relay with seeded throwaway data. It covers short messages from another author in a channel and a thread; own messages, DMs and media are covered by the tests only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Matt Toohey <contact@matttoohey.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Jitter <2b2e6415e748c35180847a37aadae06a11e30dddc76b784e7fd9354c4eb42e7a@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>mobile-v1.5.0-rc.5 |
||
|
|
69ea27343c |
Fix media deletion’s community ownership and share agent discovery (#9670)
## Summary Deleting a human must preserve an agent's uploads in communities where someone else owns that agent or its profile is missing. Media cleanup now carries community/key pairs through database and storage discovery, shared-file decisions, and uploader-row deletion. Media, content, account and profile cleanup share one direct-agent discovery utility. Each caller retains its previous limits and transaction behavior. Media discovers ownership once per invocation, including retries, and uses a hash set for storage matching. The report shape stays unchanged. The operator guide explains that community/agent pairs have no separate cap and sit outside the inventory budget. The discovery helper documents that global, identity-grouped discovery requires `lock: false` because PostgreSQL cannot combine `GROUP BY` with `FOR SHARE`. Run a read-only preview first, then keep writers stopped throughout deletion. Reverting the binary restores the old cross-community selection bug; it cannot restore deleted objects. ### Related issue Follow-up to the merged media handler in #9365 and the content/account/profile handlers in #9363, #9364 and #9580. No duplicate of this ownership correction was identified. ### Testing Exercised the rebuilt `buzz-admin user-deletions media-batches --pubkey <fixture-human> --read-only`, then `--delete`, against isolated PostgreSQL and versioned MinIO. Preview changed neither rows nor storage. Exclusive versions and in-scope uploader rows were deleted; shared originals, thumbnails and historical versions survived. All four handler commands agreed before and after a between-invocation ownership change. Failure followed by retry used fresh ownership, and repeat deletion removed zero versions. Compared the production candidate SQL with the pre-PR query on about 50,000 local upload/audit rows. With 9,999 agents, execution took 120–185 ms per 500-row page versus 38–83 ms before community matching. Three runs per query; this excludes planning, Rust preparation and storage operations. The added per-version ownership queries are removed entirely. Full database/deletion/admin package runs passed (339 tests). The PostgreSQL database/deletion run passed 904 tests; after strengthening the retry fixture, the full deletion PostgreSQL package passed all 45 tests. The retry case retains ownership in another community, and media tests assert exactly one ownership lookup per invocation. Local `just test` completed with one failure in the unchanged relay logging test `composition_log_does_not_leak_issuer_url` (expected warning not captured); all other test groups passed. Two pre-push attempts failed in unchanged ACP tests: first a launch timeout, then credential tests using Git 2.40 where 2.46+ is required. All four credential integration tests passed with Git 2.54; the full pre-push retry was stopped at the author’s request to skip local checks and push. Local `just ci` was also stopped before completion. Neither interrupted run is a full pass; local hooks were skipped for publication. The follow-up for the optional review comments changes documentation only. Its statements were checked against the query and all five production callers; `git diff --check` passed. Runtime suites were not repeated for this follow-up. Human local acceptance remains pending. Generated with Codex --------- Signed-off-by: Ravneet Arora <rarora@squareup.com> Signed-off-by: dessert <7d616e7e143e5d408159614dccff1371350a1c1bd36c8de838a45ece5aca0aca@buzz.block.builderlab.xyz> Co-authored-by: dessert <7d616e7e143e5d408159614dccff1371350a1c1bd36c8de838a45ece5aca0aca@buzz.block.builderlab.xyz> |
||
|
|
729cb10b78 | buzz-db: drop the remaining relay foreign keys (#9740) | ||
|
|
9bcb3e45a4 |
perf(mobile): hash upload payloads in bounded worker chunks (#9747)
Follow-up to #9736, which moved upload hashing off the UI isolate with `compute`. `compute(_sha256Hex, bytes)` copies the whole prepared payload into the worker while the uploader keeps the original for the PUT. For a 100 MiB attachment that adds about 100 MiB to peak memory before the first request. This streams the payload to a worker isolate in 1 MiB chunks, with one chunk in flight at a time (the worker acks each chunk before the next is sent). Each chunk is copied with `TransferableTypedData.fromList` on its own slice, since sending a `sublistView` would copy the whole backing buffer. The digest, the `X-SHA-256` header, the signed Blossom `x` tag and the cancellation checks are unchanged. ### Validation In a 100 MiB AOT probe, peak RSS was 114 MiB hashing inline, 214 MiB with the whole-buffer `compute` handoff, and 141 MiB with acked 1 MiB chunks, at about the same hash time (611 / 622 / 614 ms). Added tests in `mobile/test/shared/relay/media_upload_test.dart`: the worker digest matches `crypto.sha256` for a 2 MiB + 123 byte payload, sends three chunks with at most 1 MiB in flight, and handles an empty payload. ### Regressions - UI responsiveness: the hash still runs off the UI isolate. The UI isolate now does one 1 MiB slice copy per chunk instead of one full copy. - Latency: hash time is about the same as with `compute` in the probe. Small uploads pay one isolate spawn, as before. --------- Signed-off-by: Tom Brow <tomb@block.xyz> |
||
|
|
890824f072 |
feat(read-state): sync mark read, channel mark unread and thread follows (#9501)
Reading, mark read, whole-channel mark unread and thread follow choices now sync across a person's installations. This PR specifies the rules in NIP-RS and implements them in the mobile app. ## Spec (`docs/nips/NIP-RS.md`) - Defines *catch-up* and *displayed*. - A catch-up advances the channel's own frontier (top-level messages) or `thread:<root>`. `activity:` and `thread-activity:` become read-only legacy keys. - Explicit mark read is synchronized state. A first explicit read of a message with no override group writes only its `msg:` frontier. Display, dwell, scroll, catch-up and mention visibility create no `msg:` entries. - Only whole-channel override groups are published, merged and cleared with the counter. Readers ignore peer `msg:` and `thread:` groups. - Single-message and thread mark unread stay on the device. They end once the merged frontier covering them passes their baseline, from any installation, or on display, catch-up or explicit read. The section also states clearing scope, the accepted concurrency limitation and capacity. - When the merged override union no longer fits the primary, the client rewrites the primary compactly from the groups its last published primary carried, each canonical against current frontiers. It never omits merged groups or tombstone floors that primary carried, and override actions fail visibly. - Adds Buzz Thread Follow Choices: `thread-follows:<32hex>` coordinates, validation, three-state verdict, last-writer merge with ties going to unfollow, publication and recovery, legacy import at `at = 0`, and capacity. ## Mobile - Catch-up writes the main frontier. A flat timeline reads up to the newest top-level message it reached. - Explicit mark read publishes. Passive `msg:` marks stay on the device. - Whole-channel mark unread publishes an override group and merges peer groups. An explicit read or catch-up clears it, even when no frontier moves. The action fails visibly at the uint32 limit or when the primary is full. A synced clear the primary can't carry is rolled back, and the channel view reports it once while the failure stands. - Device-local message and Inbox unread overrides record a baseline and clear when a covering frontier passes it, including one merged from a peer. - Thread follows move from local storage to the synced `thread-follows:` slots. They share the read-state `client_id`, journal, `created_at` sequence, snapshot and live subscription, and spill across up to 16 slots with stable placement. An unreadable coordinate marks follow state incomplete and blocks this installation's follow publication. - Follow and unfollow are refused on every cold start of the writer until its first complete recovery of its own state succeeds and every owned follow head is readable. Cached follows show at once. A refused tap changes nothing and shows "Follow choices are not ready. Connect and try again." Reads, catch-up and both kinds of mark unread are not gated. - A follow tap is accepted only once journaled. The accepted own head, pending edits and the exact in-flight packet are kept apart, so a retry or restore never drops or re-attributes an edit. - Pre-sync local follows are imported at `at = 0` after a complete merge, once their channel is known from a relay event. An imported key is settled, and its legacy copy retired, only when the journal write the import awaited covered it and that entry is still current. - An explicit unfollow suppresses ordinary replies at live and catch-up admission. A change in follow choices drops the unread replies already counted for an unfollowed thread. A newly followed thread re-runs catch-up only for its own channel. - A reading clear refused because the view hasn't completely loaded is retried after the next complete snapshot, including when publishing was shut off at the time. The view also counts as not completely loaded while the live subscription is reconnecting, so a read made while the phone is offline can't erase a newer unread mark set on another device. Offline, whole-channel mark unread is still refused, with a message. - Read-state events, including live ones, are verified with native libsecp256k1 before they are used. - A pending unread packet is counted as published only when no newer own head outranks it. When a newer head supersedes it, a successor is built above that head from the saved intent, and a late echo of a replaced packet doesn't overwrite what was published. - When the merged unread state overfills the primary and the compact fallback can't carry a pending mark, the packet stays pending and the "read state full" error shows. Other queued reads and follows in the same flush still publish. - When this installation's own unread record can't be decoded, only the unread step is held: that record isn't overwritten, its pending marks stay queued and the sync error shows. Other queued reads and follows in the same flush still publish. - The sync notice stays up after an unsupported refusal until a new session. Offline, it can't be tapped and says it will retry when back online. - Two-device fixtures against an in-memory relay cover channel round-trips and clears, stray message groups, the first explicit message read, the primary cap, follow propagation, same-second and backward-clock follow publication, legacy import, retry after a failed publish, unreadable coordinates and slot packing. Recovery fixtures cover the startup gate, journal failures during flush, interleaved legacy imports, and restore of an older journal. ## Relay - Conforming `thread-follows:<32 hex>` records get the NIP-RS treatment: a replaced record is purged, and a stale resend of an older one is refused. Records with a mismatched `t` tag keep ordinary replaceable-event behavior. ## Known gap - An unread packet held for capacity can age past the relay's timestamp window. The relay then refuses it, and the refusal path retires it without the capacity check, so the error clears and other installations don't get that mark. The mark stays on the device. Related: [block/buzz-app#3552](https://github.com/block/buzz-app/pull/3552) --------- Signed-off-by: Will Pfleger <wpfleger@block.xyz> Signed-off-by: Will Pfleger <wpfleger@squareup.com> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> |
||
|
|
cda68a9333 |
Fix shared stars and mutes in mobile and CLI (#9684)
## Summary Mobile, CLI, and legacy desktop write millisecond timestamps for new star and mute edits. They compare legacy seconds in the same unit and retain the original timestamps of untouched entries during rollout. Mobile and CLI cap saved records at 500 entries and repair oversized records on a write. CLI no-op adds and removes leave oversized records alone. They keep the current edits and evict by age, preferring clears when timestamps tie. The CLI accepts a full flag record within the short-form NIP-44 envelope. Mobile builds each write from the writer's retained snapshot plus a durable journal of local edits. The journal drains in batches of at most 500 edits. It retries transient failures and older writer snapshots with bounded backoff and retires a pending edit after verifying that the writer already holds it or holds a strictly newer one. Retried writes preserve the original entry timestamps. An exact timestamp tie with a conflicting writer value advances by one millisecond so older clients accept the edit. An unreadable record pauses writes until a valid snapshot or app resume. On mobile upgrade, a verified writer snapshot lets the app recover newer local star and mute edits from the old cache. The legacy cache has no edit journal. Below 500 writer entries, the app also recovers absent active flags. At 500 or above it only recovers absent active flags dated after the snapshot's creation second. Absent legacy clears and clears newer than the writer's recorded clear are kept locally. They enter the publish queue when an older or equal enable appears. If the enable disappears before preflight, the clear returns to the local cache. A newer enable, an equal or newer clear, or a fresh tap retires the saved clear. A cached enable is queued when it is newer than the writer entry or ties a writer clear. A strictly newer cached enable advances the timestamp even when both copies are enabled. Recovered enables and promoted clears keep their original stamps in the journal. When the relay entry is absent or uses seconds, the write keeps a recovered seconds stamp so a later edit from an older phone can win. An existing millisecond entry uses millisecond comparison and serialization for the recovered edit. ## Validation - Mobile regressions exercise a later seconds-stamped edit, two-device eviction, a pending clear at the cap across manager replacement, transient read recovery, a losing duplicate acknowledgement, and a second toggle during confirmation, including at the cap. - CLI regressions cover seconds-stamped entries, the 500-entry limit, recovery from oversized records, and clear retention, including a repeated remove that leaves active flags intact. - Runtime validation uses scripted relays. - All 702 CLI tests passed. - Pre-push gates passed, including the full Flutter suite and analysis, repository Rust tests, and desktop Tauri checks. - Legacy desktop tests cover mixed-unit merges and back-to-back toggles. Mobile upgrade regressions cover newer offline entries, eviction, reconnect, and malformed-head recovery. --------- Signed-off-by: Wes <wesb@block.xyz> Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> |
||
|
|
b7fb268e8b |
fix(mobile): keep active iOS Huddles connected while locked (#9682)
## Summary Locking an iPhone paused Buzz and ended the current Huddle. An admitted iOS Huddle now keeps its audio session and media connection through app pause and resume. Detaching the app or switching communities still ends local audio, and the main relay retains its normal pause policy. ### Related issue None found. The disconnect was reported while using the installed Buzz iPhone app. ### Testing - A Flutter regression joins a Huddle, pauses the app, lets the main relay’s background grace period expire, and resumes. The baseline left the Huddle. With the fix, the local session remains active and detach still stops media. The test uses fake media and transport. - The iOS simulator package and development-signed iPhone package both declare the background audio mode. An iPhone 15 Pro running the development build at `18db4d969494` stayed connected when locked. Two-way lock-screen audio and headset switching remain unverified. In a test Huddle, exchange distinct phrases in both directions with the phone unlocked, while it stays locked, and after unlock. Confirm that participation continues without rejoining and that Leave stops audio. - Before readiness, verify what peers see when the backgrounded app exits after its main relay disconnects, and what the iPhone shows on unlock after a prolonged media interruption. #### Screenshots Flutter Huddle card rendered with test data.   --------- Signed-off-by: John Tennant <jtennant@squareup.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Oliver <e78152627ea32fbacb070e5047afcfb8e409fa3343d9e618227baacca5b5e607@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> |
||
|
|
f7496607a8 |
fix(mobile): hash upload payloads off the UI isolate (#9736)
## Summary Move SHA-256 for prepared mobile uploads to a worker isolate with Flutter's `compute`, at all payload sizes. The same digest feeds the `X-SHA-256` header and Blossom authorization. The existing cancellation check runs before each HTTP send, including after the worker returns. ### Related issue No matching open issue or PR found. ### Testing - `just mobile-install mobile-check mobile-test` passed, including `flutter analyze` and the full Flutter suite. - The upload regression verifies that a 2 MiB attachment's `X-SHA-256` header matches the request body's digest. - The composer widget tests wait for the worker while exercising send, progress, cancellation, and error handling. - On Apple M3 Ultra, a host Flutter test ran the production prepared-byte upload path with a stub HTTP transport. Median delay to a queued main-isolate timer over three runs: | Payload | Before | After | | --- | ---: | ---: | | 50 MiB | 330 ms | 3.6 ms | | 100 MiB | 644 ms | 7.5 ms | At 100 MiB, the patched isolate serviced at least 40 callbacks from a 16 ms timer before HTTP send. The baseline serviced zero. Both produced the same hash. This measures host isolate responsiveness. ### Manual check On a phone, attach a large file in a test conversation. Tap Send and immediately scroll the conversation. Scrolling should stay responsive during upload preparation. Open or download the completed attachment and verify that it matches the original. Signed-off-by: Wes <wesb@block.xyz> Co-authored-by: Rocket <0c41329ade659e01801116549bc617351689892a382bc864a1186dc9191293a7@buzz.block.builderlab.xyz> |
||
|
|
e581555bf8 |
perf(relay): serve named-only channel access from the access caches (#9735)
## What
REQ, COUNT, `POST /query` and `POST /count` now take a reader's
named-only channel access (system channels, and any type added later)
from the two access caches they already read. Before, any filter that
opted in to system channels, or named a channel outside the implicit
set, ran `get_readable_named_only_channels` on the writer, uncached, on
every request.
## Why
Clients send such a filter on every connect. buzz-app's system channel
discovery reads `{kinds:[39002], "#p":[me], "#t":["system"]}`. So a
fleet reconnect (rollout, relay restart, network blip) paid one extra
uncached writer read per client, on top of the cached access set. This
read showed up near the top of writer SQL during reconnect herds.
## How
- `get_member_channels_read_at` and `get_listed_open_channels_read_at`
(buzz-db) return every channel type, with their connection checkout
time, and split rows into the implicit set (legacy types) and the
named-only set, with the type. They are the same two queries as before,
without the type filter. `get_member_channel_ids` and
`get_listed_open_channel_ids` keep their results.
- With no names, the two named-only halves together are exactly what
`get_readable_named_only_channels` returns. A new Postgres test pins
that equality for a member and a non-member.
- `AppState::get_channel_access_cached` returns a `ChannelAccess` from
the member cache (per pubkey, 10 s, dropped on every membership write)
and the open cache (1 s, shared reads). It yields the named-only
channels on demand, so a request that uses only the implicit set does no
extra work. `get_accessible_channel_ids_cached` is now a wrapper around
it.
- Both caches' refills are fenced against invalidation by a small shared
`LoadFence` (new `load_fence.rs`), as `MembershipCache` does.
Overlapping misses for a key share one load token, so the first read to
finish publishes. Invalidation drops the token, and a read publishes
only while its token is current. Before, a read that began before a
removal (or an open-to-private change) could finish after it and cache
the old set. That race also affected private stream/forum channels.
- The member snapshot is dated from its read's connection checkout, like
the open set, and a hit older than `MEMBER_CHANNELS_MAX_AGE` (10 s)
reads again. Before, its 10 s started at insert, so a slow read
stretched the bound.
- `readable_named_only_channels_for_filters` uses the cached set when
every channel the request names outside the implicit set is in it. The
system opt-in needs exactly that set. When a request names any other
channel (an unlisted open channel, or one it can't read), it keeps the
uncached read, unchanged.
- A `"consistency": "strong"` `POST /query` takes its named-only access
from the database, so a client that just created a system channel finds
it even on a pod that has not yet seen the invalidation. REQ, COUNT and
`POST /count` keep the cache.
- The thread-window and workflow checks keep the uncached read.
## Staleness
Same as the implicit set's today. Every membership write
(`invalidate_membership`) drops the per-pubkey entry, whatever the
channel type, and the drop is sent to every pod. On the pod that ran the
removal, the next request sees it (the refill fence closes the race). A
missed cross-pod drop keeps a removed member's system channel for up to
10 s after the read began on that pod, as for a private channel. The
open half is used for 1 s.
## What got simpler
No new access cache and no new invalidation trigger. The named-only
access now comes from the same snapshot as the implicit set, so REQ no
longer mixes a cached implicit set with an uncached named-only set.
`get_member_channel_ids` and `get_listed_open_channel_ids` no longer
have their own SQL, and their unused `Db` wrappers are gone. The two
replacement reads keep the old span names (`get_member_channel_ids`,
`get_listed_open_channel_ids`).
## Tests
-
`handlers::system_channels::tests::cached_access_answers_named_only_needs_without_a_database_read`
(unit, unreachable DB): discovery and a cached `#h` name are answered
with no read, the token scope still narrows the result, and a name
outside the cached sets reads the database.
-
`store::unlisted_channels_postgres_tests::cached_channel_sets_match_the_uncached_named_only_read`
(Postgres): the cached halves equal the uncached read and the accessible
set.
-
`state::tests::a_member_read_that_straddles_an_invalidation_is_not_cached`
(unit): a read held open through a per-user or a community-wide
invalidation answers its own request but is not cached.
-
`state::tests::an_open_read_that_straddles_an_invalidation_is_not_cached`
(unit): an open-set read held open through the community's invalidation
answers its own request, and the next request reads again.
- `state::tests::a_member_snapshot_ages_from_its_read_not_its_insert`
(unit): a member snapshot already 10 s old when published is not served.
- `state::tests::overlapping_member_reads_cache_the_first_to_finish`
(unit): a second miss that starts while the first read is in flight does
not stop the first from being cached.
-
`handlers::system_channel_postgres_tests::a_strong_query_sees_a_just_created_system_channel_past_a_stale_cache`
(Postgres): a strong `/query` finds a just-created system channel past a
stale member entry.
-
`handlers::system_channel_postgres_tests::a_token_scope_narrows_system_channels_on_both_access_paths`
(Postgres): token-scoped WS REQ and COUNT, through the cache path and
the database path.
- Must-fail mutants: always take the database branch; keep only legacy
types in the member query; drop the token scope at the REQ call site;
publish without the fence check; drop the open-set token on
invalidation; ignore the member snapshot's checkout age.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Signed-off-by: Luke Tornquist <tornquist@squareup.com>
Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tom Brow <tomb@block.xyz>
|
||
|
|
9bc5740012 |
fix(mobile): stop notification extension sending cookies to Builderlab (#9741)
Builderlab's hosts set Cloudflare's `__cf_bm` cookie on every response. The notification extension's sessions are `.ephemeral`, which keeps an in-memory cookie store, so after the first response every later request to Builderlab sends the cookie back. The NIP-FI assertion issuer refuses any request carrying a `Cookie` header with 401 `session_required`, so the extension's assertions fail and notifications from communities that require NIP-FI fall back to "Open Buzz to view this message". - `BuzzRelayAssertionIssuer` now turns off cookie storage and sending (`httpCookieStorage = nil`, `httpShouldSetCookies = false`) on the configuration it uses for both the identity-binding check and the assertion request, whatever session it is given. - The extension's per-notification relay session gets the same settings, since the relay is also a Builderlab host. - The issuer gains a `startDownload` seam, matching `BuzzNotificationAvatarLoader`'s, and a `BuzzPushKitTests` test checks that the assertion request carries no `Cookie` header after the identity check's response sets one. Signed-off-by: Will Pfleger <wpfleger@block.xyz> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz> |
||
|
|
d9c3f4e99e |
Remove personal workflow data and missed event copies (#9675)
## Summary User content cleanup left private hide-list snapshots, saved workflow inputs and notes, unused automation, and some delivery copies behind. This extends the existing per-community content handler to remove them with the same preview, ownership and retry checks. - Delete trusted-relay hidden-DM snapshots and author-signed historical file-metadata events (kind 1063). - Clear recorded event-trigger text/emoji, authenticated manual inputs, and the recorded approver's note while preserving the rest of each run or approval. - Delete unused workflow database definitions and their schedule claims together. Any run, approval or linked claim protects the definition. The entire group must fit the requested batch size, capped at 100 rows, or planning refuses before mutation. - Delete delivery logs under surviving subscriptions before erasing their source events; reject newly arrived dependent rows before committing. Check the whole event batch with hashed membership to avoid repeated work across unrelated delivery history. Run deletion offline with the relay, workflow engine and external writers stopped. Shared history, canvases, artifacts, Git data and device registrations remain outside these additions. Retained runs can subsequently read the cleared inputs; this does not cancel them or claim complete account erasure. Existing signed kind 30620 event cleanup is unchanged. This is an application-only change against existing tables. It adds no migrations, indexes, triggers, functions or foreign keys. Existing per-statement timeouts and community write admission remain in use. ### Related issue Related: #9353. Extends the content handler in #9363. Shared workflow ownership policy remains separate from these personal-field deletions. ### Testing Ran the rebuilt `buzz-admin user-deletions content-batches --community <fixture-community> --pubkey <fixture-user> --batch-size 100` against disposable PostgreSQL 17 fixtures with 100 events, 500,000 unrelated delivery logs, and 9,999 small communities. `--read-only` selected 100; `--delete` removed 100 in 0.39 seconds locally; a second `--delete` selected zero. All 500,000 unrelated same-community delivery rows survived. EXPLAIN used hashed membership under both custom and generic plans. Independent review also exercised stale statistics. Removing the planner safeguard made the regression fail at the executor's actual 3-second timeout. The late-copy test still refuses deletion and preserves the source until retry can include the new copy. Independent agent review completed with no remaining blockers. Earlier command validation on the original patch exercised all agreed additions: preview nine operations, delete nine, retry zero, with whole-row preservation checks for the other community, shared canvas, surviving subscriptions, workflow output/provenance, and other approvers' notes. The repository-wide `just ci` run passed static checks, then stopped on two timeouts in unchanged `buzz-agent` OAuth tests. Both cases passed a serial recheck. The subsequent normal push hooks passed, including the complete Rust unit lane and Tauri checks. Later app build/test recipes were not reached; the full local CI command is not claimed green. Human command verification is pending, so this PR remains draft. On disposable fixtures, run the same preview/delete/retry sequence and verify that only the planned rows/fields change. Generated with Codex --------- Signed-off-by: maincourse <37ce551b493d4a998caf030929c47bce0b6a0e43f1178b3a63c4151d7c16b76e@buzz.block.builderlab.xyz> Co-authored-by: maincourse <37ce551b493d4a998caf030929c47bce0b6a0e43f1178b3a63c4151d7c16b76e@buzz.block.builderlab.xyz> |
||
|
|
946d9c3467 |
fix(relay): rename target log field to target_pubkey (#9739)
Rename the relay's custom structured log field from `target` to `target_pubkey` at the affected call sites. `tracing` also writes its own `target` field (the module path) after callsite fields, and Datadog keeps the last value. That overwrites the pubkey; using `target_pubkey` preserves it without changing tracing's built-in `target` metadata used by `RUST_LOG` and Vector routing. Signed-off-by: Will Pfleger <wpfleger@block.xyz> Co-authored-by: Alia <d32955ad69077062930cc46cfe2df30ca9aaf6f8e76422681265e9e9af704d78@buzz.block.builderlab.xyz> |
||
|
|
379b501124 |
feat(push-gateway): declarative desired-state schema, one file per table (#8328)
## Summary Gives the push gateway a declarative desired-state schema in the same layout the relay uses since #8131: a `\i` manifest plus one file per table, the shape SchemaBot reads. - `crates/buzz-push-gateway/schema/schema.sql`: an ordered `\i` manifest and nothing else. - `crates/buzz-push-gateway/schema/tables/public/<table>.sql`: the end state of migrations `0001`–`0008` for all six gateway tables. That includes `0007`'s `installations.platform` column and `0008`'s dropped delegation → installation foreign key (#9610), so the delegation table declares no `REFERENCES`. Each file holds only its `CREATE TABLE` and plain `CREATE [UNIQUE] INDEX` statements. - `src/postgres.rs`: the six table names are now one `GATEWAY_TABLES` constant shared by readiness and the runtime-role GRANT, instead of two hand-copied lists. - `src/postgres/desired_schema_postgres_tests.rs` adds two tests: - `desired_state_schema_layout_is_complete_and_schemabot_shaped` (no infra needed). It checks that the manifest includes every file exactly once and holds only `\i` lines, that each table file creates exactly one table, and that indexes use a plain `CREATE INDEX` on that table. - `desired_state_schema_matches_migrations` (PostgreSQL lane). It builds one probe database from `schema.sql` through the real `bin/pgschema apply` and another through `GATEWAY_MIGRATOR`. It then requires the two `public` catalogs to match: table set, columns from `pg_attribute` (full type with typmod via `format_type`, default, nullability, identity, generation, collation), table options (persistence, RLS flags, `reloptions`), constraints (`pg_get_constraintdef`) and index shapes (`pg_get_indexdef` + `indoption`). Neither probe may hold functions, non-internal triggers, policies, views, sequences or user types, and the declared table set must equal `GATEWAY_TABLES`. It compares the whole `public` catalog, not a list of tables, so a future migration that changes `public` tables, columns, table options, constraints or indexes without a matching `schema/` change fails CI. It doesn't cover data-only migrations or objects outside `public` (other schemas, roles, database settings). Probe databases are created from `template0` and dropped even when an assertion, `pgschema` or setup fails; the original failure is re-raised unchanged. Connection details, including the password, come from the resolved `PgConnectOptions`, so percent-encoded credentials, `?password=` and Unix-socket URLs reach `pgschema` the way SQLx sees them. `pgschema` 1.7.4 builds an unquoted keyword DSN, so a password or socket path with whitespace, a quote, `=` or a backslash isn't supported (noted in the test). ## Not changed The gateway still migrates itself at startup: bootstrap guard, then SQLx migrations, then runtime-role grants. The guard and grants are operational steps, not desired-state DDL, so they stay in code. No `schemabot.yaml` is added: SchemaBot isn't configured for the relay or the gateway yet, so the yaml for both waits until that server-side setup exists. The manifest header notes that the relay's post-pgschema reconcile step (root `AGENTS.md` gotcha #7) doesn't apply, because the gateway schema has no seed DML or storage parameters. SchemaBot compatibility is not proven here. The parity test shows the files are equivalent under `pgschema`. Since #9610 the gateway schema has no foreign keys, so the earlier inline-FK caveat is gone. `docs/database.md` Rule 4 now lists the gateway `schema/` directory as a schema location. ## What got simpler To read the gateway's schema today you have to replay eight migrations: two CHECK rewrites, two dropped UNIQUE constraints, a dropped column, an added column and a dropped foreign key. After this PR it's one declarative file per table, in the same convention as the relay. There is no new runtime path and no new abstraction, and the duplicated table list in `postgres.rs` collapses to one constant. ## Testing At `c4336392` (rebased on main after #9610; mirrors gateway `0007`/`0008`; reads the `pgschema` password from a copy with a URL-safe host and username, so a `PGHOST` or default-search socket no longer panics and a `/role` username no longer drops the password): - `cargo fmt --all -- --check` and `cargo clippy -p buzz-push-gateway --all-targets -- -D warnings`: pass. - `cargo test -p buzz-push-gateway --lib desired_schema`: pass, including `resolved_password_reads_through_a_socket_host_and_slash_username`. Removing the username normalization makes that test fail. - `scripts/postgres-test-run.sh -p buzz-push-gateway --lib --tests`: 17/17 passed, including `desired_state_schema_matches_migrations`. At `df3ff104` (password from resolved connect options), same workstation: - fmt, clippy (`-D warnings`, with and without `personal-dev-app-attest`): pass. `cargo nextest run -p buzz-push-gateway`: 80/80, and 82/82 with the feature. `scripts/postgres-test-run.sh -p buzz-push-gateway --lib --tests`: 13/13. - `?password=`: with `PGPASSWORD` unset, `postgres://<role>:wrong@localhost/postgres?password=<encoded p@ss:w/rd#x>` passes the parity test, so `pgschema` gets the query-parameter password that SQLx uses. A wrong `?password=` is rejected (`28P01`). - The CHECK-bound falsification still fails with `constraint parity mismatch`. Every run leaves 0 probe databases. At `f937924a` (probe cleanup and connection-URL follow-up), on a Linux workstation against PostgreSQL 16 with the repo's pinned `bin/pgschema`: - `cargo fmt --all -- --check`, plus `cargo clippy -p buzz-push-gateway --all-targets -- -D warnings` with and without `--features personal-dev-app-attest`: pass. - `cargo nextest run -p buzz-push-gateway`: 60/60 passed, and 62/62 with `personal-dev-app-attest`. `scripts/postgres-test-run.sh -p buzz-push-gateway --lib --tests`: 12/12 passed. - Probe cleanup: with a CHECK bound changed (2048→4096), the previous test code fails and leaves both `push_gateway_{desired,migrated}_*` databases behind. The new code fails with the same `constraint parity mismatch` panic and leaves none. A table file that makes `pgschema apply` fail (`no_such_column`) also reports `pgschema apply failed: ... column "no_such_column" does not exist` and leaves none. - Connection URLs: the parity test passes as a role whose password is `p@ss:w/rd#%x`, given percent-encoded in the URL with `PGPASSWORD` unset. It also passes over `postgres://<user>@%2Fvar%2Frun%2Fpostgresql:5432/postgres` (Unix socket, peer auth). Earlier, at `ee2745cb78`: - `scripts/postgres-test-packages.sh` discovers `buzz-push-gateway`. The parity test lives under a `*_postgres_tests` module so the `postgres-ci` nextest filter selects it. - `cargo fmt --all -- --check` and `cargo clippy -p buzz-push-gateway --all-targets -- -D warnings` both pass. - `cargo nextest run -p buzz-push-gateway`: 60/60 passed, including the layout test. - `scripts/postgres-test-run.sh -p buzz-push-gateway`: 12/12 passed, including `desired_state_schema_matches_migrations`. - Falsification checks: - Dropping the partial predicate from `push_gateway_installations_active_token` makes the parity test fail with an index-shape mismatch. - Adding an unmirrored `0007` migration (`ADD COLUMN probe TEXT`) makes the parity test fail with a column mismatch. Mirroring the column in the table file makes it pass again. - Putting `CREATE TABLE` DDL in `schema.sql` makes the layout test fail. - A `0007` adding `probe VARCHAR(64)` mirrored as `VARCHAR(128)` fails with a column mismatch (typmod); mirroring it exactly passes. - An unmirrored `0007` `ALTER COLUMN expires_at TYPE TIMESTAMP` fails with a column mismatch. - An unmirrored `0007` `ENABLE ROW LEVEL SECURITY` fails with a table-option mismatch. - A `0007` creating a function and trigger fails the "only tables and indexes" check. Known gap: `sqlx::migrate!` doesn't notice a *new* migration file on an incremental build. The crate has no `build.rs` `rerun-if-changed`, and neither does any other crate in the workspace. For the `0007` check above I touched `src/postgres.rs` to force the macro to re-expand. Clean CI builds aren't affected. buzz-review-completed --------- Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7e7ec731cd |
test(cli): keep the raw refusal exit test independent of BUZZ_* env (#9733)
## Summary
Follow-up to #9653. Its new test
`cli_exits_nonzero_when_the_relay_refuses_a_raw_publish` went through
`run_from_args`, which resolves credentials from the caller's
environment. With `BUZZ_AUTH_TAG` set (as it is for agents run by the
ACP harness), the test client's key doesn't match the auth tag and the
test exits 3 instead of 2.
The check moves to an integration test,
[`tests/raw_publish_exit.rs`](
|
||
|
|
7bff21e513 |
docs(nip-pm): define pinned messages (#9712)
## Summary Adds NIP-PM, the wire contract for pinned messages in a channel. A Buzz DM is a channel here. - `kind:40010` and `kind:40011`: member-signed pin and unpin commands, one message per command. Each new command carries a fresh `client-id` value, so two commands for one message in the same second are different events. - `kind:30623`: the relay-signed pin list, one addressable event per channel, newest pin first, in the tag shape of NIP-29 `kind:39005` plus an `h` tag. Clients read it with `#h`, which names the channel under NIP-CL. - Relay processing: every change to a channel's list, from a command or from the deletion of a pinned message, applies one at a time in one order. A resent command answers `duplicate:`, pinning an already pinned message changes nothing, and a channel holds at most 250 pins. - Whoever may post a message in the channel may pin and unpin in it. - Deleting a pinned message removes it from the list, whoever deletes it. - A `message_pinned` system message announces each pin and names the command that made it. - A relay does not advertise the NIP. A relay that does not accept the commands refuses them as unknown kinds. The relay implementation follows in a stacked pull request. ### Related issue N/A ### Testing Documentation only. Checked the rendered Markdown, the relative NIP links against the other documents in `docs/nips/`, and that kinds `40010`, `40011` and `30623` are unused in the repository. --------- Signed-off-by: Kalvin Chau <kalvin@block.xyz> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
bc3023a050 |
push-gateway: drop the delegation → installation foreign key (#9610)
## Summary Retire the last foreign key in the push gateway schema: `push_gateway_delegations.installation_id → push_gateway_installations(id)`. This follows `docs/database.md` Rule 2 and the relay FK retirement work (#9399, #9404). - **Gateway migration 0008** drops the constraint. - **Relay migration 0101** drops the relay's legacy copy (Rule 4: gateway schema changes go in both). `schema/tables/public/push_gateway_delegations.sql` loses the inline `REFERENCES`. ## Required stop Every gateway and rollback target must run #9627 (`44cdd9fe`) or later before this merges and deploys. #9627 makes the reaper lock expired installations before it deletes their delegations. Without the FK, an older reaper can leave an orphaned delegation. This is step 2 of the Rule 5 retirement sequence; #9627 is step 1. ## Why the app already enforces the reference | Path | Check | |---|---| | `upsert_delegation` (only delegation insert) | Locks the installation `FOR UPDATE` in the same transaction; rejects a missing or revoked one. | | `create_installation` (replaces expired installations) | Locks the matching installations `FOR UPDATE`, deletes their delegations, then the installations. | | `reap_expired` | Locks expired installations `FOR UPDATE`, deletes their delegations, then the installations (#9627). | | `authorize_delivery` | Reads the installation through the delegation; a missing installation is `Rejected`. | | `revoke_delegation` | Updates the delegation only; an orphan has no effect. | | `revoke_installation`, `rotate_endpoint`, `advance_assertion_counter` | Update the installation; they never delete it. | The relay never reads or writes the `push_gateway_*` tables (the gateway requires its own database), so dropping the relay copy changes no relay behavior. ## Tests The gateway tests run against the migrated schema, which no longer has the FK, so they prove the app check. - `migrated_schema_has_no_foreign_keys` (new): the gateway schema has no foreign keys after migrations. It fails if gateway migration 0008 is removed. - `delegation_for_missing_installation_is_rejected` and `reaper_deletes_delegation_committed_while_it_waits` (from #9627) now run without the FK. - `reaper_retains_revocation_tombstones_until_authority_expiry`: its hand-built schema drops the FK too. - Relay: `push_gateway_delegations` joins the constraint parity check in `admin_schema_parity_between_desired_state_and_migrations`, and the migration count test covers 0101. ## Validation Blox at `33f7df90` (before the rename to 0101; CI covers the rebased head): - `cargo fmt --check`, clippy (`buzz-push-gateway`, `buzz-db`, all targets), gateway unit tests, `buzz-db` migration unit tests: pass. - `scripts/postgres-test-run.sh -p buzz-push-gateway --lib --tests`: 16/16 pass. - `buzz-db` Postgres tests for migrations, parity, push, floor retirement and retained guards: 56/56 pass, including `admin_schema_parity_between_desired_state_and_migrations`. - Must-fail check: with gateway migration 0008 removed, `migrated_schema_has_no_foreign_keys` fails (1 foreign key vs 0). ## Coordination - On main after #8696, #9398 and #9710 (relay 0095–0100). #9627 shipped this PR's reaper fix and tests separately, so this PR is the schema drop only. - Renumbered to relay 0101 after #9710 took 0098–0100 (rename only; file contents unchanged). #9690 and #9621 also add a relay 0098; whichever merges second renumbers. - #8328 adds the gateway's declarative schema with the inline FK. Whichever PR merges second removes it there. ## What got simpler One fewer database object. Every gateway reference check now lives in one place: the gateway's own transactions. buzz-review-completed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Luke Tornquist <tornquist@squareup.com> Co-authored-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4079793f99 |
Match desktop unread cues on mobile channel rows (#9715)
## Summary - Honor the synced `seen:<channel>` timestamp in mobile row styling and the **Unreads** filter. Attention keeps its dot regardless of timestamp, and the row's mark-read menu uses the underlying unread state. - Hide the dot when the row shows a mute the relay has confirmed. Confirmation survives reconnects within the same account and relay. The row still exposes unread attention to screen readers. Unmuting on the phone restores any dot supported by retained unread evidence as soon as the bell disappears. - Apply the same `seen:<channel>` timestamp to the app icon badge's ordinary backlog count. Mentions and thread replies keep counting. Includes #9721. This reuses the existing read-state and mute sync. Pending mutes keep the dot visible, and the patch adds no relay requests or read-state writes. ### Related issue No matching issue or open PR found. Earlier mobile sidebar unread parity work is in #1303. ## Testing - `just mobile-install mobile-check mobile-test` - Widget coverage for backlog at and after the desktop cut, mentions on either side of it, the **Unreads** filter, the mark-read menu, pending and confirmed mute, and unmute while the relay still reports muted. - Scripted relay coverage for mute confirmation across reconnects, delayed and older responses, newer confirmations, and relay switches. Read-state tests cover reading a peer's `seen:` context during an ordinary mobile publish. - Badge provider tests cover backlog at and after the cut, plus mentions and thread replies older than the cut. ### Test on a phone with desktop alongside 1. Check out the PR. To install a local debug build, run `./scripts/mobile-worktree-overrides.sh` from the repo root, then run `flutter devices` and `flutter run -d <device-id>` from `mobile/` with Hermit active. Use the device signing setup if needed for a physical iPhone. Sign in to the same account and community on both clients. Use an already initialized mobile account and leave the phone on the channel list. [Device signing setup](https://github.com/block/buzz/tree/main/mobile#ios-push-capability) 2. Have a second account post an ordinary message in a test channel. Wait for its row to become bold on both clients. On desktop, open that channel and switch away quickly, before the 300 ms reading dwell. After sync, the phone row should lose bold. In the phone's section menu, choose **Filter…**, select **Unreads**, and tap **Apply**. The row should disappear. Use **Show hidden channels** and long-press the row to verify that **Mark Read** is still available. Dismiss the menu, tap **Hide filtered channels**, and have the second account send a newer ordinary message. The row should appear bold again. 3. For a mention older than the cut, have the second account @mention you in a different test channel before making the quick desktop visit. After leaving the channel on desktop, the phone should still show its attention dot. For a newer mention, do the quick desktop visit after an ordinary post in a separate channel, wait for its phone row to quiet, then send the @mention. Its phone row should gain a dot. 4. With the mention still unread, mute that channel on desktop. When the phone shows the muted bell, verify that the attention dot disappears. Turn off the phone's network connection, return to the channel list, then reconnect. The dot should stay hidden throughout. On the phone, long-press the row and choose **Unmute channel**. The dot should return as soon as the bell disappears. Keep the phone on the channel list throughout so it does not read the mention. 5. On a phone with app badges enabled, repeat the ordinary-message case in step 2 with that message as the only unread item. After the phone syncs the desktop visit, the app icon badge should clear. A newer ordinary message should bring it back. Device and desktop testing is pending. ### Before and after Before and after captures from the Flutter channel list widget with synthetic rows. The ordinary `desktop-seen` row loses bold, the confirmed-muted mention loses its dot, and the unread control stays bold. | Theme | Before | After | | --- | --- | --- | | Light |  |  | | Dark |  |  | --------- Signed-off-by: Wes <wesb@block.xyz> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> |
||
|
|
286095c937 |
feat(mobile): refresh Huddle speaking styles and iOS controls (#9716)
## Summary Bring mobile Huddle speaking indicators closer to desktop with a close, avatar-colored ring and subtle portrait motion, respecting reduced motion. Use native Liquid Glass for full-screen iOS controls with clear microphone/speaker active states; preserve the minimized sheet. Regular iPhone and Android controls retain their existing positions and sizes. Duo uses a side rail with End Call above minimize, microphone and speaker below, consistent spacing, and extra cover-display status clearance. Participants remain centered across the full display width. Hide the emoji action while retaining reaction support for a future return. ### Related issue No matching open issue found. Earlier mobile control exploration: #9383; invitation changes are outside this PR. ### Testing - Static analysis and pre-push checks passed at `bc5eb34f4`. - Full mobile suite: 5,126 passed; companion suite: 27 passed. - Coverage includes speaking-ring geometry, reduced motion, glass selected states, both Duo rail sides and display sizes, standard-phone control geometry, and minimizing to the original sheet. - Physical Duo previews reviewed during iteration; final build installed on iPhone Air for owner testing. Owner approved proceeding to PR. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> |
||
|
|
5ccbb61190 |
feat(cli): add raw query and publish escape-hatch commands (#9653)
## Summary Agents using the CLI had no way to answer questions like "which channels is key X a member of" (kind 39002 with `#p`) without scanning channels one at a time, which runs into identity-adapter rate limits. This adds a small escape hatch that reuses the CLI's existing credentials (signing key, auth tag, federated identity assertion): - `buzz raw query <filter>`: send one filter object or an array of filters (or `-` for stdin) to the relay's `/query` endpoint and print the relay's JSON as-is (an event array, or an object for filters such as read-state snapshots). - `buzz raw publish`: build, sign and send an arbitrary event, either from `--kind`, repeatable `--tag` (JSON arrays, as in `social set-list`) and `--content`, or from a full `--event-json` template. Signing goes through `sign_event`, so the auth tag is attached as for every other command; a caller-supplied `auth` tag is refused. Ephemeral kinds (20000 to 29999) use the ephemeral publish path, except the NIP-43 leave request (28936), which goes over HTTP because the relay revokes the submitting socket on success. Gift wraps (1059) are refused, since they need NIP-59 signing with a throwaway key. Malformed input (bad JSON, a filter that isn't an object, a bad tag) exits 1 with the usual `user_error` JSON; the relay validates filter fields itself, and its rejection exits 2 as a relay error. A publish the relay refuses (`accepted:false`, over HTTP or the WebSocket) exits 2 with the event id and message. README and TESTING.md list the new commands and their limits (replaceable and addressable kinds replace the whole event; kind-scoped credentials can fail artifact revisions). ## Regressions None expected: this adds a new command group and does not change existing commands. `submit_event` now also gives the relay-admin kinds (9030 to 9033), identity archive and unarchive requests (9035, 9036) and the leave request (28936) the moderation retry policy (no blind resend after an ambiguous outcome). `agents archive` and `agents unarchive` send 9035 and 9036, so after a lost response they now report an unknown outcome instead of resending, which could re-archive over a later unarchive. ### Validation Tried against a live relay as a signed-in user: a kind 39002 `#p` query listed one key's channels, a two-filter array and an `ids` lookup returned the expected events, and `raw publish` sent a typing indicator, a reaction and a deletion of that reaction, all accepted. New tests in [`raw.rs`]( |
||
|
|
03336d0872 |
fix(mobile): only say "Community changed" when the community changed (#9156)
On mobile, a text send that failed for almost any reason showed **"Not sent. Community changed."** The composer caught every `StateError` as a community switch, and relay failures such as a briefly disconnected socket (`RelaySession.publish` throws "Relay session is not connected") are also `StateError`s. So a reconnect blip during a send told the user they had switched communities when they hadn't. The community-switch guards in message, forum and channel-action delivery now throw a dedicated `ActiveCommunityChangedError`, and an unconnected publish throws `RelayNotConnectedError`. Both still extend `StateError`, so every existing `on StateError` caller behaves as before. The composer now reports: | Failure | Message | | --- | --- | | Active community changed mid-send | Not sent. Community changed. | | Relay socket not connected | Not sent. No connection. | | Relay never acknowledged the event (ack timeout) | Not confirmed. The relay didn't respond. | | A relay request timed out before the event was published (e.g. a roster lookup) | Not sent. The relay didn't respond. | | Connection lost after the event was sent, before its acknowledgement | Not confirmed. Connection lost. | | Relay rejected the event, or anything else | Not sent: *relay reason or error text* | The two "Not confirmed" cases may still have been accepted by the relay, so they avoid a definite "Not sent" that would invite a duplicate resend. Pending publishes rejected by a disconnect or backgrounding now complete with a typed `RelayAckLostError` instead of a generic exception, and an unacknowledged publish times out with `RelayAckTimeoutError` (still a `TimeoutException`) so it can be told apart from earlier timeouts. The draft is restored in every case, as before. ### Validation - Added [composer widget tests](https://github.com/block/buzz/pull/9156/files#diff-101740841aadcb902d0717f3909debe16073c672e73be74a5b908bf11dfc8782) for each non-community failure (disconnect, timeout before publishing, ack timeout, connection lost before acknowledgement, relay rejection, other `StateError`), checking the snackbar text, that the draft is restored, and whether the message EVENT was sent. The disconnect, timeout and connection-lost cases run through the real relay session (a pending publish rejected by backgrounding, a history request that times out before any message EVENT). The existing community-switch journey goes through the real channel-action guard. - Simulator (iPhone 17 Pro, debug build of this branch signed in to a test community): opened a channel and sent a message; it was delivered and the composer cleared normally. Limitation: the error paths themselves were exercised only by widget tests, since the simulator shares the Mac's network and I couldn't drop the relay connection for it alone. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Tom Brow <tomb@squareup.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz> |
||
|
|
4e1d0b27fd |
chore: require relay owner review for the relay and db crates (#9728)
## Summary Make the relay database owners also the code owners for the relay crate, `/crates/buzz-relay/`, and the relay database crate, `/crates/buzz-db/`. This uses the same five owners that #9708 gave the migration and schema paths. The `main` ruleset requires code owner review, so any PR that touches either crate now needs an approval from one of these owners instead of `@block/buzz-oss-team`. Any one of them can approve. The ruleset still requires one approval in total. ### Related issue N/A. Extends #9708. ### Testing `GET /repos/block/buzz/codeowners/errors?ref=wpfleger/relay-crate-codeowners` returns no errors. --------- Signed-off-by: Will Pfleger <wpfleger@block.xyz> |
||
|
|
42b89f9b5f |
fix(mobile): align Huddle cards and preserve conversation navigation (#9713)
Hide generated private Huddle rooms from mobile channel lists, including cached rooms and older rooms with creator-matched creation receipts. Ended Huddle cards keep **View** available while membership is unknown. Known non-members see disabled **Ended**. Unknown membership is checked with the relay before opening history, and explicit access denials clear cached transcript rows. Opening history never joins audio. Known members can reopen loaded history offline. Already-authorized history stays mounted through a disconnect or transient revalidation failure while the route remains open; reconnects recheck access, and explicit denial clears it. Rooms without sufficient evidence remain visible. Match desktop card colours, borders, 20-point corners, elapsed duration, participant avatars and ended-call icon. Active cards retain headphones and mobile tap targets. Replace the minimized Huddle's full-app UIKit background with Flutter clipping: the native background caused the two-pane iOS conversation to appear blank even though its messages were loaded and scrollable. The owner reproduced the failure and confirmed the Flutter surface restores the timeline on iPhone Duo. Lifecycle updates share one live subscription and merge into history. Start/end discovery has its own query budget and survives a failed participant-history read; avatar rosters use revision and admission metadata for same-second reconnects. Explicit denials propagate without trying a fallback transport. Creation receipts coalesce overlapping list refreshes and reconcile after the list loads, retain verified classifications in scoped snapshots, and stop sending batches after a community switch. Removed the unused native backdrop and bottom-corner options. Validation on `7f1a278dbe`: 5,133 Flutter tests plus 27 companion tests passed (71 skipped), analyzer and file-size checks passed, and the iOS release build passed. The updated Buzz Huddles preview is installed on iPhone Duo. The phone locked before launch, so the exact-revision native journey is still pending. Regressions cover cached-history denial, live-only lifecycle events across recovery, busy-call discovery, same-second rejoining, slow and overlapping receipt lookups, cached classifications, community switching, and HTTP denial with a transient WS failure configured. Both transport-denial and overlapping-refresh regressions were verified failing before the fixes. Tom’s follow-up from #9719 adds held-revalidation, known-member offline reopen and partial-roster failure coverage. The original blank-screen fix was verified by the owner on iPhone Duo; this review revision still needs their on-device minimized-Huddle/two-pane and VoiceOver checks. The surface retains Flutter's existing 24-point shape instead of iOS-adaptive concentric corners. ### Snapshots Synthetic widget previews; no private conversation data. | Active | Ended | Dark mode | | --- | --- | --- | |  |  |  |  --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> |
||
|
|
1ac0b1dad1 |
Match mobile mention chips to desktop styling (#9706)
Mobile mentions now use the desktop chip treatment: neutral rounded pills for other identities, the chat accent for mentions of the viewer, and a contrasting inset fill inside outgoing messages. This applies to message bodies and compact previews, while preserving profile taps and resolving self-highlights by public key. The change reuses the existing chat palette and keeps it stable across parent rebuilds, so unchanged messages retain their parsed Markdown. Mention routing and composer behavior are unchanged. Validation: `just mobile-check mobile-test` passed (5,118 Flutter tests, 71 skipped, plus 27 crypto-package tests). Coverage includes light/dark themes, 2× text, profile taps, live identity switching, outgoing contrast, and Markdown reuse; removing self-highlighting makes the regression fail. A signed iOS build was installed and checked on a physical device, then approved for PR preparation. ### Snapshots Actual Flutter component renders with synthetic identities and the bundled app font. Each shows received/own messages, compact previews, and enlarged text. | Light | Dark | | --- | --- | |  |  | buzz-review-completed Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> |
||
|
|
98e2b7cbbc |
feat(relay): push mentions to people outside a listed channel (#9623)
## Summary A message that `p`-tags someone in a listed channel they haven't joined now sends them a push. Before this, push woke only channel members. This is the relay part of "Let them know", a choice for mentioning people outside a public channel. The client changes are https://github.com/block/buzz-app/pull/3769, https://github.com/block/buzz-app/pull/3771 and https://github.com/block/buzz/pull/9629. - The matcher wakes a non-member only when a `p` tag names them and the channel is open, not unlisted, and a stream or forum. It reuses the channel directory's `LISTED_CHANNEL_SQL`. - Delivery checks again before sending. The channel must still be listed, the event must still mention them, and they must still be able to connect. A ban on them or their agent's owner blocks the push, and so does a missing membership or allowlist entry when the relay requires one. - Members, private and unlisted channels, DMs and system channels are unchanged. **Needs security review.** This decides who gets push wakes. A wake goes only to someone who could already read the event with `REQ`, and it carries no message content. Follow-up: a banned or removed channel member still gets wakes until their lease expires. That predates this PR, and the fix belongs in the ban and removal code. ### Related issue None found. ### Testing - Postgres tests run ingest through delivery against a fake gateway. They cover private, unlisted and system channels, a switch to private before delivery, bans, removal, a missing allowlist entry, and an agent relying on its owner's membership. I made 20 small changes that each broke one of these checks, and each one made a test fail. - On a local relay with a stand-in gateway, an outsider's mention push arrived, and nothing went out after a ban, a removal or a switch to private. With the new delivery check turned off, the banned and removed people got pushes. - Not tested: a real gateway and a phone. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Soheyl Vakili <soheyl@squareup.com> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> |
||
|
|
9ea57cba2a |
fix(db): undo migration 0097 (#9710)
## What Migrations `0098`–`0100` undo migration `0097` (community artifact expand). The declared schema goes back to its shape before #9650. #9650 added `0097`. The revert, #9689, removed the feature but kept `0097` byte for byte, because databases that auto-migrated recorded its checksum. No code on `main` reads or writes what `0097` added. This PR removes it with forward migrations, as `docs/database.md` requires ("Never edit a merged migration. Fix forward."). `artifact_heads.channel_id` gets `NOT NULL` back in the three steps from *Adding `NOT NULL` to a populated table*: - `0098` checks that the artifact head key is `(community_id, artifact_id)`, then adds `CHECK (channel_id IS NOT NULL) NOT VALID`. - `0099` validates the check under `SHARE UPDATE EXCLUSIVE`, so channel artifact reads and writes continue. - `0100` sets `NOT NULL` from the validated check (no scan), drops the check, drops `artifact_heads_live_type`, `artifact_heads_scoped_identity` and `artifact_revisions_scoped_identity`, and drops `artifact_heads.scope`, `artifact_revisions.scope`, `artifact_revisions.community_event`, `artifact_revisions.redacted` and `communities.artifact_type_policies`. The primary keys don't change. `0097` never changed them. ## Review checklist (docs/database.md) - **Phase:** contract. It follows the expand in #9650 (`0097`) and the code revert in #9689. - **Required stop:** every relay pod, job and rollback target must run #9689 (`sha-a406191`) or later before `0100` runs. The chart's upgrade notes (`deploy/charts/buzz/README.md`) say this, along with how to roll back with auto-migration off. No tagged relay release contains #9650. Only rolling images from `eebf62b6` up to, but not including, `a4061916` are affected. Relays built from #9650 itself read `artifact_heads.scope` and write with `ON CONFLICT` on `artifact_heads_scoped_identity`. Releases before #9650 never read these objects. - **Fails closed:** `0098` refuses a database whose artifact head key is the scoped key from #9650's removed operator contract script or declared schema. That database needs the recovery in #9689's Compatibility section. `0099` fails if any head has a null `channel_id`. Both stop before any cleanup. - No trigger, function, procedure, rule or foreign key is added. No migration changes existing rows. - Every schema location in Rule 4 is updated: `migrations/` and `schema/tables/public/` (`artifact_heads.sql`, `artifact_revisions.sql`, `communities.sql`). No reconcile-script or gateway change applies. - **Currently deployed relay:** a relay from #9689 or later doesn't use these objects, and neither does a relay from before #9650. The populated-table test runs every migration over channel artifact data. - **Locks:** each migration sets `lock_timeout = '5s'` and `statement_timeout = '30s'`. No index is built. ## Tests - `admin_schema_parity_between_desired_state_and_migrations` compares `artifact_heads`, `artifact_revisions` and `communities` across the desired-state and migrated paths. It fails without `0100`. - `populated_artifact_tables_auto_migrate_through_every_migration` checks that a channel head and revision written before `0097` survive with the same channel and event. - `artifact_unexpand_validates_while_channel_heads_are_written`: `0099` completes while a channel head write is still open. It fails if `0099` sets `NOT NULL` directly. - `artifact_unexpand_refuses_scoped_head_key`: `0098` stops on the scoped key and leaves `0097`'s columns in place. ## What got simpler The schema loses 5 unused columns and 3 unused indexes. `artifact_heads.channel_id` is required again, as the channel code assumes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Luke Tornquist <tornquist@squareup.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |