Skip to content

refactor(orphan): separate reaper test responsibilities - #36

Merged
bipolarrr merged 2 commits into
masterfrom
refactor/orphan-test-organization
Aug 18, 2026
Merged

refactor(orphan): separate reaper test responsibilities#36
bipolarrr merged 2 commits into
masterfrom
refactor/orphan-test-organization

Conversation

@bipolarrr

@bipolarrr bipolarrr commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

변경 내용

  • orphan service 테스트를 orchestration, ownership/renewal, storage abort·timeout 책임으로 분리
  • per-orphan claim lifecycle을 claim-lease-guard 상태 머신으로 추출
  • heartbeat, renewal single-flight, deadline, abort composition, late completion fencing을 guard 단위 테스트로 고정
  • 반복 Promise/dependency fixture를 작은 test helper로 공통화
  • 더 강한 cross-layer invariant에 완전히 포함된 중복 테스트 2건 제거

변경 배경

기존 orphan-service.test.ts는 safety, concurrency, timeout, PREFIX integration이 한 파일에 결합되어 있었다. 이번 변경은 LOC 감소가 아니라 기존 24 declarations / 25 expanded cases의 의미를 모두 보존하면서 각 invariant의 소유 레이어를 명확히 하는 데 목적이 있다.

서비스는 initial/destructive renewal ordering, storage request deadline, reference cancellation, terminal DB ownership fence와 accounting을 계속 소유한다. 새 guard는 heartbeat lifecycle, renewal coalescing, deadline, claim-loss latch와 late-result fencing만 소유한다.

Invariant 보존

다음 failure mode를 각각 유지하거나 더 직접적인 단위 테스트로 보강하였다.

  • claim loss 이후 DELETE 금지
  • timeout 이후 stale success 거부
  • outer abort 이후 storage work 재개 금지
  • overlapping renewal의 중복 DB call 금지
  • terminal mutation ownership loss
  • late promise rejection 관찰
  • PREFIX delete failure 이후 잘못된 resolution 금지

기존 service 테스트 25개 의미 케이스는 삭제 없이 새 책임별 suite에 모두 대응한다.

중복 제거

  • object-deletion.test.ts의 기본 partial recovery 테스트는 더 강한 prefix invariant 테스트가 processed count, 부모 PREFIX 기록, 후속 page 처리와 same-sweep no-retry까지 포함하여 제거
  • renewal-timeout PostgreSQL의 정상/expired renewal smoke 테스트는 orphan durability suite의 active/expired ownership CAS와 남은 timeout/pool recovery 테스트가 완전히 대체하여 제거

검증

  • 관련 unit: 8 files, 66 tests passed
  • 전체 API: 97 files passed / 12 skipped, 967 tests passed / 76 skipped
  • API ESLint 및 TypeScript: passed
  • architecture guard, self-test, dependency-cruiser: passed
  • PostgreSQL orphan renewal timeout: 5 tests passed
  • PostgreSQL orphan durability: 16 tests passed
  • 독립 clean-room reviewer G: APPROVE
  • 최종 독립 reviewer H: APPROVE

임시 dependency override

CI의 workspace audit가 GHSA-ggr8-5vv4-36mx를 탐지하여, Prisma 7.9.1은 유지하고 @prisma/config@7.9.1 하위의 deepmerge-ts8.0.1로 제한하여 override하였다.

  • Prisma의 실제 사용 지점은 plain deepmerge를 c12 merger로 전달하는 단일 경로
  • v8 breaking change인 Map merge, deepmergeInto, 내부 type rename은 해당 경로에서 미사용
  • clean npm ci 후 실제 8.0.1 설치와 7.1.5 미설치 확인
  • npm audit --audit-level=high: 취약점 0건
  • Prisma config validate/generate, 전체 test/lint/architecture/build 검증
  • upstream 수정: prisma/prisma#30054

제거 계획

  1. Prisma upstream PR #30054 병합과 이를 포함한 stable release를 추적한다.
  2. 해당 stable의 @prisma/configdeepmerge-ts >=8.0.0을 직접 선언하는지 확인한다.
  3. Prisma 패키지 버전 정합성을 유지하여 prisma, @prisma/client, @prisma/adapter-pg를 함께 갱신한다.
  4. root의 scoped override를 제거하고 lockfile을 재생성한다.
  5. clean npm ci, audit, Prisma generate/validate, 전체 test/lint/architecture/build를 다시 실행한다.

@bipolarrr
bipolarrr marked this pull request as ready for review August 18, 2026 02:51
@bipolarrr
bipolarrr merged commit bdeafe1 into master Aug 18, 2026
2 checks passed
@bipolarrr
bipolarrr deleted the refactor/orphan-test-organization branch August 19, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant