Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughFeature repository operations now use transactions supplied through context. Feature connector create, update, and archive flows run repository work and event publication within transactions. Tests cover transaction reuse, publisher failures, and rollbacks. ChangesFeature transaction participation
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant featureConnector
participant transactionRun
participant featureRepo
participant eventPublisher
featureConnector->>transactionRun: Run create, update, or archive flow
transactionRun->>featureRepo: Validate and persist using transaction context
transactionRun->>eventPublisher: Publish event using transaction context
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Feature changes and their queued events appear to share a transaction. No actionable merge-blocking issue was identified; complete the planned CI and HTTP E2E checks. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Overview
Connection-pool exhaustion occurred during the subscription E2E stress test. Concurrent subscription creation held database connections while waiting for the customer lock, while feature queries in the transaction holding that lock attempted to acquire another pooled connection. With the pool exhausted, the lock holder could not proceed and the stress test timed out.
Make every feature repository operation join the Ent transaction in the caller's context, including eager meter loading, pagination counts, archive guards, and follow-up reads. Remove the metered grant-owner workaround now that the repository handles transaction binding itself.
Wrap feature create, update, and archive commands in
transaction.Runso standalone commands own a transaction and nested commands reuse their caller's transaction. This also makes feature changes atomic with system-event outbox enqueueing.Notes for reviewer
Coverage stays with the feature packages: one adapter regression holds the sole available connection and exercises repository operations against uncommitted data; connector tests verify publication-failure rollback and reuse of an outer transaction. Existing CRUD, workflow, and outbox tests retain their respective responsibilities. The feature package README documents the transaction contract.
Set E2E's existing structured
postgres.options.poolMaxConnsto 64 so test capacity is independent of runner CPU count. Fork Base E2E otherwise defaults to four connections, while non-fork Base E2E defaults to eight. Strip the pgx-onlypool_max_connsoption from migration connections, matching the existing Cloud behavior, so explicit pool configuration works with automatic migrations.The fork Container Tests run passed: Quickstart, Base E2E, and credits-disabled E2E all succeeded. The subscription stress test completed in 0.12 seconds; its five requests took 61–118 milliseconds, compared with the previous 30-second timeouts on the same runner class and unchanged test deadline. This supports pool exhaustion as the cause of that timeout. Billing's default-profile lookup still requests a connection outside the caller's transaction; making that adapter transaction-aware remains separate work.
Local validation passed:
CI's unit tests, lint, migration checks, and generators also passed. Secret Scanning currently reports an unverified PostgreSQL finding in the disposable E2E configuration. The HTTP E2E suites were validated in fork CI rather than rerun locally.
Summary by CodeRabbit
No outstanding review finding blocks merging, though the E2E rerun described in the PR remains pending.
Summary
The PR makes feature repository operations use a caller’s Ent transaction and wraps feature commands so persistence and event publication share a transaction. Since the previous review, it has changed the E2E PostgreSQL configuration to structured fields and removed the pool setting from migration connection strings.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Caller[Caller transaction context] --> Connector[Feature connector] Connector --> Repository[Feature repository] Connector --> Publisher[Event publisher] Repository --> DB[(Ent transaction)] Publisher --> DBReviews (3) · Last reviewed commit: "fix(migrate): exclude pool settings from..."