chore(TwoWindingsTransformerModification): use form from commons-UI - #953
chore(TwoWindingsTransformerModification): use form from commons-UI#953dbraquart wants to merge 13 commits into
Conversation
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
…ation-form-from-commons-UI # Conflicts: # src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesThe modification dialogs now accept configurable widths. The composite dialog registers two-windings transformer creation and modification with the required forms, converters, identifiers, mode settings, optional-field behavior, and Transformer dialog integration
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1⚔️ Resolve 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx`:
- Around line 100-103: Update the `@gridsuite/commons-ui` dependency to a release
that exports TwoWindingsTransformerForm,
twoWindingsTransformerCreationFormSchema,
twoWindingsTransformerCreationDtoToForm, and
twoWindingsTransformerCreationFormToDto and declares dialogWidth in
CustomMuiDialogProps. Apply this dependency update for the transformer imports
in composite-modification-dialog.tsx and the dialogWidth usage in
ModificationDialog.tsx.
🪄 Autofix
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 Plus
Run ID: 79b05318-86b1-4c2c-bcec-d11b0c47386a
📒 Files selected for processing (2)
src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsxsrc/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx
| TwoWindingsTransformerForm, | ||
| twoWindingsTransformerCreationFormSchema, | ||
| twoWindingsTransformerCreationDtoToForm, | ||
| twoWindingsTransformerCreationFormToDto, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- package manifests and lockfiles ---'
git ls-files | grep -E '(^|/)(package\.json|yarn\.lock|package-lock\.json|pnpm-lock\.yaml|\.yarnrc|\.npmrc)$' || true
printf '%s\n' '--- target files ---'
for f in \
src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx \
src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx
do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
sed -n '80,120p' "$f"
fi
done
printf '%s\n' '--- commons-ui references and API names ---'
rg -n --hidden \
-g '!node_modules' \
-g '!dist' \
-g '!build' \
'(`@gridsuite/commons-ui`|TwoWindingsTransformerForm|twoWindingsTransformerCreationFormSchema|twoWindingsTransformerCreationDtoToForm|twoWindingsTransformerCreationFormToDto|dialogWidth|interface CustomMuiDialogProps|type CustomMuiDialogProps)' \
. | head -300Repository: gridsuite/gridexplore-app
Length of output: 15374
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- package declarations ---'
sed -n '1,55p' package.json
sed -n '1,35p' package-lock.json
sed -n '3318,3340p' package-lock.json
printf '%s\n' '--- local dialog type/import context ---'
sed -n '1,125p' src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx
sed -n '90,135p' src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
printf '%s\n' '--- published commons-ui 0.267.0 metadata ---'
python3 - <<'PY'
import json, urllib.request
url = 'https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0'
with urllib.request.urlopen(url, timeout=20) as response:
data = json.load(response)
print(json.dumps({
'version': data.get('version'),
'dist': data.get('dist'),
'types': data.get('types'),
'files': data.get('files'),
}, indent=2))
PY
printf '%s\n' '--- available published commons-ui versions near 0.267 ---'
python3 - <<'PY'
import json, urllib.request
with urllib.request.urlopen('https://registry.npmjs.org/@gridsuite%2fcommons-ui', timeout=20) as response:
data = json.load(response)
versions = list(data.get('versions', {}))
for v in versions:
if v.startswith('0.26'):
print(v)
PYRepository: gridsuite/gridexplore-app
Length of output: 12564
🏁 Script executed:
#!/bin/bash
set -eu
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
printf '%s\n' '--- npm metadata for `@gridsuite/commons-ui` 0.267.0 ---'
curl -fsSLk 'https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0' \
| tee "$tmpdir/metadata.json" \
| jq '{version, dist, types, main, module, files}'
tarball="$(jq -r '.dist.tarball' "$tmpdir/metadata.json")"
curl -fsSLk "$tarball" -o "$tmpdir/commons-ui.tgz"
mkdir "$tmpdir/pkg"
tar -xzf "$tmpdir/commons-ui.tgz" -C "$tmpdir/pkg"
printf '%s\n' '--- package files related to the disputed APIs ---'
find "$tmpdir/pkg" -type f \( -name '*.d.ts' -o -name '*.js' -o -name '*.json' \) -print0 \
| xargs -0 grep -nE \
'TwoWindingsTransformerForm|twoWindingsTransformerCreation(FormSchema|DtoToForm|FormToDto)|CustomMuiDialogProps|dialogWidth' \
| head -200 || true
printf '%s\n' '--- package entrypoint exports ---'
entry="$(jq -r '.main // .module // .types // empty' "$tmpdir/pkg/package/package.json")"
printf 'entrypoint: %s\n' "$entry"
if [ -n "$entry" ] && [ -f "$tmpdir/pkg/package/$entry" ]; then
grep -nE 'TwoWindingsTransformerForm|twoWindingsTransformerCreation(FormSchema|DtoToForm|FormToDto)|CustomMuiDialogProps' \
"$tmpdir/pkg/package/$entry" || true
fi
printf '%s\n' '--- commons-ui PR `#1291` ---'
curl -fsSLk 'https://api.github.com/repos/gridsuite/commons-ui/pulls/1291' \
| jq '{html_url, state, title, base: .base.ref, head: .head.ref, merge_commit_sha, merged_at}' || trueRepository: gridsuite/gridexplore-app
Length of output: 447
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
import io
import json
import ssl
import tarfile
import urllib.request
ctx = ssl._create_unverified_context()
def get(url):
req = urllib.request.Request(url, headers={'User-Agent': 'review-contract-check'})
with urllib.request.urlopen(req, context=ctx, timeout=30) as r:
return r.read()
metadata = json.loads(get('https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0'))
print('--- npm metadata ---')
print(json.dumps({
'version': metadata.get('version'),
'dist': metadata.get('dist'),
'types': metadata.get('types'),
'main': metadata.get('main'),
'module': metadata.get('module'),
}, indent=2))
tarball = get(metadata['dist']['tarball'])
with tarfile.open(fileobj=io.BytesIO(tarball), mode='r:gz') as archive:
print('--- matching package contents ---')
matches = []
for member in archive.getmembers():
if member.isfile() and member.name.endswith(('.d.ts', '.js', '.json')):
content = archive.extractfile(member).read().decode('utf-8', errors='replace')
if any(token in content for token in (
'TwoWindingsTransformerForm',
'twoWindingsTransformerCreationFormSchema',
'twoWindingsTransformerCreationDtoToForm',
'twoWindingsTransformerCreationFormToDto',
'CustomMuiDialogProps',
'dialogWidth',
)):
matches.append((member.name, content))
for name, content in matches:
print(f'--- {name} ---')
for i, line in enumerate(content.splitlines(), 1):
if any(token in line for token in (
'TwoWindingsTransformerForm',
'twoWindingsTransformerCreationFormSchema',
'twoWindingsTransformerCreationDtoToForm',
'twoWindingsTransformerCreationFormToDto',
'CustomMuiDialogProps',
'dialogWidth',
)):
print(f'{i}:{line}')
print('--- commons-ui PR `#1291` ---')
try:
pr = json.loads(get('https://api.github.com/repos/gridsuite/commons-ui/pulls/1291'))
print(json.dumps({
'html_url': pr.get('html_url'),
'state': pr.get('state'),
'title': pr.get('title'),
'base': (pr.get('base') or {}).get('ref'),
'head': (pr.get('head') or {}).get('ref'),
'merge_commit_sha': pr.get('merge_commit_sha'),
'merged_at': pr.get('merged_at'),
}, indent=2))
except Exception as e:
print(f'GitHub query failed: {e}')
PYRepository: gridsuite/gridexplore-app
Length of output: 1980
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
import io
import json
import ssl
import tarfile
import urllib.request
ctx = ssl._create_unverified_context()
def get(url):
req = urllib.request.Request(url, headers={'User-Agent': 'review-contract-check'})
with urllib.request.urlopen(req, context=ctx, timeout=30) as r:
return r.read()
def package_files(version):
metadata = json.loads(get(f'https://registry.npmjs.org/@gridsuite%2fcommons-ui/{version}'))
archive = tarfile.open(fileobj=io.BytesIO(get(metadata['dist']['tarball'])), mode='r:gz')
files = {}
for member in archive.getmembers():
if member.isfile() and member.name.endswith(('.d.ts', '.js')):
files[member.name] = archive.extractfile(member).read().decode('utf-8', errors='replace')
return metadata, files
metadata, files = package_files('0.267.0')
print('--- CustomMuiDialogProps declaration ---')
for name, content in files.items():
if name.endswith('CustomMuiDialog.d.ts'):
print(name)
print('\n'.join(f'{i}:{line}' for i, line in enumerate(content.splitlines(), 1)))
break
print('--- package entrypoint references ---')
for name, content in files.items():
if name.endswith('/index.d.ts') and ('dist/index.d.ts' in name or name == 'package/dist/index.d.ts'):
for i, line in enumerate(content.splitlines(), 1):
if any(x in line for x in (
'TwoWindingsTransformerForm',
'twoWindingsTransformerCreation',
'CustomMuiDialog',
)):
print(f'{name}:{i}:{line}')
print('--- versions containing all requested symbols ---')
registry = json.loads(get('https://registry.npmjs.org/@gridsuite%2fcommons-ui'))
versions = list(registry.get('versions', {}))
candidates = []
for version in versions:
try:
_, candidate_files = package_files(version)
except Exception:
continue
text = '\n'.join(candidate_files.values())
required = [
'TwoWindingsTransformerForm',
'twoWindingsTransformerCreationFormSchema',
'twoWindingsTransformerCreationDtoToForm',
'twoWindingsTransformerCreationFormToDto',
'dialogWidth',
]
if all(symbol in text for symbol in required):
candidates.append(version)
print(candidates[-20:])
PYRepository: gridsuite/gridexplore-app
Length of output: 155
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
import io
import json
import ssl
import tarfile
import urllib.request
ctx = ssl._create_unverified_context()
def get(url):
req = urllib.request.Request(url, headers={'User-Agent': 'review-contract-check'})
with urllib.request.urlopen(req, context=ctx, timeout=30) as r:
return r.read()
metadata = json.loads(get('https://registry.npmjs.org/@gridsuite%2fcommons-ui/0.267.0'))
archive = tarfile.open(fileobj=io.BytesIO(get(metadata['dist']['tarball'])), mode='r:gz')
needles = (
'TwoWindingsTransformerForm',
'twoWindingsTransformerCreationFormSchema',
'twoWindingsTransformerCreationDtoToForm',
'twoWindingsTransformerCreationFormToDto',
'CustomMuiDialogProps',
'dialogWidth',
)
for member in archive.getmembers():
if member.isfile() and member.name.endswith('.d.ts'):
content = archive.extractfile(member).read().decode('utf-8', errors='replace')
if member.name.endswith('CustomMuiDialog.d.ts') or member.name.endswith('dist/index.d.ts'):
print(f'--- {member.name} ---')
for i, line in enumerate(content.splitlines(), 1):
if member.name.endswith('CustomMuiDialog.d.ts') or any(n in line for n in needles):
print(f'{i}:{line}')
PYRepository: gridsuite/gridexplore-app
Length of output: 2471
🌐 Web query:
"gridsuite/commons-ui" "1291"
💡 Result:
The term "1291" in the context of the GitHub repository gridsuite/commons-ui refers to a specific Pull Request (PR) or issue identifier within that project [1]. As of August 12, 2026, the gridsuite/commons-ui repository is an active project that hosts common React components for GridSuite applications [1][2]. The repository utilizes a standard GitHub issue and PR tracking system, where numbers such as 1291 are assigned sequentially to track development tasks, bug fixes, or feature requests [1][2]. Other recent examples include PR #1241 regarding an MUI v7 upgrade and PR #1246 regarding ElementAttributes [3][4]. If you are looking for specific information regarding a change or discussion associated with #1291, you can access it directly by appending the number to the repository's pull request URL: gridsuite/commons-ui#1291.
Citations:
- 1: https://github.com/gridsuite/commons-ui
- 2: https://www.npmjs.com/package/@gridsuite/commons-ui
- 3: Upgrade to MUI v7 commons-ui#1241
- 4: feat: add optional references field to ElementAttributes commons-ui#1246
Update @gridsuite/commons-ui to a release that provides the required APIs.
Version 0.267.0 exports none of the four transformer symbols and does not declare dialogWidth in CustomMuiDialogProps. The TypeScript build fails at both usage sites.
🧰 Tools
🪛 GitHub Actions: CI / 0_build _ build.txt
[error] 100-100: TypeScript type-check failed: Module '@gridsuite/commons-ui' has no exported member 'TwoWindingsTransformerForm'.
🪛 GitHub Actions: CI / build _ build
[error] 100-5: TypeScript type-check failed: Module "@gridsuite/commons-ui" has no exported member "TwoWindingsTransformerForm".
🪛 GitHub Check: build / build
[failure] 103-103:
Module '"@gridsuite/commons-ui"' has no exported member 'twoWindingsTransformerCreationFormToDto'.
[failure] 102-102:
Module '"@gridsuite/commons-ui"' has no exported member 'twoWindingsTransformerCreationDtoToForm'.
[failure] 101-101:
Module '"@gridsuite/commons-ui"' has no exported member 'twoWindingsTransformerCreationFormSchema'.
[failure] 100-100:
Module '"@gridsuite/commons-ui"' has no exported member 'TwoWindingsTransformerForm'.
📍 Affects 2 files
src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx#L100-L103(this comment)src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx#L107-L107
🤖 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/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx`
around lines 100 - 103, Update the `@gridsuite/commons-ui` dependency to a release
that exports TwoWindingsTransformerForm,
twoWindingsTransformerCreationFormSchema,
twoWindingsTransformerCreationDtoToForm, and
twoWindingsTransformerCreationFormToDto and declares dialogWidth in
CustomMuiDialogProps. Apply this dependency update for the transformer imports
in composite-modification-dialog.tsx and the dialogWidth usage in
ModificationDialog.tsx.
Source: Linters/SAST tools
Signed-off-by: David BRAQUART <david.braquart@rte-france.com>
…ation-form-from-commons-UI # Conflicts: # src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx # src/components/dialogs/network-modification/simple-modification/ModificationDialog.tsx
…braquart/use-2wt-modification-form-from-commons-UI # Conflicts: # src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
…braquart/use-2wt-modification-form-from-commons-UI
…ification-form-from-commons-UI # Conflicts: # src/components/dialogs/network-modification/composite-modification/composite-modification-dialog.tsx
PR Summary
TwoWindingsTransformerModification form is now supported in composite modifications dialog. Requires gridsuite/commons-ui#1291.