feat(miner-ui): add governor pause/resume controls#5611
Merged
Conversation
Adds vite-governor-api.ts (GET /api/governor/pause-state, POST pause/resume), a client fetcher, and a GovernorControlSection wired into the ledgers page. The governor half of #4857 -- queue release/requeue is deferred pending a separate identifier-exposure design decision. Safe only because #4858 now authenticates all /api/* requests.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
3 tasks
Closed
26 tasks
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
apps/gittensory-miner-ui/vite-governor-api.ts:GET /api/governor/pause-state(read) plusPOST /api/governor/pause/POST /api/governor/resume(write) — the miner-ui's first write-capable endpoints, thin bridges to the samegovernor-state.jsexports (loadPauseState/savePauseState) the CLI'sgovernor pause/governor resume/governor statusalready use. No new pause/resume semantics invented;governor-chokepoint.js/governor-chokepoint-persisted.js(the governor's actual decision-to-proceed logic) are completely untouched.apps/gittensory-miner-ui/src/lib/governor.ts: typed client (fetchGovernorPauseState,pauseGovernor,resumeGovernor), mirroring the existing read-only fetchers' error-handling shape.GovernorControlSectionto the ledgers page: current pause state + a Pause/Resume button, wired intoLedgersPage's existing fetch-on-mount pattern with its own independent load/action state.governorApiPlugin()invite.config.tsafterauthPlugin(), so both the read and write routes are covered by Add auth to the local miner-ui API #4858's cookie auth from the moment they exist.Scope
This is the governor half of #4857 ("Add real actions to the miner-ui"). Queue release/requeue actions (the other half) are deliberately not included: they need a per-item
identifier, which the read-only portfolio-queue API intentionally never republishes over the wire (seevite-portfolio-queue-api.ts's own header comment — repo names are exposed, identifiers/priorities are not). Exposing identifiers safely is a real design decision, not a trivial wire-up, and is left for a follow-up. Also deliberately sequenced after #4858 (merged): a write-capable/api/*endpoint landing before that auth gate would have shipped briefly unauthenticated depending on merge order.Advances #4857 (not closing it — the queue release/requeue half is still open).
Test plan
npm run ui:typecheck(vianpm run ui:kit:buildfirst)npm --workspace @loopover/ui-miner run lint— 0 errors (5 pre-existing, unrelated warnings)npm --workspace @loopover/ui-miner run test— 103/103 passing across the app (41 new: route matching, the handler's fresh-install-safe GET path, POST body parsing incl. malformed/non-string reason, store-failure 500s, the actual Vite middleware wiring via bothconfigureServer/configurePreviewServer,GovernorControlSectionrender/interaction states, the two client fetchers, andLedgersPageintegration — load-on-mount, click-to-pause/resume updates the displayed state, button disabled while an action is in flight, error state doesn't break the rest of the page)npm --workspace @loopover/ui-miner run build/,GET pause-state(not paused),POST pausewith a reason,GET pause-state(paused, reason/timestamp present),POST resume(back to not-paused), and confirmed an unauthenticatedPOST /api/governor/pauseis rejected with401This change lives entirely under
apps/gittensory-miner-ui/**, whichvitest.config.ts's rootcoverage.includeexplicitly excludes (apps/**) — Codecov's patch gate does not apply here, matching #5605/#5479's precedent.