Repository navigation
fix(config): map invalid ladder amendments to ErrLadderAmendInvalid - #694
Merged
Merged
Conversation
- AmendLadderTranche returned the plain Validate() error, so callers other than the HTTP handler could not tell a bad amendment from a server fault. The error now matches ErrLadderAmendInvalid via errors.Is while keeping the specific validation message (the sentinel text is about the run total and cap, which would mislead). - Unit test covers the mapping without a database and fails without it. Refs #668
Contributor
Member
Author
|
Independent review (ladder-graph-kimi, Claude Sonnet 5.5; full-diff pass by me, not a model-pinned Opus run) at head 710f0fb. Verdict: no actionable findings. Approve at this SHA, conditional on CI green.
Writer's declined items on #668: agree.
Limits: unit level only, no DB or API run; I did not run CI-dependent checks (CI was still pending at my check). Any new commit restarts the gate. |
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
Part of #668 (follow-ups from PR #665):
AmendLadderTranchereturned the plainValidate()error, so non-handler callers could not tell an invalid amendment from a server fault. It now returns an error that matchesErrLadderAmendInvalidviaerrors.Isand keeps the specific validation message. A new unexportedladderAmendValidationErrorcarries both, because the sentinel's own text is about the run total and per-run cap, which would mislead for "amount must be a positive decimal".The HTTP handler already validates before calling the store, so API behavior is unchanged.
Not in this PR, with reasons (also on #668)
FOR UPDATE OF ctoFOR NO KEY UPDATE: not done. The run INSERT takesFOR KEY SHAREon the config row, whichFOR NO KEY UPDATEdoes not block, so amend and a run save would stop serializing on the config. The review of PR 670 relied on that serialization. Needs a reviewer-proved ordering analysis first.ON DELETE RESTRICTonladder_tranche_amendments.tranche_id: it is already the default, and editing the merged migration 000107 is not an option; a no-op follow-up migration is not worth it on its own.completeTimeline: separate, larger designs (single pass or snapshot read), left for their own PR.What is verified
Run locally (macOS):
go vet ./internal/config, gofmt clean,go test ./internal/config -run 'AmendLadderTranche_Invalid|LadderAmendmentValidation'pass. The new test fails when the wrapping is removed (mutant run). Unit level only: no database, no handler run.What is not proven
No integration or API test run locally for this change (only the store's pre-database validation path is touched). No deployed check. CI does the full run. Independent review at the head SHA is pending.
Refs #668
Summary by CodeRabbit