Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
3f553b1 to
dcbd79d
Compare
dcbd79d to
301b485
Compare
| func (s *service) recognitionGroup(ctx context.Context, namespace, id string, groups map[string]ledger.TransactionGroup) (ledger.TransactionGroup, error) { | ||
| if id == "" { | ||
| return nil, fmt.Errorf("recognition lineage is missing its allocation or backing transaction group") | ||
| return nil, models.NewError("ledger_recognition_failed", "recognition lineage is missing its allocation or backing transaction group", models.WithAttribute("reason", "ledger_recognition_lineage_reference_missing")) |
There was a problem hiding this comment.
Please use a constant for the error codes.
| }, | ||
| }, nil | ||
| case models.Error: | ||
| if ordinaryErrorSeverity == "" { |
There was a problem hiding this comment.
Please add a comment here, that any generic error not wrapped using WrapAsValidationIssue is considered a system error.
bea52da to
299ba20
Compare
Negative FBO source minima emit a counter and diagnostic warning on every observation, including repeated reads. Logs include the source, query boundary, and minimum balance; the counter measures observations, not distinct failures.
Ledger accounting guards gain stable codes and reasons, surfaced by the shared error logger through wrapped and joined errors. Diagnostic traversal is bounded.
Introduce
models.Errorwith the existing structured-error capabilities while keepingmodels.ValidationIssuea distinct type. Both share the implementation and preserve cause traversal and identity through context enrichment. Billing propagates structured system failures instead of storing them as validation issues, even when their cause is a validation issue.Validation on the rebased stack: model, logging, HTTP, billing classification, PostgreSQL-backed ledger, and invoice error-propagation tests plus scoped Go lint passed.
Stack: #5252 → #5270 → #5294 → #5304. Depends on #5294.
Summary by CodeRabbit
New Features
Improvements
Documentation


Confidence Score: 5/5
This PR appears safe to merge; no new actionable issues remain.Summary
Adds ledger error codes and reasons, includes them in shared error logs, and counts each observed negative FBO source balance.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Ledger guard fails] --> B[models.Error with code and reason] B --> C[Shared error logger] C --> D[Log codes and reasons] B --> E{Explicit validation conversion?} E -->|No| F[Return operation failure] E -->|Yes| G[Create billing validation issue]Reviews (5) · Last reviewed commit: "refactor(ledger): name diagnostic error ..." · Reviewed by Greptile