fix: 일반 리셋이 서버 지정 브랜치를 추적

상위 배포 권한자가 선택한 branch 또는 commit 정책을 profile metadata에 보존하고 일반 시나리오 초기화가 이를 따르도록 변경한다. 같은 active commit의 설치 완료 workspace는 빌드를 생략하고 기존 migration, seed, readiness 흐름을 유지한다.
This commit is contained in:
2026-08-19 13:42:52 +00:00
parent a9029c4675
commit 4977fb615d
14 changed files with 259 additions and 35 deletions
@@ -0,0 +1,36 @@
-- Preserve the source policy of the release that produced the active profile build.
-- BRANCH keeps following its remote head; COMMIT remains explicitly pinned.
WITH latest_success AS (
SELECT DISTINCT ON ("profile_name")
"profile_name",
"source_mode",
"source_ref",
"resolved_commit_sha"
FROM "gateway_operation"
WHERE "status" = 'SUCCEEDED'
AND (
"type" = 'DEPLOY'
OR ("type" = 'RESET' AND "payload" ->> 'requestedSource' IN ('BRANCH', 'COMMIT'))
)
AND "source_mode" IS NOT NULL
AND "source_ref" IS NOT NULL
AND "resolved_commit_sha" IS NOT NULL
ORDER BY "profile_name", "completed_at" DESC NULLS LAST, "created_at" DESC
)
UPDATE "gateway_profile" AS profile
SET "meta" = jsonb_set(
COALESCE(profile."meta", '{}'::jsonb),
'{releaseSource}',
jsonb_build_object(
'mode', latest."source_mode"::text,
'ref', CASE
WHEN latest."source_mode" = 'BRANCH' THEN latest."source_ref"
ELSE latest."resolved_commit_sha"
END
),
true
)
FROM latest_success AS latest
WHERE profile."profile_name" = latest."profile_name"
AND profile."build_commit_sha" = latest."resolved_commit_sha"
AND NOT (COALESCE(profile."meta", '{}'::jsonb) ? 'releaseSource');