Skip to content

fix: missing error mapping on conflict - #4426

Merged
chrisgacsal merged 1 commit into
mainfrom
fix/llm-cost-conflict
May 26, 2026
Merged

chrisgacsal merged 1 commit into
mainfrom
fix/llm-cost-conflict

Conversation

@chrisgacsal

@chrisgacsal chrisgacsal commented May 25, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Ensure that db constraint errors are wrapped as conflict errors in llmcost service.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error messaging for price override creation. Constraint violation errors are now presented as clear conflict notifications rather than database-level error messages.

Review Change Stack

@chrisgacsal chrisgacsal self-assigned this May 25, 2026
@chrisgacsal
chrisgacsal requested a review from a team as a code owner May 25, 2026 14:13
@chrisgacsal chrisgacsal added the release-note/bug-fix Release note: Bug Fixes label May 25, 2026
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8c16d8d9-d76d-4626-8222-6b2f2ba667e5

📥 Commits

Reviewing files that changed from the base of the PR and between e1a6265 and 9adf9d4.

📒 Files selected for processing (1)
  • openmeter/llmcost/adapter/price.go

📝 Walkthrough

Walkthrough

This PR improves error handling in the LLM cost pricing adapter by converting database constraint errors to a normalized conflict error when creating price overrides. The change adds one import and wraps the error handling logic in CreateOverride to catch constraint violations and map them to a client-friendly error type.

Changes

Constraint Error Handling in Price Override

Layer / File(s) Summary
Conflict error translation for price override creation
openmeter/llmcost/adapter/price.go
The models package is imported, and CreateOverride now detects database constraint errors using entdb.IsConstraintError() and converts them to models.NewGenericConflictError() before returning, normalizing client-facing errors.

🎯 2 (Simple) | ⏱️ ~7 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: missing error mapping on conflict' clearly and concisely describes the main change: adding error mapping for conflict scenarios in the llmcost adapter's CreateOverride method.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/llm-cost-conflict

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chrisgacsal
chrisgacsal merged commit 3ac9744 into main May 26, 2026
33 of 35 checks passed
@chrisgacsal
chrisgacsal deleted the fix/llm-cost-conflict branch May 26, 2026 09:21

This branch was previously deployed

1 inactive deployment
dev — 9adf9d44 Deployed May 25, 2026 by chrisgacsal via Migration Checks #14622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/bug-fix Release note: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants