Skip to content

Commit b25a1dd

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 292c7e9 + c71f658 commit b25a1dd

376 files changed

Lines changed: 35059 additions & 4804 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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,10 @@ BUZZ_S3_ADDRESSING_STYLE=path
102102
# BUZZ_MEDIA_MAX_CONCURRENT_UPLOADS=8
103103
# BUZZ_MEDIA_MAX_CONCURRENT_UPLOADS_PER_PUBKEY=2
104104
# BUZZ_MEDIA_UPLOADS_PER_MINUTE=30
105-
# Require Blossom t=get auth and relay membership for GET/HEAD /media/*.
106-
# Keep off until desktop/mobile/CLI clients that attach media read auth are deployed.
107-
# BUZZ_REQUIRE_MEDIA_GET_AUTH=false
108-
# Legacy alias accepted by the relay while rollout docs catch up:
109-
# BUZZ_REQUIRE_MEDIA_READ_AUTH=false
105+
# GET/HEAD /media/* always require Blossom t=get auth and relay membership.
106+
# BUZZ_REQUIRE_MEDIA_GET_AUTH and BUZZ_REQUIRE_MEDIA_READ_AUTH are no longer
107+
# read; setting either (including to false) changes nothing and the relay warns
108+
# about it at startup.
110109

111110
# -----------------------------------------------------------------------------
112111
# Ephemeral Channels (TTL testing)

‎.github/workflows/auto-tag-on-release-pr-merge.yml‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
echo "enabled=true"
9292
echo "tag=${TAG_PREFIX}${VERSION}"
9393
if [[ "$TAG_PREFIX" == desktop-v ]]; then
94-
echo "target_sha=${{ github.event.pull_request.merge_commit_sha }}"
94+
echo "target_sha=${{ github.event.pull_request.head.sha }}"
9595
echo "desktop=true"
9696
else
9797
echo "target_sha=$GITHUB_SHA"
@@ -112,6 +112,7 @@ jobs:
112112
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
113113
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
114114
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
115+
MERGED_AT: ${{ github.event.pull_request.merged_at }}
115116
run: |
116117
VERSION="${VERSION#desktop-v}"
117118
export VERSION
@@ -146,7 +147,17 @@ jobs:
146147
exit 1
147148
fi
148149
fi
149-
gh api --method POST "repos/$GITHUB_REPOSITORY/git/refs" \
150+
if ! gh api --method POST "repos/$GITHUB_REPOSITORY/git/refs" \
150151
-f ref="refs/tags/$TAG" \
151152
-f sha="$TARGET_SHA" \
152-
--silent
153+
--silent; then
154+
# Ref creation is atomic. A concurrent retry may have won the race;
155+
# accept that only when it created the exact immutable ref.
156+
EXISTING_SHA="$(gh api "repos/$GITHUB_REPOSITORY/commits/$TAG" --jq .sha)"
157+
if [ "$EXISTING_SHA" = "$TARGET_SHA" ]; then
158+
echo "Tag $TAG was concurrently created at $TARGET_SHA"
159+
exit 0
160+
fi
161+
echo "::error::Tag creation failed and $TAG resolves to $EXISTING_SHA (expected $TARGET_SHA)"
162+
exit 1
163+
fi

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,19 @@ jobs:
768768
env:
769769
RELAY_URL: ws://localhost:3000
770770
GIT_CREDENTIAL_NOSTR_BIN: ${{ github.workspace }}/target/ci/git-credential-nostr
771+
- name: Media read-auth e2e
772+
# Reads require kind:24242 `t=get` auth, so these binaries are the only
773+
# coverage that a real relay rejects bare reads and honours host- and
774+
# hash-scoped tokens. They were #[ignore]d and selected by no CI job, so
775+
# the lane never ran; select it here, where MinIO and the seeded
776+
# 'localhost:3000' community already exist.
777+
# --no-fail-fast: without it cargo stops after the first failing binary,
778+
# so one broken case hides every later binary's result.
779+
run: |
780+
cargo test -p buzz-test-client --no-fail-fast --test e2e_media --test e2e_media_extended --test e2e_media_video -- --ignored --nocapture
781+
env:
782+
RELAY_URL: ws://localhost:3000
783+
RELAY_HTTP_URL: http://localhost:3000
771784
- name: Upload relay logs
772785
if: failure()
773786
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7

‎.github/workflows/desktop-release-candidate.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
permissions:
88
contents: read
9+
pull-requests: read
910

1011
jobs:
1112
validate:
@@ -20,6 +21,7 @@ jobs:
2021
- name: Validate immutable desktop candidate
2122
if: startsWith(github.event.pull_request.head.ref, 'version-bump/')
2223
env:
24+
GH_TOKEN: ${{ github.token }}
2325
VERSION: ${{ github.event.pull_request.head.ref }}
2426
run: |
2527
VERSION="${VERSION#version-bump/}"
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Mesh Lifecycle
2+
# Relay-driven mesh lifecycle smoke: membership → signed discovery notes →
3+
# relay-derived allowlist → join → CPU inference over QUIC → stranger denied
4+
# (relay membership rejection + no routed inference, with a differential
5+
# trusted-inference health proof so a dead serve node can't fake a denial).
6+
# Runs the full Buzz "shared compute" join story with three real mesh-llm
7+
# node processes on one runner, using the Buzz relay as the control plane
8+
# (no hand-carried invite tokens). Mirrors the shape mesh-llm's own CI uses
9+
# for its two-node smokes (tiny CPU model, one runner, real QUIC mesh).
10+
11+
on:
12+
push:
13+
branches: [main]
14+
paths:
15+
- 'crates/buzz-relay/examples/mesh_*.rs'
16+
- 'crates/buzz-relay/Cargo.toml'
17+
- 'crates/buzz-admin/**'
18+
- 'crates/buzz-test-client/**'
19+
- 'crates/buzz-ws-client/**'
20+
- 'Cargo.lock'
21+
- 'desktop/src-tauri/src/mesh_llm/**'
22+
- 'scripts/ci-mesh-lifecycle-smoke.sh'
23+
- 'scripts/start-relay-for-tests.sh'
24+
- '.github/workflows/mesh-lifecycle.yml'
25+
pull_request:
26+
paths:
27+
- 'crates/buzz-relay/examples/mesh_*.rs'
28+
- 'crates/buzz-relay/Cargo.toml'
29+
- 'crates/buzz-admin/**'
30+
- 'crates/buzz-test-client/**'
31+
- 'crates/buzz-ws-client/**'
32+
- 'Cargo.lock'
33+
- 'desktop/src-tauri/src/mesh_llm/**'
34+
- 'scripts/ci-mesh-lifecycle-smoke.sh'
35+
- 'scripts/start-relay-for-tests.sh'
36+
- '.github/workflows/mesh-lifecycle.yml'
37+
workflow_dispatch:
38+
39+
concurrency:
40+
group: mesh-lifecycle-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
41+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
42+
43+
env:
44+
CARGO_TERM_COLOR: always
45+
46+
jobs:
47+
lifecycle-smoke:
48+
name: Relay-Driven Mesh Lifecycle Smoke
49+
runs-on: ubuntu-24.04
50+
timeout-minutes: 45
51+
permissions:
52+
contents: read
53+
steps:
54+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
55+
56+
- uses: cashapp/activate-hermit@cea9af7913204a965fd488637a8d1811bba2e616 # v1
57+
58+
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
59+
with:
60+
save-if: ${{ github.event_name != 'pull_request' }}
61+
62+
# The mesh-llm SDK downloads a signed native runtime (llama.cpp CPU
63+
# build) on first init, and the serve node downloads the smoke model
64+
# from HuggingFace on first run. Key on the lockfile so a mesh pin bump
65+
# rolls the runtime cache; the model ref is stable.
66+
- name: Restore mesh runtime + model caches
67+
id: mesh-caches
68+
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
69+
with:
70+
path: |
71+
~/.cache/mesh-llm/native-runtimes
72+
~/.cache/huggingface/hub
73+
key: mesh-lifecycle-${{ runner.os }}-smollm2-135m-${{ hashFiles('Cargo.lock') }}
74+
restore-keys: |
75+
mesh-lifecycle-${{ runner.os }}-smollm2-135m-
76+
77+
- name: Start integration services
78+
run: |
79+
for attempt in 1 2 3; do
80+
if docker compose up -d postgres redis minio minio-init; then
81+
break
82+
fi
83+
if [ "$attempt" -eq 3 ]; then
84+
echo "docker compose up failed after 3 attempts" >&2
85+
exit 1
86+
fi
87+
echo "docker compose up failed (attempt $attempt), retrying in $((attempt * 5))s..." >&2
88+
sleep $((attempt * 5))
89+
done
90+
91+
- name: Run relay-driven mesh lifecycle smoke
92+
run: ./scripts/ci-mesh-lifecycle-smoke.sh 2>&1 | tee /tmp/mesh-lifecycle-harness.log
93+
94+
- name: Save mesh runtime + model caches
95+
if: github.ref == 'refs/heads/main' && steps.mesh-caches.outputs.cache-hit != 'true'
96+
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
97+
with:
98+
path: |
99+
~/.cache/mesh-llm/native-runtimes
100+
~/.cache/huggingface/hub
101+
key: mesh-lifecycle-${{ runner.os }}-smollm2-135m-${{ hashFiles('Cargo.lock') }}
102+
103+
- name: Upload relay + harness logs
104+
if: failure()
105+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
106+
with:
107+
name: mesh-lifecycle-logs
108+
path: |
109+
/tmp/buzz-relay.log
110+
/tmp/mesh-lifecycle-harness.log
111+
if-no-files-found: ignore

