fix(mercury_items): redirect on validation failure instead of rendering missing template - #3137
fix(mercury_items): redirect on validation failure instead of rendering missing template#3137sentry[bot] wants to merge 1 commit into
Conversation
…ng missing template
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c87dde593
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ), status: :unprocessable_entity | ||
| else | ||
| render :new, status: :unprocessable_entity | ||
| redirect_to accounts_path, alert: @error_message, status: :see_other |
There was a problem hiding this comment.
Redirect failed creates back to provider settings
When Turbo is disabled or a client submits without a Turbo-Frame header, a validation failure now sends the user to the accounts index, but the Mercury connection form exists only on the provider settings page. The alert is shown, yet the user is taken away from the form and cannot correct the invalid input without manually navigating back; redirect this failure to settings_providers_path instead.
Useful? React with 👍 / 👎.
|
Reviewed the diff — the One related issue outside this diff: Generated by Claude Code |
jjmata
left a comment
There was a problem hiding this comment.
Daily PR scan review for head 1c87dde5937e5207ec8e6926977384697e329c8d.
CI is green (Pull Request workflow run 32602141692, Pipelock Security Scan 32602141746), but I would not merge this yet.
-
app/controllers/mercury_items_controller.rbnow redirects non-Turbo create failures toaccounts_path. That avoids the missingnewtemplate, but it sends the user away from the Mercury/provider settings flow after a validation failure. Use the provider settings destination instead, such assettings_providers_path, so the alert lands next to the form they need to fix. -
The same missing-template failure class still exists in the update path: invalid non-Turbo PATCH falls through to
render :edit, status: :unprocessable_entity, and there is noapp/views/mercury_items/edit.html.erb. Apply the same redirect pattern there, or explicitly split it into a follow-up if this PR stays narrowly scoped.
|
Automated PR sweep: two issues flagged by Codex/@jjmata on 2026-08-23 remain open — the redirect on validation failure goes to Generated by Claude Code |
This PR addresses SURE-APP-19A by modifying
MercuryItemsController#create.Previously, when a
mercury_itemfailed validation outside of a Turbo Frame request, the controller attempted torender :new, which resulted in anActionView::MissingTemplateerror because noapp/views/mercury_items/new.html.erbtemplate exists.This change replaces
render :new, status: :unprocessable_entitywithredirect_to accounts_path, alert: @error_message, status: :see_otheron line 437. This aligns the error handling for non-Turbo Frame requests with the existing success path (which redirects) and the Turbo Frame error path (which renders a partial, not a full template).Fixes SURE-APP-19A
This PR was automatically generated by Sentry. You can adjust this setting at any time.