can;t see health checks in edit for actions #19

Closed
opened 2026-03-20 17:20:41 +00:00 by despiegk · 4 comments
Owner

image

check that all objects params can be editted

![image](/attachments/cec00a8b-8197-4bea-9db0-d5f068501a10) check that all objects params can be editted
483 KiB
Author
Owner

Implementation Spec for Issue #19 — Health Checks Not Editable in Actions Edit Form

Objective

The "Edit Action" panel in the dashboard does not render a Health Checks editor section. When a user opens the edit form for an action that has health_checks defined, those entries are silently dropped on save. The fix must add a fully functional add/edit/remove UI for health_checks (each with all sub-fields and an optional health_check_policy) and fix a secondary bug where retry_policy.backoff is serialized as a string enum instead of a boolean.


Requirements

  • The showActionForm function must render a "Health Checks" section in the edit panel, populated with the existing health_checks array when editing.
  • Each health check row must expose all five check-target fields: action, tcp_port, http_url, openrpc_socket, openrpc_http_url.
  • Each health check row must expose all four health_check_policy fields: interval_ms, timeout_ms, retries, start_period_ms.
  • An "Add health check" button must allow adding new empty rows.
  • Each row must have a remove button consistent with the existing .kv-remove pattern.
  • The saveAction function must collect all health check rows and include them as health_checks in the spec sent to action.set.
  • retry_policy.backoff must be serialized as a boolean, not a string.
  • Add missing retry fields: max_delay_ms and stability_period_ms.

Files to Modify

  • crates/hero_proc_ui/static/js/dashboard.js — Only file needing changes (all bug is in JS UI layer)

Implementation Plan

Step 1 — Fix retry_policy.backoff serialization + add missing retry fields

Files: crates/hero_proc_ui/static/js/dashboard.js

  • Replace backoff <select> with a checkbox (boolean)
  • Add max_delay_ms and stability_period_ms fields to the retry form
  • Fix saveAction to read .checked for backoff
    Dependencies: none

Step 2 — Add addHealthCheckRow(containerId, hc) helper function

Files: crates/hero_proc_ui/static/js/dashboard.js

  • New function after addDepRow that renders a health check entry card
  • All 5 target fields + 4 policy fields (in <details> for compactness)
  • Remove button using .kv-remove pattern
    Dependencies: none

Step 3 — Add collectHealthChecks(containerId) helper function

Files: crates/hero_proc_ui/static/js/dashboard.js

  • Collects all .health-check-entry elements and builds the array
  • Only adds health_check_policy when at least one policy field is set
    Dependencies: Step 2

Step 4 — Add Health Checks section to showActionForm

Files: crates/hero_proc_ui/static/js/dashboard.js

  • Add <div id="af-health-checks"> container and "Add health check" button in the form HTML
  • After setting innerHTML, iterate (a.health_checks || []) and call addHealthCheckRow to pre-populate
    Dependencies: Steps 2, 3

Step 5 — Wire collectHealthChecks into saveAction

Files: crates/hero_proc_ui/static/js/dashboard.js

  • Add health_checks: collectHealthChecks('af-health-checks') to the spec object
    Dependencies: Steps 3, 4

Acceptance Criteria

  • Opening "Edit Action" on an action with zero health checks shows an empty Health Checks section with an "Add health check" button
  • Opening "Edit Action" on an action with existing health checks pre-populates all rows correctly
  • Add/remove health check rows works
  • All 5 target fields and 4 policy fields are editable
  • Saving sends a valid health_checks array in the RPC payload
  • Round-trip: add health check, save, reopen — persists correctly
  • retry_policy.backoff sent as boolean true/false
  • retry_policy.max_delay_ms and stability_period_ms fields visible and persist
  • No regressions in existing action form functionality

Notes

  • No Rust changes required. Backend model, OpenRPC spec, and action.set handler already support health checks fully.
  • backoff type mismatch is a silent data-corruption bug — fix bundled here since it's in the same function.
  • <details>/<summary> for health check policy keeps the form compact.
  • New class names use hc- prefix, scoped to .health-check-entry to avoid collisions.
## Implementation Spec for Issue #19 — Health Checks Not Editable in Actions Edit Form ### Objective The "Edit Action" panel in the dashboard does not render a Health Checks editor section. When a user opens the edit form for an action that has `health_checks` defined, those entries are silently dropped on save. The fix must add a fully functional add/edit/remove UI for `health_checks` (each with all sub-fields and an optional `health_check_policy`) and fix a secondary bug where `retry_policy.backoff` is serialized as a string enum instead of a boolean. --- ### Requirements - The `showActionForm` function must render a "Health Checks" section in the edit panel, populated with the existing `health_checks` array when editing. - Each health check row must expose all five check-target fields: `action`, `tcp_port`, `http_url`, `openrpc_socket`, `openrpc_http_url`. - Each health check row must expose all four `health_check_policy` fields: `interval_ms`, `timeout_ms`, `retries`, `start_period_ms`. - An "Add health check" button must allow adding new empty rows. - Each row must have a remove button consistent with the existing `.kv-remove` pattern. - The `saveAction` function must collect all health check rows and include them as `health_checks` in the spec sent to `action.set`. - `retry_policy.backoff` must be serialized as a `boolean`, not a string. - Add missing retry fields: `max_delay_ms` and `stability_period_ms`. --- ### Files to Modify - `crates/hero_proc_ui/static/js/dashboard.js` — Only file needing changes (all bug is in JS UI layer) --- ### Implementation Plan #### Step 1 — Fix `retry_policy.backoff` serialization + add missing retry fields Files: `crates/hero_proc_ui/static/js/dashboard.js` - Replace backoff `<select>` with a checkbox (boolean) - Add `max_delay_ms` and `stability_period_ms` fields to the retry form - Fix `saveAction` to read `.checked` for backoff Dependencies: none #### Step 2 — Add `addHealthCheckRow(containerId, hc)` helper function Files: `crates/hero_proc_ui/static/js/dashboard.js` - New function after `addDepRow` that renders a health check entry card - All 5 target fields + 4 policy fields (in `<details>` for compactness) - Remove button using `.kv-remove` pattern Dependencies: none #### Step 3 — Add `collectHealthChecks(containerId)` helper function Files: `crates/hero_proc_ui/static/js/dashboard.js` - Collects all `.health-check-entry` elements and builds the array - Only adds `health_check_policy` when at least one policy field is set Dependencies: Step 2 #### Step 4 — Add Health Checks section to `showActionForm` Files: `crates/hero_proc_ui/static/js/dashboard.js` - Add `<div id="af-health-checks">` container and "Add health check" button in the form HTML - After setting `innerHTML`, iterate `(a.health_checks || [])` and call `addHealthCheckRow` to pre-populate Dependencies: Steps 2, 3 #### Step 5 — Wire `collectHealthChecks` into `saveAction` Files: `crates/hero_proc_ui/static/js/dashboard.js` - Add `health_checks: collectHealthChecks('af-health-checks')` to the spec object Dependencies: Steps 3, 4 --- ### Acceptance Criteria - [ ] Opening "Edit Action" on an action with zero health checks shows an empty Health Checks section with an "Add health check" button - [ ] Opening "Edit Action" on an action with existing health checks pre-populates all rows correctly - [ ] Add/remove health check rows works - [ ] All 5 target fields and 4 policy fields are editable - [ ] Saving sends a valid `health_checks` array in the RPC payload - [ ] Round-trip: add health check, save, reopen — persists correctly - [ ] `retry_policy.backoff` sent as boolean `true`/`false` - [ ] `retry_policy.max_delay_ms` and `stability_period_ms` fields visible and persist - [ ] No regressions in existing action form functionality --- ### Notes - **No Rust changes required.** Backend model, OpenRPC spec, and `action.set` handler already support health checks fully. - `backoff` type mismatch is a silent data-corruption bug — fix bundled here since it's in the same function. - `<details>/<summary>` for health check policy keeps the form compact. - New class names use `hc-` prefix, scoped to `.health-check-entry` to avoid collisions.
Author
Owner

Test Results

  • Total: 390
  • Passed: 389
  • Failed: 1
  • Ignored (skipped): 13

Failure Details

Doctest failure in crates/hero_proc_integration_test/src/harness.rs (line 14):

test crates/hero_proc_integration_test/src/harness.rs - harness (line 14) - compile ... FAILED

error[E0433]: failed to resolve: use of undeclared type `TestHarness`
 --> crates/hero_proc_integration_test/src/harness.rs:15:15
  |
3 | let harness = TestHarness::start().await?;
  |               ^^^^^^^^^^^ use of undeclared type `TestHarness`
  |
help: consider importing this struct
  |
2 + use hero_proc_integration_test::harness::TestHarness;

error[E0728]: `await` is only allowed inside `async` functions and blocks
  --> the doctest example is not wrapped in an async context

Root cause: The doctest example in harness.rs uses .await and TestHarness without the required use import and without being marked as an async block. Fix: add # use hero_proc_integration_test::harness::TestHarness; and wrap the example with # tokio_test::block_on(async { / # }), or annotate the example with rust,no_run.

Summary

389 of 390 tests passed. All functional tests pass; the single failure is a documentation example (doctest) that is missing an async wrapper and a use import.

## Test Results - **Total:** 390 - **Passed:** 389 - **Failed:** 1 - **Ignored (skipped):** 13 ### Failure Details **Doctest failure** in `crates/hero_proc_integration_test/src/harness.rs` (line 14): ``` test crates/hero_proc_integration_test/src/harness.rs - harness (line 14) - compile ... FAILED error[E0433]: failed to resolve: use of undeclared type `TestHarness` --> crates/hero_proc_integration_test/src/harness.rs:15:15 | 3 | let harness = TestHarness::start().await?; | ^^^^^^^^^^^ use of undeclared type `TestHarness` | help: consider importing this struct | 2 + use hero_proc_integration_test::harness::TestHarness; error[E0728]: `await` is only allowed inside `async` functions and blocks --> the doctest example is not wrapped in an async context ``` **Root cause:** The doctest example in `harness.rs` uses `.await` and `TestHarness` without the required `use` import and without being marked as an `async` block. Fix: add `# use hero_proc_integration_test::harness::TestHarness;` and wrap the example with `# tokio_test::block_on(async {` / `# })`, or annotate the example with ```rust,no_run```. ### Summary 389 of 390 tests passed. All functional tests pass; the single failure is a documentation example (doctest) that is missing an `async` wrapper and a `use` import.
Author
Owner

Implementation Complete

Changes Made

All changes are in a single file: crates/hero_proc_ui/static/js/dashboard.js

Step 1 — Fixed retry_policy.backoff serialization bug + added missing retry fields

  • Replaced the backoff <select> (string values) with a <input type="checkbox"> — backoff is now serialized as a boolean true/false matching the Rust model
  • Added max_delay_ms and stability_period_ms fields to the retry policy form
  • Fixed saveAction to read .checked for backoff and collect the two new fields

Step 2 — Added addHealthCheckRow(containerId, hc) helper

  • New function that renders a health check entry card with all 5 target fields (action, tcp_port, http_url, openrpc_socket, openrpc_http_url) and 4 policy fields (interval_ms, timeout_ms, retries, start_period_ms) in a collapsible <details> section
  • Includes a remove × button consistent with existing .kv-remove pattern

Step 3 — Added collectHealthChecks(containerId) helper

  • Collects all .health-check-entry elements and builds the health_checks array
  • Only includes health_check_policy on a row when at least one policy field is set

Step 4 — Added Health Checks section to showActionForm

  • Added <div id="af-health-checks"> container and "Add health check" button before the Schedule Policy section
  • Added pre-population loop: (a.health_checks || []).forEach(hc => addHealthCheckRow('af-health-checks', hc)) after the form renders

Step 5 — Wired collectHealthChecks into saveAction

  • Added health_checks: collectHealthChecks('af-health-checks') to the spec object alongside depends_on

Test Results

  • 389 tests passed, 0 failures in functional tests
  • 1 pre-existing doctest compilation issue in harness.rs (unrelated to this change)

No Rust changes required

The backend model, OpenRPC spec, and action.set handler already supported health checks fully — the bug was entirely in the JavaScript UI layer.

## Implementation Complete ### Changes Made All changes are in a single file: `crates/hero_proc_ui/static/js/dashboard.js` **Step 1 — Fixed `retry_policy.backoff` serialization bug + added missing retry fields** - Replaced the backoff `<select>` (string values) with a `<input type="checkbox">` — backoff is now serialized as a boolean `true`/`false` matching the Rust model - Added `max_delay_ms` and `stability_period_ms` fields to the retry policy form - Fixed `saveAction` to read `.checked` for backoff and collect the two new fields **Step 2 — Added `addHealthCheckRow(containerId, hc)` helper** - New function that renders a health check entry card with all 5 target fields (`action`, `tcp_port`, `http_url`, `openrpc_socket`, `openrpc_http_url`) and 4 policy fields (`interval_ms`, `timeout_ms`, `retries`, `start_period_ms`) in a collapsible `<details>` section - Includes a remove `×` button consistent with existing `.kv-remove` pattern **Step 3 — Added `collectHealthChecks(containerId)` helper** - Collects all `.health-check-entry` elements and builds the `health_checks` array - Only includes `health_check_policy` on a row when at least one policy field is set **Step 4 — Added Health Checks section to `showActionForm`** - Added `<div id="af-health-checks">` container and "Add health check" button before the Schedule Policy section - Added pre-population loop: `(a.health_checks || []).forEach(hc => addHealthCheckRow('af-health-checks', hc))` after the form renders **Step 5 — Wired `collectHealthChecks` into `saveAction`** - Added `health_checks: collectHealthChecks('af-health-checks')` to the spec object alongside `depends_on` ### Test Results - 389 tests passed, 0 failures in functional tests - 1 pre-existing doctest compilation issue in `harness.rs` (unrelated to this change) ### No Rust changes required The backend model, OpenRPC spec, and `action.set` handler already supported health checks fully — the bug was entirely in the JavaScript UI layer.
Author
Owner

Implementation committed: 24de8af8744433e214c80850605a5fd5844790b0

Browse: 24de8af874

Implementation committed: `24de8af8744433e214c80850605a5fd5844790b0` Browse: https://forge.ourworld.tf/lhumina_code/hero_proc/commit/24de8af8744433e214c80850605a5fd5844790b0
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_proc#19
No description provided.