Skip to content

Commit 63aff9b

Browse files
committed
Merge remote-tracking branch 'origin/main' into lock-screen-controls
* origin/main: (26 commits) feat(search): people-only search filter, and the agent owner on each indexed message (#10021) fix(search): drop the community label from indexer metrics (#10019) relay: advertise the build's source SHA in NIP-11 (#9827) feat(mobile): record a push baseline when Android enrolls (#10038) Show deletion evidence to the requester (#10076) Give single photos the stack card style in mobile chat (#10071) fix(search): do not return expired AWS credentials after a failed reload (#10042) feat(mobile): unify the Android conversation composer (#10015) feat(mobile): check the relay key on Android push channel titles (#10037) chore(devex): streamline local OpenSearch and Postgres test workflows (#10034) feat(mobile): record messages the app shows so Android wakes skip them (#10039) feat(search): remove a deleted community's messages from OpenSearch (#9999) Preview user deletion from the original saved inventory (#10028) Add queued follow-ups to the mobile Solo composer (#10018) feat(mobile): browse and stage GIFs from the iOS composer (#10017) Wait for active uploads before purging user media (#9946) feat(search): park outbox rows OpenSearch rejects and split HTTP 413 bulk requests (#9998) fix(mobile): align icon badge with Activity (#9835) feat(mobile): show profile avatars in mention chips (#9868) feat(acp): stop one thread with cancel_thread_turn (#10002) ... Co-authored-by: Arthur Garza <arthur.garzajr@gmail.com> Signed-off-by: Arthur Garza <arthur.garzajr@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # mobile/ios/Runner/HomeScreenShortcuts.swift # mobile/ios/RunnerTests/HomeScreenShortcutsTests.swift
2 parents 9dcfdef + a12a999 commit 63aff9b

252 files changed

Lines changed: 17334 additions & 3118 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.

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ crates/
112112
buzz-db # Postgres event store and data access layer
113113
buzz-auth # Authentication and authorization
114114
buzz-pubsub # Redis pub/sub fan-out, presence, typing indicators
115-
buzz-search # Postgres FTS full-text search
115+
buzz-search # Postgres FTS and OpenSearch message search + indexer
116116
buzz-audit # Hash-chain audit log
117117
buzz-media # Blossom/S3 media storage
118118
# Agent surface

‎CONTRIBUTING.md‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ We review as capacity allows — focused PRs that follow this guide move fastest
8585
| pnpm | 10+ | Required for desktop app commands and `just ci` |
8686
| Flutter | 3.47.9+ | Required for mobile app — install via [flutter.dev](https://docs.flutter.dev/get-started/install) |
8787
| Xcode | 27.1 recommended; 26 supported | Required for iOS builds; see [iOS toolchain setup](mobile/README.md#ios-toolchain) |
88-
| Docker | 24+ | For Postgres, Redis, MinIO |
88+
| Docker | 24+ | For Postgres, Redis, MinIO (and opt-in OpenSearch) |
8989
| `just` | latest | Task runner — `cargo install just` |
90+
| `cargo-nextest` | 0.9.136+ | Faster unit tests; required for `just test-postgres` and `just test-search` |
9091
| `lefthook` | 2.1.3 (Hermit-pinned) | Auto-installed by `just hooks` — no manual install needed |
9192
| `sqlx` migrations | workspace crate | `just migrate` applies embedded migrations from `migrations/` |
9293

@@ -179,6 +180,13 @@ just relay # terminal 1 — relay on ws://localhost:3000
179180
just desktop-dev # terminal 2 — Vite dev server only (no Tauri shell)
180181
```
181182

183+
To also run the opt-in local OpenSearch message index (auto-starts the
184+
`buzz-opensearch` container on `:9200`):
185+
186+
```bash
187+
just search=1 relay # or `just search=1 dev`
188+
```
189+
182190
### Stopping / Resetting
183191

184192
```bash
@@ -264,11 +272,20 @@ Set `BUZZ_POSTGRES_ADMIN_URL` to that role's maintenance database, and set
264272
schema bootstrap. PostgreSQL client tools are resolved from `PATH` unless
265273
`PG_BIN_DIR` is set. Tests that use Redis read `REDIS_URL`.
266274

267-
With native PostgreSQL and Redis running, the complete lane is below. The
268-
runner bounds compilation to the packages discovered from the current source
269-
tree and removes the run-scoped desired-state source database on exit.
270-
Per-test and source-database cleanup retries transient PostgreSQL disconnect
271-
races and emits a warning if all five attempts fail.
275+
Against the local Docker Compose stack, the `just` recipes auto-start the
276+
needed containers and set the local Postgres/OpenSearch environment variables
277+
for you (requires `cargo-nextest` and PostgreSQL client tools such as `psql` /
278+
`createdb` / `dropdb`):
279+
280+
```bash
281+
just test-search # Postgres FTS + OpenSearch tests
282+
just test-postgres # full PostgreSQL-backed lane
283+
just test-postgres -p buzz-db --lib # a single package or filter
284+
```
285+
286+
Against native PostgreSQL and Redis (or CI), run the script directly after
287+
setting `BUZZ_POSTGRES_ADMIN_URL`, `PGHOST`, `PGPORT`, `PGUSER`, `PGPASSWORD`,
288+
and `REDIS_URL`:
272289

273290
```bash
274291
./scripts/postgres-test-run.sh

‎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: 126 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ web_dir := "web"
1212
# `just mesh=1 staging` / `just mesh=1 production`.
1313
mesh := ""
1414

15+
# Opt-in OpenSearch message index. Off by default so Postgres-only work skips
16+
# the extra JVM container. Turn on with `just search=1 relay` / `just search=1 dev`
17+
# / `just search=1 setup`, or by uncommenting BUZZ_OPENSEARCH_URL in .env.
18+
search := ""
19+
1520
# Reset only the current standalone desktop instance before launch.
1621
# Usage: `just fresh=1 desktop-standalone`.
1722
fresh := ""
@@ -47,7 +52,7 @@ bootstrap:
4752
4853
# Start Docker services, run migrations, install desktop deps
4954
setup: bootstrap
50-
./scripts/dev-setup.sh
55+
BUZZ_DEV_SEARCH="{{search}}" ./scripts/dev-setup.sh
5156

5257
# Install git hooks via lefthook (dispatches from the shared .git/hooks dir so all
5358
# linked worktrees inherit the same hooks without a worktree-relative .hooks path)
@@ -72,15 +77,15 @@ reset:
7277

7378
# Stop all dev services (keep data)
7479
down:
75-
docker compose down
80+
docker compose --profile '*' down
7681

7782
# Show dev service status
7883
ps:
79-
docker compose ps
84+
docker compose --profile '*' ps
8085

8186
# Tail all service logs
8287
logs *ARGS:
83-
docker compose logs -f {{ARGS}}
88+
docker compose --profile '*' logs -f {{ARGS}}
8489

8590
# ─── Build & Check ───────────────────────────────────────────────────────────
8691

@@ -183,32 +188,76 @@ _ensure-sidecar-stubs:
183188
[[ -e "$stub" ]] || : > "$stub"
184189
done
185190
186-
# Ensure Docker dev services (Postgres, Redis, etc.) are running and healthy
187-
_ensure-services:
191+
# Ensure the opt-in OpenSearch dev container is running and healthy
192+
_ensure-opensearch:
188193
#!/usr/bin/env bash
189194
set -euo pipefail
190-
pg=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-postgres 2>/dev/null || echo "not_found")
191-
redis=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-redis 2>/dev/null || echo "not_found")
192-
if [[ "$pg" == "healthy" && "$redis" == "healthy" ]]; then
193-
echo "Services already healthy"
195+
os=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-opensearch 2>/dev/null || echo "not_found")
196+
if [[ "$os" == "healthy" ]]; then
197+
echo "OpenSearch already healthy"
194198
exit 0
195199
fi
196-
echo "Starting services..."
197-
docker compose up -d || true
198-
echo -n "Waiting for services"
199-
for i in $(seq 1 40); do
200-
pg=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-postgres 2>/dev/null || echo "not_found")
201-
redis=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-redis 2>/dev/null || echo "not_found")
202-
if [[ "$pg" == "healthy" && "$redis" == "healthy" ]]; then
200+
echo "Starting OpenSearch..."
201+
docker compose --profile search up -d opensearch
202+
echo -n "Waiting for OpenSearch"
203+
for i in $(seq 1 60); do
204+
os=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-opensearch 2>/dev/null || echo "not_found")
205+
if [[ "$os" == "healthy" ]]; then
203206
echo " ready"
204207
exit 0
205208
fi
206209
echo -n "."
207-
sleep 3
210+
sleep 2
208211
done
209212
echo " timed out"
213+
docker logs buzz-opensearch 2>&1 | tail -30 >&2 || true
210214
exit 1
211215
216+
# Ensure Docker dev services (Postgres, Redis, etc.) are running and healthy
217+
_ensure-services:
218+
#!/usr/bin/env bash
219+
set -euo pipefail
220+
pg=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-postgres 2>/dev/null || echo "not_found")
221+
redis=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-redis 2>/dev/null || echo "not_found")
222+
if [[ "$pg" == "healthy" && "$redis" == "healthy" ]]; then
223+
echo "Services already healthy"
224+
else
225+
echo "Starting services..."
226+
docker compose up -d || true
227+
echo -n "Waiting for services"
228+
ready=false
229+
for i in $(seq 1 40); do
230+
pg=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-postgres 2>/dev/null || echo "not_found")
231+
redis=$(docker inspect --format '{{"{{"}}.State.Health.Status{{"}}"}}' buzz-redis 2>/dev/null || echo "not_found")
232+
if [[ "$pg" == "healthy" && "$redis" == "healthy" ]]; then
233+
echo " ready"
234+
ready=true
235+
break
236+
fi
237+
echo -n "."
238+
sleep 3
239+
done
240+
if [[ "$ready" != true ]]; then
241+
echo " timed out"
242+
exit 1
243+
fi
244+
fi
245+
want_opensearch=false
246+
if [[ -n "{{search}}" ]]; then
247+
want_opensearch=true
248+
else
249+
os_url="${BUZZ_OPENSEARCH_URL:-}"
250+
if [[ -z "$os_url" && -f .env ]]; then
251+
os_url="$(bash -c 'set -a; source .env >/dev/null 2>&1; printf "%s" "${BUZZ_OPENSEARCH_URL:-}"')"
252+
fi
253+
case "${os_url%/}" in
254+
http://localhost:9200|http://127.0.0.1:9200) want_opensearch=true ;;
255+
esac
256+
fi
257+
if [[ "$want_opensearch" == true ]]; then
258+
"{{justfile_directory()}}/bin/just" _ensure-opensearch
259+
fi
260+
212261
# Apply database migrations and seed the local dev community if the dev database is running
213262
_ensure-migrations: _ensure-services
214263
cargo run -p buzz-admin -- migrate
@@ -692,10 +741,36 @@ test-unit:
692741
test-integration:
693742
./scripts/run-tests.sh integration
694743

744+
# Run PostgreSQL-backed tests (auto-starts Docker services, including OpenSearch,
745+
# matching the CI PostgreSQL lane)
746+
[positional-arguments]
747+
test-postgres *ARGS: _ensure-services
748+
#!/usr/bin/env bash
749+
set -euo pipefail
750+
export PATH="{{justfile_directory()}}/bin:$PATH"
751+
export PGHOST="${PGHOST:-localhost}"
752+
export PGPORT="${PGPORT:-5432}"
753+
export PGUSER="${PGUSER:-buzz}"
754+
export PGPASSWORD="${PGPASSWORD:-buzz_dev}"
755+
export REDIS_URL="${REDIS_URL:-redis://localhost:6379}"
756+
export BUZZ_POSTGRES_ADMIN_URL="${BUZZ_POSTGRES_ADMIN_URL:-postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/postgres}"
757+
export BUZZ_TEST_OPENSEARCH_URL="${BUZZ_TEST_OPENSEARCH_URL:-http://localhost:9200}"
758+
case "${BUZZ_TEST_OPENSEARCH_URL%/}" in
759+
http://localhost:9200|http://127.0.0.1:9200)
760+
"{{justfile_directory()}}/bin/just" _ensure-opensearch
761+
;;
762+
esac
763+
./scripts/postgres-test-run.sh "$@"
764+
765+
# Run search integration tests (Postgres FTS + OpenSearch; auto-starts Postgres and OpenSearch)
766+
[positional-arguments]
767+
test-search *ARGS:
768+
"{{justfile_directory()}}/bin/just" test-postgres -p buzz-search --tests "$@"
769+
695770
# Enforce-mode upload/publication/read journey (requires PostgreSQL and Redis).
696771
# Uses the isolated PostgreSQL runner, including CLI edits and the target index.
697772
test-media-access:
698-
./scripts/postgres-test-run.sh -p buzz-relay -p buzz-db --lib -E 'test(/^api::media_access_postgres_tests::/) | test(effective_edit_uses_target_index) | test(historical_edit_preflight)'
773+
"{{justfile_directory()}}/bin/just" test-postgres -p buzz-relay -p buzz-db --lib -E 'test(/^api::media_access_postgres_tests::/) | test(effective_edit_uses_target_index) | test(historical_edit_preflight)'
699774

700775
# Regenerate the model-capability normative corpus from the production Rust
701776
# resolver. The corpus is a golden snapshot, never hand-edited: this runs the
@@ -772,9 +847,17 @@ relay: bootstrap _ensure-migrations
772847
#!/usr/bin/env bash
773848
set -euo pipefail
774849
export PATH="{{justfile_directory()}}/bin:$PATH"
850+
_caller_os_url="${BUZZ_OPENSEARCH_URL-}"
851+
_caller_os_preview="${BUZZ_OPENSEARCH_PREVIEW-}"
775852
set -o allexport
776853
source .env
777854
set +o allexport
855+
[[ -n "$_caller_os_url" ]] && export BUZZ_OPENSEARCH_URL="$_caller_os_url"
856+
[[ -n "$_caller_os_preview" ]] && export BUZZ_OPENSEARCH_PREVIEW="$_caller_os_preview"
857+
if [[ -n "{{search}}" ]]; then
858+
export BUZZ_OPENSEARCH_URL="${BUZZ_OPENSEARCH_URL:-http://localhost:9200}"
859+
export BUZZ_OPENSEARCH_PREVIEW="${BUZZ_OPENSEARCH_PREVIEW:-true}"
860+
fi
778861
cargo run -p buzz-relay
779862
780863
# Post one root + N replies (and a few reactions) to the local dev relay, for eyeballing long threads
@@ -786,9 +869,17 @@ relay-web: bootstrap _ensure-migrations
786869
#!/usr/bin/env bash
787870
set -euo pipefail
788871
export PATH="{{justfile_directory()}}/bin:$PATH"
872+
_caller_os_url="${BUZZ_OPENSEARCH_URL-}"
873+
_caller_os_preview="${BUZZ_OPENSEARCH_PREVIEW-}"
789874
set -o allexport
790875
source .env
791876
set +o allexport
877+
[[ -n "$_caller_os_url" ]] && export BUZZ_OPENSEARCH_URL="$_caller_os_url"
878+
[[ -n "$_caller_os_preview" ]] && export BUZZ_OPENSEARCH_PREVIEW="$_caller_os_preview"
879+
if [[ -n "{{search}}" ]]; then
880+
export BUZZ_OPENSEARCH_URL="${BUZZ_OPENSEARCH_URL:-http://localhost:9200}"
881+
export BUZZ_OPENSEARCH_PREVIEW="${BUZZ_OPENSEARCH_PREVIEW:-true}"
882+
fi
792883
[[ -d node_modules ]] || pnpm install
793884
pnpm -C web build
794885
BUZZ_WEB_DIR=./web/dist cargo run -p buzz-relay
@@ -841,9 +932,17 @@ admin-check: fmt-check
841932
relay-release: bootstrap _ensure-migrations
842933
#!/usr/bin/env bash
843934
set -euo pipefail
935+
_caller_os_url="${BUZZ_OPENSEARCH_URL-}"
936+
_caller_os_preview="${BUZZ_OPENSEARCH_PREVIEW-}"
844937
set -o allexport
845938
source .env
846939
set +o allexport
940+
[[ -n "$_caller_os_url" ]] && export BUZZ_OPENSEARCH_URL="$_caller_os_url"
941+
[[ -n "$_caller_os_preview" ]] && export BUZZ_OPENSEARCH_PREVIEW="$_caller_os_preview"
942+
if [[ -n "{{search}}" ]]; then
943+
export BUZZ_OPENSEARCH_URL="${BUZZ_OPENSEARCH_URL:-http://localhost:9200}"
944+
export BUZZ_OPENSEARCH_PREVIEW="${BUZZ_OPENSEARCH_PREVIEW:-true}"
945+
fi
847946
cargo run -p buzz-relay --release
848947
849948
@@ -852,9 +951,17 @@ dev *ARGS: bootstrap _ensure-sidecar-stubs _ensure-migrations
852951
#!/usr/bin/env bash
853952
set -euo pipefail
854953
export PATH="{{justfile_directory()}}/bin:$PATH"
954+
_caller_os_url="${BUZZ_OPENSEARCH_URL-}"
955+
_caller_os_preview="${BUZZ_OPENSEARCH_PREVIEW-}"
855956
set -o allexport
856957
source .env
857958
set +o allexport
959+
[[ -n "$_caller_os_url" ]] && export BUZZ_OPENSEARCH_URL="$_caller_os_url"
960+
[[ -n "$_caller_os_preview" ]] && export BUZZ_OPENSEARCH_PREVIEW="$_caller_os_preview"
961+
if [[ -n "{{search}}" ]]; then
962+
export BUZZ_OPENSEARCH_URL="${BUZZ_OPENSEARCH_URL:-http://localhost:9200}"
963+
export BUZZ_OPENSEARCH_PREVIEW="${BUZZ_OPENSEARCH_PREVIEW:-true}"
964+
fi
858965
bind_addr="${BUZZ_BIND_ADDR:-0.0.0.0:3000}"
859966
relay_port="${bind_addr##*:}"; [[ -n "$relay_port" ]] || relay_port=3000
860967
health_port="${BUZZ_HEALTH_PORT:-8080}"

‎NOSTR.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ PGPASSWORD=buzz_dev psql -h localhost -U buzz -d buzz -c \
6868
| **NIP-42 authentication** | ✅ | Proactive challenge; optional pubkey allowlist |
6969
| **NIP-11 relay info** | ✅ | `GET /` with `Accept: application/nostr+json` |
7070
| **Blossom media** | ✅ | `PUT /media/upload` (BUD-02), `GET /media/{sha256}.{ext}` (BUD-01) |
71-
| **NIP-50 search** | ✅ | One-shot search REQs: `{"search":"query","kinds":[9],"#h":["<uuid>"]}` → relevance-sorted results → EOSE. Not registered as persistent subscriptions. HTTP `POST /query` also accepts `search_sort: "newest"` (advertised as `buzz-search-sort` in NIP-11 `supported_extensions`) for newest-first results, paged with `page`. |
71+
| **NIP-50 search** | ✅ | One-shot search REQs: `{"search":"query","kinds":[9],"#h":["<uuid>"]}` → relevance-sorted results → EOSE. Not registered as persistent subscriptions. HTTP `POST /query` also accepts `search_sort: "newest"` (advertised as `buzz-search-sort` in NIP-11 `supported_extensions`) for newest-first results, paged with `page`, and `search_from: "people"` or `"agents"` (advertised as `buzz-search-from`) to keep only messages people or agents wrote. An agent is an author with a stored NIP-OA owner, or the relay key, which signs workflow output. An unknown `search_from`, or one on a filter without search text, is refused with 400. |
7272
| **NIP-10 threads** | ✅ | WS-submitted replies with `["e","<root>","","reply"]` tags create `thread_metadata` atomically. Visible in REST thread queries. Unknown parents rejected. |
7373
| **NIP-17 DMs (gift wrap)** | ✅ | kind:1059 accepted with ephemeral signing keys. Stored community-globally (`channel_id=None` inside the connected community). Delivered via `#p`-filtered subscriptions. Not indexed in search. |
7474
| **DM discovery** | ✅ | DM creation emits kind:39000 (with `hidden` tag) + kind:44100 membership notifications. NIP-29 clients discover DMs via standard group discovery flow. |

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ A Rust workspace of focused crates. Single source of truth: the relay. The human
231231

232232
**Shared** — `buzz-sdk` (typed event builders) · `buzz-media` (Blossom/S3)
233233

234-
**Tooling** — `buzz-admin` (admin CLI) · `buzz-test-client` (E2E)
234+
**Tooling** — `buzz-admin` (admin CLI, [user deletion runbook](docs/operator-user-deletion.md)) · `buzz-test-client` (E2E)
235235

236236
</details>
237237

‎TESTING.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55
```bash
66
just test-unit # unit tests — no infrastructure needed
77
just test # unit + integration (starts Docker if needed)
8+
just test-search # Postgres FTS + OpenSearch tests (auto-starts Postgres & OpenSearch)
9+
just test-postgres # full PostgreSQL-backed lane (auto-starts Docker services)
810
```
911

1012
`just test` runs unit tests plus integration tests against Postgres and Redis
11-
(started automatically if not already running). Neither task runs the E2E suites in
12-
`buzz-test-client` — those are marked `#[ignore]` and require a running relay:
13+
(started automatically if not already running). `just test-search` and
14+
`just test-postgres` run the isolated per-test-database PostgreSQL lane
15+
(requiring `cargo-nextest` and `psql`/`createdb`/`dropdb`; on macOS,
16+
`brew install libpq` is detected automatically). Neither `just test-unit` nor
17+
`just test` runs the E2E suites in `buzz-test-client` — those are marked
18+
`#[ignore]` and require a running relay:
1319

1420
```bash
1521
# Start a relay first (see below), then:

0 commit comments

Comments
 (0)