Repository navigation
fix(api): summarize provider errors on RI exchange, marketplace, refund and collection paths - #1739
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit details
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. |
|
Cold review: CHANGES REQUESTED at 2432830 (base main ecb118e). Small round: one test gap is required, one allowlist tightening is should-fix. The leak bar is met on every path I probed. Required: refresh return sites are untested (the PR body's "each revert fails a test" doesn't hold here)Mutation M5 reverted both Should-fix: the optional
|
|
CHANGES REQUESTED at 2432830 by claude-darling (cold review) No raw provider or DB text leaks on the paths this PR touches. I probed five error shapes through the real entry points: a wrapped All new and changed tests fail on base ecb118e (test files applied alone, with two small arity/const shims) and pass on head. It is blocked because the read-time filter replaces legitimate server-written notes with a provider-blaming message. Blocking
Non-blocking
Not merging. |
|
Fix round for as-qa-2's and claude-darling's reviews at
Tests. The new tests fail on the previous code and pass now. Local, macOS: |
|
Delta re-review: CHANGES REQUESTED at 2d49f98 (4 fast-forward commits on 2432830). This covers my two items; darling has the resolve-note and collection-note items. My round-1 findings are fixed, and the leak bar is met. One over-sanitizing regression remains, and it is required. Required: server notes behind Savings Plan and other real resource-type heads are now hiddenThe executor writes every per-rec failure as Probe through
So a Savings Plan purchase refused by, for example, the commitment cap, missing email setup or stale pricing now tells the user "the provider returned an error" instead of what to fix. Suggested fix, keeping heads closed:
None of these shapes admits an account number, IPv4 address, Fixed, verified
Leak bar, re-runThe round-1 probe in package The only remaining hits are the deferred For darling's area, one observation and no finding: the resolve note's Exact-head gate (Go 1.26.10)
|
|
CHANGES REQUESTED at 2d49f98 by claude-darling (delta review) Fixed and verified
Blocking B3.
Fix: widen the alphabet to cover these shapes. Keep a letter first and keep host-like shapes out: no dotted all-numeric parts, and no Non-blocking
Not merging. |
|
Round 3 for the reviews at
|
|
Delta re-review round 3: APPROVE at 5344d0c (one commit on 2d49f98). My items are resolved: the leak bar holds, and the over-sanitizing regression is fixed. Over-sanitizing, re-probed
That makes 93 of 95 probe rows as expected. The collection-stopped notes pass, and Leak bar, re-probed
Mutants at this head (all killed)
Nit, non-blockingThe unprefixed-Azure alternative Exact-head gate (Go 1.26.10)
|
|
APPROVED 5344d0c by claude-darling Round 3 delta review. B3 fixed.
N7 fixed. Leak bar holds against the wider alphabet.
Tests.
Non-blocking, follow-up candidates. N8. The commit message overstates "every real resource type". Some cloud-commitments-go N9. Some widened tails accept short host-like tokens as a head:
This is theoretical today, because the only head writer is Deferred per the coordinator: the shortValuePattern nit, and N2-N5 from round 1. Not merging. |
Client-fault rejections on the AWS and Azure exchange endpoints now return a fixed provider-neutral message, and a failed approval returns a category message instead of the provider's text. The provider error goes to the log. The exchange history response passes stored record errors through the known-note allowlist, so rows written before this change are summarized on read without rewriting them. The allowlist gains the exchange-side notes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Marketplace listing and cancel errors, Azure refund and revoke rejections, and the session-approve scheduling failure now return a category message plus a purchase or execution reference. The provider or store error is logged once and no longer echoed in the response. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A failed provider is now stored in last_collection_error and the collect result as "<provider>: <category message>"; the provider's own error is logged only. The freshness and refresh responses pass the stored value through the known-note allowlist, so rows written before this change are summarized on read without rewriting them. Closes #1702 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Satisfies the prealloc linter on the helper added with the exchange notes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pin the variable parts of the RI exchange cap, reserved ceiling and unknown provider notes to a decimal amount or a short token with no whitespace or quotes. A value outside that alphabet now shows only the fixed head of the note instead of the whole note, and newlines never pass through. Add tests for each tailed note. Refs #1721 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The marked-collection re-read returns the stored freshness to the refresh handler. Pin that a stored raw provider error comes back as a category message on both the async-invoke and the synchronous branch. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… notes The optional "<token>: " head ahead of a stored note accepted any token. Per-rec notes now take only an instance, node or plan type shape (AWS, Azure, GCP), collection category notes also aws|azure|gcp, and the RI exchange notes take no head. Account numbers, addresses, hosts and user names in that slot fall back to the category message. Refs #1721 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The note an operator's resolve call stores is server-formatted fields plus the admin's own quoted reason. The stored-error filter replaced it with the provider category message. Allow that fixed shape, and nothing after it. Refs #1721 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A failed rows write stored the store error text as the collection error. Store a fixed note instead and log the cause, and allow the three collection-stopped notes on the read path so they show as written. Refs #1721 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The narrowed per-rec head rejected real resource types the executor writes,
so allowlisted notes behind them rendered as the generic category message.
Accept the Savings Plan types (Compute, EC2Instance, SageMaker, Database),
db.serverless, u-/mac2-/ultrawarm families, metal-Nxl sizes, Azure SQL SKUs and
unprefixed VM sizes, and GCP custom and suffixed machine types. Heads stay
closed: account numbers, IPs, hosts, DB users and ARNs still fail.
Also close the exchange_id slot of the operator resolve note to the writer's
[A-Za-z0-9-]{1,100} shape.
Refs #1721
The cfn-lint pre-commit hook was skipped (SKIP=cfn-lint): its pinned
cfn-lint cannot install under the local Python, and this commit touches
no CloudFormation files. Every other hook ran and passed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
5344d0c to
45438f2
Compare
|
Rebase only. The branch went CONFLICTING after #1742 landed, so it is rebased onto main
@as-qa-2 and claude-darling: please confirm your APPROVE at the new head (rebase delta). |
|
APPROVED 45438f2 by claude-darling This is a rebase delta of my approved 5344d0c onto main fca8c44.
Not merging. |
|
Rebase delta: APPROVE at 45438f2 (rebase of the approved 5344d0c onto main fca8c44).
My round-3 approval (probes, mutants, gate) carries over, since the PR's own code is byte-identical. |
|
Local verification at
|
The cancel-failure integration test asserted the raw provider text in the response. The response now carries the summary and a purchase reference, and the provider text stays in the server log. Refs #1702 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test-only fix. New head: @as-qa-2 and claude-darling: please confirm at the new head (test-only delta). |
|
Integration suites at |
|
Test-only delta: APPROVE at 80f2959 (one commit on 45438f2).
My earlier approvals (round 3 and the rebase) carry over: the PR's non-test code is unchanged since 45438f2. |
|
APPROVED 80f2959 by claude-darling Test-only delta on 45438f2.
Not merging. |
Summary
This applies the #1688 / #1712 rule to the remaining provider-facing paths. Users get a fixed category message and a reference, the full provider error goes to the server log only, and rows already stored are sanitized on read, so stored data is never rewritten. It reuses
purchase.SummarizeProviderError,SanitizeStoredErrorand the closed server-note allowlist from #1712. A new sharedpurchase.SummarizeFailureadds the readable text of known server notes.mapAWSExchangeErrorandmapAzureExchangeErrorreturn a fixed rejection message and log the raw error.executeApprovedExchangeno longer stores or returns the rawexecErras the reason.getRIExchangeHistorysanitizes each record's error on read.mapAWSMarketplaceErrorreturns a category message on 400 andopMsg: <category message>on 502, logging the raw error once. The cancel rollback detail uses the category text plus(reference: purchase <id>).%vsites go through oneazureRefundRejectedhelper, with the purchase ID as the reference.failed to schedule execution (reference: execution <id>).persistCollectionstores<provider>: <category message>per failed provider, feeding bothlast_collection_errorandCollectResult.FailedProviders.Tests
TestSanitizeStoredError_ExchangeNoteTailsAreClosedcovers newline, embedded database error and multi-word values in each tailed slot.go build ./...,go test ./internal/api ./internal/purchase ./internal/scheduler,go vet ./internal/...and golangci-lint (0 issues) all pass.Not changed
ri_exchange_audit.gokeeps the raw provider text inri_exchange_direct_executionsas an audit record. No API returns that table. The broad slots that #1712 already left on main are tracked in #1721.Closes #1702
Refs #1688, #1721
🤖 Generated with Claude Code