Repository navigation
fix(web): reveal invalid group settings on save - #8035
mameikagou wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Validation feedback and correction web/src/features/system-settings/models/group-ratio-form.tsx, web/src/features/system-settings/models/__tests__/group-settings.test.tsx |
The form switches to JSON mode when a validation error is not on MaxTokenAutoGroups. Tests validate JSON-backed settings, check that invalid values block saving and focus the field, and confirm that correcting the values allows saving. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
- 分组定价页保存静默失败:AutoGroups 值非法时 onInvalid 只处理 MaxTokenAutoGroups #8033 — Describes a group-pricing validation gap for invalid JSON fields. This change routes those errors to JSON mode and focuses the invalid field.
Suggested reviewers: calcium-ion
Merge Risk: 
Minimal · up to f7f96
-
The change exposes invalid JSON settings so users can correct them before saving. No actionable merge-blocking risk is established by the supplied evidence.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue
#8034requires either successful saving or visible feedback when validation blocks saving. The change adds the non-silent path:onInvalidswitches non-MaxTokenAutoGroupserrors to JSON mode, so the shared form can reveal and focus the invalid field. The added parameterized test coversAutoGroupsand five other JSON fields, checks the error and focus, confirms that saving is blocked, and confirms saving after correction. Closed issues#7452and#5986provide context only.
Full details: Out of Scope Changes check
-
Explanation
The production diff changes only the invalid-submit handling in
group-ratio-form.tsx. The test changes cover the same validation behavior and reformat existing test calls. These changes directly support issue#8034and do not modify unrelated settings, persistence, billing logic, or configuration rewriting.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit taps Save with a hop,
Invalid JSON says, “Please stop.”
The right editor comes into view,
A corrected value makes it through.
Then off goes the bunny, pleased with the flow.
Comment @coderabbitai help to get the list of available commands.
Fixes #8034.
When a JSON-backed group setting is invalid, saving now opens the JSON editor so the existing form can display the validation error and focus the affected field. Correcting the value allows saving. The existing numeric-limit error handling is preserved.
Validation: reproduced the hidden-field failure before the change. All 19 related form/editor tests passed afterward, covering six JSON fields, error visibility, focus, correction and saving. Type checking, lint, formatting and the production build also passed.
The interaction tests ran on Linux with the actual React form, validation schema and editor. A live Windows/Edge instance and backend persistence were not tested.