Repository navigation
Refactor action feed display with structured rho data - #6
Merged
Merged
Conversation
Replace stdout regex parsing and manual action description loading with direct use of the new run_analysis return dict (lines_overloaded_names, prioritized_actions with rho_before/after, max_rho, is_rho_reduction). Update frontend ActionFeed to render structured action cards with overload status badges, rho comparisons, and overloaded lines banner. https://claude.ai/code/session_01WoJya26bEC3W5yUuBJLXWb
…nature Align the standalone HTML interface with the updated API response: - Use max_rho/is_rho_reduction instead of new_max_rho null checks - Use rho_before/rho_after arrays instead of old_rho/new_rho strings - Add overloaded lines banner from lines_overloaded field - Add priority numbering and reduction badge to action cards https://claude.ai/code/session_01WoJya26bEC3W5yUuBJLXWb
Keep N and N-1 SVG containers always mounted in the DOM, using CSS visibility/pointer-events/z-index to show/hide them instead of conditional rendering. This preserves the usePanZoom hook's viewBox state when switching to the Overflow Analysis tab and back. Also re-apply saved viewBox when a tab becomes active again, and only cross-sync zoom between N and N-1 when switching directly between them (not when returning from the overflow tab). https://claude.ai/code/session_01WoJya26bEC3W5yUuBJLXWb
The synchronization logic block (added in 9ed46c6) re-declared `const prevTabRef = useRef(activeTab)` which already existed earlier in the component. This caused a SyntaxError that prevented the entire React app from rendering, resulting in a blank page. https://claude.ai/code/session_01WoJya26bEC3W5yUuBJLXWb
Zoom persistence fix: The "reinit on overflow exit" effect (dead code — reinitCount was never consumed) was overwriting prevTabRef before the sync effect could read it. When switching overflow → N-1, the sync effect saw prevTab='n-1' instead of 'overflow', so the guard didn't fire and it overwrote the N-1 zoom with the N full-grid viewBox. Removed the dead reinitCount state and the conflicting effect so prevTabRef is managed in one place. Action card tri-color severity: Cards were colored only by is_rho_reduction (green/red). An action that reduces rho but leaves max_rho > 100% (e.g. 108.3%) still showed green, which is misleading. Now uses max_rho thresholds: - Green (<=90%): "Solves overload" - Orange (90-100%): "Partial reduction" - Red (>100%): "Still overloaded" / "No reduction" Applied to both standalone_interface.html and ActionFeed.tsx. https://claude.ai/code/session_01WoJya26bEC3W5yUuBJLXWb
90-100% max_rho means the overload is actually solved, but with little headroom. The new label makes this clear while still flagging it for supervision. https://claude.ai/code/session_01WoJya26bEC3W5yUuBJLXWb
4 of 6 tasks
marota
pushed a commit
that referenced
this pull request
Jun 18, 2026
…casts 19→12 Target #6 from the code-quality review. The SVG getScreenCTM / .style casts used `as unknown as SVGGraphicsElement` where the source is already an `Element` (e.g. from querySelector) — a plain downcast suffices (highlights.ts:74 already did `as SVGGraphicsElement` right beside one). Simplified the 7 such casts in highlights.ts (3) and actionPinRender.ts (4). Type-only assertions — erased at runtime, tsc + eslint clean, zero behaviour change. (ActionOverviewDiagram's `HTMLElement`→`SVGSVGElement` cast genuinely needs `as unknown as` — sibling types — and is left.) Lowers the `as unknown as` ratchet 19 → 12. The 46 `Record<string, unknown>` remain the next weak-typing target. https://claude.ai/code/session_0185GQf52QDpMM4zRDmGVN8X
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 refactors the action feed display to show structured rho (congestion) data and overloaded line information. The backend now returns pre-processed action details with rho arrays and reduction status, while the frontend displays this data in a more user-friendly format with visual indicators.
Key Changes
Backend (recommender_service.py):
prioritized_actionsandlines_overloaded_namesdirectly from the result objectrho_before,rho_after,max_rho,max_rho_line, andis_rho_reductionfieldsFrontend (ActionFeed.tsx):
ActionDetailtype import for type safetylinesOverloadedprop to display overloaded transmission linesformatRhoArray()helper to display rho values as human-readable percentages with line namesType Definitions (types.ts):
ActionDetailinterface with typed fields for rho dataAnalysisResultinterface to includelines_overloadedarray andmessage/dc_fallbackfieldsactionsfield type fromRecord<string, any>toRecord<string, ActionDetail>Other:
typekeyword for type-only importsuseEffectfrom ConfigurationPanel,queueandrefrom backend)Implementation Details
linesOverloadedarray by index, with fallback to generic "line N" labelshttps://claude.ai/code/session_01WoJya26bEC3W5yUuBJLXWb