fix(purchase): preserve nullable cost with updated library pin - #34
Conversation
Pin all four library modules to ce9513612901 and pass the provider's upfront cost pointer through unchanged. Preserve known zero values and omit unknown amounts in MCP output. Verify nil, zero, and positive costs through the MCP protocol with a fake provider. The old zero-dropping conversion fails the zero case.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: LeanerCloud/cloud-commitments-mcp/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughThe PR updates the ChangesPurchase cost handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Unknown costs can be omitted while known zero and positive costs remain available. No actionable merge risk is identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
MCP #33 independent final-SHA reviewVerdict: MERGE once required CI is green, reviewed SHA Reviewer: gpt-6-astra, session-authorized substitute. This is not an Opus review. No actionable findings in two independent diff passes or staged review; 0 Major, Minor, or Info. Scope matches the approved five-file plan and live issue #33. Comment updates are adjacent and factual. The direct pointer assignment preserves provider-known zero without changing preview, purchase gates, idempotency, or error behavior. Independent clone:
All Go runs used Attacks checked: unknown vs zero vs positive cost, count multiplication (request count 3), omitted unpriced financial fields, schema/tool registration, test assertion sensitivity, provider-call count, unsafe production expansion and dependency drift. Four modules all resolve to target ce951361290141aa53b528dfce862fbc22a1d01b. Evidence boundary: real MCP protocol and JSON serialization with a fake cloud provider, not a real AWS purchase or live cloud-price verification. No purchases, deployments, or GitHub mutations performed by reviewer. Any new commit invalidates this SHA-specific verdict. |
Summary
Pin all four cloud-commitments-go modules to
ce951361290141aa53b528dfce862fbc22a1d01band preserve the provider's nullable upfront cost in MCP output. Unknown costs remain omitted, known zero is returned as0, and positive totals pass through unchanged.Root cause and fix
The library changed
PurchaseResult.Costfromfloat64to*float64. The old scalar conversion prevented a re-pin from compiling and would discard known zero if retained through dereferencing. The execute response now receives the provider pointer directly. Preview cost handling is unchanged.Regression proof
A registered MCP tool is exercised through an in-memory client/server connection for nil, zero, and positive costs, using a fake provider boundary. Assertions cover serialized cost presence and numeric value with a count of three. No real cloud purchase was performed.
nonZeroCostPtr(result.Cost).costdisappears.Verification
Go 1.26.6,
GOWORK=off; all commands passed:go test -race -short ./...go vet ./...,go build ./...,make buildgo mod verify,go mod tidy -diffrun --timeout=10m --allow-serial-runners(0 issues)Independent review and protocol mutation proof use the available GPT-6 Astra, explicitly authorized for this session. This is not an Opus review. The final reviewed commit is
5f3a3f4cf00967da8a007f132c5f74a1f39acab4; required GitHub checks still gate merge. CodeRabbit review was waived by the user for this session.Issue labels are mirrored. Issue #33 does not carry
triaged; this PR does not add that marker.Closes #33
Summary by CodeRabbit