Skip to content

fix(cli): classify errored provider purchase results as failures #1900

Description

@cristim

Problem

The CLI purchase path classifies a provider result using only PurchaseResult.Success.

If a provider returns PurchaseResult{Success: true, Error: nonNil}, purchaseSingleRec records audit status success and prints the success diagnostic even though the result contains a provider error. The MCP path had the same inconsistency and is being corrected in PR #1889.

Relevant current code:

  • cmd/multi_service.go: purchaseSingleRec selects status and diagnostics from result.Success only.
  • cmd/multi_service_helpers.go: executePurchase preserves a provider-returned result when the separate Go error is nil, including a non-nil result.Error.

Expected

CLI audit status and diagnostics should treat a purchase as successful only when result.Success is true and result.Error is nil. Returned provider data should remain compatible unless a separate API decision is made.

Acceptance criteria

  • Add a regression using a provider result with Success=true and a non-nil Error.
  • Require audit status error and a failure diagnostic for that result.
  • Preserve existing behavior for ordinary success, Success=false, and a separate Go error.
  • Verify the real purchaseSingleRec path, not only a helper predicate.

Found during adversarial review of PR #1889. This is intentionally separate because #1889 is scoped to MCP purchase auditing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions