Repository navigation
Conversation
…s missing Payment triggers whose post data uses <value> failed when the tx's day had no price yet, e.g. for payments right after midnight UTC, before the new day's price is available from the price API. When that day's prices can't be found or fetched, look up those of the nearest day that has them (at most TRIGGER_PRICE_FALLBACK_MAX_DAYS = 3 days away, same day for USD and CAD, current price row excluded) and log which day was used. Only the trigger value uses the fallback; the tx itself is still linked to its own day's prices once they are available. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019G564i2sNiHJYQR95m8zGq
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 56 minutes. View limit details
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. |
This branch has not been deployed
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.
Related to #1062
Description
Payment triggers whose POST data includes the payment's value (
<value>) still failed when we had no price for the day of the payment. This happens most often right after midnight (UTC), before the new day's price is available.Now, when the day's price is missing, the trigger uses the price from the nearest day we have, up to 3 days before or after, so it fires anyway. If no price is that close, the trigger fails and is logged as before. Emails and POST triggers that don't use
<value>were already fixed in 94d7bea and still fire.Test plan
make github-test-unit: all 19 suites / 410 tests pass. New unit tests:priceService: the nearest-price lookup searches both sides of the day within the window and ignores the current-price row. It picks the closest day (the earlier one on a tie), takes USD and CAD from the same day, and errors when nothing is found.triggerService:<value>is filled from the fallback price when the day's price is missing. The fallback is not used when the day's price exists. When no price is found at all, the<value>trigger is logged as an error and the other triggers still run.npx tsc --noEmit -p .: no new errors in the changed files (the repo has pre-existing errors elsewhere).eslinton the changed files: clean.Remarks
<value>. The transaction is not linked to the fallback price; it is still linked to its own day's price later by the periodiclinkUnpricedTransactionsjob.TRIGGER_PRICE_FALLBACK_MAX_DAYS = 3inconstants/index.ts. Every time the fallback is used, aconsole.warnnames the missing day and the day used instead.services/triggerService.tsand its tests, so the others may need a small rebase after one is merged.Generated by Claude Code