Curtailment: Migrate active curtailment detail to keyed RPCs#444
Curtailment: Migrate active curtailment detail to keyed RPCs#444rongxin-liu wants to merge 14 commits into
Conversation
🔐 Codex Security Review
Review SummaryOverall Risk: MEDIUM Findings[MEDIUM] Active curtailment polling hydrates unbounded target pages
[MEDIUM] Stale manage-detail responses can open the wrong active curtailment
NotesNo SQL, backend authz, plugin, infrastructure, protobuf, or mining-pool address changes were present in the reviewed diff. Generated by Codex Security Review | |
Preserve selected terminal events, bound detail hydration to the selected event, and isolate failed detail pages so multi-active polling stays reliable.
Keep cached active state through read failures and hydrate secondary active rows before management so operators retain correct stop and edit controls.
Keep protobuf test fixtures type-safe after adding target-page overrides for active detail hydration coverage.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec7affb6eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bound background detail hydration, render summary-only active rows without fake target metrics, and ignore stale manage-detail selections.
Addressed in
Addressed in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd39517504
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Keep the header pill and active polling driven by non-terminal listed events when the selected curtailment is preserved as terminal.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d1e0d56e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Render summary-only active curtailment pill details without fake zero target metrics.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d8aa2b9d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Keep history row management aligned with updateable curtailment states so restoring rows cannot open an edit flow that the server rejects.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30c411cb5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Prevent stale manage-detail responses from opening edit flows after an event transitions out of updateable states.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10ecbabb2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Let page-zero active injections filter each active event individually so non-selected active rows remain visible under matching filters.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5388d27a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Abort and invalidate in-flight history manage detail loads before opening the create curtailment flow.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d472712af4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (currentEvent.state === CurtailmentEventState.RESTORING) { | ||
| return events.length > 0 ? currentEvent : undefined; |
There was a problem hiding this comment.
Drop vanished restoring events from active-only polls
When the selected event is RESTORING and ListActiveCurtailments no longer returns it while another curtailment is still active, this preserves the old event; getActiveCurtailmentSnapshotFromResponse then re-inserts that stale restoring event into snapshot.events. The page header's useCurtailmentPillData only runs refreshActiveCurtailmentData and never does the history reconciliation that can turn restoring into terminal, so in this multi-active scenario the pill can remain stuck on the vanished restoring curtailment and keep 3s polling instead of switching to the remaining active event.
Useful? React with 👍 / 👎.
Summary
This PR moves active curtailment UI state from a single-active-event model to a list-plus-selected-detail model, so operators can see every active curtailment while the status card and edit flow stay focused on the selected event.
Behavior Changes
GetCurtailmentEvent.Codebase Impact
useCurtailmentApinow exposes selected active-event hydration for secondary history-row management.Verification
npm test -- --run protoFleet/api/activeCurtailmentData.test.ts protoFleet/api/useCurtailmentApi.test.ts protoFleet/components/PageHeader/useCurtailmentPillData.test.tsx protoFleet/features/energy/CurtailmentManagementPanel.test.tsx protoFleet/features/energy/CurtailmentHistory.test.tsxnpm run lintnpx tsc --noEmit