Repository navigation
fix(prompts): surface savePromptSet failures instead of the masked digest error - #536
Merged
Merged
Conversation
…e real message
Errors thrown from a server action are masked in production (digest-only),
so a PlanLimitError from the onboarding prompt-review step surfaced as the
meaningless "Server Components render" toast and the save silently failed.
- savePromptSet now returns { promptSet } | { error } (same pattern as
addPromptToBrand, #427); plan-limit, empty-selection and DB failures come
back as values and are toasted verbatim.
- The prompt cap is checked explicitly and inclusively: saving exactly
maxPrompts passes, and the error spells out how many prompts to remove.
- Call sites (onboarding, brand setup wizard, brand prompts page) handle the
error value and stop instead of advancing.
The review step should never surface a technical toast. The wizards now fetch the org's effective prompt capacity (getPromptCapacity) when the step opens, show 'X prompts total - up to N included in your plan', and disable Continue with an inline amber hint while over the cap. Save failures render inline too: the plan-limit message verbatim (actionable), everything else as a friendly retry line — never a raw error message.
The wizard runs before any plan is picked, so advertising a cap there is confusing; the inline over-limit hint still appears when it matters.
This was referenced Jul 28, 2026
4 tasks done
gkhngyk
pushed a commit
that referenced
this pull request
Jul 31, 2026
…566) * fix(web): return invite/accept errors as values instead of throwing inviteMember and acceptInvitation threw on common, user-reachable failures (duplicate invite, wrong account, expired token, etc.). In production a thrown server action surfaces as the masked digest string, hiding the actionable message. Both now return `{ error }` and the call sites branch on it, following the pattern from #536. Closes #550 * style: apply prettier formatting to team.ts
7 tasks done
gkhngyk
added a commit
that referenced
this pull request
Aug 3, 2026
#580) Production masks errors thrown from server actions, so plan-limit and validation failures from addPromptToSet reached users as the meaningless digest toast (#427 pattern). Convert it to the same { prompt } | { error, code? } shape savePromptSet adopted in #536: - addPromptToSet returns { prompt } | { error, code?: 'plan_limit' }; PlanLimitError from enforceLimit maps to code 'plan_limit' - addPromptToBrand and trackFanoutQuery drop their try/catch wrappers and forward the error value - acceptSuggestion keeps its existing throwing contract, adapted to the new shape - brand Prompts page (bulk suggestion save + manual add) shows the real message via toast; the bulk path also refreshes the list on partial failure so saved prompts appear Closes #547
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
A new user got stuck on the onboarding prompt-review step: pressing Continue showed the production-masked toast
An error occurred in the Server Components render…and the prompts were never saved. Supabase API logs show the request chain stopping right at the prompt-limit check —enforceLimitthrewPlanLimitError, and since errors thrown from server actions are masked in production, the user never saw the real reason (over the plan's prompt cap after adding their own prompts on top of the generated ones).Two layers of fix:
Server action (
savePromptSet){ promptSet } | { error, code? }instead of throwing for user-facing failures (plan limit, empty platform/model selection, DB errors) — same pattern asaddPromptToBrand(Query fan-out: long hang then production-masked server error surfaced raw in the UI #427). Plan-limit failures carrycode: 'plan_limit'.maxPrompts(e.g. 50 on Starter) passes; only totals above the cap are rejected.getOrgPlanround-trip.getPromptCapacity(brandId)action exposes{ maxPrompts, used }(used = prompts on the org's other brands, since a save replaces the brand's own set).Review step UX (onboarding + brand setup wizard) — no error toasts at all
X prompts total · up to N included in your plan.Related issue
Follow-up to #427 (same masking bug, different action).
Type of change
fix— Bug fixHow to test
51 prompts total · up to 50 included in your plan, an inline hint says to remove 1, and Continue is disabled — no toast anywhere.Checklist
feature/,fix/,chore/,docs/)yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)