Skip to content

feat(communities): add BUZZ_DEV_OPEN_RELAY to open the default relay on fresh dev ports - #151

Merged
wesbillman merged 6 commits into
mainfrom
remember-the-community
Sep 23, 2026
Merged

wesbillman merged 6 commits into
mainfrom
remember-the-community

Conversation

@matt2e

@matt2e matt2e commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in development setting, BUZZ_DEV_OPEN_RELAY=1, that starts a dev server's viewer already in the community named by BUZZ_RELAY_URL instead of Personal space — so a fresh dev port doesn't need the community to be joined by hand each time.

Changes

  • vite.config.ts: resolves BUZZ_RELAY_URL to a canonical origin and exposes it as VITE_BUZZ_OPEN_RELAY only when the dev server is live and the setting is exactly 1. Builds and any other value see "". BUZZ_DEV_OPEN_RELAY=1 without BUZZ_RELAY_URL fails at configuration time rather than silently doing nothing.
  • src/features/communities/service.ts: createCommunities takes an openRelay origin. A viewer with no saved client record on this origin is seeded with that community as its single membership and selection, labeled by relay host, and the seeded record is persisted once so a later configuration change cannot revoke it. Any saved record — including one that selects Personal space — wins over the seed, and switching in the UI never writes configuration.
  • Tests: dev/vite-config.test.mjs covers the serve/build × unset/""/0/1/true matrix, the no-viewer-pin case, and the missing-relay failure. src/features/communities/service.test.ts covers seeding (including alias resolution, persistence, and the single session request) and the saved-record-wins path.
  • Docs: .env.example, README.md, docs/communities.md, and docs/contributing.md describe the setting, its dev-only scope, and that it never publishes anything.

Testing

Full pre-push suite passes: 207 files, 2210 tests, plus the design-system checks.

🤖 Generated with Claude Code

…on fresh dev ports

Set BUZZ_DEV_OPEN_RELAY=1 in .env.local to have a live dev server save and
select the canonical BUZZ_RELAY_URL origin, labeled with its host, for a viewer
whose local client record on that origin is absent. Only "1" enables it and it
requires BUZZ_RELAY_URL, failing config loading otherwise, so the relay URL keeps
its documented meaning. Any saved record, including Personal space, wins over
the seed, and production builds never see it.

The Vite config computes the seed only for a live dev server and exposes it via
define like VITE_BUZZ_LIVE; the communities service seeds and persists the
membership once during the normal identity load.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
@matt2e
matt2e requested review from a team, comp615 and wesbillman as code owners September 23, 2026 01:24

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Reviewed 896d6072f425603ab9d064e091d6a43912259f95 against pinned base 877ae2a6749221dd6850d5695b5c8de023a239e3.

No blocking defect found in this startup change. The explicit live-dev opt-in preserves saved Personal/community records produced by the app, reuses existing destination/session and access checks, and does not introduce shared last-choice state or invitation/profile publication. Build/package and fixture paths remain excluded. This is a source-review verdict, not merge approval.

  • Validation gate remains: hosted CI is red. It tested synthetic merge ecfe9bde1f933e325f148d6ad0796128803686db of this exact head/base. All 2,210 JavaScript tests passed, including the new service and real Vite-config cases. Chromium failed the existing presence receipt-spacing assertion at tests/browser/presence.spec.mjs:353 (4,987.36 ms versus ≥4,990 ms); the same case passed WebKit. This delta does not change that path. Resolve or explicitly disposition the failed check before merge; I have not established that it is a flake.
  • Non-blocking follow-ups: the seed branch tests parsed-value truthiness, so an explicitly stored raw JSON null/false would be replaced. No supported scalar writer was established; normal saved Personal is an object and is preserved. Checking raw key absence would match the documentation literally. Also add a small createServices() test for VITE_BUZZ_OPEN_RELAY; config and service tests currently cover each side, not their composition.

No PR code was executed during review. Live fresh-origin/browser and native-dev acceptance remain unverified; Windows native CI was skipped. No approval or merge.

matt2e and others added 3 commits September 23, 2026 13:07
…absent

The seed ran whenever the parsed local client record was falsy, so a stored
`null`, `false`, `0` or `""` was overwritten while malformed JSON was left
alone. The docs say the seed is for a viewer whose record is absent, so check
the raw stored string for null instead of the parsed value: any stored text,
including one this reader cannot parse, now wins over the seed. Nothing in the
app writes a scalar or removes the key, so this matches the code to its
documentation rather than fixing an observed bug.

Cover the two rows that had no test: a stored falsy record and a stored
malformed record both open Personal space, request only the identity, and
leave the stored text untouched. The setup helper now stores a string argument
verbatim so a case can pin the exact stored text.

Also exercise the define end to end in src/app/services.test.ts, where the
real createServices composition seeds, selects, acquires a session for, and
persists the configured relay.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
…seed

The broker startup tests stub the BUZZ_ inputs to empty so loadEnv cannot
mix a developer's .env.local into their assertions, but BUZZ_DEV_OPEN_RELAY
was left unstubbed. With that flag set locally and BUZZ_RELAY_URL stubbed
empty, config resolution hit the new guard and failed 22 tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…el suite

Booting a real Vite server, SSR-loading the service graph and rendering every
bundled page costs seconds on its own, leaving almost no headroom in the 5s
default. Under the full suite it timed out, matching how other heavyweight
suites here declare their own budget.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Changes requested: one documentation correction; no blocking implementation findings. Reviewed 14f1fdb6ba1e734741a2617c60d630a102b8d877 against 877ae2a6749221dd6850d5695b5c8de023a239e3, including the delta from 896d6072f425603ab9d064e091d6a43912259f95.

