From 9a615d05d17be0527bc03aea8e5de59b0a211731 Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 30 Sep 2026 16:16:38 +0800 Subject: [PATCH] fix(acceptance): run only verified current MQ integration checks --- Makefile | 2 +- .../saas-dispatcher-implementation.md | 2 + internal/store/store.go | 6 +-- scripts/acceptance-local.sh | 4 +- scripts/mq-integration-local.sh | 53 ------------------- 5 files changed, 8 insertions(+), 59 deletions(-) delete mode 100755 scripts/mq-integration-local.sh diff --git a/Makefile b/Makefile index 37e76a6..a6537c5 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ release-check-local: ./scripts/check-release-gates-local.sh mq-integration-local: - ./scripts/mq-integration-local.sh + bash scripts/check-current-mq-mock.sh proto-lint: buf lint diff --git a/docs/evidence/saas-dispatcher-implementation.md b/docs/evidence/saas-dispatcher-implementation.md index a17e62d..542727a 100644 --- a/docs/evidence/saas-dispatcher-implementation.md +++ b/docs/evidence/saas-dispatcher-implementation.md @@ -134,6 +134,8 @@ - Agent 端点样例:包内 `deploys/config/agent-endpoints.example.json` 原指向非本机地址,无法通过唯一现行 Mock Dispatcher 的本地端点校验;新增读取实际打包样例的测试先复现失败,再将地址改为显式 loopback 端口。Agent/Cell 标识与证书 SNI 仍为部署占位值,须由受控环境提供匹配证书;样例通过只证明隔离 Mock 可读取,不授权真实 Agent/线路。 +- 当前本地验收入口:旧 `scripts/mq-integration-local.sh` 的 V3/旧 Dispatcher 筛选式均匹配零项测试,但原脚本仍可能返回成功;先以 `go test -list` 复现空匹配,随后删除旧入口并令 `scripts/acceptance-local.sh`、`Makefile` 共用要求三项明确 PASS 的当前隔离 MQ 脚本。首次运行发现 `internal/store/store.go` 三处匿名结构体缩进未格式化,已仅执行格式化;再次运行当前验收入口的合同来源、完整 race 测试、静态检查、构建及三项真实隔离 MQ 测试均通过。完成提示明确非生产主机诊断和真实外部仍未验证,不把历史 F09 验收数写成本轮通过。 + ## 验收台账 P01–P06 的项目内隔离证据见上;P07 全仓命名与唯一入口尚在清理,A01–A12 和 K01–K16 的最终对照仍待 P08。不得用本地 Mock 冒充外部签收。 diff --git a/internal/store/store.go b/internal/store/store.go index 91e272f..87642f8 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -391,14 +391,14 @@ func (s *Store) SaveSnapshot(snapshot configread.Snapshot) error { return fmt.Errorf("decode immutable task: %w", err) } binding, err := json.Marshal(struct { - Task any `json:"task"` + Task any `json:"task"` Providers map[string]configread.Provider `json:"providers"` }{canonicalTask, providers}) if err != nil { return fmt.Errorf("encode immutable task binding: %w", err) } full, err := json.Marshal(struct { - Task any `json:"task"` + Task any `json:"task"` Providers map[string]configread.Provider `json:"providers"` SIP configread.SIP `json:"sip"` Quota configread.Quota `json:"quota"` @@ -523,7 +523,7 @@ func (s *Store) ReadSnapshot(dispatcherID string, tenantID int64, taskID string) return configread.Snapshot{}, fmt.Errorf("load task execution snapshot: %w", err) } var decoded struct { - Task json.RawMessage `json:"task"` + Task json.RawMessage `json:"task"` Providers map[string]configread.Provider `json:"providers"` SIP configread.SIP `json:"sip"` Quota configread.Quota `json:"quota"` diff --git a/scripts/acceptance-local.sh b/scripts/acceptance-local.sh index c8ee71f..79dea48 100755 --- a/scripts/acceptance-local.sh +++ b/scripts/acceptance-local.sh @@ -28,6 +28,6 @@ tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT go build -trimpath -buildvcs=false -o "$tmp/sip-go-agent" ./cmd/sip-go-agent -./scripts/mq-integration-local.sh +bash scripts/check-current-mq-mock.sh -echo "P1 local F09 v0.3 checks passed (business-module coverage only; see docs/evidence/f09-local-acceptance-v0.3.md); external SaaS/management, tombstone capacity, cloud, supplier, SIP, deployment, and production acceptance remain unverified" +echo "Current single-node Mock checks passed; see docs/evidence/saas-dispatcher-implementation.md. External SaaS, OSS, AI, Asterisk, SIP, non-production host diagnostics and production acceptance remain unverified." diff --git a/scripts/mq-integration-local.sh b/scripts/mq-integration-local.sh deleted file mode 100755 index 8acf134..0000000 --- a/scripts/mq-integration-local.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) -cd -- "$ROOT" -IMAGE=${RABBITMQ_IMAGE:-rabbitmq:4.1-management-alpine} -NAME="sip-go-agent-rabbit-poc-${$}" -PORT="" -command -v docker >/dev/null 2>&1 || { echo "docker is required for local RabbitMQ tests" >&2; exit 1; } -if ! docker image inspect "$IMAGE" >/dev/null 2>&1; then - echo "RabbitMQ image $IMAGE is not cached locally; refusing an implicit image pull" >&2 - exit 1 -fi -RABBIT_USER=${RABBITMQ_TEST_USER:-agent_call_integration} -RABBIT_PASSWORD=${RABBITMQ_TEST_PASSWORD:-$(openssl rand -hex 16)} -DISPATCHER_USER="sip_go_agent_no_config_${$}" -DISPATCHER_PASSWORD=$(openssl rand -hex 16) -RABBIT_UID=$(docker run --rm "$IMAGE" id -u rabbitmq) -RABBIT_GID=$(docker run --rm "$IMAGE" id -g rabbitmq) - -cleanup() { - docker rm -f "$NAME" >/dev/null 2>&1 || true -} -trap cleanup EXIT - -docker run -d --name "$NAME" --user "${RABBIT_UID}:${RABBIT_GID}" -e RABBITMQ_DEFAULT_USER="$RABBIT_USER" -e RABBITMQ_DEFAULT_PASS="$RABBIT_PASSWORD" -p 0:5672 "$IMAGE" >/dev/null -ready=false -for _ in $(seq 1 90); do - if docker exec "$NAME" rabbitmq-diagnostics -q check_running >/dev/null 2>&1; then - ready=true - break - fi - sleep 1 -done -if [[ "$ready" != true ]]; then - docker logs "$NAME" >&2 || true - echo "RabbitMQ did not become ready" >&2 - exit 1 -fi -PORT=$(docker port "$NAME" 5672/tcp | head -1 | sed -E 's/.*:([0-9]+)$/\1/') -if [[ -z "$PORT" ]]; then - echo "could not determine RabbitMQ host port" >&2 - exit 1 -fi -IMAGE_ID=$(docker image inspect --format '{{.Id}}' "$IMAGE") -docker exec "$NAME" rabbitmqctl add_user "$DISPATCHER_USER" "$DISPATCHER_PASSWORD" >/dev/null -docker exec "$NAME" rabbitmqctl set_permissions -p / "$DISPATCHER_USER" '^$' '.*' '.*' >/dev/null -ADMIN_URL="amqp://${RABBIT_USER}:${RABBIT_PASSWORD}@127.0.0.1:${PORT}/" -DISPATCHER_URL="amqp://${DISPATCHER_USER}:${DISPATCHER_PASSWORD}@127.0.0.1:${PORT}/" -printf 'local RabbitMQ image=%s id=%s uid=%s gid=%s port=%s; restricted Dispatcher configure permission=none\n' "$IMAGE" "$IMAGE_ID" "$RABBIT_UID" "$RABBIT_GID" "$PORT" -RABBITMQ_URL="$ADMIN_URL" RABBITMQ_PROVISIONER_URL="$ADMIN_URL" go test -race -cover -tags=integration ./internal/mq ./internal/dispatcher -RABBITMQ_URL="$DISPATCHER_URL" RABBITMQ_PROVISIONER_URL="$ADMIN_URL" RABBITMQ_EXPECT_NO_CONFIG=1 go test -race -tags=integration ./internal/mq -run '^TestV3BrokerConsumesSaaSOwnedQueueAndPublishesConfirmedResult$' -count=1 -RABBITMQ_URL="$DISPATCHER_URL" RABBITMQ_PROVISIONER_URL="$ADMIN_URL" go test -race -tags=integration ./internal/dispatcher -run '^TestLocalDispatcherMockSaaSEndToEndWithOutboxRecovery$' -count=1