fix: exclude stale candidates from /by_uids batch; document backfill behavior (COW-992)#91
Closed
lgahdl wants to merge 1 commit into
Conversation
…nt backfill behavior (COW-992) Prevents redundant /by_uids calls for already-expired candidates on every block during post-backfill catch-up. The stale path (account fallback, 500/block) already handles these — excluding them from the unconfirmed SELECT eliminates wasted API quota until the drain completes. Also documents cold-start duration, /ready semantics, and the historical discrete-order gap for integrators in docs/deployment.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jeffersonBastos
approved these changes
Jun 17, 2026
Contributor
|
Superseded by #102 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validToin the past) are now excluded from the C2 unconfirmedSELECTand its/by_uidsbatch. These were always misses — the stale sweep path (500/block,/account/{owner}/ordersfallback) already handles them. Without this, every block during post-backfill catch-up fired a large/by_uidscall for all remaining aged-out UIDs, wasting API quota until the drain completed.docs/deployment.mdcovering cold-start duration,/readysemantics, and the historical discrete-order gap explanation for integrators.Root cause (F13 finding)
The structural gap (COW-992) arises because C2–C5 are live-only handlers. TWAP parts precomputed during backfill land in
candidate_discrete_orderwith pastvalidTodates. When live sync starts, the stale sweep promotes them using/account/{owner}/ordersas fallback (added in COW-989). This PR adds the missing query optimization and documents the behavior.Test plan
pnpm typecheck— passespnpm test— passesexpired)docs/deployment.mdcold-start section for accuracyCloses COW-992
🤖 Generated with Claude Code