buzz icon indicating copy to clipboard operation
buzz copied to clipboard

feat(stickers): add Sonar sticker packs (resurrects #1920)

Open vincenzopalazzo opened this issue 4 months ago • 7 comments

Resurrects #1920 — Sonar sticker packs, rebased onto current main

This PR brings back the sticker-packs work from #1920 (closed unmerged) and rebases it onto today's main (103 commits newer). All merge conflicts are resolved and every local quality gate is green.

Why Buzz must have this

Emoji reactions and custom emoji already proved that lightweight, expressive communication matters in Buzz — but every serious chat product our users compare us to (Slack, Signal, Telegram, Discord) ships stickers as the next tier of expression: larger, authored, pack-based, and fun. Today a Buzz user who wants to react with more personality than an emoji has to upload an image by hand, every time.

Stickers are also a community-culture primitive: teams build shared identity around their own packs. With this PR Buzz gets that — but with a safety model no competitor has:

  • Admin-approved catalog (kind 13536) — a community's sticker catalog is a materialized, curated list. Clients never fetch arbitrary pack events from the open network.
  • Content-addressed, approval-gated asset cache — the relay only serves sticker assets whose SHA-256 matches an approved pack revision (/media/sticker/{author}/{identifier}/{shortcode}/{sha256}). It never fetches unapproved assets, caps dimensions/frame counts, and pins DNS resolution.
  • Signal interop — users can import an official signal.art pack link and republish it as a Sonar pack, so existing sticker culture ports over instead of starting from zero.
  • Authoring built-in — create/edit packs in Settings, upload WebP covers and images from the desktop app, publish via buzz stickers CLI commands (agent-first, like everything else in Buzz).
  • Agents can sticker too — stickers ride ordinary channel messages as validated sticker tags, so managed agents and CLI flows can send them through the same pipeline.

What it looks like

Composer — sticker picker entry point (empty state prompts pack install):

Settings → Stickers — install curated packs, author your own, or import a Signal pack:

(Screenshots in the comment below — posted via scripts/post-screenshots.sh.)

Note on the screenshots: the E2E mock bridge has no seeded sticker catalog yet, so the picker renders its honest empty state. A follow-up will seed a mock catalog + pack events in e2eBridge.ts so we can capture the populated grid and add a screen recording of the full send flow. To try it live: buzz stickers --help against any relay running this branch.

What changed since #1920 (rebase notes)

  • Migration renumbered 0020_sticker_catalog.sql → 0021_sticker_catalog.sql (0020 is now join_policy_acceptances on main); migration tests updated for 21 migrations.
  • Merged with main's media-auth rework — kept authenticate_media_read / blob_cache_control alongside the new verified-sticker route; kept should_retry_legacy_upload upload fallback in both buzz-cli and the desktop app while exposing do_upload to the sticker commands.
  • Merged with main's mention-flow rework — sticker tags compose with audienceGeneration/audienceRevision, postSendContent, and the persistent-agent-audience send path; MessageComposerProps extraction kept and extended with main's newer props.
  • File-size guard compliance — split desktop sticker commands into commands/stickers.rs and the tag validator into sticker_events.rs (keeps media.rs, events.rs, lib.rs, AppShell.tsx under the 1000-line ceiling without overrides); added a small useLiveUpdates aggregator hook in the app shell.
  • Mobile — receive-only sticker rendering conflicts resolved against main's relay-provider changes.

Security properties (unchanged from #1920)

  • No fetching of unapproved assets; approval pins exact pack event IDs.
  • SHA-256 verified, dimension- and frame-capped animated media; zeroized secrets on import.
  • Pinned bitchat-to-sonar dependency (rev-locked).

Verification (this branch)

  • cargo clippy --workspace --all-targets -D warnings ✅
  • just desktop-tauri-check / just desktop-tauri-clippy / just desktop-tauri-test (1469 passed) ✅
  • Desktop: pnpm check (biome + file-size + px-text guards) ✅, pnpm test (3129 passed) ✅, tsc --noEmit ✅
  • Mobile: dart format ✅, flutter analyze ✅, flutter test (520 passed, incl. new sticker preview/reference tests) ✅
  • cargo test -p buzz-db -p buzz-core -p buzz-media -p buzz-sdk -p buzz-cli ✅ (incl. updated migration-sequence tests)

Design doc: docs/brainstorms/2026-07-15-sonar-sticker-packs-design.md.

Supersedes #1920.

vincenzopalazzo avatar Jul 26 '26 11:07 vincenzopalazzo

Screenshots

Sticker picker — populated (from the original #1920 build, same UI)

The composer sticker button opens the pack picker with the installed "Herecomesbitcoin.org" pack.

picker

Sticker rendered in the message timeline

message

Settings → Stickers (current main rebase)

Install curated Sonar packs, author your own pack with WebP cover + images, or import an official Signal pack.

settings

Picker empty state (current main rebase)

Honest empty state when no packs are installed yet — points the user to Settings.

picker-empty

vincenzopalazzo avatar Jul 26 '26 11:07 vincenzopalazzo

Review — feat(stickers): add Sonar sticker packs (resurrects #1920)

Verdict: auth boundary is right; structurally blocked — hold line-level review until it's clean. Reviewed at commit 8e9c410 (77 files, ~8.3k+/1.7k-).

🐝 Migration 0025 is a three-way collision

origin/main already ships 0025_relay_invites.sql (merged). This PR's 0025_sticker_catalog.sql and #2948's 0025_channel_owner_recovery.sql both also claim 0025. sqlx keys migrations by the numeric prefix (version), so a duplicate version fails at startup. This PR must renumber to the next free slot — coordinate with #2948 so you don't re-collide. This is part of why the PR shows CONFLICTING.

Auth boundary — verified

  • KIND_STICKER_PACK = 30031 is parameterized-replaceable (compile-time assert!(is_parameterized_replaceable(...))).
  • KIND_STICKER_CATALOG = 13536 mutations route through relay_admin.rs with a sticker_catalog_command_requires_admin_users ingest test and coordinate validation (30031:{author}:{identifier}).
  • Correct gating — catalog is admin-only, packs are user-replaceable.

Why it's blocked for now

CONFLICTING + the 0025 collision + 77 files across relay/db/cli/desktop/mobile. A meaningful line-level review isn't worth doing until it's structurally clean.

Action items

  • [ ] Rebase (currently CONFLICTING).
  • [ ] Renumber migration off 0025 to the next free slot (coordinate with #2948 so they don't re-collide).
  • [ ] After rebase + renumber, request a full line-level review — ~8k lines is too large to review meaningfully in the current state.

Independent review by Fizz 🐝 — auth boundary + structure triaged against the checked-out branch; not yet line-reviewed.

dophsquare avatar Jul 28 '26 17:07 dophsquare

@vincenzopalazzo you still working on this? this is a great feature, that blocks from moving over from telegram to buzz. you need help

mattkanwisher avatar Jul 31 '26 20:07 mattkanwisher

@mattkanwisher no i just need to have a feedback from the block team that they want this then I can rebase and move along with the review!

The code is mostly ready

vincenzopalazzo avatar Jul 31 '26 21:07 vincenzopalazzo

@vincenzopalazzo they already reviewed it and said why its blocked , I fixed their comment in my branch can you merge in my branch? https://github.com/mattkanwisher/buzz/pull/1

mattkanwisher avatar Jul 31 '26 22:07 mattkanwisher

@mattkanwisher if you the credit to me for the stickers idea you can carry on the PR and I will close it, feel free to ping me if you need any input on the design

vincenzopalazzo avatar Jul 31 '26 22:07 vincenzopalazzo

@vincenzopalazzo ok feel free to close this. I also included your commits so you'll get credit https://github.com/block/buzz/pull/4026

mattkanwisher avatar Jul 31 '26 22:07 mattkanwisher

Continuing this on https://github.com/block/buzz/pull/4026

vincenzopalazzo avatar Aug 01 '26 08:08 vincenzopalazzo