Skip to content

Add dynamic reconnection action support and cleanup unused prop - #110

Merged
marota merged 2 commits into
mainfrom
claude/fix-reconnection-simulation-hVoLu
Apr 22, 2026
Merged

marota merged 2 commits into
mainfrom
claude/fix-reconnection-simulation-hVoLu

Conversation

@marota

@marota marota commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds support for auto-creating dynamic reconnection actions with the reco_ prefix in the simulation service, and removes an unused prop from the ActionFeed component.

Key Changes

Backend (simulation_mixin.py)

  • Updated _create_dynamic_actions_if_needed() to handle reco_ prefixed action IDs for line reconnection
  • Implemented new _create_dynamic_reconnection() method that:
    • Extracts the line name from the action ID
    • Creates a topology action that reconnects both ends of the line to bus 1
    • Builds the action entry with appropriate French and English descriptions
    • Logs the action creation for debugging

Frontend (ActionFeed.tsx)

  • Removed unused onOverviewFiltersChange prop from the ActionFeed component signature

Implementation Details

The reconnection action follows the same pattern as existing dynamic actions (curtailment, load shedding, PST tap adjustments). It leverages the existing _build_action_entry_from_topology() helper to construct the action entry with proper topology modifications for line reconnection.

https://claude.ai/code/session_01Tzp2fdUas3Y9vNZy6dxxuC

claude added 2 commits April 22, 2026 14:43
…e unused prop destructure

Reconnection actions generated by expert_op4grid_recommender (e.g.
reco_CAZARL72MARSI) are not in the loaded action dictionary and are
not pre-populated in recent_analysis when the user clicks Simulate
from the Explore Pairs tab. _create_dynamic_actions_if_needed already
handled curtail_, load_shedding_, and pst_ prefixes dynamically; this
patch adds the same for reco_ by reconnecting both line ends to bus 1.

Also drops the unused onOverviewFiltersChange destructure in
ActionFeed.tsx to fix the @typescript-eslint/no-unused-vars lint error.

https://claude.ai/code/session_01Tzp2fdUas3Y9vNZy6dxxuC
… dynamic fix

Captures the post-0.6.0 work: svgPatch DOM-recycling (PR #108),
Action Overview filters + unsimulated pins (PR #105, #107),
code-quality gate + 5 decomposition passes (PR #104, #106),
docs reorganisation (PR #103), App.tsx hook extraction
(PR #109), and the dynamic reco_ reconnection-action fix on
the current branch.

https://claude.ai/code/session_01Tzp2fdUas3Y9vNZy6dxxuC
@marota
marota merged commit 403d5d0 into main Apr 22, 2026
8 checks passed
marota pushed a commit that referenced this pull request Apr 24, 2026
Follow-up to the root/frontend/backend CLAUDE.md + README refresh.
Audits the remaining project docs against PRs merged 2026-04-21 →
2026-04-23 and updates the eight that had actually drifted.

frontend/README.md (HIGH)
  Replaced the stock Vite-template boilerplate with a real frontend
  orientation: npm scripts, source-tree map (hooks, components,
  utils incl. the utils/svg/* split from PR #104), pointer to the
  auto-generated standalone bundle, testing + lint commands, and
  cross-refs to CLAUDE.md / PARITY_AUDIT.md / docs/README.md.

expert_backend/tests/CLAUDE.md (MEDIUM)
  Full rewrite of the test-file inventory: added the PR #104
  decomposition suites (test_simulation_helpers.py,
  test_analysis_helpers.py, test_diagram_helpers.py), the patch-
  endpoint coverage (test_diagram_patch_helpers.py,
  test_n1_diagram_fast_path.py) from PR #108, the regression
  guards (test_resimulate_regression.py,
  test_second_contingency_reset.py,
  test_get_n1_variant_clones_from_n_state.py,
  test_configurable_mw.py) that were added since 2026-04-11, and
  the dynamic reco_* reconnection path from PR #110. Replaced the
  frontend inventory with a structural summary matching the
  current ~60-file Vitest layout, listed the scripts/pypsa_eur
  pytest coverage, and documented the tests removed by PR #103 /
  #104 (test_ui_regressions.py, standaloneInterface.test.ts,
  cssRegression.test.ts).

docs/features/combined-actions.md (MEDIUM)
  Added a "Recent updates (PR #114, release 0.6.5)" section
  covering LS/curtailment in combined pairs, Simulate Combined
  moved out of the card + clickable sub-action badges,
  target_max_rho on the user-selected overload set, and Explore-
  Pairs re-estimation aligned with the pre-computed betas.
  Rewrote the "Standalone Interface" section to describe the
  auto-generated bundle, and dropped the checklist line that
  required manual standalone_interface.html mirroring. Added a
  row to the key-files table for the ActionCard sub-action badges
  and the ComputedPairsTable / ExplorePairsTab split.

docs/features/state-reset-and-confirmation-dialogs.md (MEDIUM)
  Replaced the standalone_interface.html section with a pointer
  to the auto-generated bundle, and expanded the "What reset()
  clears" list to match the current RecommenderService.reset()
  implementation (drain order + fast-path caches +
  _layout_cache + NAD-prefetch state, with the
  add-a-new-cache-goes-here guardrail).

docs/features/detachable-viz-tabs.md (MEDIUM)
  Removed the "standalone_interface.html mirror" row and the
  follow-up caveat that said the single-file interface doesn't
  support detaching — both are obsolete now that the bundle is
  auto-generated from the React tree.

docs/architecture/app-refactoring-plan.md (MEDIUM)
  Added a "Status: SHIPPED" banner at the top summarising both
  refactor waves (Phase 1 via PR #74, Phase 2 hook extraction
  via PR #109) and pointing readers at the current source of
  truth (frontend/CLAUDE.md + CHANGELOG.md 0.6.5). Preserved the
  original plan below the banner for historical value.

docs/architecture/phase2-state-management-optimization.md (LOW)
  Added a "Status: Partially shipped" banner — memoization +
  React.memo pass shipped under PR #75, superseded in part by
  PR #109 (useN1Fetch / useDiagramHighlights extractions),
  orchestrator hooks still deferred.

docs/features/frontend-ui-improvements.md (LOW)
  Scope header now names `frontend/dist-standalone/standalone.html`
  (auto-generated, PR #101) instead of the decommissioned
  hand-maintained file.

https://claude.ai/code/session_01RsvHjjFbAauF3NvD9BNT5V
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