Skip to content

Review follow-ups for #77: hint after the error, exact refusal phrases - #81

Merged
rahuldotiyer merged 1 commit into
credit-limit-hintsfrom
credit-limit-hints-review
Nov 26, 2026
Merged

rahuldotiyer merged 1 commit into
credit-limit-hintsfrom
credit-limit-hints-review

Conversation

@rahuldotiyer

Copy link
Copy Markdown
Contributor

Follow-ups to @norbertdurcansk's review of #77. They go through this PR because the repo's default ruleset refuses direct pushes to any existing branch, #77's included. It targets #77's branch, so merging it puts these changes into #77.

  • The plan hint now prints once, after the last copy of the error. Before, it sat between fang's error box and the plain error line that root.go prints. The WithErrorHandler wrapper is gone.
  • "Update your payment details" now needs a 402 as well as "unpaid", so a query error naming a column such as unpaid_balance gets no hint.
  • The credit phrases are now the exact wording of the merged MCP refusals (core#8340) and the query engine's per-query cap. The broad credits limit is gone. The new list also matches the trial message ("used all its credits"), which the old list missed. REST refusals still match on their 402 status.

New test cases: trial, team or organization limit, a 400 naming unpaid_balance, and a SQL error quoting a column named extra credits limit. All four fail against #77's planhint.go and pass here. go test ./cmdutil/ ./cli/ passes. Against a stub API that returns the REST 402, dune query run prints the error box, then the plain error, then Credits used this billing period: dune usage. The two links are not repeated because the REST message already contains them.

…rases

The hint printed between fang's error box and the plain error line, so it
now prints after the last one. Unpaid invoices need a 402, so a query error
naming a column such as unpaid_balance gets no hint, and the credit phrases
are the exact wording of the MCP and query engine refusals, which also
covers the trial message the old list missed.

Amp-Thread-ID: https://ampcode.com/threads/T-01a21432-3ab4-74cb-a610-cc642f0dc0ab
Co-authored-by: Amp <amp@ampcode.com>

@norbertdurcansk norbertdurcansk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Checked the two runtime facts this depends on: duneapi's customer middleware returns 402 for unpaid invoices, so the new status gate doesn't hide the payment hint; and the credit phrases match the merged core#8340 refusal wording (free plan, trial, team/org limit, unknown cause). Dropping the bare credits limit phrase loses nothing. Removing the WithErrorHandler wrapper fixes the hint ordering from my #77 review.

@rahuldotiyer
rahuldotiyer merged commit 12afa4c into credit-limit-hints Nov 26, 2026
6 checks passed
rahuldotiyer added a commit that referenced this pull request Nov 26, 2026
* Show how to get past credit, rate and billing limits

When a command fails because of the account's plan, print where to see
usage, upgrade the plan, or change the extra credits limit, leaving out
links the API's message already gives.

Amp-Thread-ID: https://ampcode.com/threads/T-01a21432-3ab4-74cb-a610-cc642f0dc0ab
Co-authored-by: Amp <amp@ampcode.com>

* Print the plan hint once, after the error, and match exact refusal phrases (#81)

The hint printed between fang's error box and the plain error line, so it
now prints after the last one. Unpaid invoices need a 402, so a query error
naming a column such as unpaid_balance gets no hint, and the credit phrases
are the exact wording of the MCP and query engine refusals, which also
covers the trial message the old list missed.

Amp-Thread-ID: https://ampcode.com/threads/T-01a21432-3ab4-74cb-a610-cc642f0dc0ab

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants