test(e2e): converge e2e host on localhost + seed before relay boot

Two CI-honesty follow-ups after the first seed surfaced host/ordering
mismatches in the MT e2e path (no product behavior):

1. Desktop E2E 404: the seed-readiness helper queried 127.0.0.1:3000
   while the relay reconciles + the community is seeded for localhost:3000.
   normalize_host keeps the non-default port and 127.0.0.1 != localhost,
   so the inbound host resolved to no community and every /query 404'd.
   Default the helper to http://localhost:3000, matching the rest of the
   desktop e2e suite (e2eBridge.ts / bridge.ts already use localhost) and
   the relay's RELAY_URL.

2. Backend Integration UnmappedHost: the reminder scheduler binds the
   deployment community once at boot and exits permanently on an unmapped
   host (no retry, unlike the channel reconciler). The community was being
   seeded after relay start, leaving the scheduler dead. Apply the schema
   and seed the community BEFORE starting the relay (dropping
   BUZZ_AUTO_MIGRATE since the schema is now applied up front), so the
   scheduler binds on its single boot-time attempt.

Both are test/CI wiring. The Relay E2E suite stays red on a separate,
gated body-level bug (command_executor.rs inserts events without
community_id) tracked for the §4 scoping slice.

Co-authored-by: Eva <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
This commit is contained in:
tlongwell-block
2026-06-26 21:43:06 -04:00
co-authored by Eva
parent 528c4a918a
commit 107aa6977e
2 changed files with 33 additions and 16 deletions
+25 -15
View File
@@ -474,12 +474,36 @@ jobs:
with:
name: desktop-e2e-relay
path: target/ci
- name: Apply schema and seed deployment community
# MT: the relay resolves each request's tenant from the communities host
# map and fails closed on an unmapped host. The reminder scheduler binds
# the deployment community ONCE at boot and exits permanently on an
# unmapped host (no retry, unlike the channel reconciler), so the
# 'localhost:3000' community MUST exist before the relay starts — seeding
# after boot leaves the scheduler dead. The relay migrates at boot via
# BUZZ_AUTO_MIGRATE, but that's too late for the pre-boot seed, so apply
# the schema here first (then drop AUTO_MIGRATE below). lower(host) is the
# unique index → ON CONFLICT target. psql isn't on PATH in hermit → exec
# into the buzz-postgres container.
env:
PGHOST: localhost
PGPORT: "5432"
PGUSER: buzz
PGPASSWORD: buzz_dev
PGDATABASE: buzz
run: |
./bin/pgschema apply --file schema/schema.sql --auto-approve
docker exec -e PGPASSWORD=buzz_dev buzz-postgres \
psql -U buzz -d buzz -qtA -c "
INSERT INTO communities (id, host)
VALUES ('00000000-0000-4000-8000-00000000c0de', 'localhost:3000')
ON CONFLICT (lower(host)) DO NOTHING
;"
- name: Start relay
run: |
chmod +x ./target/ci/buzz-relay
nohup env \
DATABASE_URL=postgres://buzz:buzz_dev@localhost:5432/buzz \
BUZZ_AUTO_MIGRATE=true \
REDIS_URL=redis://localhost:6379 \
TYPESENSE_URL=http://localhost:8108 \
TYPESENSE_API_KEY=buzz_dev_key \
@@ -504,20 +528,6 @@ jobs:
done
cat /tmp/buzz-relay.log
exit 1
- name: Seed deployment community
# MT: the relay resolves each connection's tenant from the communities
# host map and fails closed on an unmapped host. This suite connects over
# ws://localhost:3000 and creates channels at runtime, so the
# 'localhost:3000' community must exist or every connection 404s at
# host-binding. The relay's reconciler retries for 2min, so seeding after
# relay start is fine. lower(host) is the unique index → ON CONFLICT target.
run: |
docker exec -e PGPASSWORD=buzz_dev buzz-postgres \
psql -U buzz -d buzz -qtA -c "
INSERT INTO communities (id, host)
VALUES ('00000000-0000-4000-8000-00000000c0de', 'localhost:3000')
ON CONFLICT (lower(host)) DO NOTHING
;"
- name: NIP-ER reminder e2e
# Feature e2e for NIP-ER (Event Reminders, kind:30300): write-path
# validation, author-only read filtering, and scheduler delivery against
+8 -1
View File
@@ -3,7 +3,14 @@ import { request } from "@playwright/test";
const tylerPubkey =
"e5ebc6cdb579be112e336cc319b5989b4bb6af11786ea90dbe52b5f08d741b34";
const isCi = Boolean(process.env.CI);
const relayBaseUrl = process.env.BUZZ_E2E_RELAY_URL ?? "http://127.0.0.1:3000";
// Multi-tenant: the relay resolves each request's tenant from its Host header
// against the communities host map and fails closed (404) on an unmapped host.
// The seed maps host 'localhost:3000' (matching the relay's RELAY_URL) — and
// `localhost` != `127.0.0.1` to normalize_host — so this readiness check must
// hit `localhost:3000`, not `127.0.0.1:3000`, or every /query 404s. This also
// matches the rest of the desktop e2e suite (e2eBridge.ts / bridge.ts), which
// already default to localhost.
const relayBaseUrl = process.env.BUZZ_E2E_RELAY_URL ?? "http://localhost:3000";
const seedTimeoutMs = Number.parseInt(
process.env.BUZZ_E2E_SEED_TIMEOUT_MS ?? (isCi ? "60000" : "25000"),
10,