Add billing adjustments application - #44
Merged
Merged
Conversation
added 2 commits
August 3, 2026 18:08
…guard, poll backoff, and input hardening Ports the latest billing-adjustments engine work from the working repo: engine: - Pipeline processing by invoice_id: the same invoice is serialized (never two requests in flight at once) while different invoices run concurrently, replacing the global phase barrier. - Pre-validate adjustmentAmount to at most 2 decimals at the universal submit gate. - Poll interval now backs off (5s to 60s cap, resets on progress) instead of flat 60s. - Recover an existing request on a reused client-token error instead of failing. - Fail-closed duplicate pre-check: hold rows as NEED_REVIEW when listing cannot verify; never submit unverified. - Reference columns optional (REFERENCE_COLUMNS); only agreement_id, invoice_id, and amount required. webapp: bound the credential wait (default 30m) with a credentials_timeout state and a heartbeat so a paused job cannot hang forever. cli/docs: surface NEED_REVIEW and document the guards and column requirements.
… ERROR When GetBillingAdjustmentRequest itself fails during polling (a transient network blip, throttle, or 5xx), the request's real status is unknown. Previously get_adjustment_status returned 'ERROR' for any exception, which the poller treated as terminal, so a transient poll failure could mark an already-submitted refund as failed even though it had actually completed server-side. - get_adjustment_status now returns the sentinel 'POLL_ERROR' (status unknown) for call failures; a genuine service-returned 'ERROR' status stays terminal. - The poll sweep treats 'POLL_ERROR' as retryable: keep the request in flight and retry on the next sweep, bounded by the existing per-request deadline. - If the deadline is reached while status is still unconfirmed, TIMEOUT now says the status could not be confirmed and to re-run to reconcile (the pre-check will detect an existing refund and never duplicate).
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.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.