Repository navigation
fix(hunts): show and set a hunt's enabled state - #744
Open
catinspace-au wants to merge 3 commits into
Open
catinspace-au wants to merge 3 commits into
catinspace-au wants to merge 3 commits into
Conversation
The Hunts console had no way to see or change whether the runner fires a hunt. - The list row and detail header show Disabled or Auto-disabled. The tooltip shows the stop time and ClickHouse reason. - The detail action menu has Disable, Enable and Re-enable. Each sends a PUT with enabled. - The hunt form has an Enabled switch. Edits send enabled only when the switch changes. Any PUT with enabled true clears a runner stop. - The update request type makes enabled optional. The generated type needs enabled for its default. - Regenerated engine types match the spec and have the engine's other changes.
The engine returns auto_disabled_at and auto_disabled_reason on GET /hunts/{name}. The console read the stop from the loaded list page. A direct link to a hunt outside that page showed no Auto-disabled tag and offered Disable instead of Re-enable.
- useHuntRunState takes the stop from the detail and falls back to the list row only for an engine that leaves the field out.
- Enable, Disable and Re-enable fetch the hunt before the PUT. The engine has no per-field write, so a toggle sends the whole config. Without the read, it could undo an edit made since the page loaded.
- Above the Enabled switch, the edit drawer warns when the runner stopped the hunt. It says a save leaves the hunt stopped.
- Engine types regenerated from the engine's spec. A Playwright spec covers the toggle and the edit rule against the live stack.
The actions menu fetched the hunt afresh for the PUT body but took the toggle direction from page state. If another session changed enabled after page load, the button wrote the opposite enabled value. - After the read, a hunt with auto_disabled_at set gets enabled true, and any other hunt gets the opposite of its enabled value. - The success and failure notices name the direction that was sent. - The menu label still comes from the page state, because it only guides the click.
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.
Pairs with hyperi-io/dfe-engine#1191 (hunt enable, disable and auto-disable, dfe-engine#1179), for 2.2.3.
The hunt list row and detail header have a state tag. Disabled means the YAML turns the hunt off. Auto-disabled means the runner stopped the hunt after repeated ClickHouse resource-limit failures. The tooltip gives the time and reason. It says Re-enable clears the stop.
The actions menu has Disable, Enable or Re-enable. A toggle fetches the latest hunt config and writes it with the changed flag. This preserves edits made since the page loaded.
The edit form has an Enabled switch. A runner stop is shown above it. Leaving the switch alone sends no
enabled. The engine treats that as unchanged, preserving a runner stop.The stop is read from the hunt detail, falling back to the list row. Direct links outside the loaded page still show the stop. The engine spec and client types come from #1191.
Test setup on desktop-derek: the #1191 engine's e2e server, a hunt runner and this console.
e2e/specs/huntEnabled.spec.ts has three cases:
The third case covers a runner stop of a YAML hunt on code 158. It needs E2E_STOPPED_HUNT and a runner against the engine.
Vitest: 138 across the Hunts tree. check-types and lint: clean. The spec writes screenshots of the four states to test-results/hunt-enabled when it runs.