Skip to content

fix(BatteryCreation) : yup error messages issues#1131

Merged
dbraquart merged 4 commits into
mainfrom
dbraquart/fix-battery-creation-form
May 13, 2026
Merged

fix(BatteryCreation) : yup error messages issues#1131
dbraquart merged 4 commits into
mainfrom
dbraquart/fix-battery-creation-form

Conversation

@dbraquart
Copy link
Copy Markdown
Contributor

PR Summary

2 issues:

  • one missing translation
  • one missing explicit yup control on numbers

dbraquart added 2 commits May 13, 2026 11:58
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b241fd84-6887-40e7-97ce-1014b035f407

📥 Commits

Reviewing files that changed from the base of the PR and between 835be8b and 973dbbc.

📒 Files selected for processing (1)
  • src/components/network-modifications/common/setpoints/setPoints.utils.ts

📝 Walkthrough

Walkthrough

Six form validation schemas across network modification modules are updated to apply consistent type error handling for numeric fields. Each imports YUP_NOT_TYPE_NUMBER and adds .typeError(YUP_NOT_TYPE_NUMBER) to relevant numeric field definitions. Additionally, one schema replaces a hardcoded required message with the YUP_REQUIRED constant.

Changes

Numeric field type error validation consistency

Layer / File(s) Summary
Battery creation active power validation
src/components/network-modifications/battery/creation/batteryCreation.utils.ts
MAXIMUM_ACTIVE_POWER and MINIMUM_ACTIVE_POWER fields import and apply YUP_NOT_TYPE_NUMBER type error handling to their Yup schemas.
Active power control DROOP validation
src/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.ts
DROOP field imports and applies YUP_NOT_TYPE_NUMBER type error handling to the Yup schema.
Reactive limits and capability validation
src/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.ts, src/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.ts
MINIMUM_REACTIVE_POWER and MAXIMUM_REACTIVE_POWER fields add type error handling; MAX_Q and MIN_Q fields in the reactive capability curve schema also add type error handling.
Short circuit reactance validation
src/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.ts
TRANSFORMER_REACTANCE and TRANSIENT_REACTANCE fields now source the number helper from local utils and apply YUP_NOT_TYPE_NUMBER type error handling.
Set points required field constant
src/components/network-modifications/common/setpoints/setPoints.utils.ts
ACTIVE_POWER_SET_POINT field replaces hardcoded 'FieldIsRequired' with the YUP_REQUIRED constant in the .nonNullable() constraint.

Suggested reviewers

  • TheMaskedTurtle
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(BatteryCreation) : yup error messages issues' accurately summarizes the main change—fixing Yup error message handling in battery creation and related forms by adding explicit type error validation.
Description check ✅ Passed The description is related to the changeset, identifying the two main issues being addressed: a missing translation and missing explicit yup control on numbers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/translations/fr/networkModificationsFr.ts (1)

213-213: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Verify whether both FieldIsRequired and YUP_REQUIRED are needed.

The new FieldIsRequired key has the same message as the existing YUP_REQUIRED key on line 136. This duplication could lead to maintenance issues if the message needs updating in the future.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/translations/fr/networkModificationsFr.ts` at line 213, There’s a
duplicate French message defined under FieldIsRequired that matches the existing
YUP_REQUIRED; decide on a single canonical key (prefer reusing YUP_REQUIRED) and
remove the duplicate string: either delete the FieldIsRequired entry and update
any code or components that reference FieldIsRequired to use YUP_REQUIRED, or
keep FieldIsRequired but set it as an alias (assign it the value of
YUP_REQUIRED) and update usages accordingly; ensure you update all references to
the chosen key (FieldIsRequired or YUP_REQUIRED) so no lookup breaks and adjust
any translation tests or snapshots that expect the removed key.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/translations/en/networkModificationsEn.ts`:
- Line 210: Remove the duplicate "FieldIsRequired" translation key and
consolidate all usages to the existing "YUP_REQUIRED" key; specifically, delete
the FieldIsRequired entry from the translations object and update the ~7 places
where the literal "FieldIsRequired" string or translation key is referenced to
instead reference YUP_REQUIRED (or translations.YUP_REQUIRED) so schemas and UI
use the single constant YUP_REQUIRED already imported across the codebase;
ensure imports/exports remain correct after removing FieldIsRequired and run
tests/lint to catch any leftover references.

---

Duplicate comments:
In `@src/translations/fr/networkModificationsFr.ts`:
- Line 213: There’s a duplicate French message defined under FieldIsRequired
that matches the existing YUP_REQUIRED; decide on a single canonical key (prefer
reusing YUP_REQUIRED) and remove the duplicate string: either delete the
FieldIsRequired entry and update any code or components that reference
FieldIsRequired to use YUP_REQUIRED, or keep FieldIsRequired but set it as an
alias (assign it the value of YUP_REQUIRED) and update usages accordingly;
ensure you update all references to the chosen key (FieldIsRequired or
YUP_REQUIRED) so no lookup breaks and adjust any translation tests or snapshots
that expect the removed key.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ada26bd0-cc18-46a0-9ec0-a52f7f83e2cc

📥 Commits

Reviewing files that changed from the base of the PR and between 549105e and 835be8b.

📒 Files selected for processing (7)
  • src/components/network-modifications/battery/creation/batteryCreation.utils.ts
  • src/components/network-modifications/common/activePowerControl/activePowerControlForm.utils.ts
  • src/components/network-modifications/common/reactiveLimits/reactiveCapabilityCurve/reactiveCapability.utils.ts
  • src/components/network-modifications/common/reactiveLimits/reactiveLimits.utils.ts
  • src/components/network-modifications/common/shortCircuit/shortCircuitForm.utils.ts
  • src/translations/en/networkModificationsEn.ts
  • src/translations/fr/networkModificationsFr.ts

Comment thread src/translations/en/networkModificationsEn.ts Outdated
@dbraquart dbraquart requested a review from TheMaskedTurtle May 13, 2026 12:49
@sonarqubecloud
Copy link
Copy Markdown

@dbraquart dbraquart merged commit 50f0a17 into main May 13, 2026
6 checks passed
@dbraquart dbraquart deleted the dbraquart/fix-battery-creation-form branch May 13, 2026 12:53
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.

2 participants