Skip to content

fix(web): reveal invalid group settings on save - #8035

Closed
mameikagou wants to merge 1 commit into
QuantumNous:mainfrom
mameikagou:fix/group-validation-feedback
Closed

mameikagou wants to merge 1 commit into
QuantumNous:mainfrom
mameikagou:fix/group-validation-feedback

Conversation

@mameikagou

@mameikagou mameikagou commented Oct 26, 2026 •

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d6e3d5f-e7c3-4f47-ae8b-230997769e46
Commits

Reviewing files that changed from the base of the PR and between 34003e9 and f7f96fa.

Files selected for processing: 2
  • web/src/features/system-settings/models/__tests__/group-settings.test.tsx
  • web/src/features/system-settings/models/group-ratio-form.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The group settings form now routes validation failures to an editor. Tests verify that invalid JSON blocks saving, identifies the invalid field, and permits saving after correction.

Changes

Group settings validation

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: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: revealing invalid group settings when saving fails validation.
Linked Issues check Passed Issue #8034 requires either successful saving or visible feedback when validation blocks saving. The change adds the non-silent path: onInvalid switches non-MaxTokenAutoGroups errors to JSON mode,…
Out of Scope Changes check Passed 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 sup…
Full details: Linked Issues check

Explanation

Issue #8034 requires either successful saving or visible feedback when validation blocks saving. The change adds the non-silent path: onInvalid switches non-MaxTokenAutoGroups errors to JSON mode, so the shared form can reveal and focus the invalid field. The added parameterized test covers AutoGroups and five other JSON fields, checks the error and focus, confirms that saving is blocked, and confirms saving after correction. Closed issues #7452 and #5986 provide 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 #8034 and 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.

❤️ Share

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.

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.

分组定价页保存静默失败:AutoGroups 值为 <nil> 时表单永久 invalid,onInvalid 只处理 MaxTokenAutoGroups

2 participants