Skip to content

fix: expose community icon control on open relays - #2640

Merged
wesbillman merged 1 commit into
mainfrom
carl/non-nip43-community-icon
Jul 23, 2026
Merged

fix: expose community icon control on open relays#2640
wesbillman merged 1 commit into
mainfrom
carl/non-nip43-community-icon

Conversation

@wesbillman

@wesbillman wesbillman commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • expose the existing community icon editor when the active relay does not advertise NIP-43 membership enforcement
  • keep member-management controls gated to relay-reported owner/admin roles
  • share one fail-closed capability predicate between settings navigation and the icon card
  • rely on the existing kind 9033 relay authorization for the authoritative icon-write permission check

Why

The Block production relay is intentionally open and does not advertise NIP-43, so Desktop skips the membership snapshot and currently hides the icon editor even though the relay supports owner-signed kind 9033 icon updates.

This does not enable membership management on open relays and does not change relay admission semantics.

Verification

At commit 5ea82929cb28814c027c0640996870f9594d4722:

  • pnpm exec biome lint src/shared/api/relayMembers.ts src/shared/api/relayMembers.test.mjs src/features/settings/ui/SettingsView.tsx src/features/community-members/ui/CommunityMembersSettingsCard.tsx
  • pnpm typecheck
  • pnpm test — 3,462 passed before history-only rebase onto current main
  • git diff --check

@wesbillman
wesbillman requested a review from a team as a code owner July 23, 2026 22:41
@wesbillman
wesbillman force-pushed the carl/non-nip43-community-icon branch from a7dc11b to 21c0332 Compare July 23, 2026 22:43
Co-authored-by: npub1cl47vfhsqpqy9pwndphpm36vcp7vvz5h2js4qpqm5yewzj7nutkq7xyw8c <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
Signed-off-by: npub1cl47vfhsqpqy9pwndphpm36vcp7vvz5h2js4qpqm5yewzj7nutkq7xyw8c <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
@wesbillman
wesbillman force-pushed the carl/non-nip43-community-icon branch from 21c0332 to 5ea8292 Compare July 23, 2026 22:45
@wesbillman
wesbillman merged commit e341b09 into main Jul 23, 2026
25 checks passed
@wesbillman
wesbillman deleted the carl/non-nip43-community-icon branch July 23, 2026 23:13
brow pushed a commit that referenced this pull request Jul 24, 2026
…r-only

* origin/main: (28 commits)
  Clarify agent harness defaults in create flow (#2601)
  chore(mobile): relax release check (#2636)
  fix: expose community icon control on open relays (#2640)
  chore(release): release Buzz Desktop version 0.4.24 (#2627)
  feat: remember per-community navigation location (#2629)
  fix(desktop): suppress Windows console flashes and reject WSL bash alias (#2587)
  fix(desktop): fix Windows PATH clobber and .cmd shim EINVAL (#2563)
  Update SECURITY.md
  chore(mobile): lighter-weight release process (#2144)
  Gate default relay auto-connect behind release flag (#2589)
  fix(desktop): fast-track relay restart reconnects (#2579)
  fix(sharing): preserve agent/team snapshot tEXt chunks through media sanitization (#2438)
  fix(acp): restrict DM turns to owner and verified siblings (#2591)
  test(desktop): live relay kill/restart reconnect gate (#2583)
  fix(relay): send 1012 restart close to all clients on graceful drain (#2575)
  fix(desktop): retry failed initial relay dials (#2564)
  Refine channel lifecycle settings (#2427)
  Fix avatar upload lifecycle edge cases (#2277)
  fix(observer): eager archive hydration on panel open + 200-frame pages (#2574)
  fix(cli): install rustls crypto provider to unbreak WSS publishes in release builds (#2590)
  ...

Co-authored-by: npub102wg7q285p64ch2fjvstmf2ntn2sz3c4u5hmwatalc76mhsuauysftjtfj <7a9c8f0147a0755c5d499320bda5535cd5014715e52fb7757dfe3dadde1cef09@buzz.block.builderlab.xyz>
Signed-off-by: npub102wg7q285p64ch2fjvstmf2ntn2sz3c4u5hmwatalc76mhsuauysftjtfj <7a9c8f0147a0755c5d499320bda5535cd5014715e52fb7757dfe3dadde1cef09@buzz.block.builderlab.xyz>

# Conflicts:
#	desktop/src-tauri/build.rs
#	desktop/src/features/agents/ui/AgentDefinitionDialog.tsx
#	desktop/src/testing/e2eBridge.ts
#	desktop/tests/helpers/bridge.ts
wpfleger96 added a commit that referenced this pull request Jul 24, 2026
## Buzz Desktop release v0.4.25

### Changes since v0.4.24:

- fix(discovery): spawn PowerShell install commands natively on Windows
([#2750](#2750))
([`f3981dbfe`](f3981db))
- fix(desktop): use augmented PATH for model discovery subprocess
([#2753](#2753))
([`3bd3a014c`](3bd3a01))
- Improve huddle audio failure handling
([#2578](#2578))
([`fb4a801ad`](fb4a801))
- fix(onboarding): show real install errors and fix concurrent install
state ([#2658](#2658))
([`9731cd818`](9731cd8))
- feat(node): add Windows managed Node.js fallback (win-x64 + win-arm64)
([#2661](#2661))
([`596386ee5`](596386e))
- fix(desktop): parse runtime team instructions section
([#2645](#2645))
([`269ef357f`](269ef35))
- Match create-channel template selector styling
([#2654](#2654))
([`72bbaece4`](72bbaec))
- feat(desktop): make pull request reviews actionable
([#2510](#2510))
([`9081ab0ec`](9081ab0))
- fix(desktop): shared-compute usability — share toggle, usage
indicator, model resync
([#2448](#2448))
([`9cc9652c7`](9cc9652))
- fix(desktop): refine focused thread dismissal targets
([#2644](#2644))
([`c86c4f59c`](c86c4f5))
- Clarify agent harness defaults in create flow
([#2601](#2601))
([`76aeae703`](76aeae7))
- fix: expose community icon control on open relays
([#2640](#2640))
([`e341b09cb`](e341b09))

**To release:** merge this PR. The tag and build will happen
automatically.
tlongwell-block added a commit that referenced this pull request Aug 1, 2026
…d:9033) (#3998)

## Problem

The desktop deliberately shows the workspace icon editor on open relays
(#2640, gate: `canEditIcon` in
`desktop/src/features/communities/ui/EditCommunityDialog.tsx`) and
defers to the relay-side kind:9033 check — which required an admin/owner
row in `relay_members`. For a community with **no admin/owner row at
all** (the `ensure_configured_community` path, which never writes an
owner), every 9033 was refused and the icon was permanently unsettable.

**Correction from review (thanks @dawn):** the original version of this
PR claimed nobody holds a role on an open relay. That's false —
`main.rs` bootstraps `RELAY_OWNER_PUBKEY` as owner regardless of
`BUZZ_REQUIRE_RELAY_MEMBERSHIP`, so a production open relay like
bb-block *does* have an owner row, and the old gate was refusing
everyone except that owner. The first revision of this diff would have
silently widened that owner-only control to any NIP-42-authenticated
sender.

## Fix — steward-wins

`may_set_workspace_profile(sender_role, membership_enforced,
community_has_steward)`:

| Relay mode | Community has admin/owner row? | Who may set the icon |
|---|---|---|
| Closed (`require_relay_membership=true`) | any | admin or owner
(unchanged) |
| Open | yes (e.g. bb-block) | admin or owner (unchanged posture) |
| Open | no (genuinely rosterless) | any NIP-42-authenticated sender |

- New DB helper `has_admin_or_owner(community)`
(`crates/buzz-db/src/relay_members.rs`); the call site only queries it
on open relays.
- The rosterless admit logs a `warn!` with the sender pubkey — 9033
writes no audit row and publishes no announcement event (unlike
9030/9031), so this is the only durable attribution.
- Kinds 9030–9032, NIP-42 auth, `AdminUsers` scope, ban gate, and icon
validation are all untouched.
- Doc comment fixed: cited nonexistent `canEditCommunityProfile`; real
symbol is `canEditIcon`.

## Test coverage — closing the mutation gap

Dawn's mutation testing showed the original unit tests pinned only the
helper's truth table: inverting the flag at the call site or deleting
the gate entirely survived the full suite.

- Unit tests now cover the 3-arg truth table (closed
steward-independent, open-with-steward stays steward-only,
rosterless-open admits).
- Two `#[ignore]`d Postgres integration tests drive
`handle_relay_admin_event` with a real `AppState` (open rosterless admit
→ steward appears → roleless refused again; closed relay member
refused). Wired into the Backend Integration CI job as a dedicated
nextest step.
- **Both of Dawn's mutants verified killed** at this head: flag
inversion fails 1 unit test; gate deletion fails both integration tests
(`Ok(())` where `Rejected` expected).

## CI wrinkle found and fixed: pre-existing schema drift

The first Backend Integration run of the new 9033 tests failed with
`column "icon" of relation "communities" does not exist` — migration
`0003_community_icon.sql` added the column, but `schema/schema.sql` (the
desired-state file that CI job applies via pgschema) was never updated.
Pre-existing drift, invisible until a test in that job actually wrote
the column. Fixed in `297148f62` (3-line addition to
`schema/schema.sql`).

## Receipts (at `1b4b52db8` code / `297148f62` head)

- `cargo test -p buzz-relay`: 835 pass, 1 fail —
`api::mesh_demo::tests::demo_join_forwarded_arm_round_trips_echo`,
pre-existing (fails identically at the old base and on clean main);
`telemetry::trace_context_lookup_does_not_enable_callsites` is a known
order-dependent flake, passes in isolation.
- `cargo test -p buzz-db`: 94 pass.
- Both ignored integration tests pass live against local Postgres.
- `cargo fmt --all -- --check`: clean.
- Live-local pass per TESTING.md at this head (release build, relay on
:3199, real WS + NIP-42 via nak):
- open rosterless: roleless key sets icon → NIP-11 serves it; `warn!`
with sender pubkey in the relay log
- open + owner row inserted: fresh roleless key refused ("must be admin
or owner"); owner sets icon
- closed relay (owner bootstrapped, `BUZZ_RELAY_PRIVATE_KEY` set): plain
member refused, owner sets icon, `javascript:` URL rejected, empty icon
clears (NIP-11 → null)

---------

Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
mrmoe28 pushed a commit to mrmoe28/buzz-reloaded that referenced this pull request Aug 6, 2026
## Buzz Desktop release v0.4.25

### Changes since v0.4.24:

- fix(discovery): spawn PowerShell install commands natively on Windows
([#2750](block/buzz#2750))
([`d0fc1b5ef`](block/buzz@d0fc1b5))
- fix(desktop): use augmented PATH for model discovery subprocess
([#2753](block/buzz#2753))
([`bf8a73a11`](block/buzz@bf8a73a))
- Improve huddle audio failure handling
([#2578](block/buzz#2578))
([`a555f9e52`](block/buzz@a555f9e))
- fix(onboarding): show real install errors and fix concurrent install
state ([#2658](block/buzz#2658))
([`0bb0c2b1a`](block/buzz@0bb0c2b))
- feat(node): add Windows managed Node.js fallback (win-x64 + win-arm64)
([#2661](block/buzz#2661))
([`5f1c56ae1`](block/buzz@5f1c56a))
- fix(desktop): parse runtime team instructions section
([#2645](block/buzz#2645))
([`8bf56ae69`](block/buzz@8bf56ae))
- Match create-channel template selector styling
([#2654](block/buzz#2654))
([`c0a20703f`](block/buzz@c0a2070))
- feat(desktop): make pull request reviews actionable
([#2510](block/buzz#2510))
([`1585dad4e`](block/buzz@1585dad))
- fix(desktop): shared-compute usability — share toggle, usage
indicator, model resync
([#2448](block/buzz#2448))
([`12ac55b7e`](block/buzz@12ac55b))
- fix(desktop): refine focused thread dismissal targets
([#2644](block/buzz#2644))
([`2f6722540`](block/buzz@2f67225))
- Clarify agent harness defaults in create flow
([#2601](block/buzz#2601))
([`c63210c95`](block/buzz@c63210c))
- fix: expose community icon control on open relays
([#2640](block/buzz#2640))
([`50454cc86`](block/buzz@50454cc))

**To release:** merge this PR. The tag and build will happen
automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants