Skip to content

test(ci): #373 drift gate red-path smoke — DO NOT MERGE#594

Draft
thxforall wants to merge 1 commit into
devfrom
test/373-drift-smoke
Draft

test(ci): #373 drift gate red-path smoke — DO NOT MERGE#594
thxforall wants to merge 1 commit into
devfrom
test/373-drift-smoke

Conversation

@thxforall
Copy link
Copy Markdown
Contributor

목적

#588 에서 머지된 Schema drift gate workflow 가 실제로 red 를 trigger 하는지 검증하기 위한 의도적 drift smoke PR.

머지 금지. 검증 완료 후 close + branch 삭제 예정.

변경

  • packages/web/lib/api/admin/magazines.ts MAGAZINE_STATUSES'foo' 추가
  • DB CHECK constraint post_magazines_status_check 와 의도적 drift 발생

기대 결과

Phase 1 (라벨 없음 — 현재 상태)

  • Schema drift gate job → fail (bun run scripts/check-schema-drift.ts exit 1)
  • sticky PR comment 에 다음 표 표기:
    | SOT | Status | Detail |
    | post_magazines.status | DRIFT | TS-only: `foo` |
    

Phase 2 (drift-bypass label 추가 후)

  • workflow rerun → step 은 continue-on-error: true 로 전환
  • job → green (false positive 가 아닌 의도적 bypass)
  • comment 는 그대로 유지 (DRIFT 표시)

부수 효과 (무관)

  • packages/web/lib/api/admin/__tests__/magazines.test.ts hardcoded toEqual([...]) fail
  • lint/test workflow 도 red — drift gate 검증 결과와 무관

Cleanup

검증 완료 후:

  1. PR close
  2. git push origin --delete test/373-drift-smoke
  3. 로컬 worktree + branch 정리

Refs

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
decoded-app Error Error May 28, 2026 8:44am

@thxforall
Copy link
Copy Markdown
Contributor Author

Status update

#595 fix PR self-validate 1차 실패 → supabase image 권한 문제 추가 노출 (permission denied for database drift). #595 별도 follow-up 필요.