‎AGENTS.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ Run `just test` for integration tests if you touched `buzz-relay`,
100100
formatting via `stage_fixed`. Pre-commit runs fix variants in parallel (Rust
101101
fmt, Tauri Rust fmt, desktop biome fix, web biome fix, mobile dart format).
102102
Auto-fixable issues are fixed and re-staged; unfixable lint issues block the
103-
commit. **Pre-push hooks** run clippy (workspace + Tauri) and fast unit tests
104-
in parallel (Rust, desktop JS, Tauri Rust, mobile Flutter) — no overlap with
105-
pre-commit. Builds are CI-only. Run `just fix-all` to auto-fix all formatting
106-
in one shot. Run `just ci` for the full local gate. Run `just hooks` to
103+
commit. **Pre-push hooks** run clippy (workspace + Tauri), desktop TypeScript
104+
typechecking (`tsc --noEmit`), and fast unit tests in parallel (Rust, desktop
105+
JS, Tauri Rust, mobile Flutter) — no overlap with pre-commit. Builds are
106+
CI-only. Run `just fix-all` to auto-fix all formatting in one shot. Run
107+
`just ci` for the full local gate. Run `just hooks` to
107108
re-install hooks after env changes. Before agents run Git or hooks, activate the
108109
repo's Hermit environment (`. ./bin/activate-hermit`); do not rewrite hook
109110
commands to compensate for an unconfigured shell `PATH`.

‎Cargo.lock‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Justfile‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,10 @@ desktop-tauri-test: _ensure-sidecar-stubs
212212
desktop-terminal-performance-test:
213213
cargo test --manifest-path desktop/src-tauri/crates/buzz-terminal/Cargo.toml --release --test latency g3_renderer_acquire_stays_within_frame_budget -- --ignored --exact --nocapture
214214

215-
# Verify compiled-flag behavior under both compile states (clean + internal).
216-
# Runs the auto-connect compiled-flag test twice with independently supplied
217-
# expected values; build.rs rerun-if-env-changed triggers recompilation.
215+
# Verify compiled-flag behavior under both compile states (clean + capability set).
216+
# Runs the auto-connect and owner-only access focused tests twice with
217+
# independently supplied expected values; build.rs rerun-if-env-changed
218+
# triggers recompilation.
218219
desktop-tauri-test-compiled-flags: _ensure-sidecar-stubs
219220
#!/usr/bin/env bash
220221
set -euo pipefail
@@ -223,10 +224,22 @@ desktop-tauri-test-compiled-flags: _ensure-sidecar-stubs
223224
env -u BUZZ_BUILD_AUTO_CONNECT_DEFAULT_RELAY \
224225
BUZZ_TEST_EXPECTED_AUTO_CONNECT_DEFAULT_RELAY=false \
225226
cargo test compiled_flag_matches_expected -- --ignored --nocapture
226-
echo "=== Internal build (flag set) → expect true ==="
227+
env -u BUZZ_BUILD_AGENT_ACCESS_OWNER_ONLY \
228+
BUZZ_TEST_EXPECTED_AGENT_ACCESS_OWNER_ONLY=false \
229+
cargo test --lib
230+
env -u BUZZ_BUILD_AGENT_ACCESS_OWNER_ONLY \
231+
BUZZ_TEST_EXPECTED_AGENT_ACCESS_OWNER_ONLY=false \
232+
cargo test compiled_policy_matches_expected -- --ignored --nocapture
233+
echo "=== Internal build (flags set) → expect true ==="
227234
BUZZ_BUILD_AUTO_CONNECT_DEFAULT_RELAY=1 \
228235
BUZZ_TEST_EXPECTED_AUTO_CONNECT_DEFAULT_RELAY=true \
229236
cargo test compiled_flag_matches_expected -- --ignored --nocapture
237+
BUZZ_BUILD_AGENT_ACCESS_OWNER_ONLY=1 \
238+
BUZZ_TEST_EXPECTED_AGENT_ACCESS_OWNER_ONLY=true \
239+
cargo test --lib
240+
BUZZ_BUILD_AGENT_ACCESS_OWNER_ONLY=1 \
241+
BUZZ_TEST_EXPECTED_AGENT_ACCESS_OWNER_ONLY=true \
242+
cargo test compiled_policy_matches_expected -- --ignored --nocapture
230243
echo "Both compiled states verified."
231244
232245
# Build the full desktop Tauri app locally (unsigned, for testing)

‎RELEASING.md‎

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,30 @@ or mobile GitHub Release.
4848
### Desktop
4949

