Repository navigation
Fix SLD highlighting for manual actions - #72
Merged
Merged
Conversation
…convention robustness
…ls and fix MW calculation consistency
- Enrichment: Updated simulate_manual_action to return action_topology and rich descriptions (quotes + VL IDs). - Registry: Ensured manual actions are registered in the global self._dict_action for SLD generation. - Frontend: Propagated action_topology in all simulation handlers and robustified findCellForEquipment with fuzzy/SVG matching. - Testing: Added regression tests in expert_backend/tests/test_manual_action_enrichment.py.
- Fixed missing dependencies in App.tsx useCallback hooks. - Updated simulateManualAction return type in api.ts to include curtailment_details. - Removed explicit 'any' cast in ActionFeed.tsx.
- Restored 'content' key in _dict_action for manual actions (required by superposition and tests). - Added string robustness for description fields to prevent TypeError in ActionClassifier. - Verified all 17 failing tests pass in a batch run.
- Resolved UnboundLocalError by initializing 'content' and 'topo' before simulation logic. - Fixed AttributeError by adding dictionary type checks during topology reconstruction. - Ensured 'action_topology' is always returned for all manual actions (fixes LINE_1_OPEN test). - Verified all 28 backend tests pass in a single batch run.
marota
pushed a commit
that referenced
this pull request
Apr 30, 2026
Reconciliation of section 2 (0.5.0): - Drop misattributed PRs that were actually pre-rebrand: save/reload (#49/#52), MW Start (#62), interaction-logging (#64), SLD highlights (#63), load shedding initial integration (#61). All now properly cited in section 1.5–1.6. - Disambiguate App.tsx refactor history: PR #56 (hooks, 2100 → 800, pre-rebrand) vs PR #74 (components, 1000 → 650, 0.5.0) vs PR #75 (memoization Phase 2, same LoC). - Add accurate 0.5.0 PRs: #66 (vectorization w/ benchmark table), #69/#70/#71 (UI polish), #72 (curtailment), #73 (loads_p/gens_p format + configurable MW), #74/#75 (App.tsx decomposition), #78 (PST tap re-simulation), #84/#86/#87/#90 (detachable tabs). - Add a recap table summarizing what's truly new in 0.5.0. Diagrams added (Mermaid, GitHub-rendered): - Gantt timeline of all 4 phases (top of doc). - High-level architecture (frontend / backend / data). - Two-step analysis sequence diagram (section 1.6). - App.tsx LoC evolution flow (section 2.4). - Backend mixin decomposition before/after PR #104/#106 (section 3). - PyPSA-EUR pipeline flowchart (section 4). https://claude.ai/code/session_01Pg7fuCUG2edfm5PyHS6SbN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR resolves a persistent issue where manually simulated renewable curtailment and load shedding actions failed to trigger Single Line Diagram (SLD) highlighting. It also aligns the manual action metadata and presentation with the automated "suggested" actions for a consistent user experience.
Key Changes
Backend (
recommender_service.py)simulate_manual_actionnow includes theaction_topologyin its immediate response, allowing the frontend to sync state instantly.'GEN_NAME' at voltage level 'VL_ID'), which assists the frontend in asset discovery.Frontend (
standalone_interface.html)action_topologyto the application state.findCellForEquipment, including case-insensitive prefix matching and direct SVG text searching, to resolve naming discrepancies between Grid2Op and Pypowsybl.Verification Results
expert_backend/tests/test_manual_action_enrichment.pyverifying description enrichment, topology propagation, and registry integration. All tests passed.curtail_VIELMIN3results in a yellow glow on the generator in the SLD and a light blue MW box in the action card.