본 PR (#594)은 검증 vehicle로 계속 보존. #595가 머지되면 origin/dev rebase + force push로 red-path 재검증 예정.

진행 상황:

  • ✅ Bug 2 (pipefail) — fix 작동 확인 (setup fail이 step fail로 노출됨)
  • ✅ Bug 3 (sticky comment) — 본 comment처럼 게시 작동
  • 🟡 Bug 1 (postgres ext) — pgvector → supabase image, 권한 추가 fix 필요

thxforall added a commit that referenced this pull request May 28, 2026
* fix(ci): #373 drift gate — pgvector image, pipefail, sticky comment path

#594 red-path smoke 가 노출한 3 가지 결함 동시 수정.

1. postgres service `image: postgres:17` → `pgvector/pgvector:pg17`
   - supabase/migrations 가 `CREATE EXTENSION vector` 를 호출하므로 vanilla
     postgres:17 으로는 setup 단계에서 첫 migration 부터 fail
   - 결과: SOT 비교 자체가 한 번도 실행된 적 없음

2. `bun run ... | tee /tmp/drift.md` → `set -eo pipefail` + `> drift.md`
   - GitHub Actions 의 default shell 은 `bash -e` (no pipefail) 이므로 pipe 의
     last command (tee) exit 0 이 전체 exit code 가 된다. script `process.exit(1)`
     이 가려져 job 이 항상 green 으로 표시됨
   - pipe 자체를 제거하고 redirect → cat 으로 동일 효과 + log 가시성 유지

3. `hashFiles('/tmp/drift.md')` → `hashFiles('drift.md')`
   - `hashFiles()` 는 GITHUB_WORKSPACE 내부 파일만 해시화. `/tmp/*` 는
     항상 빈 문자열 → `'' != ''` false → sticky comment step 영구 skip
   - drift.md 를 workspace 에 두고 path 도 동기화

## 검증

본 PR self-validate:
- workflow trigger (path 매치: `.github/workflows/schema-drift.yml`)
- pgvector 이미지로 23 migration 정상 적용 기대
- MAGAZINE_STATUSES 는 dev 와 동일 → "OK — 1 SOT entries match" sticky comment 기대

머지 후 #594 (red-path smoke) 를 origin/dev rebase + force push 하면
의도된 DRIFT 결과 + drift-bypass label flow 까지 자동 재검증된다.

## Refs

- 검증 PR: #594 (test/373-drift-smoke, DO NOT MERGE)
- 원본 workflow: #588
- SOT: docs/database/schema-drift-sot.md

* fix(ci): #373 drift gate — use supabase/postgres image for all required extensions

self-validate 첫 시도 (PR #595 initial) 가 노출: pgvector/pgvector:pg17 도 부족.
20260409075040_remote_schema.sql 이 `CREATE EXTENSION pg_graphql` 요구.

supabase/postgres 는 prod 에서 사용 중인 모든 ext (vector, pg_graphql, pgsodium,
pg_net, pgaudit, pgjwt 등) 를 포함하는 공식 이미지. 17.6.1.131 (2026-05-27 stable)
태그 고정 — latest 사용 시 reproducibility 깨짐.

cold start 가 vanilla 대비 다소 느릴 수 있으나 setup fail 위험 제거가 우선.

* fix(ci): #373 drift gate — use default postgres DB to avoid supabase init permission issue

#595 v2 self-validate 실패 노출: `POSTGRES_DB: drift` 로 별도 DB 를 만들면
supabase/postgres image 의 init script 가 default `postgres` DB 에서만 role/권한을
설정하므로 postgres user 가 `permission denied for database drift` 를 받는다.

별도 DB 만들지 말고 image 가 init 한 default `postgres` DB 위에서 migration 적용.

* fix(ci): #373 drift gate — bootstrap supabase namespace stubs

supabase/postgres image 의 init script 는 storage/auth/vault/graphql/realtime
객체를 만들지 않아 (그건 별도 docker-compose service 가 담당)
storage.buckets INSERT 같은 migration 에서 setup 이 fail 함.

게이트 범위는 CHECK constraint 정합성이지 prod-parity 가 아니므로,
migration 적용 전에 FK/INSERT target 만큼만 minimal stub 으로 만든다.

stub:
- auth, storage, vault, graphql, realtime schemas
- auth.users(id uuid PRIMARY KEY) — FK + trigger target
- auth.uid() — NULL 반환 stub (RLS USING/WITH CHECK 에서 호출)
- storage.buckets(id, name, public) — INSERT target

신규 migration 이 다른 supabase namespace 객체를 참조하면 여기 추가.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(ci): #373 drift gate v5 — drop+recreate auth/storage schemas

이전 v4 (commit 9f89ca4) 는 schema 가 supabase image 에 이미 존재하지만
ownership 이 supabase_admin 이라 postgres user 가 CREATE TABLE 시
`permission denied for schema auth` 로 fail 했음.

해결: auth / storage 만 DROP CASCADE 로 날리고 postgres owner 로 재생성.
vault / graphql / realtime 은 첫 migration 의 CREATE EXTENSION 이 의존하므로
건드리지 않음.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(ci): #373 drift gate v6 — connect as supabase_admin + diagnostic

v5 (drop+create) 가 `must be owner of schema auth` 로 fail.
postgres role 은 supabase/postgres image 에서 superuser 가 아님 — schema 가
supabase_admin 소유로 잡혀있어 DROP/CREATE TABLE 둘 다 막힘.

v6 변경:
- LOCAL_DATABASE_URL 의 user 를 supabase_admin 으로 변경 (POSTGRES_PASSWORD 공용)
- DROP/CREATE SCHEMA 제거, IF NOT EXISTS stub 객체만 추가
- gen_random_uuid DEFAULT 제거 (stub PK 는 INSERT 안 함, extensions schema 의존 회피)
- 진단 라인 (current_user / \du) 추가 — 다음 fail 시 즉시 원인 파악

v6 도 fail 하면 stub 접근 폐기 → supabase CLI 로 전환.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: empty commit to re-trigger drift workflow after drift-bypass label add

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MAGAZINE_STATUSES 에 'foo' 추가 — DB CHECK constraint 와 의도적 drift 발생.

목적:
- #588 에서 머지된 schema-drift PR gate workflow 의 red path 검증
- 기대 결과: workflow fail + sticky comment 에 TS-only: foo 표기

부수 효과:
- packages/web/lib/api/admin/__tests__/magazines.test.ts hardcoded toEqual fail
  (lint/test workflow 도 red — 무관)

검증 완료 후 PR close + branch 삭제 예정.
@thxforall thxforall force-pushed the test/373-drift-smoke branch from e61d035 to e2d7842 Compare May 28, 2026 08:40
@github-actions
Copy link
Copy Markdown

Schema drift report (#373 v2)

1 of 1 SOT entries failed.

SOT Status Detail
post_magazines.status DRIFT TS-only: foo; DB-only: generating

SOT mapping: docs/database/schema-drift-sot.md · Bypass via drift-bypass label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant