Skip to content

Improve curtailment workflow UX#443

Open
negarn wants to merge 3 commits into
mainfrom
negar/curtailment-ui-improvements
Open

Improve curtailment workflow UX#443
negarn wants to merge 3 commits into
mainfrom
negar/curtailment-ui-improvements

Conversation

@negarn

@negarn negarn commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Allow curtailment CTAs to surface required-field validation instead of staying disabled for missing local inputs
Screen.Recording.2026-06-12.at.10.29.00.AM.mov
  • Restore saved response profile scope when switching profiles, including clearing stale miner selections for whole-fleet profiles
Screen.Recording.2026-06-12.at.10.30.39.AM.mov
  • Keep readonly inputs from showing focus highlights and update leftover MQTT wording to MaestroOS
Screen.Recording.2026-06-12.at.10.31.30.AM.mov
  • Update curtailment polling so that when restoring has completed, the curtailment history status changes to "completed" instead of remaining at "restoring" until manually refreshing the page
Untitled.mov

Test plan

  • In New curtailment, click Run with required fields empty and confirm field errors appear on the form
  • Select miners, switch to a whole-fleet response profile, and confirm the Apply to selection resets before running
  • Verify MaestroOS source and automation modals surface required-field errors from their Save/Test actions

@negarn negarn requested a review from a team as a code owner June 12, 2026 15:28
Copilot AI review requested due to automatic review settings June 12, 2026 15:28
@github-actions github-actions Bot added javascript Pull requests that update javascript code client server labels Jun 12, 2026
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Note: This is an automated security-focused code review generated by Codex.
It should be used as a supplementary check alongside human review.
False positives are possible - use your judgment.

Scope summary

  • Reviewed pull request diff only (75933fce45c269e41e0ba2b30cd33825b0389fa7...5585fb645a9fd9a2f2c1d002b98f272150fabcd1, exact PR three-dot diff)
  • Model: gpt-5.5

💡 Click "edited" above to see previous reviews for this PR.


Review Summary

Overall Risk: MEDIUM

Findings

[MEDIUM] Site-scoped response profiles can be applied while the target control still shows miner selection

  • Category: Reliability
  • Location: client/src/protoFleet/features/energy/CurtailmentStartModal.tsx:862
  • Description: The PR now applies saved response-profile scope into the run-curtailment modal. For site-scoped profiles, this changes submitted values to scopeType: "site"/siteId, but the create-mode “Apply to” control still renders only miner selection and derives its value from explicit miner IDs. A site-scoped profile therefore appears as Miners Select even though submitting will start a site-scoped curtailment.
  • Impact: Operators can misread the active curtailment target and approve a curtailment against a different scope than the visible target control suggests. In fleet operations, that can cause unintended miner shutdowns or missed curtailment at the intended scope.
  • Recommendation: When selected profile values include scope, render the actual scope in “Apply to” for create mode, such as Site Austin, TX or Whole fleet, and add a test for selecting a site-scoped response profile from the run modal. Alternatively, keep stripping scope unless the user explicitly opts to use the profile’s target.

Notes

Reviewed .git/codex-review.diff only. I did not find changed auth/JWT, SQL, shell execution, plugin, protobuf/codegen, Docker, Rust ASIC, or pool/wallet-address logic in this diff.


Generated by Codex Security Review |
Triggered by: @negarn |
Review workflow run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6aee00b0e8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread client/src/protoFleet/features/energy/CurtailmentStartModal.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the curtailment workflow UX across the ProtoFleet client and supporting server surfaces by enabling CTA-driven validation feedback (instead of disabled actions), restoring/clearing scope state when switching response profiles, and aligning curtailment “MQTT” copy to “MaestroOS” for operator-facing messaging.

Changes:

  • Client: Enable Save/Run/Test CTAs while surfacing required-field validation on click (including Enter-to-save handling) and remove focus highlights for read-only inputs.
  • Client: Restore saved response-profile scope when switching profiles (clearing stale miner selections for whole-fleet profiles) and adjust curtailment polling to continue while non-terminal history is visible.
  • Server: Update various curtailment source/automation error strings and admin-action copy from “MQTT” to “MaestroOS”, with tests updated/added accordingly.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/internal/handlers/curtailment/handler.go Updates admin-action copy to “MaestroOS” for source-management messages.
server/internal/domain/curtailment/mqttingest/subscriber.go Updates broker-transport validation error copy to “MaestroOS”.
server/internal/domain/curtailment/mqttingest/settings_service.go Updates MaestroOS source error copy for test/reconcile/quiesce/store mapping.
server/internal/domain/curtailment/mqttingest/settings_service_test.go Adds/updates tests asserting new MaestroOS-facing error strings.
server/internal/domain/curtailment/automation.go Updates automation validation/errors to refer to MaestroOS sources.
server/internal/domain/curtailment/automation_test.go Updates assertions for updated MaestroOS-facing automation messages/reason strings.
client/src/shared/components/Input/Input.tsx Suppresses focus styling for read-only inputs and adjusts cursor behavior.
client/src/shared/components/Input/Input.test.tsx Adds coverage for read-only focus styling suppression.
client/src/protoFleet/features/settings/components/Curtailment/keyboard.ts Adds shared key handler helper for Enter-to-save within curtailment modals.
client/src/protoFleet/features/settings/components/Curtailment/CurtailmentSettingsPage.tsx Reworks source modal validation to show errors on CTA click; adds Enter-to-save.
client/src/protoFleet/features/settings/components/Curtailment/CurtailmentSettingsPage.test.tsx Updates tests for CTA-enabled validation behavior and Enter-to-save.
client/src/protoFleet/features/settings/components/Curtailment/CurtailmentAutomations.tsx Enables Save CTA while showing validation on click; adds Enter-to-save.
client/src/protoFleet/features/settings/components/Curtailment/CurtailmentAutomations.test.tsx Updates tests for CTA-enabled validation behavior and Enter-to-save.
client/src/protoFleet/features/energy/CurtailmentStartModal.tsx Restores response-profile scope correctly and shows local validation on CTA click.
client/src/protoFleet/features/energy/CurtailmentStartModal.test.tsx Adds/updates tests for scope restoration and CTA-enabled required-field validation.
client/src/protoFleet/features/energy/CurtailmentManagementPanel.tsx Continues polling while visible history includes non-terminal events.
client/src/protoFleet/features/energy/CurtailmentManagementPanel.test.tsx Adds test ensuring polling continues with non-terminal history after active clears.

Comment thread server/internal/domain/curtailment/automation.go
Comment thread server/internal/domain/curtailment/mqttingest/settings_service.go

@rongxin-liu rongxin-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Some minor issues worth fixing before merging.

return;
}

if (!canSave) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In edit mode with a saved password, changing a credential field (e.g. changing username) makes passwordRequired true, so clicking Save lands here with saveValidationErrors.password set — but the input keeps rendering the ...... placeholder, so the field looks filled while the error says it's empty. The Test connection path already clears the placeholder for exactly this case (from the earlier review round);

Save needs the same treatment:

if (!canSave) {
  if (showSavedPasswordPlaceholder && saveValidationErrors.password) {
    setPasswordPlaceholderActive(false);
  }
  setValidationIntent("save");
  return;
}

(plus saveValidationErrors / showSavedPasswordPlaceholder in the useCallback deps).

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client javascript Pull requests that update javascript code server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants