#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$REPO_ROOT"

echo "[e2e] verifying provider-only Node command and cancellation boundary"
go test -count=1 ./apps/node/internal/node \
  -run 'Test(NodeCommandProviderAllowlist|NodeCommandRejectsUnknownAgentAndShell|SessionIDIsCorrelationOnly|CancelByRunIDOnly)'

echo "[e2e] verifying Edge dispatch, provider tunnel, queue, and reconnect fencing"
go test -count=1 ./apps/edge/internal/service ./apps/edge/internal/transport \
  -run 'Test(Provider|Submit|Queue|Reconnect|Ready|Cancel|ServiceExecuteCommand|NodeCommand)'

echo "[e2e] provider-only Edge-Node smoke PASSED"
