문제: src/ 최상위에 계층 폴더와 들여온 제품 폴더(messaging, grpc,
grpc-advanced)와 optional 빌드 폴더(optional-platforms)가 같은 높이로
놓여, 무엇이 이 애플리케이션의 계층인지 폴더만으로 안 보인다.
src/config/에는 빌드 전체 설정과 기능 하나가 주인인 데이터(jpa,
messaging, mongodb)가 섞여 있다.
고른 방법(소유자 결정 2026-11-07, 설계 가-1):
- git mv로 src/platforms/{messaging,grpc,grpc-advanced,optional-build}.
registry source_path 28행만 바꾸고 Gradle 경로(:messaging:*, :grpc:*)는
그대로다. optional 빌드의 이름(optional-platforms)도 그대로다.
- optional 빌드가 한 단계 깊어져, build-logic이 "optional 빌드의 부모 =
주 빌드"로 가정한 네 곳(registry settings, ArchitecturePlugin, 테스트
이미지 catalog, checkstyle·spotbugs 설정)을 MainBuild(위로 올라가며
registry·설정 파일을 찾음)로 바꾼다.
- settings.gradle·build.gradle의 상대 경로, workflow의 -p 값과 경로,
buf 작업 폴더를 고친다. buf breaking은 이동 전 baseline에서도 옛
경로로 비교해 이동 PR에서 건너뛰지 않는다.
- config/jpa, config/messaging, config/mongodb의 데이터를 주인 leaf의
release/로 옮기고 읽는 빌드 줄·테스트·스크립트·문서를 고친다.
- 루트 CLAUDE.md 5절에 최상위 폴더 지도를 한 줄로 적는다.
버린 대안: Gradle 루트를 저장소 루트로(가-3, CI 재편 때 다시 봄),
application-* 묶기(가-2, 파생 서비스 충돌이 큼).
위험·한계: Gradle 문서의 "이름 = 위치" 권고와 한 단계 어긋난다
(:messaging:x가 platforms/messaging/x). 옮긴 폴더를 고쳐 쓰던 파생
서비스는 이름 바뀜 충돌이 날 수 있다(B-52). docs/capability-status.md
「제거된 코드」 표와 docs/work/evidence.md의 옛 경로는 이력이라 두었다.
검증(desktop, 트리 2b3354a4, ~/t1-layout-logs/):
- ./gradlew :ci :verifyDependencyLocks --warning-mode=fail --continue
첫 실행 rc=1: MessagingAuthorityContractTest가 src/messaging을 찾아 실패
→ 경로를 고침. 두 번째 rc=1: messaging-policy
MessagingAdmissionControllerTest.aWaitingCallerIsAdmittedOnceAPermitIsReturned
(2초 대기 경쟁, 부하 7.3에서 한 번 실패, 코드 변경 없는 leaf) → --rerun
3회 모두 통과. 세 번째 rc=0
- -p platforms/optional-build ci rc=0, 두 빌드의 verifyStrictLaneStages
--dry-run rc=0, -p build-logic check rc=0
- :app-bootstrap:documentContractTest
:adapter:outbound:persistence-mongo:mongoDocumentContractTest rc=0
- ./gradlew projects(주 빌드)와 optional 빌드 projects의 프로젝트 목록이
이동 전 트리와 같다(Gradle 경로 불변)
- check-work-docs.py, 상대 링크 검사 rc=0
Refs: design-docs repo-structure/README.md 3.1, repo-structure/01-backend-layout.md 6.1
BREAKING CHANGE: src/messaging·src/grpc·src/grpc-advanced·src/optional-platforms가 src/platforms/ 아래로, src/config/{jpa,messaging,mongodb}가 주인 leaf의 release/로 옮겨졌다. optional 빌드는 -p platforms/optional-build로 부른다. docs/upgrade/2026-11-maturity-review.md B-52.
178 lines
7.1 KiB
Bash
Executable File
178 lines
7.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# The MongoDB Stable release gate (design §30, plan Task 50).
|
|
#
|
|
# Runs every lane that produces one of the Stable evidence categories:
|
|
#
|
|
# mapping, transaction, migration, change-stream, security,
|
|
# failover, performance, compatibility
|
|
#
|
|
# The gate exists because "the test suite is green" and "every category has evidence" are different
|
|
# statements. A suite passes happily with a whole lane skipped -- no Docker, a disabled tag, a
|
|
# renamed task -- and a release built on that suite has no failover or compatibility evidence at
|
|
# all, silently. Each lane below is therefore run by name, and a skipped lane is reported as skipped
|
|
# rather than counted as passed.
|
|
#
|
|
# Advanced capabilities are NOT promoted or transitively included here. See
|
|
# scripts/verify-mongodb-advanced.sh.
|
|
#
|
|
# Usage:
|
|
# bash scripts/verify-mongodb-platform.sh # hermetic lanes only
|
|
# MONGODB_DOCKER=1 bash scripts/verify-mongodb-platform.sh # + container lanes
|
|
#
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
GRADLE_DIR="${REPO_ROOT}/src"
|
|
MODULE=':adapter:outbound:persistence-mongo'
|
|
GRADLE=(./gradlew --console=plain)
|
|
|
|
RESULTS_DIR="${GRADLE_DIR}/adapter/outbound/persistence-mongo/build/test-results"
|
|
|
|
RAN=()
|
|
SKIPPED=()
|
|
FAILED=()
|
|
|
|
# Counts the tests a lane actually executed, from its JUnit XML.
|
|
#
|
|
# A lane whose filter matches nothing passes: Gradle runs the task, discovers no tests, and reports
|
|
# success. That is the failure mode this whole gate exists to prevent -- an empty lane is not
|
|
# evidence, it is the absence of evidence wearing a green tick. Any lane that reports zero executed
|
|
# tests is treated as a failure.
|
|
executed_tests() {
|
|
local task="$1"
|
|
local dir="${RESULTS_DIR}/${task}"
|
|
[[ -d "${dir}" ]] || { echo 0; return; }
|
|
local total=0
|
|
shopt -s nullglob
|
|
for xml in "${dir}"/*.xml; do
|
|
local count
|
|
count=$(sed -n 's/.*<testsuite[^>]* tests="\([0-9]*\)".*/\1/p' "${xml}" | head -1)
|
|
total=$(( total + ${count:-0} ))
|
|
done
|
|
shopt -u nullglob
|
|
echo "${total}"
|
|
}
|
|
|
|
run_lane() {
|
|
local category="$1"
|
|
local task="$2"
|
|
shift 2
|
|
echo ""
|
|
echo "=== [${category}] ${task}"
|
|
if ! (cd "${GRADLE_DIR}" && "${GRADLE[@]}" "${MODULE}:${task}" "$@"); then
|
|
FAILED+=("${category}:${task}")
|
|
return
|
|
fi
|
|
# `check` aggregates several tasks and has no results directory of its own.
|
|
if [[ "${task}" == "check" ]]; then
|
|
RAN+=("${category}:${task}")
|
|
return
|
|
fi
|
|
local executed
|
|
executed=$(executed_tests "${task}")
|
|
if (( executed == 0 )); then
|
|
echo "!!! ${task} passed without executing a single test — the lane's filter matches nothing,"
|
|
echo "!!! so the '${category}' evidence category is empty."
|
|
FAILED+=("${category}:${task} (0 tests executed)")
|
|
else
|
|
RAN+=("${category}:${task} (${executed} tests)")
|
|
fi
|
|
}
|
|
|
|
skip_lane() {
|
|
local category="$1"
|
|
local task="$2"
|
|
local reason="$3"
|
|
echo ""
|
|
echo "=== [${category}] ${task} -- SKIPPED (${reason})"
|
|
SKIPPED+=("${category}:${task} (${reason})")
|
|
}
|
|
|
|
docker_available() {
|
|
[[ "${MONGODB_DOCKER:-0}" == "1" ]] && command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1
|
|
}
|
|
|
|
echo "MongoDB Stable release gate"
|
|
echo "repository: ${REPO_ROOT}"
|
|
|
|
# --- Always-on lanes -------------------------------------------------------------------------
|
|
# Static analysis, architecture boundaries, unit and hermetic contract tests. These produce the
|
|
# mapping, transaction, migration, change-stream and security evidence that does not need a server.
|
|
run_lane "static-analysis" "check" -x "mongoStableContractTest"
|
|
run_lane "mapping+transaction+migration+change-stream+security" "mongoStableContractTest"
|
|
|
|
# --- Container lanes -------------------------------------------------------------------------
|
|
# A lane that needs Docker inside `check` teaches people to skip `check`, so these are opt-in --
|
|
# but opting out is recorded, not silent.
|
|
if docker_available; then
|
|
run_lane "compatibility" "mongoCompatibilityTest"
|
|
run_lane "migration" "mongoMigrationTest"
|
|
run_lane "security" "mongoSecurityIntegrationTest"
|
|
run_lane "failover" "mongoReplicaSetTest"
|
|
run_lane "failover" "mongoFailoverTest"
|
|
run_lane "performance" "mongoPerformanceTest"
|
|
else
|
|
reason="MONGODB_DOCKER!=1 or Docker unavailable"
|
|
skip_lane "compatibility" "mongoCompatibilityTest" "${reason}"
|
|
skip_lane "migration" "mongoMigrationTest" "${reason}"
|
|
skip_lane "security" "mongoSecurityIntegrationTest" "${reason}"
|
|
skip_lane "failover" "mongoReplicaSetTest" "${reason}"
|
|
skip_lane "failover" "mongoFailoverTest" "${reason}"
|
|
skip_lane "performance" "mongoPerformanceTest" "${reason}"
|
|
fi
|
|
|
|
# --- Architecture-wide gates -----------------------------------------------------------------
|
|
echo ""
|
|
echo "=== [architecture] repository-wide verification"
|
|
if (cd "${GRADLE_DIR}" \
|
|
&& "${GRADLE[@]}" verifyCleanArchitectureDependencies \
|
|
&& "${GRADLE[@]}" :app-bootstrap:test --tests '*CleanArchitectureTest'); then
|
|
RAN+=("architecture:repository-wide")
|
|
else
|
|
FAILED+=("architecture:repository-wide")
|
|
fi
|
|
|
|
# --- Report ------------------------------------------------------------------------------------
|
|
echo ""
|
|
echo "---------------------------------------------------------------"
|
|
echo "ran: ${#RAN[@]}"
|
|
for entry in "${RAN[@]:-}"; do [[ -n "${entry}" ]] && echo " + ${entry}"; done
|
|
echo "skipped: ${#SKIPPED[@]}"
|
|
for entry in "${SKIPPED[@]:-}"; do [[ -n "${entry}" ]] && echo " ~ ${entry}"; done
|
|
echo "failed: ${#FAILED[@]}"
|
|
for entry in "${FAILED[@]:-}"; do [[ -n "${entry}" ]] && echo " - ${entry}"; done
|
|
|
|
# --- promotion manifest -------------------------------------------------------------------------
|
|
# What was actually certified, tied to what produced it. A gate output that says "PASSED" and
|
|
# nothing else cannot be checked later against the artefact it supposedly certified: the commit, the
|
|
# server image and the driver version are exactly what somebody reads during an incident.
|
|
MANIFEST_DIR="${REPO_ROOT}/src/adapter/outbound/persistence-mongo/build/reports/mongo-release"
|
|
mkdir -p "${MANIFEST_DIR}"
|
|
{
|
|
echo "{"
|
|
echo " \"commit\": \"$(git -C "${REPO_ROOT}" rev-parse HEAD)\","
|
|
echo " \"commitDirty\": $( [[ -n "$(git -C "${REPO_ROOT}" status --porcelain)" ]] && echo true || echo false ),"
|
|
echo " \"serverImage\": \"${MONGODB_IMAGE:-mongo:8.0.16}\","
|
|
echo " \"generatedAt\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\","
|
|
echo " \"contractManifest\": \"src/adapter/outbound/persistence-mongo/release/release-contracts.json\","
|
|
echo " \"contractManifestSha256\": \"$(sha256sum "${REPO_ROOT}/src/adapter/outbound/persistence-mongo/release/release-contracts.json" | cut -d' ' -f1)\""
|
|
echo "}"
|
|
} > "${MANIFEST_DIR}/promotion.json"
|
|
echo "promotion manifest: ${MANIFEST_DIR}/promotion.json"
|
|
|
|
echo "---------------------------------------------------------------"
|
|
|
|
if (( ${#FAILED[@]} > 0 )); then
|
|
echo "STABLE GATE: FAILED"
|
|
exit 1
|
|
fi
|
|
|
|
if (( ${#SKIPPED[@]} > 0 )); then
|
|
echo "STABLE GATE: INCOMPLETE -- lanes above were not run, so their evidence categories are absent."
|
|
echo "A release requires every category. Re-run with MONGODB_DOCKER=1 on a host with Docker."
|
|
exit 2
|
|
fi
|
|
|
|
echo "STABLE GATE: PASSED -- every evidence category produced."
|