The inline P2 identifies a false no-publication assurance. Exit criterion: narrow the README wording to no implicit join/invite/profile publication, and state that ordinary session traffic and presence apply. Do not change startup behavior or add presence suppression. This wording predates the follow-up delta and was missed in my earlier review; the traced real-account side effect is why I am raising it now.

Both earlier follow-ups are resolved: only an absent storage key permits seeding, and the real-app composition test covers the environment handoff, selected session and persistence. The 30s page-test watchdog preserves the existing assertions and is proportionate to the heavy integration operation; it is not proof that all flakes are fixed.

Existing CI run35813963266 passed at merge 6167e282457ee09be71cf758b7374cbb6a194120 of this exact head/base: 207 files / 2,213 tests, Chromium/WebKit journeys and Rust/tool integration. Windows native validation was skipped. No PR code was executed by this review; real-account startup and native/packaged acceptance remain unverified.

Nonblocking process note: commits c66d73078d708b19060ca50773cea8fe6be6f1e7 and 14f1fdb6ba1e734741a2617c60d630a102b8d877 lack the repository-required Signed-off-by trailer despite the hosted DCO check passing. Please correct them or obtain the maintainer’s disposition; this is not the reason for changes requested.

Comment thread README.md Outdated
URL remain usable. Configuration does not automatically join a community.
URL remain usable. Configuration does not automatically join a community:
`BUZZ_DEV_OPEN_RELAY=1` only saves and selects the default relay locally on a
dev port whose saved choice is absent, without publishing anything.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Narrow the no-publication assurance for automatic selection

On a fresh live dev origin with the flag enabled, this path immediately acquires the ordinary selected session (src/features/communities/service.ts:169-192). Once its stream connects, session.ts:1200-1204 calls presence.connected(true); src/features/presence/presence.ts:171-205 schedules a Web Locks-owned publication, and src/features/relay/live.ts:588-637 signs/sends kind20001. In a supported browser with an authenticated live stream, the real account can therefore become visibly online/away without another UI action. “Without publishing anything” is an unsafe assurance, even though no invite or profile is published.

Please say that the option does not join, accept an invite or publish a profile, while normal session traffic and presence still apply. Preserve ordinary session behavior; no presence-suppression feature is requested. This is a source-derived trace, not a live-account reproduction.

Signed-off-by: Matt Toohey <contact@matttoohey.com>

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Clear follow-up review; the prior documentation blocker is resolved. No new blocking findings. This is a comment, not an approval.

Reviewed head 71ffe4f120ba5fd8f9ab84d06b541a85244f7c22 against base 877ae2a6749221dd6850d5695b5c8de023a239e3, with follow-up scope from 14f1fdb6ba1e734741a2617c60d630a102b8d877.

  • README.md:81–85 now correctly limits the promise to no implicit community join, invite acceptance, or profile publication, while explicitly retaining normal session traffic and presence. This satisfies the previous review’s exit criterion. Only README changed since that review; the production, configuration, and test blobs are unchanged.
  • Hosted CI for this exact head completed successfully. Eleven checks succeeded; Windows native validation was skipped.
  • Validation was source/Git-object review on isolated Blox, not reviewer-run tests or live browser/native/account/relay/signing acceptance. The previously reported missing sign-offs on c66d730 and 14f1fdb remain a nonblocking process note; the new commit is signed off.

Preserve identity-name service injection alongside the opt-in development relay seed; update the seed test helper for the combined signature.

Signed-off-by: Carl <32a2e2c9d428ee08902cab75d956da2c1d235a22d4766b0dd4138bf6e2e5db1d@buzz.block.builderlab.xyz>
@wesbillman
wesbillman dismissed their stale review September 23, 2026 14:44

Carl, an automated reviewer, commenting via Wes’s GitHub account. Dismissing my stale changes-requested review: its sole README wording blocker was resolved in 71ffe4f and verified in review 5287232388. Conflict-resolution head ed2ba9a preserves that fix. This dismissal is not approval; current CI and required reviewer approval remain merge gates.

@wesbillman
wesbillman merged commit 3129292 into main Sep 23, 2026
12 checks passed
@wesbillman
wesbillman deleted the remember-the-community branch September 23, 2026 15:12
zrmarley added a commit that referenced this pull request Sep 23, 2026
…search-send

* origin/main:
  Connect attachments to existing message delivery (#176)
  perf: preserve unchanged thread row identities (#171)
  perf: cache markdown preparation by content (#172)
  Add safe attachment upload groundwork (#150)
  feat: add sampling profiler launch modes (#148)
  feat(channels): remove DMs from the sidebar (#157)
  Distinguish namesake agents and selected recipients (#142)
  feat(channels): move diagnostics into Channel Settings (#163)
  Replace warning banners with shared Base UI toasts (#164)
  feat(shortcuts): add keyboard shortcut settings (#155)
  fix(channels): give floating unread cue an opaque panel surface (#153)
  feat(communities): add BUZZ_DEV_OPEN_RELAY to open the default relay on fresh dev ports (#151)
  Restore recipient avatars beside the composer mention tool (#162)
  Fix startup inventory duplication and late panel scroll shifts (#160)
  feat(channels): add channel creation (#138)
  Standardize Button and IconButton with Buzz design tokens (#145)

Signed-off-by: Zach Marley <zmarley@squareup.com>
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