feat(tenant): isolate durable lifecycle state - #53
Conversation
|
Warning Review limit reached
Next review available in: 14 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthrough테넌트 범위를 durable lifecycle 식별자에 추가했습니다. PostgreSQL 복합 키와 강제 RLS를 적용했습니다. tenant-aware 저장·조회 API와 Changes테넌트 범위 lifecycle 격리
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Host
participant TenantDurableBatchAPIClient
participant Provider
participant PostgreSQL
Host->>TenantDurableBatchAPIClient: 인증된 tenant_scope 전달
TenantDurableBatchAPIClient->>TenantDurableBatchAPIClient: tenant_scope 검증
TenantDurableBatchAPIClient->>Provider: 배치 생성 또는 상태 요청
Provider-->>TenantDurableBatchAPIClient: provider 상태 반환
TenantDurableBatchAPIClient->>PostgreSQL: transaction-local scope 설정
TenantDurableBatchAPIClient->>PostgreSQL: tenant-qualified lifecycle 저장 또는 조회
PostgreSQL-->>TenantDurableBatchAPIClient: RLS 적용 결과 반환
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
⚔️ Resolve merge conflicts 💡
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review Please review exact current source head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='bf2cc2e140dc3ff4a56c3203f80f41bb9fed5d10'
head='f6f328a8b9f7db57c5286be00c854fafc0b5bbf8'
repo='ContextualWisdomLab/pg-llm-batch'
printf '%s\n' '== Exact commit identity =='
git rev-parse "${base}^{commit}"
git rev-parse "${head}^{commit}"
git merge-base --is-ancestor "$base" "$head" && echo 'BASE_IS_ANCESTOR=true' || echo 'BASE_IS_ANCESTOR=false'
git show -s --format='base: %H%n%an%n%s' "$base"
git show -s --format='head: %H%n%an%n%s' "$head"
printf '%s\n' '== Exact changed paths =='
git diff --name-status "$base" "$head"
printf '%s\n' '== Exact diff stat =='
git diff --stat "$base" "$head"
printf '%s\n' '== Relevant implementation outlines at requested head =='
git show "${head}:pg_llm_batch/db.py" > /tmp/pg_llm_batch_db.py
git show "${head}:pg_llm_batch/durable_client.py" > /tmp/pg_llm_batch_durable_client.py
ast-grep outline /tmp/pg_llm_batch_db.py --items all --view expanded
ast-grep outline /tmp/pg_llm_batch_durable_client.py --items all --view expanded
printf '%s\n' '== Exact implementation diff =='
git diff --unified=70 "$base" "$head" -- \
pg_llm_batch/db.py pg_llm_batch/durable_client.py pg_llm_batch/__init__.py
printf '%s\n' '== Canonical schema and image schema at requested head =='
git show "${head}:pg_llm_batch/schema.sql" > /tmp/canonical_schema.sql
git show "${head}:docker/postgres/init/02_schema.sql" > /tmp/image_schema.sql
cmp -s /tmp/canonical_schema.sql /tmp/image_schema.sql && echo 'SCHEMAS_IDENTICAL=true' || echo 'SCHEMAS_IDENTICAL=false'
sha256sum /tmp/canonical_schema.sql /tmp/image_schema.sql
cat -n /tmp/canonical_schema.sql
printf '%s\n' '== Targeted contract-test outlines at requested head =='
for path in \
tests/test_tenant_scope_validation.py \
tests/test_tenant_lifecycle_persistence.py \
tests/test_tenant_durable_client.py \
tests/test_standalone_lifecycle_compatibility.py \
tests/test_tenant_lifecycle_schema.py \
tests/test_integration_pg.py \
tests/test_schema_integrity.py
do
if git cat-file -e "${head}:${path}" 2>/dev/null; then
printf '\n-- %s --\n' "$path"
git show "${head}:${path}" > "/tmp/$(basename "$path")"
ast-grep outline "/tmp/$(basename "$path")" --items all --view expanded
fi
done
printf '%s\n' '== Exact-head PR and check evidence =='
gh pr view 53 --repo "$repo" --json headRefOid,baseRefOid,mergeable,reviewDecision,statusCheckRollup \
2>&1 || true
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
--jq '.check_runs[] | [.name,.status,.conclusion,.html_url] | `@tsv`' 2>&1 || trueLength of output: 94677 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='bf2cc2e140dc3ff4a56c3203f80f41bb9fed5d10'
head='f6f328a8b9f7db57c5286be00c854fafc0b5bbf8'
repo='ContextualWisdomLab/pg-llm-batch'
show_range() {
local path="$1"
local start="$2"
local end="$3"
printf '\n== %s:%s-%s at requested head ==\n' "$path" "$start" "$end"
git show "${head}:${path}" | sed -n "${start},${end}p" | cat -n
}
show_range pg_llm_batch/db.py 150 645
show_range pg_llm_batch/durable_client.py 20 390
show_range tests/test_tenant_scope_validation.py 1 130
show_range tests/test_tenant_lifecycle_persistence.py 75 330
show_range tests/test_tenant_durable_client.py 1 330
show_range tests/test_standalone_lifecycle_compatibility.py 1 150
show_range tests/test_tenant_lifecycle_schema.py 1 150
show_range tests/test_integration_pg.py 100 285
show_range tests/test_tenant_operator_documentation.py 1 150
show_range docs/superpowers/plans/2026-08-05-tenant-scoped-lifecycle.md 1 220
printf '%s\n' '== Tenant-qualified lifecycle SQL in the requested diff =='
git diff --unified=12 "$base" "$head" -- pg_llm_batch/db.py pg_llm_batch/schema.sql \
| rg -n -C4 '(tenant_scope|ON CONFLICT|WHERE|CREATE INDEX|UNIQUE|ROW LEVEL|CREATE POLICY|set_config)' || true
printf '%s\n' '== RLS migration and policy definition in the base =='
git show "${base}:pg_llm_batch/schema.sql" \
| rg -n -C5 '(llm_remote_batch_jobs|ROW LEVEL|CREATE POLICY|tenant_scope|NO FORCE|ENABLE|FORCE)' || true
printf '%s\n' '== Failed Strix check metadata and log =='
gh api "repos/${repo}/actions/jobs/93140451999" \
--jq '{name,status,conclusion,started_at,completed_at,html_url,steps}' 2>&1 || true
gh run view 31272387553 --repo "$repo" --log-failed 2>&1 | tail -n 350 || true
printf '%s\n' '== Review states and unresolved review threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='pg-llm-batch' -F number=53 -f query='
query($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
reviewDecision
reviews(first: 100) {
nodes { author { login } state commit { oid } submittedAt }
}
reviewThreads(first: 100) {
nodes { isResolved comments(first: 1) { nodes { author { login } body } } }
}
}
}
}' --jq '.data.repository.pullRequest' 2>&1 || trueLength of output: 120649
I found one source-level blocker.
I verified these exact-head source contracts:
The exact-head Python, coverage, package, container, CodeQL, Semgrep, OSV, Trivy, and dependency-review checks succeeded. The I did not approve the PR because the atomic policy-recreation contract remains unmet. You are interacting with an AI system. |
|
@opencode-agent address Continue the existing PR branch. Refetch the exact current head/base, all reviews/threads, and every GitHub Check; fix current defects directly and keep working while central prerequisites run. Once central Do not open a competing PR, synthesize approval, or bypass protection. Merge only after all exact-head gates succeed, actionable threads are zero, and a qualifying non-author formal approval exists. |
Product gap
Protected
mainkeys durable provider lifecycle state by endpoint alias + remote batch id and lacks package-owned trusted tenant identity/RLS for shared-table MSA deployments.Bounded implementation
This branch adds strict 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, atomic legacy backfill/constraint/RLS migration, packaged/container schema identity, and standalone compatibility. Production application identities remainNOSUPERUSER NOBYPASSRLS; provider metadata/IDs/payloads/headers never select tenant scope.Test-first / review evidence
Tenant validation, schema, persistence, client compatibility, migration, and isolation contracts were introduced test-first. The valid migration-order/RLS findings were repaired; the only returned inline review thread is resolved/outdated. No predecessor review/check evidence transfers after a source change.
A later CodeRabbit review included maintainability-only suggestions such as consolidating duplicated test doubles/exception-handler structure. Those do not establish a correctness/security regression on the unchanged current source and are deliberately not used to churn this stack root: changing #53 for a low-value refactor would invalidate every downstream exact-base relation. Re-evaluate such refactors from protected main after the stack lands.
Current exact state
f6f328a8b9f7db57c5286be00c854fafc0b5bbf8.pg-llm-batch/main:bf2cc2e140dc3ff4a56c3203f80f41bb9fed5d10.31272388550, Security Scan31272388560, and SAST Semgrep31272388548: completed / success on this source relation.31274235004is still formalCHANGES_REQUESTED; its stated reason was failed coverage-evidence infrastructure, not a pg-llm-batch semantic/source finding. It remains an unsuperseded review state until a fresh current-head review legitimately replaces it.The protected-main repository CI still predates #88 exact-source checkout governance, so successful PR-triggered runs are staged integration evidence rather than final contributor-source-head acceptance.
Current prerequisite classification
Repository-local exact-source governance #88 remains the immediate prerequisite. Current protected organization rules require the central workflow set and review-thread resolution, but specify
required_approving_review_count: 0, code-owner review disabled, and no last-push approval requirement. Therefore lack of an independent formal approval is not itself a current leaf merge prerequisite unless live policy changes.The protected central OpenCode required-workflow entrypoint on
.github/mainis a stable-context wrapper; its required jobs are separate from authenticated review dispatch.ContextualWisdomLab/.github#790remains read-only and must not be copied, weakened, triggered, dismissed, resolved, or merged by this writer, but its historical review state is not promoted into an extra leaf approval requirement beyond live policy.After #88 reaches protected main, move this PR from Draft only after refetching the unchanged head/base and current writer state. Acquire fresh required central/repository workflow evidence under exact-source governance and a fresh review outcome sufficient to supersede the existing infrastructure-only
CHANGES_REQUESTEDstate. Do not dismiss that current-head review merely to manufacture mergeability; supersede it with legitimate new evidence first.Downstream stack boundary
The current product chain remains:
#53 -> #57 -> #58 -> #59 -> #60 -> #92 -> #94 -> #95 -> #96 -> #97.Each downstream PR must continue to descend from its exact predecessor. Former #55/#56 and #78/#79/#80/#83/#84 are superseded/closed implementation lines and their evidence does not transfer. Avoid low-value source churn on this root because changing #53 invalidates every downstream exact-base relation.
Follow-up lifecycle boundaries
status/endpointtext needs a reviewed field grammar/length/compatibility policy. Compose with protected provider-control validation rather than racing this branch.llm_queues,llm_batches,llm_batch_files,llm_batch_file_payloads,llm_requests,llm_jsonl_lines) remain outside this lifecycle-only RLS boundary; feat(tenant): isolate durable lifecycle state #53 is not end-to-end tenant isolation.completed + failed > total; separate monotonicGREATEST(...)updates can also require invariant-preserving composition. Implement the persistence invariant test-first from the protected feat(tenant): isolate durable lifecycle state #53 result or a proven successor. ACTIVE-PR fix(http): retry 425 Too Early on bounded GETs #71's HTTP status parser validation is complementary but does not make the durable persistence helper self-validating.These are independent follow-ups and do not justify expanding or rewriting this root PR while it owns the tenant-lifecycle stack.
Merge / release boundary
Keep Draft until #88 reaches protected
main. Then obtain fresh exact-current-head required workflow/review evidence, re-evaluate current protected main/rulesets, and regenerate every applicable exact-source quality/security/dependency/package/provenance/live-PostgreSQL/release-acceptance gate on the unchanged final source. Merge only with zero valid unresolved findings, the existing infrastructure-onlyCHANGES_REQUESTEDlegitimately superseded, review threads resolved, and every review/approval requirement actually imposed by live policy satisfied.The feature remains
Unreleased; release evaluation begins only after protected integration and integrated-head release acceptance.