5050
1. Run `just release-desktop <version>` from a clean, up-to-date `main` checkout.
51-
The script fetches the current `origin/main`, regenerates
52-
`version-bump/<version>` as one
53-
deterministic candidate commit, records the frozen base and proposed
54-
`desktop-v<version>` tag in `.release/desktop-candidate.json`, updates every
55-
desktop manifest and lockfile, writes a full-SHA changelog, and opens or
56-
updates the PR.
57-
2. Review the recorded base and candidate SHA, the complete changelog, and CI.
58-
The required **Desktop Release Candidate** check validates the exact head.
59-
A trusted repository member, owner, or collaborator must approve that exact
60-
candidate head. Any regeneration or push changes the head, invalidates the
61-
prior approval, and requires both the checks and approval to run again.
62-
3. **Squash merge** the PR. The protected branch must still be exactly the
63-
recorded base; otherwise regenerate the candidate from current `main`.
64-
4. `auto-tag-on-release-pr-merge` verifies the frozen parent, full-tree identity,
65-
required checks, and trusted approval on the exact candidate head, then tags
66-
the squash commit as `desktop-v<version>`. An admin or ruleset bypass does not
67-
authorize desktop tagging.
68-
5. The tag triggers `release.yml`. It builds and stages Apple Silicon and Intel
69-
macOS, Windows, and Linux artifacts; publishes the versioned release only
70-
after the complete set succeeds; then updates the rolling updater manifest
71-
last for stable versions. A failed platform leaves no partially published
72-
versioned release.
51+
The script creates one deterministic candidate commit and records both its
52+
frozen base and the verified prior release ledger in candidate metadata.
53+
2. Review the exact candidate SHA, complete changelog, and CI. Regenerating or
54+
pushing the branch creates a new candidate and requires checks to run again.
55+
3. **Squash merge** the PR after all protected-branch checks pass. The merge is
56+
the human authorization event; an authorized owner/admin bypass is treated
57+
the same way. Unrelated changes reaching `main` do not invalidate the
58+
reviewed candidate.
59+
4. `auto-tag-on-release-pr-merge` verifies the closed event against GitHub's PR
60+
identity, validates candidate content, and proves every required check came
61+
from its trusted producer and was successful when the PR merged. It creates
62+
`desktop-v<version>` at the exact reviewed PR head—not the squash commit.
63+
Retries accept that tag only at the same SHA and never move it. GitHub does
64+
not expose when an individual check rerun was created, so an ordinary rerun
65+
after merge deliberately makes tag verification fail closed; inspect that
66+
run and create a new candidate version rather than retrying the blocked tag.
67+
5. The tag triggers `release.yml`. It builds and stages all platform artifacts,
68+
publishes the versioned release only after the complete set succeeds, then
69+
updates the rolling updater manifest last for stable versions.
70+
71+
Because squash merging leaves immutable candidate tags on side history, the next
72+
release uses validated prior candidate metadata as its ledger boundary. It
73+
includes unrelated commits after the prior frozen base and excludes exactly the
74+
prior release's recorded squash commit; tag ancestry is deliberately irrelevant.
7375

7476
### Relay
7577

‎TESTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ out of the box with `just setup` or `just relay`. Common overrides:
277277
| `REDIS_URL` | `redis://localhost:6379` | |
278278
| `BUZZ_REQUIRE_AUTH_TOKEN` | `false` | When true, REST requires NIP-98 (no `X-Pubkey` fallback) |
279279
| `BUZZ_REQUIRE_RELAY_MEMBERSHIP` | `false` | When true, only pubkeys in `relay_members` can connect |
280-
| `BUZZ_REQUIRE_MEDIA_GET_AUTH` | `false` | When true, `GET`/`HEAD /media/*` require Blossom kind 24242 `t=get` auth plus relay membership. |
280+
| `BUZZ_DRAIN_JITTER_MS` | `0` (off) | Per-connection upper bound, in ms, for the random delay before each live WebSocket gets its `1012 Service Restart` close on graceful shutdown. `0` closes every socket at once (the previous behavior). A positive value spreads closes uniformly over `[1, value]` ms to avoid a reconnect thundering herd on rolling deploys. Values above `20000` are capped to `20000` (`MAX_DRAIN_JITTER_MS`) to leave close-frame delivery headroom under the relay's 30s hard-drain timeout. Empty or whitespace-only is treated as unset (off); a non-integer fails startup loudly. |
281281
| `BUZZ_AUDIT_ENABLED` | `true` | Tamper-evident event/media audit log. Set `false`/`0`/`off` to skip its DB pool and writes. Does not disable the separate moderation audit trail. |
282282
| `BUZZ_AUTO_MIGRATE` | `false` | Opt in with `true`/`1`/`yes`/`on` to run embedded SQLx migrations on relay startup |
283283
| `RELAY_OWNER_PUBKEY` | unset | Bootstrapped as `owner` in `relay_members` at first start |

0 commit comments

Comments
 (0)