Merge origin/main into buzz-agent-goose-core

Resolves conflict in scripts/run-tests.sh: keep main's new relay handler
unit-test steps alongside this branch's buzz-agent test step ordering.

Co-authored-by: Michael Neale <michael.neale@gmail.com>
Signed-off-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
Michael Neale
2026-09-05 09:43:33 +10:00
318 changed files with 40008 additions and 3211 deletions

View File

@@ -34,6 +34,17 @@
# the post-reset empty-dev-keyring state) with the crash-safe
# marker-before-delete ordering already shipped. The plaintext file exists
# only until that first boot consumes it.
# - It does NOT copy baked build-time agent defaults. The prod DMG bakes a
# provider and default env vars at compile time via `option_env!` in
# `build.rs` (driven by `BUZZ_BUILD_BUZZ_AGENT_PROVIDER` and
# `BUZZ_BUILD_AGENT_ENV`). These are compiled into the binary, not stored in
# app-data — there is no file here to copy. Dev parity means setting those
# env vars when invoking the dev build:
# export BUZZ_BUILD_BUZZ_AGENT_PROVIDER="databricks_v2"
# export BUZZ_BUILD_AGENT_ENV=$'DATABRICKS_HOST=...\nDATABRICKS_MODEL=...'
# just production
# Do NOT add these to .env — `set dotenv-load := true` in the Justfile
# would bake them into every recipe in that checkout, including test runs.
#
# FLAGS
# --dry-run Print every action; write nothing.
@@ -70,7 +81,7 @@ KEYCHAIN_ACCT="${BUZZ_KEYCHAIN_ACCT:-secrets}"
DRY_RUN=0
FORCE=0
RECORD_FILES=(managed-agents.json personas.json teams.json)
RECORD_FILES=(managed-agents.json personas.json teams.json global-agent-config.json)
# --- helpers ----------------------------------------------------------------
say() { printf '%s\n' "$*"; }
@@ -251,7 +262,7 @@ if [[ ${#dev_blocking[@]} -gt 0 ]]; then
fi
if [[ $dmg_running -eq 1 ]]; then
info "installed DMG is running — allowed (read-only source)"
warn "Do NOT create/archive agents or edit teams in the DMG while this runs; the 4-file bundle is read as one snapshot."
warn "Do NOT create/archive agents or edit teams in the DMG while this runs; the 5-file bundle is read as one snapshot."
else
info "no running Buzz process detected"
fi
@@ -326,8 +337,9 @@ if [[ $DRY_RUN -eq 0 && -d "$DEV_DIR/agents" ]] && ! have python3; then
fi
# --- step 2: restore records (exact bundle, one atomic commit) --------------
# The four boot-critical paths (managed-agents.json, personas.json, teams.json,
# teams/) are read as one related state, so the commit must be all-or-nothing.
# The five boot-critical paths (managed-agents.json, personas.json, teams.json,
# global-agent-config.json, teams/) are read as one related state, so the
# commit must be all-or-nothing.
# Phase 1 builds a COMPLETE replacement agents/ in a staging dir beside the live
# one — the prod bundle plus any unrelated live entries carried across verbatim,
# every transform validated, zero live-path mutation. Phase 2 commits it in ONE
@@ -372,16 +384,17 @@ else
STAGE_TEMPS+=("$stage_agents")
# Seed the stage with the entire live agents/ (a single checked copy — under
# `set -e` a partial copy aborts before any commit), then drop the four bundle
# `set -e` a partial copy aborts before any commit), then drop the five bundle
# names FROM THE STAGE so the prod overlay below replaces them cleanly. Any
# other live entry (logs/, agent-pids/, global-agent-config.json, retention
# stores, …) is carried across verbatim and preserved by the directory swap.
# other live entry (logs/, agent-pids/, retention stores, …) is carried across
# verbatim and preserved by the directory swap.
if [[ -d "$DEV_DIR/agents" ]]; then
cp -Rp "$DEV_DIR/agents/." "$stage_agents/"
rm -rf -- \
"$stage_agents/managed-agents.json" \
"$stage_agents/personas.json" \
"$stage_agents/teams.json" \
"$stage_agents/global-agent-config.json" \
"$stage_agents/teams"
fi

View File

@@ -90,6 +90,11 @@ run_unit_tests() {
run_test_step "buzz-cli tests" \
cargo test -p buzz-cli -- --nocapture
# Keep the relay-to-agent trust-boundary regressions in the fallback path
# when cargo-nextest is unavailable.
run_test_step "buzz-acp tests" \
cargo test -p buzz-acp -- --nocapture
# buzz-db migrator/lint unit tests (no infra): guard the embedded-migrator
# invariant (exactly the consolidated 0001; cutover/backfill stays an operator
# script, not startup state) and the tenant-scoping lints. The Postgres-backed
@@ -130,6 +135,17 @@ run_unit_tests() {
run_test_step "buzz-acp unit tests" \
cargo test -p buzz-acp --lib -- --nocapture
# Mirror the three infra-free relay handler modules in `just test-unit`'s
# nextest expression. Keep the side-effects filter pinned to `::tests::` so
# it does not select the sibling Postgres-backed test module.
run_test_step "buzz-relay channel authorization tests" \
cargo test -p buzz-relay --lib handlers::channel_authz:: -- --nocapture
run_test_step "buzz-relay moderation authorization tests" \
cargo test -p buzz-relay --lib handlers::moderation_authz:: -- --nocapture
run_test_step "buzz-relay side-effects helper tests" \
cargo test -p buzz-relay --lib handlers::side_effects::tests:: -- --nocapture
}
# ---- DB / integration tests (infra required) --------------------------------

View File

@@ -37,6 +37,7 @@ clients_call=$(extract_job clients "$orchestrator")
mobile_swift_call=$(extract_job mobile-swift-domain "$orchestrator")
desktop_gate=$(extract_job desktop "$orchestrator")
macos_gate=$(extract_job desktop-build-macos "$orchestrator")
relay_e2e_job=$(extract_job relay-e2e "$relay_workflow")
[[ "$desktop_call" == *'uses: ./.github/workflows/_ci-desktop.yml'* ]] ||
fail "Desktop Domain must call _ci-desktop.yml"
@@ -68,6 +69,8 @@ grep -Fq "inputs.lane == 'postgres'" "$relay_workflow" ||
fail "PostgreSQL tests must be selected by their isolated lane"
grep -Fq "inputs.lane == 'artifacts'" "$relay_workflow" ||
fail "relay artifacts must be selected by their isolated lane"
[[ "$relay_e2e_job" == *'cargo test -p buzz-test-client --test e2e_relay nip29_departure_wire -- --ignored --nocapture'* ]] ||
fail "Relay E2E must select the NIP-29 departure wire tests"
grep -Fq "inputs.lane == 'mobile-swift'" "$clients_workflow" ||
fail "Mobile Swift must be selected by its isolated lane"