Skip to content

feat(tenant): rebuild lifecycle isolation on current main - #141

Merged
seonghobae merged 6 commits into
mainfrom
feat/tenant-lifecycle-current-main
Aug 12, 2026
Merged

feat(tenant): rebuild lifecycle isolation on current main#141
seonghobae merged 6 commits into
mainfrom
feat/tenant-lifecycle-current-main

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Controlled replacement for #53

PR #53 accumulated a long-lived conflicted history against protected main. A fresh compare against protected main 2833e5f382e97943c9cde8ea2966c3e694ba5bd8 proved that only README.md and CHANGELOG.md overlap with changes made on protected main since #53's merge base. This replacement therefore starts from the exact current protected head and replays the exact reviewed #53 result blobs for the other 28 tenant-lifecycle paths.

Preserved product boundary

The replay preserves #53's host-selected tenant_scope, TenantDurableBatchAPIClient, tenant-qualified lifecycle persistence/read helpers, tenant-qualified uniqueness/indexes, parameterized transaction-local tenant context, forced default-deny PostgreSQL RLS, package/container schema identity, standalone compatibility, operator/security documentation, and tenant lifecycle tests.

README.md and CHANGELOG.md are deliberately left at current protected-main content in this first replacement commit rather than copying stale conflict-side blobs. Exact-head CI is expected to identify any current documentation composition required by the preserved tenant contract; that composition will be applied narrowly from current main.

No old #53 check, review, approval, generated merge, or stale-base evidence transfers to this PR. No force-push, destructive rebase, conflict-side selection, gate weakening, release action, or central dependency workaround is used.

Replacement proof

  • exact protected parent at creation: 2833e5f382e97943c9cde8ea2966c3e694ba5bd8
  • initial replay head: aaeceb1fcd9022f20108606d92808a96ab5644da
  • 28 non-overlapping paths reuse exact feat(tenant): isolate durable lifecycle state #53 result blobs
  • current-main README.md and CHANGELOG.md remain authoritative pending exact-head RED evidence
  • feat(tenant): isolate durable lifecycle state #53 remains open only until this replacement proves unique-work preservation and reaches a coherent validated current-main state

Merge boundary

Keep Draft until exact-head repository CI, security, coverage, required central workflows, review-thread state, tenant-specific PostgreSQL tests, and current-main documentation composition are all validated. Merge only on an unchanged exact head satisfying live rules and zero valid unresolved findings. After replacement equivalence is proven, close #53 as superseded and rebuild each dependent stack boundary from the protected result in dependency order.

Summary by CodeRabbit

새로운 기능

  • 독립형 및 테넌트 범위 durable lifecycle 모드를 지원합니다.
  • 테넌트별 배치 상태 저장·조회와 식별을 제공합니다.
  • PostgreSQL RLS 기반 데이터 격리와 기존 데이터의 안전한 마이그레이션을 지원합니다.
  • 기존 standalone 사용 방식과의 호환성을 유지합니다.

문서

  • 테넌트 lifecycle 사용법, 아키텍처, 운영 절차 및 보안 제약을 문서화했습니다.

테스트

  • 테넌트 격리, 입력 검증, 마이그레이션, 호환성 및 스키마 일치 검증을 강화했습니다.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a828e26e-22f9-48a1-bbcd-c5543cc0b67b

📥 Commits

Reviewing files that changed from the base of the PR and between 3e029d8 and eeac4a9.

