Skip to content

chore: remove dead legacy error-string mappings in form-error.ts - #37

Open
detail-app[bot] wants to merge 1 commit into
devfrom
detail/dead-code/chore-remove-dead-legacy-error-string-mappings-in-4ba48c
Open

detail-app[bot] wants to merge 1 commit into
devfrom
detail/dead-code/chore-remove-dead-legacy-error-string-mappings-in-4ba48c

Conversation

@detail-app

@detail-app detail-app Bot commented Sep 15, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Removes 22 lines of dead code from packages/console/app/src/lib/form-error.ts:

  1. Sixteen string-literal entries in the map object (e.g. "Invalid plan", "Workspace ID is required", "Email is required", "Model is required") that mapped pre-i18n raw error strings to i18n keys. No code in the monorepo produces any of these raw strings anymore — they were superseded by formError.* keys during the i18n migration, so the lookups were unreachable.
  2. Two regex branches in localizeError matching /^Reload amount must be at least \$(\d+)$/ and /^Balance trigger must be at least \$(\d+)$/. The producers of those strings were replaced by formErrorReloadAmountMin/formErrorReloadTriggerMin (which emit the error.reloadAmountMin:<amount> prefix format handled by the earlier startsWith branches), so the regex branches were unreachable.

The payment-related map entries ("workspace.reload.error.paymentFailed", "Payment failed", "Payment failed.") are kept — billing.ts and stripe/webhook.ts still feed those strings into localizeError via the reloadError DB column.

How did you verify your code works?

  • Ran npx tsgo --noEmit in packages/console/app — passes with no errors.
  • Confirmed via repo-wide grep that no producer of the removed raw strings or regex-matched patterns exists in the monorepo.
  • All live exports (formError, formErrorReloadAmountMin, formErrorReloadTriggerMin, localizeError) are unchanged and still resolve to their 11+ production callers.

Screenshots / recordings

N/A — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

History


Dead Code PRs can be configured here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants