fix(billing): detect FK violations from error messages#173
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #173 +/- ##
=======================================
Coverage 78.65% 78.66%
=======================================
Files 145 145
Lines 11521 11538 +17
Branches 3985 3992 +7
=======================================
+ Hits 9062 9076 +14
Misses 1631 1631
- Partials 828 831 +3
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
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
Fix billing snapshot FK retry detection when the deployed Postgres/Drizzle error only exposes the violated constraint in the error message text.
Related Issue
Follow-up to deploy smoke failure observed in run
26326869522.Type of Change
Changes
violates foreign key constraint "..."from top-level and cause error messages when Postgres FK metadata fields are unavailable.api_key_idandupstream_idbilling snapshot constraints are retried withNULL.Test Plan
pnpm test:run tests/unit/services/billing-cost-service.test.ts)pnpm exec tsc --noEmit)eslintvia commit hook)Checklist
Screenshots
N/A
Additional Notes
The previous fix handled
constraint_nameandconstraintfields, but the deployed error in run26326869522did not expose those fields to the application-level detector. The constraint name was still present in the error message text, so this patch uses that text as the final FK detection source.