📒 Files selected for processing (31)
  • AGENTS.md
  • ARCHITECTURE.md
  • CHANGELOG.md
  • CLAUDE.md
  • README.md
  • docker/postgres/init/02_schema.sql
  • docs/adr/0002-tenant-scoped-lifecycle.md
  • docs/doctoring/tenant-scoped-lifecycle.md
  • docs/remote-batch-lifecycle.md
  • docs/superpowers/evidence/2026-08-05-standalone-lifecycle-compatibility.md
  • docs/superpowers/plans/2026-08-05-tenant-scoped-lifecycle.md
  • docs/superpowers/specs/2026-08-05-tenant-scoped-lifecycle-design.md
  • pg_llm_batch/__init__.py
  • pg_llm_batch/db.py
  • pg_llm_batch/durable_client.py
  • pg_llm_batch/schema.sql
  • tests/smoke_legacy_sql_cleanup.sh
  • tests/test_bounded_response_double_reconciliation.py
  • tests/test_integration_pg.py
  • tests/test_lifecycle_seam_validation.py
  • tests/test_remote_batch_identity_contract.py
  • tests/test_remote_batch_lifecycle.py
  • tests/test_remote_batch_metadata_contract.py
  • tests/test_remote_batch_state_contracts.py
  • tests/test_schema_integrity.py
  • tests/test_standalone_lifecycle_compatibility.py
  • tests/test_tenant_durable_client.py
  • tests/test_tenant_lifecycle_persistence.py
  • tests/test_tenant_lifecycle_schema.py
  • tests/test_tenant_operator_documentation.py
  • tests/test_tenant_scope_validation.py

📝 Walkthrough

Walkthrough

테넌트 범위 durable lifecycle 저장 기능을 추가했습니다. PostgreSQL 스키마와 RLS를 tenant-qualified 식별자로 변경했습니다. standalone API 호환성을 유지하고 tenant-aware client, 영속화 헬퍼, 검증 및 격리 테스트를 추가했습니다.

Changes

테넌트 lifecycle 격리

Layer / File(s) Summary
계약과 운영 문서
AGENTS.md, ARCHITECTURE.md, CLAUDE.md, README.md, docs/...
tenant_scope의 출처와 검증 순서, lifecycle 식별자, RLS, 마이그레이션, standalone 호환성 계약을 문서화했습니다.
스키마와 RLS 마이그레이션
pg_llm_batch/schema.sql, docker/postgres/init/02_schema.sql, tests/test_tenant_lifecycle_schema.py
tenant_scope 컬럼과 복합 키를 추가했습니다. 기존 행을 standalone으로 백필하고 강제 RLS와 tenant별 인덱스를 적용했습니다.
영속화 API와 client 연동
pg_llm_batch/db.py, pg_llm_batch/durable_client.py, pg_llm_batch/__init__.py
tenant scope 검증, transaction-local 설정, tenant-qualified 저장·조회 API와 TenantDurableBatchAPIClient를 추가했습니다. 기존 standalone API와 recorder 계약은 유지했습니다.
검증과 테스트
tests/test_tenant_*.py, tests/test_remote_batch_*.py, tests/test_integration_pg.py, tests/smoke_legacy_sql_cleanup.sh
입력 검증, SQL 계약, client 전파, RLS 격리, 스키마 미러링과 bounded response 계약을 검증했습니다.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TenantDurableBatchAPIClient
  participant ObservationReserver
  participant Provider
  participant PostgreSQL
  participant TenantLifecycleRecorder
  TenantDurableBatchAPIClient->>ObservationReserver: observation order 예약
  TenantDurableBatchAPIClient->>Provider: lifecycle 요청
  Provider-->>TenantDurableBatchAPIClient: provider batch 응답
  TenantDurableBatchAPIClient->>PostgreSQL: tenant scope 설정 및 상태 저장
  TenantDurableBatchAPIClient->>TenantLifecycleRecorder: tenant scope와 snapshot 기록
Loading

Possibly related issues

  • #135 — 동일한 durable lifecycle persistence 경계를 다루지만, completed + failed <= total 불변조건은 이 변경에 포함되지 않습니다.
  • #125 — lifecycle 예약·영속화 오류 진단과 recovery context가 관련되지만, 동적 예외 정보 문제는 별도 범위입니다.
  • #130 — 동일한 tenant/RLS 모델과 관련되지만, 이 변경은 llm_remote_batch_jobs lifecycle 테이블만 대상으로 합니다.

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tenant-lifecycle-current-main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as ready for review August 12, 2026 03:24
@seonghobae
seonghobae merged commit 6c88490 into main Aug 12, 2026
33 of 34 checks passed
@seonghobae
seonghobae deleted the feat/tenant-lifecycle-current-main branch August 12, 2026 03: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