Maintain derived trades during sync#2588
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label Raindex-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
46756c6 to
381599c
Compare
3124557 to
055e02d
Compare
|
Folded into #2587 so the derived-trades local DB schema generation lands atomically. |

Chained PRs
Depends on #2587. Stack order: #2587 -> #2588 -> #2589 -> #2590
Motivation
derived_tradesmust be maintained by the same local DB sync pipeline that writes source events and state, otherwise producer bootstrap DBs and client incremental syncs can diverge from read-path expectations.Solution
upsert_derived_tradesSQL and builder utilities.order_eventsso trade rows can resolve the latest activeAddOrderV3even when the order add predates the window.Checks
COMMIT_SHA=local nix develop -c cargo test -p raindex_common local_db::query --libCOMMIT_SHA=local nix develop -c cargo test -p raindex_common local_db::pipeline::adapters::apply --libCOMMIT_SHA=local nix develop -c cargo test -p raindex_common local_db::export --libCOMMIT_SHA=local nix develop -c cargo test -p raindex_common raindex_client::trades --lib