Skip to content

Commit 84a7766

Browse files
committed
Merge remote-tracking branch 'origin/main' into kennylopez-profile-status-indicators
Signed-off-by: kenny lopez <[email protected]>
2 parents 2d94279 + 571c190 commit 84a7766

185 files changed

Lines changed: 17882 additions & 1749 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.env.example‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ RUST_LOG=buzz_relay=debug,buzz_datastore=info,buzz_db=debug,buzz_auth=debug,buzz
274274
# app launch while keeping the current identity and relay data.
275275
# VITE_BUZZ_FORCE_FRESH_ONBOARDING=true
276276

277+
# Protected internal builds only: selects the module graph that contains the
278+
# default-off Bestie experiment. Official OSS builds must leave this unset.
279+
# VITE_BUZZ_BESTIE=1
280+
277281
# ── Subscription & filtering ─────────────────────────────────────────────────
278282
# Subscribe mode: "mentions" (default), "all", or "config" (rule-based).
279283
# BUZZ_ACP_SUBSCRIBE=mentions
@@ -297,6 +301,14 @@ RUST_LOG=buzz_relay=debug,buzz_datastore=info,buzz_db=debug,buzz_auth=debug,buzz
297301
# Set to true to process the agent's own messages (default: ignore self).
298302
# BUZZ_ACP_NO_IGNORE_SELF=false
299303

304+
# ── Session scoping ──────────────────────────────────────────────────────────
305+
# How ACP provider sessions are scoped in channels: "channel" (default) or
306+
# "thread". "channel" keeps one provider session per channel (legacy). "thread"
307+
# gives each canonical channel thread its own isolated provider session; direct
308+
# messages stay conversation-scoped either way. Ships as "channel" so thread
309+
# scoping can be canaried and rolled back without code changes.
310+
# BUZZ_ACP_SESSION_POLICY=channel
311+
300312
# ── Context ──────────────────────────────────────────────────────────────────
301313
# Max context messages fetched for thread replies and DMs (0–100). 0 = disabled.
302314
# BUZZ_ACP_CONTEXT_MESSAGE_LIMIT=12

‎.github/workflows/ci.yml‎

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ jobs:
304304
name: Desktop
305305
runs-on: ubuntu-latest
306306
timeout-minutes: 5
307-
needs: [changes, desktop-core, desktop-smoke-e2e]
307+
needs: [changes, desktop-core, desktop-smoke-e2e, desktop-windows-build]
308308
if: always() && (github.event_name == 'push' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.desktop-rust == 'true' || needs.changes.outputs.rust == 'true')
309309
permissions:
310310
contents: read
@@ -319,6 +319,10 @@ jobs:
319319
echo "Desktop Smoke E2E shards finished with: ${{ needs.desktop-smoke-e2e.result }}"
320320
exit 1
321321
fi
322+
if [ "${{ needs.desktop-windows-build.result }}" != "success" ]; then
323+
echo "Desktop Windows Build finished with: ${{ needs.desktop-windows-build.result }}"
324+
exit 1
325+
fi
322326
echo "Desktop jobs passed"
323327
324328
desktop-e2e-relay:
@@ -685,6 +689,18 @@ jobs:
685689
VALUES ('00000000-0000-4000-8000-00000000c0de', 'localhost:3000')
686690
ON CONFLICT (lower(host)) DO NOTHING
687691
;"
692+
- name: Workflow message provenance tests
693+
# The relay's workflow_sink suite is not selected by the infra-free
694+
# unit job. Run both its pure tests and ignored PostgreSQL tests here so
695+
# authored-template provenance cannot regress behind a green CI build.
696+
run: |
697+
cargo nextest run \
698+
--archive-file target/ci/backend-integration-tests.tar.zst \
699+
-E 'package(buzz-relay) and test(/workflow_sink/)' \
700+
--run-ignored all
701+
env:
702+
DATABASE_URL: postgres://buzz:${{ env.BUZZ_TEST_POSTGRES_PASSWORD }}@localhost:5432/buzz
703+
TEST_DATABASE_URL: postgres://buzz:${{ env.BUZZ_TEST_POSTGRES_PASSWORD }}@localhost:5432/buzz
688704
- name: Replaceable persistence PostgreSQL tests
689705
# Transaction, concurrency, and mention-index coverage for the
690706
# replaceable-event store seam. These tests require real Postgres and
@@ -1121,6 +1137,36 @@ jobs:
11211137
-p git-credential-nostr \
11221138
-p git-sign-nostr
11231139
1140+
desktop-windows-build:
1141+
name: Desktop Windows Build
1142+
runs-on: windows-latest
1143+
timeout-minutes: 20
1144+
needs: [changes]
1145+
if: github.event_name == 'push' || needs.changes.outputs.desktop == 'true' || needs.changes.outputs.desktop-rust == 'true' || needs.changes.outputs.rust == 'true'
1146+
permissions:
1147+
contents: read
1148+
steps:
1149+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
1150+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1151+
with:
1152+
node-version: 24.14.1
1153+
package-manager-cache: false
1154+
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
1155+
with:
1156+
version: 11.4.0
1157+
- name: Install desktop dependencies
1158+
shell: bash
1159+
run: pnpm install --frozen-lockfile
1160+
- name: Build both protected-feature selections
1161+
shell: pwsh
1162+
run: |
1163+
Remove-Item Env:VITE_BUZZ_BESTIE -ErrorAction SilentlyContinue
1164+
pnpm -C desktop build
1165+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
1166+
$env:VITE_BUZZ_BESTIE = "1"
1167+
pnpm -C desktop build
1168+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
1169+
11241170
windows-rust:
11251171
name: Windows Rust (x86_64-pc-windows-msvc)
11261172
runs-on: windows-latest

‎AGENTS.md‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,91 @@ Additional rules:
151151

152152
---
153153

154+
## Review-Proven Rules
155+
156+
These rules distill the recurring findings from the last 25 PRs' review
157+
threads — 53% of substantive review findings were repeats of the clusters
158+
below, and reviewed PRs averaged ~5 review rounds. A second, independent
159+
mining pass over 71 agent-review rooms (303 findings, Aug 18–29) confirmed
160+
the same clusters and measured how often authors actually fix each class
161+
once flagged: test-seam binding and unbounded-resource findings were fixed
162+
**100%** of the time, swallowed-error findings **90%**, stale-state races
163+
**70%** — these are not style opinions, they are defects authors agree
164+
with on sight. Apply the rules **before writing code**; each cites the
165+
PRs where reviewers litigated it.
166+
167+
1. **Every caught failure must leave a durable retry record or propagate.**
168+
Never catch-log-and-return-success (opt-out revocation permanently
169+
abandoned, PR #6269), never convert a terminal failure into an
170+
authoritative success/empty result (cold-history `error` → `success`
171+
with `[]`, PR #7013), and never delete the durable journal an operation
172+
depends on before its retry has actually succeeded (PR #6269). If a
173+
partial failure can orphan committed state (installations, endpoints),
174+
schedule its cleanup/renewal durably (PRs #6269, #6996, #7013).
175+
176+
2. **Fence async results by generation; clear derived metadata on every
177+
removal path.** A completing in-flight probe or fetch must verify it is
178+
still the newest before writing its result (stale login-shell probe
179+
recached a false-negative PATH, PR #6904). Provenance/ownership metadata
180+
attached to synthetic state must be updated or cleared on *all* paths
181+
that remove or refresh that state — typed deletion, toolbar removal,
182+
profile/name refresh; enumerate the paths and test each (PR #6956 burned
183+
4 rounds on this one class). Backfill and live subscriptions must
184+
overlap — a gap between a finite history REQ and the live subscription
185+
silently drops events (PR #3995); a retired chunk must not keep a stale
186+
scope fence (PR #6996). (PRs #3995, #6904, #6956, #6996)
187+
188+
3. **Regression tests must bind the production seam and be falsifiable.**
189+
See "Review-Proven Test Standards" in [TESTING.md](TESTING.md) for the
190+
full rule — in short: a guard whose removal doesn't fail any test
191+
protects nothing; bind regression tests to the production code path,
192+
not test-only helpers. (PRs #6807, #6980, #6996, #7013)
193+
194+
4. **Bound every resource, loop, and process tree.** Cap captured
195+
output (unbounded discovery temp files exhausted disk and overran the
196+
deadline, PR #6904). Containment failures are errors, not warnings — a
197+
tolerated Job Object creation failure or a `setsid` escape leaks whole
198+
process trees (PR #6904). Retry/re-subscribe loops need backoff and a
199+
terminal state: a persistent failure must not self-amplify into an
200+
unbounded refresh loop (PR #6996), and check zero-delay edge cases
201+
(`remainingMs()==0` selected the wrong fallback window, PR #6996).
202+
(PRs #6904, #6996)
203+
204+
5. **One user action = one atomic persist.** Implementing a single user
205+
commit as N independent durable writes leaves torn state on partial
206+
failure (theme "Set" as three independent notifier persists, PR #6944;
207+
relay-commit vs. local-save recovery gap, PR #6269). Persist one
208+
snapshot, or order the writes so every prefix is consistent and the
209+
remainder is durably retried per rule 1. (PRs #6269, #6944)
210+
211+
6. **A guard that hides the only recovery affordance is a functional
212+
failure.** Before adding a visibility predicate or state fence, ask:
213+
if the state it assumes goes wrong, does the user still have a way
214+
back? A fence that permanently suppresses "jump to latest" after a
215+
bounded correction fails strands the user silently — two reviewers
216+
flagged this independently (PR #6807).
217+
218+
7. **Audit assistive semantics on every new visual component.** The
219+
agent-review lanes flagged accessibility defects on 44 findings across
220+
the Aug 18–29 window — the second-largest cluster — and authors fixed
221+
the concrete ones (duplicate VoiceOver stops on native controls,
222+
actionable labels owned by two widgets at once, PR #6680; missing or
223+
decorative-leaking semantics on new UI, PRs #6611, #6702, #6885, #6905,
224+
#6908). New UI ships with: one owner per actionable label, no duplicate
225+
screen-reader stops, and explicit semantics for every interactive
226+
element. (PRs #6611, #6680, #6702, #6885, #6905, #6908, #6980)
227+
228+
8. **Every input modality is a first-class seam.** Keyboard, pointer, and
229+
hotkey paths must not silently diverge: `Shift+Space` treated as plain
230+
`Space` because the guard omitted `shiftKey` (PR #6862), keyboard
231+
ownership not released on blur, modifier keys dropped on the non-mouse
232+
path (PRs #5958, #6793, #6860, #6908, #7006). When adding an input
233+
handler, enumerate the modalities that can reach it and test the
234+
non-primary ones — that's where the defects were. (PRs #5958, #5972,
235+
#6793, #6860, #6862, #6908, #7006)
236+
237+
---
238+
154239
## Key Patterns
155240

156241
**Nostr-first HTTP surface**: Buzz's primary API is NIP-29 over WebSocket. The relay also exposes a narrow HTTP surface: NIP-11/NIP-05 metadata, `POST /events`, `POST /query`, `POST /count`, workflow webhooks at `/hooks/{id}`, Blossom media, git smart HTTP, git policy hooks, and health probes. These HTTP paths all preserve the same host-derived community boundary.

‎ARCHITECTURE.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,15 @@ This prevents a race where a non-member receives live fan-out events from a priv
325325

326326
After registering, the REQ handler queries Postgres for stored events matching the filters (up to 500 per filter, hard cap). These are sent as `["EVENT", sub_id, event]` frames before `["EOSE", sub_id]`. New events arriving after EOSE are delivered via the fan-out path.
327327

328+
**Client consumption invariant.** A client rebuilding channel state must
329+
open its live subscription before (or overlapping) the finite history
330+
REQ — a gap between the last backfill page and live delivery silently
331+
drops events and rebuilds stale state (PR #3995). When the relay sends a
332+
terminal CLOSED, the subscription is removed server-side; any client-side
333+
ownership tied to it (chunk/scope fences) must be released in the same
334+
step, or live delivery stops permanently while the client believes it is
335+
subscribed (PR #6996).
336+
328337
---
329338

330339
## 6. Crate Reference

‎Justfile‎

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,18 @@ desktop-tauri-test-compiled-flags: _ensure-sidecar-stubs
256256
BUZZ_BUILD_AGENT_ACCESS_OWNER_ONLY=1 \
257257
BUZZ_TEST_EXPECTED_AGENT_ACCESS_OWNER_ONLY=true \
258258
cargo test compiled_policy_matches_expected -- --ignored --nocapture
259-
echo "Both compiled states verified."
259+
echo "=== Maximum accepted demo name reaches Rust build validation ==="
260+
DEMO_CONFIG="$(node ../scripts/demo-build-config.mjs "$(printf 'x%.0s' {1..31})" /dev/null 1234567812345678)"
261+
DEMO_SLUG="$(node -e 'console.log(JSON.parse(process.argv[1]).slug)' "$DEMO_CONFIG")"
262+
BUZZ_BUILD_DEMO_SLUG="$DEMO_SLUG" \
263+
BUZZ_TEST_EXPECTED_DEMO_SLUG="$DEMO_SLUG" \
264+
cargo test compiled_demo_slug_matches_expected -- --ignored --nocapture
265+
BUZZ_BUILD_DEMO_SLUG="$DEMO_SLUG" cargo test --workspace
266+
if node ../scripts/demo-build-config.mjs "$(printf 'x%.0s' {1..32})" /dev/null 1234567812345678; then
267+
echo "A 32-character demo name unexpectedly passed JavaScript validation" >&2
268+
exit 1
269+
fi
270+
echo "Both compiled states and the accepted/rejected demo-name boundary verified."
260271
261272
# Build the full desktop Tauri app locally (unsigned, for testing)
262273
# Sidecar binary list must stay in sync with _ensure-sidecar-stubs above.
@@ -277,6 +288,38 @@ desktop-release-build target="aarch64-apple-darwin":
277288
pnpm install
278289
cd {{desktop_dir}} && pnpm tauri build --features mesh-llm --target {{target}}
279290
291+
# Build an unsigned named macOS demo DMG with isolated app and runtime identities.
292+
desktop-demo-build demo_name target="aarch64-apple-darwin":
293+
#!/usr/bin/env bash
294+
set -euo pipefail
295+
TARGET={{target}}
296+
[[ "$(uname -s)" == "Darwin" && "$TARGET" == *-apple-darwin ]] || { echo "Demo DMGs require a macOS Apple target" >&2; exit 2; }
297+
CONFIG_PATH="$(mktemp "${TMPDIR:-/tmp}/buzz-demo-config.XXXXXX")"
298+
trap 'rm -f "$CONFIG_PATH"' EXIT
299+
DEMO_BUILD_ID="$(node -e 'console.log(require("node:crypto").randomBytes(8).toString("hex"))')"
300+
DEMO_CONFIG="$(node desktop/scripts/demo-build-config.mjs {{quote(demo_name)}} "$CONFIG_PATH" "$DEMO_BUILD_ID")"
301+
read_config() { node -e 'console.log(JSON.parse(process.argv[1])[process.argv[2]])' "$DEMO_CONFIG" "$1"; }
302+
PRODUCT_NAME="$(read_config productName)"
303+
DMG_VOLUME_NAME="$(read_config dmgVolumeName)"
304+
DMG_FILE_STEM="$(read_config dmgFileStem)"
305+
DEMO_SLUG="$(read_config slug)"
306+
cargo build --release --target "$TARGET" \
307+
-p buzz-acp -p buzz-agent -p buzz-backend-kubernetes -p buzz-dev-mcp \
308+
-p git-credential-nostr -p buzz-cli
309+
./scripts/bundle-sidecars.sh "$TARGET"
310+
pnpm install
311+
cd {{desktop_dir}}
312+
BUZZ_BUILD_DEMO_SLUG="$DEMO_SLUG" pnpm tauri build --features mesh-llm --target "$TARGET" --bundles app --config "$CONFIG_PATH"
313+
cd ..
314+
VERSION="$(node -p "require('./desktop/package.json').version")"
315+
DMG_ARCH="${TARGET%%-*}"; [[ "$DMG_ARCH" == "x86_64" ]] && DMG_ARCH=x64
316+
APP_PATH="desktop/src-tauri/target/$TARGET/release/bundle/macos/$PRODUCT_NAME.app"
317+
PLIST="$APP_PATH/Contents/Info.plist"
318+
/usr/libexec/PlistBuddy -c "Set :CFBundleDisplayName $PRODUCT_NAME" "$PLIST"
319+
/usr/libexec/PlistBuddy -c "Set :CFBundleName $PRODUCT_NAME" "$PLIST"
320+
codesign --force --deep --sign - "$APP_PATH"
321+
VOL_NAME="$DMG_VOLUME_NAME" ./desktop/scripts/package-macos-dmg.sh "$APP_PATH" "desktop/src-tauri/target/$TARGET/release/bundle/dmg/${DMG_FILE_STEM}_${VERSION}_${DMG_ARCH}.dmg"
322+
280323
# Run desktop checks suitable for CI / pre-push
281324
desktop-ci: desktop-check desktop-test desktop-tauri-fmt-check desktop-build desktop-tauri-check desktop-tauri-test
282325

@@ -381,6 +424,10 @@ test-unit:
381424
# disabled_mode_still_requires_the_correct_host / _a_matching_origin.
382425
cargo nextest run -p buzz-relay --lib \
383426
-E 'test(/^api::admin::/) - test(=api::admin::tests::disabled_mode_allows_unauthenticated_requests_on_the_admin_host) - test(=api::admin::tests::nip98_mode_unrostered_signer_does_not_consume_a_replay_slot)'
427+
# ACP author-gate and queue tests protect the trust boundary between
428+
# relay events and agent prompts. They are infra-free; ignored lifecycle
429+
# tests remain excluded and run in their dedicated integration lanes.
430+
cargo nextest run -p buzz-acp --lib
384431
else
385432
./scripts/run-tests.sh unit
386433
fi

‎TESTING.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ just test # unit + integration (starts Docker if needed)
1616
cargo test -p buzz-test-client -- --ignored
1717
```
1818

19+
### Review-Proven Test Standards
20+
21+
Mined from the last 25 PRs' review threads (see Review-Proven Rules in
22+
[AGENTS.md](AGENTS.md)); this is the test-quality rule reviewers litigated
23+
most:
24+
25+
**Regression tests must bind the production seam and be falsifiable.**
26+
A guard whose removal doesn't fail any test protects nothing — mutations
27+
survived the full mobile suite twice (PRs #6996, #7013). Don't bind a
28+
regression test to a test-only helper instead of the production code
29+
path (PR #7013). Give pure predicates a table test over the full input
30+
combination space (PR #6807). Scope Playwright locators — unscoped
31+
`getByText` in a required smoke test is a strict-mode flake (PR #6980).
32+
(PRs #6807, #6980, #6996, #7013)
33+
1934
---
2035

2136
## Live Local Relay

0 commit comments

Comments
 (0)