mirror of
https://github.com/block/buzz.git
synced 2026-10-27 04:30:52 +00:00
refactor: rename sprout backend to buzz (#958)
Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <wpfleger@block.xyz> Signed-off-by: Will Pfleger <wpfleger@squareup.com> Signed-off-by: Will Pfleger <wpfleger96@gmail.com> Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub16v54tttfqacx9ycvc3k0ut0npj564ahcuajzy6qjvh57ntmsf4uq4806j2 <d32955ad69077062930cc46cfe2df30ca9aaf6f8e76422681265e9e9af704d78@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Will Pfleger <wpfleger96@gmail.com>
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
# =============================================================================
|
||||
# e2e-git-perms.sh — End-to-end test for git transport, permissions, and signing
|
||||
# =============================================================================
|
||||
# Two bots collaborate on a simple web page via the Sprout relay's git server.
|
||||
# Two bots collaborate on a simple web page via the Buzz relay's git server.
|
||||
#
|
||||
# Prerequisites:
|
||||
# - Docker services running (postgres, redis, typesense)
|
||||
# - Relay built: cargo build --release --bin sprout-relay
|
||||
# - Relay built: cargo build --release --bin buzz-relay
|
||||
# - Credential helper built: cargo build --release --bin git-credential-nostr
|
||||
# - Signing program built: cargo build --release --bin git-sign-nostr
|
||||
# - Python 3 with websocket-client: pip install websocket-client
|
||||
@@ -89,8 +89,8 @@ trap cleanup EXIT
|
||||
check_deps() {
|
||||
local missing=()
|
||||
|
||||
if [[ ! -x "${REPO_ROOT}/target/release/sprout-relay" ]]; then
|
||||
missing+=("sprout-relay (cargo build --release --bin sprout-relay)")
|
||||
if [[ ! -x "${REPO_ROOT}/target/release/buzz-relay" ]]; then
|
||||
missing+=("buzz-relay (cargo build --release --bin buzz-relay)")
|
||||
fi
|
||||
if [[ ! -x "${REPO_ROOT}/target/release/git-credential-nostr" ]]; then
|
||||
missing+=("git-credential-nostr (cargo build --release --bin git-credential-nostr)")
|
||||
@@ -331,27 +331,27 @@ if [[ -f .env ]]; then
|
||||
set +o allexport
|
||||
fi
|
||||
|
||||
export SPROUT_GIT_REPO_PATH="${REPO_ROOT}/repos"
|
||||
export SPROUT_GIT_HOOK_HMAC_SECRET="${HMAC_SECRET}"
|
||||
export SPROUT_BIND_ADDR="${RELAY_HOST}:${RELAY_PORT}"
|
||||
export BUZZ_GIT_REPO_PATH="${REPO_ROOT}/repos"
|
||||
export BUZZ_GIT_HOOK_HMAC_SECRET="${HMAC_SECRET}"
|
||||
export BUZZ_BIND_ADDR="${RELAY_HOST}:${RELAY_PORT}"
|
||||
export RELAY_URL="${RELAY_WS}"
|
||||
export RUST_LOG="sprout_relay=warn"
|
||||
export SPROUT_REQUIRE_AUTH_TOKEN=false
|
||||
export RUST_LOG="buzz_relay=warn"
|
||||
export BUZZ_REQUIRE_AUTH_TOKEN=false
|
||||
|
||||
# Clean repos dir (isolated test state)
|
||||
rm -rf "${REPO_ROOT}/repos"
|
||||
mkdir -p "${REPO_ROOT}/repos"
|
||||
|
||||
./target/release/sprout-relay > /tmp/sprout-relay-e2e.log 2>&1 &
|
||||
./target/release/buzz-relay > /tmp/buzz-relay-e2e.log 2>&1 &
|
||||
RELAY_PID=$!
|
||||
|
||||
# Wait for relay to be ready (poll, not sleep)
|
||||
for i in $(seq 1 "$RELAY_STARTUP_TIMEOUT"); do
|
||||
if curl -sf --max-time 2 "${RELAY_HTTP}/" -H "Accept: application/nostr+json" | grep -q "Sprout"; then
|
||||
if curl -sf --max-time 2 "${RELAY_HTTP}/" -H "Accept: application/nostr+json" | grep -q "Buzz"; then
|
||||
break
|
||||
fi
|
||||
if [[ $i -eq "$RELAY_STARTUP_TIMEOUT" ]]; then
|
||||
fail "Relay did not start within ${RELAY_STARTUP_TIMEOUT}s. Check /tmp/sprout-relay-e2e.log"
|
||||
fail "Relay did not start within ${RELAY_STARTUP_TIMEOUT}s. Check /tmp/buzz-relay-e2e.log"
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
@@ -403,7 +403,7 @@ log " Add bot2: $ADD_BOT2"
|
||||
|
||||
log "Creating repo: $REPO_NAME..."
|
||||
CREATE_REPO=$(send_event "$OWNER_PRIVKEY" "$KIND_CREATE_REPO" "" \
|
||||
"[\"d\", \"$REPO_NAME\"], [\"sprout-channel\", \"$CHANNEL_ID\"]")
|
||||
"[\"d\", \"$REPO_NAME\"], [\"buzz-channel\", \"$CHANNEL_ID\"]")
|
||||
log " Create repo: $CREATE_REPO"
|
||||
|
||||
# Wait for repo creation side effect (bare repo on disk)
|
||||
@@ -448,7 +448,7 @@ cat > "$BOT1_DIR/index.html" << 'HTML'
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Sprout E2E Test Page</title>
|
||||
<title>Buzz E2E Test Page</title>
|
||||
<style>
|
||||
body { font-family: system-ui; max-width: 800px; margin: 0 auto; padding: 2rem; }
|
||||
h1 { color: #2d5016; }
|
||||
@@ -456,8 +456,8 @@ cat > "$BOT1_DIR/index.html" << 'HTML'
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>🌱 Sprout Collaborative Page</h1>
|
||||
<p>This page was created by two bots collaborating via Sprout's git server.</p>
|
||||
<h1>🌱 Buzz Collaborative Page</h1>
|
||||
<p>This page was created by two bots collaborating via Buzz's git server.</p>
|
||||
<div class="contributor">
|
||||
<strong>Bot 1</strong> — Created the initial page structure
|
||||
</div>
|
||||
@@ -466,14 +466,14 @@ cat > "$BOT1_DIR/index.html" << 'HTML'
|
||||
HTML
|
||||
|
||||
git -C "$BOT1_DIR" add -A
|
||||
git -C "$BOT1_DIR" -c user.name="Bot1" -c user.email="bot1@sprout.test" \
|
||||
git -C "$BOT1_DIR" -c user.name="Bot1" -c user.email="bot1@buzz.test" \
|
||||
-c init.defaultBranch=main commit -m "Initial page structure"
|
||||
|
||||
log "Bot1: pushing..."
|
||||
if git_push "$BOT1_PRIVKEY" "$BOT1_DIR" -u origin main; then
|
||||
success "Bot1 push succeeded (member can push)"
|
||||
else
|
||||
tail -20 /tmp/sprout-relay-e2e.log
|
||||
tail -20 /tmp/buzz-relay-e2e.log
|
||||
fail "Bot1 push failed (member should be able to push)"
|
||||
fi
|
||||
|
||||
@@ -491,19 +491,19 @@ sed -i.bak '/<\/body>/i\
|
||||
<strong>Bot 2</strong> — Added this section (pushing as bot role → promoted to member)\
|
||||
</div>\
|
||||
<footer>\
|
||||
<p><em>Built with Sprout sovereign git hosting</em></p>\
|
||||
<p><em>Built with Buzz sovereign git hosting</em></p>\
|
||||
</footer>' "$BOT2_DIR/index.html"
|
||||
rm -f "$BOT2_DIR/index.html.bak"
|
||||
|
||||
git -C "$BOT2_DIR" add -A
|
||||
git -C "$BOT2_DIR" -c user.name="Bot2" -c user.email="bot2@sprout.test" \
|
||||
git -C "$BOT2_DIR" -c user.name="Bot2" -c user.email="bot2@buzz.test" \
|
||||
commit -m "Add bot2 section and footer"
|
||||
|
||||
log "Bot2: pushing..."
|
||||
if git_push "$BOT2_PRIVKEY" "$BOT2_DIR"; then
|
||||
success "Bot2 push succeeded (bot promoted to member)"
|
||||
else
|
||||
tail -20 /tmp/sprout-relay-e2e.log
|
||||
tail -20 /tmp/buzz-relay-e2e.log
|
||||
fail "Bot2 push failed (bot should be promoted to member)"
|
||||
fi
|
||||
|
||||
@@ -576,7 +576,7 @@ git_clone "$BOT1_PRIVKEY" "${RELAY_HTTP}/git/${OWNER_PUBKEY}/${REPO_NAME}" "$UNS
|
||||
|
||||
echo "<!-- unsigned change -->" >> "$UNSIGNED_DIR/index.html"
|
||||
git -C "$UNSIGNED_DIR" add -A
|
||||
git -C "$UNSIGNED_DIR" -c user.name="Bot1" -c user.email="bot1@sprout.test" \
|
||||
git -C "$UNSIGNED_DIR" -c user.name="Bot1" -c user.email="bot1@buzz.test" \
|
||||
commit -m "Unsigned commit (no gpgsign)"
|
||||
|
||||
if git_push "$BOT1_PRIVKEY" "$UNSIGNED_DIR"; then
|
||||
@@ -599,7 +599,7 @@ git -C "$SIGNED_DIR" add -A
|
||||
NOSTR_PRIVATE_KEY="$BOT1_PRIVKEY" \
|
||||
git -C "$SIGNED_DIR" \
|
||||
-c user.name="Bot1" \
|
||||
-c user.email="bot1@sprout.test" \
|
||||
-c user.email="bot1@buzz.test" \
|
||||
-c gpg.format=x509 \
|
||||
-c "gpg.x509.program=$SIGNER" \
|
||||
-c commit.gpgsign=true \
|
||||
@@ -629,7 +629,7 @@ fi
|
||||
|
||||
# ── Test: Signed commit with owner attestation (NIP-OA) ──────────────────────
|
||||
|
||||
log "Signing with owner attestation (SPROUT_AUTH_TAG)..."
|
||||
log "Signing with owner attestation (BUZZ_AUTH_TAG)..."
|
||||
OA_DIR="$WORK_DIR/oa-signed"
|
||||
|
||||
git_clone "$BOT1_PRIVKEY" "${RELAY_HTTP}/git/${OWNER_PUBKEY}/${REPO_NAME}" "$OA_DIR" \
|
||||
@@ -699,10 +699,10 @@ print(json.dumps(["auth", owner_pubkey, "", sig]))
|
||||
PYEOF
|
||||
)
|
||||
|
||||
NOSTR_PRIVATE_KEY="$BOT1_PRIVKEY" SPROUT_AUTH_TAG="$OA_TAG" \
|
||||
NOSTR_PRIVATE_KEY="$BOT1_PRIVKEY" BUZZ_AUTH_TAG="$OA_TAG" \
|
||||
git -C "$OA_DIR" \
|
||||
-c user.name="Bot1" \
|
||||
-c user.email="bot1@sprout.test" \
|
||||
-c user.email="bot1@buzz.test" \
|
||||
-c gpg.format=x509 \
|
||||
-c "gpg.x509.program=$SIGNER" \
|
||||
-c commit.gpgsign=true \
|
||||
@@ -715,7 +715,7 @@ DECODED_SIG=$(echo "$COMMIT_SIG" | base64 -d 2>/dev/null || echo "$COMMIT_SIG" |
|
||||
if echo "$DECODED_SIG" | grep -q '"oa"'; then
|
||||
success "Owner attestation (oa field) present in signature"
|
||||
else
|
||||
fail "Owner attestation missing from signature — SPROUT_AUTH_TAG not picked up"
|
||||
fail "Owner attestation missing from signature — BUZZ_AUTH_TAG not picked up"
|
||||
fi
|
||||
|
||||
# Push it
|
||||
@@ -829,7 +829,7 @@ log "Hook integrity: testing symlink hook rejection..."
|
||||
|
||||
echo "<!-- symlink test -->" >> "$SYMLINK_DIR/index.html"
|
||||
git -C "$SYMLINK_DIR" add -A
|
||||
git -C "$SYMLINK_DIR" -c user.name="Bot1" -c user.email="bot1@sprout.test" \
|
||||
git -C "$SYMLINK_DIR" -c user.name="Bot1" -c user.email="bot1@buzz.test" \
|
||||
commit -m "Symlink hook test"
|
||||
|
||||
if git_push "$BOT1_PRIVKEY" "$SYMLINK_DIR" 2>&1; then
|
||||
@@ -862,7 +862,7 @@ log "Hook integrity: testing missing hook rejection..."
|
||||
|
||||
echo "<!-- missing hook test -->" >> "$MISSING_DIR/index.html"
|
||||
git -C "$MISSING_DIR" add -A
|
||||
git -C "$MISSING_DIR" -c user.name="Bot1" -c user.email="bot1@sprout.test" \
|
||||
git -C "$MISSING_DIR" -c user.name="Bot1" -c user.email="bot1@buzz.test" \
|
||||
commit -m "Missing hook test"
|
||||
|
||||
if git_push "$BOT1_PRIVKEY" "$MISSING_DIR" 2>&1; then
|
||||
|
||||
Reference in New Issue
Block a user