Files
lijiaoqiao/scripts/ci/repo_integrity_check.sh
Your Name 687c4535f8 fix: P0-1 RateLimiter并发写安全 + P0-2工单操作错误码区分 + P1 rows.Close修复
P0-1 (limits.go): Allow()方法改为全程使用写锁保护counters map读写,避免RLock写入时的data race
P0-2 (ticket_workflow.go+ticket_handler.go): Assign/Resolve/Close操作先查询ticket存在性和状态,返回明确的CS_TICKET_4001/CS_TKT_4002/CS_TICKET_4092/CS_TICKET_4093错误码,handler根据错误前缀路由HTTP状态码
P1-1 (ticket_store.go): 移除GetStats中3处手动rows.Close(),只保留defer Close()
2026-05-01 20:56:25 +08:00

56 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
LIB_FILE="${ROOT_DIR}/scripts/ci/lib/verification_common.sh"
# shellcheck disable=SC1091
source "${LIB_FILE}"
GO_BIN="$(resolve_go_bin "${ROOT_DIR}" || true)"
if [[ -z "${GO_BIN}" ]]; then
echo "[repo] go binary not found" >&2
exit 1
fi
setup_go_env "${GO_BIN}" "/tmp/lijiaoqiao-go-cache-repo-integrity"
check_shell_syntax() {
echo "[repo] shell"
bash -n "${ROOT_DIR}/supply-api/scripts/migrate.sh"
bash -n "${ROOT_DIR}/supply-api/scripts/run_integration_tests.sh"
}
echo "[repo] fact-sources"
check_fact_sources "${ROOT_DIR}"
check_shell_syntax
run_go_suite "${ROOT_DIR}" "${GO_BIN}" "gateway" "gateway" test -count=1 ./...
run_go_suite "${ROOT_DIR}" "${GO_BIN}" "platform-token-runtime" "platform-token-runtime" test -count=1 ./...
run_go_suite "${ROOT_DIR}" "${GO_BIN}" "supply-api unit" "supply-api" test -count=1 ./...
echo "[repo] supply-api repository integration"
(
cd "${ROOT_DIR}/supply-api"
bash scripts/run_integration_tests.sh ./internal/repository
)
run_go_suite "${ROOT_DIR}" "${GO_BIN}" "supply-api service-http" "supply-api" test -count=1 -tags=e2e ./e2e
# Phase 1 contract gate entry:
# - execute after service-local suites and repository integration pass
# - command entry: bash "${ROOT_DIR}/scripts/ci/backend-verify.sh" --phase1-contract-gate
# - primary artifacts:
# reports/archive/gate_verification/contract_gate_<timestamp>.log
# reports/archive/gate_verification/contract_gate_<timestamp>.md
# - failure semantics: if the contract gate exits non-zero or any required scenario is missing,
# repo_integrity_check must fail and Phase 1 cannot be marked complete.
echo "[repo] Phase 1 contract gate (SCENARIO-1~4)"
TS="$(date +%Y%m%d_%H%M%S)"
mkdir -p "${ROOT_DIR}/reports/archive/gate_verification"
if ! bash "${ROOT_DIR}/scripts/ci/backend-verify.sh" --phase1-contract-gate >> "${ROOT_DIR}/reports/archive/gate_verification/repo_integrity_contract_gate_${TS}.log" 2>&1; then
echo "[repo] contract gate FAILED — see contract_gate_*.log in reports/archive/gate_verification/"
exit 1
fi
# Phase 2 boundary note:
# - repo_integrity_check only proves code completeness, syntax, unit/integration and service-local HTTP coverage.
# - cross_service_smoke belongs to release/path validation and must not be redefined as repository integrity.
# - even after smoke is introduced, this script remains a code integrity gate rather than a release gate.