Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughCharge lookups now support missing IDs. Strict reads keep existing errors. Tolerant reads omit missing charges. Typed charge loading uses tolerant reads and preserves the order of charges that remain. ChangesMissing-charge loading
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change makes charge reads tolerate concurrent deletion while preserving strict behavior for other callers; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Search
participant ChargeService
participant ChargeAdapter
participant IDOrdering
Search->>ChargeService: Return charge IDs
ChargeService->>ChargeAdapter: Load typed charges with AllowMissing
ChargeAdapter->>IDOrdering: Order fetched charges
IDOrdering-->>ChargeAdapter: Available charges in requested order
ChargeAdapter-->>ChargeService: Return loaded charges
ChargeService-->>Search: Return ordered available charges
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 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 |
44dd7e1 to
303805a
Compare
The typed charge loads deliberately run outside the search transaction (the realtime usage expand calls ClickHouse per charge), so a charge deleted between the search snapshot and the typed loads failed the whole ListCharges/GetByIDs read with a not-found error. Define the missing-ID contract explicitly: entutils.InIDOrderSkipMissing orders like InIDOrder but drops target IDs with no matching entity, and the typed GetByIDs inputs gain an opt-in AllowMissing flag (strict remains the default for every other caller). Only the union charge expansion opts in: a vanished charge is dropped from the list page, and GetByID keeps returning its not-found error through the empty result.
52c75ef to
8506f61
Compare
303805a to
ec8d388
Compare
Stacked on #4933.
The typed charge loads deliberately run outside the search transaction (the realtime usage expand calls ClickHouse per charge, and a remote call must not pin a pooled Postgres connection), so a charge deleted between the search snapshot and the typed loads failed the whole
ListCharges/GetByIDsread with a not-found error. A single read-committed transaction would not close the race either: each statement takes its own snapshot.This defines the missing-ID contract explicitly instead:
entutils.InIDOrderSkipMissingorders likeInIDOrderbut drops target IDs with no matching entity.GetByIDsInputs (usage-based, flat fee, credit purchase) gain an opt-inAllowMissingflag; strict not-found stays the default for every other caller.GetByIDkeeps returning its not-found error through the empty-result path.Covered by a DB-backed test feeding the expansion a search snapshot with a phantom ID.
Summary by CodeRabbit
Greptile Summary
The PR makes union charge reads tolerate charges deleted between the initial search and subsequent typed loads while preserving strict missing-ID behavior for other callers.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Caller participant Search as Charge search participant Expand as Union expansion participant Typed as Typed charge loaders Caller->>Search: List/Get charge IDs Search-->>Expand: Snapshot of IDs by type Note over Search,Typed: A charge may be deleted here Expand->>Typed: "GetByIDs(AllowMissing=true)" Typed-->>Expand: Existing charges only Expand-->>Caller: Loaded charges in search orderReviews (3): Last reviewed commit: "fix: tolerate concurrently deleted charg..." | Re-trigger Greptile
Context used: