when doing demo data it didn't populate actions? #7

Closed
opened 2026-03-19 09:05:25 +00:00 by despiegk · 4 comments
Owner

image

![image](/attachments/d55e0faa-3d6c-41d7-be0d-db34e569c469)
315 KiB
Author
Owner

Implementation Spec for Issue #7

Objective

Fix demo data not populating the Actions tab in the UI. After running "populate demo environment", the Actions table remains empty even though actions are successfully created in the database.

Root Cause

The action.list RPC method returns { "specs": [...] } (as defined in the OpenRPC spec and implemented in the server). However, dashboard.js line 441 looks for result.actions which is always undefined, causing it to fall back to an empty array [].

Server (crates/hero_proc_server/src/rpc/action.rs line 49):

Ok(specs) => success_response(id, serde_json::json!({ "specs": specs })),

JavaScript (crates/hero_proc_ui/static/js/dashboard.js line 441):

cachedActions = Array.isArray(result) ? result : (result.actions || []);
//                                                          ↑ should be result.specs

Requirements

  • Fix the field name mismatch so loadActions() correctly reads the list returned by action.list
  • Ensure the Actions tab badge count is correct after the fix
  • No changes needed to the server or OpenRPC spec — the server is correct

Files to Modify

  • crates/hero_proc_ui/static/js/dashboard.js — one-line fix on line 441

Implementation Plan

Step 1: Fix field name in loadActions()

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

  • Change result.actions to result.specs on line 441
    Dependencies: none

Acceptance Criteria

  • After running demo data, Actions tab shows populated rows
  • Actions badge count reflects the correct number of actions
  • Existing action CRUD (set/get/delete) still works

Notes

  • The demo correctly creates ~30+ actions (standalone + service-specific) via populate_demo_environment() in hero_proc_sdk/src/demo.rs
  • The RPC server and OpenRPC spec are correct — only the UI consumer has the wrong field name
  • This is a pure frontend fix, no Rust recompilation needed
## Implementation Spec for Issue #7 ### Objective Fix demo data not populating the Actions tab in the UI. After running "populate demo environment", the Actions table remains empty even though actions are successfully created in the database. ### Root Cause The `action.list` RPC method returns `{ "specs": [...] }` (as defined in the OpenRPC spec and implemented in the server). However, `dashboard.js` line 441 looks for `result.actions` which is always `undefined`, causing it to fall back to an empty array `[]`. **Server** (`crates/hero_proc_server/src/rpc/action.rs` line 49): ```rust Ok(specs) => success_response(id, serde_json::json!({ "specs": specs })), ``` **JavaScript** (`crates/hero_proc_ui/static/js/dashboard.js` line 441): ```javascript cachedActions = Array.isArray(result) ? result : (result.actions || []); // ↑ should be result.specs ``` ### Requirements - Fix the field name mismatch so `loadActions()` correctly reads the list returned by `action.list` - Ensure the Actions tab badge count is correct after the fix - No changes needed to the server or OpenRPC spec — the server is correct ### Files to Modify - `crates/hero_proc_ui/static/js/dashboard.js` — one-line fix on line 441 ### Implementation Plan #### Step 1: Fix field name in loadActions() Files: `crates/hero_proc_ui/static/js/dashboard.js` - Change `result.actions` to `result.specs` on line 441 Dependencies: none ### Acceptance Criteria - [ ] After running demo data, Actions tab shows populated rows - [ ] Actions badge count reflects the correct number of actions - [ ] Existing action CRUD (set/get/delete) still works ### Notes - The demo correctly creates ~30+ actions (standalone + service-specific) via `populate_demo_environment()` in `hero_proc_sdk/src/demo.rs` - The RPC server and OpenRPC spec are correct — only the UI consumer has the wrong field name - This is a pure frontend fix, no Rust recompilation needed
Author
Owner

Test Results

  • Total: 366
  • Passed: 366
  • Failed: 0
  • Ignored: 16

Status: PASS

All tests passed across the workspace (excluding hero_proc_examples).

Compilation Issue

The hero_proc_examples crate failed to compile due to a breaking change:

error[E0609]: no field `value` on type `ActionListOutput`
  --> crates/hero_proc_examples/examples/basic_usage.rs:47:39
   |
47 |     println!("Actions ({}):", actions.value.len());
   |                                       ^^^^^ unknown field
   |
   = note: available field is: `specs`

The basic_usage.rs example references actions.value but the field was renamed to actions.specs. Tests were run with --exclude hero_proc_examples to work around this.

Run date: 2026-03-19

## Test Results - **Total:** 366 - **Passed:** 366 - **Failed:** 0 - **Ignored:** 16 ### Status: PASS All tests passed across the workspace (excluding `hero_proc_examples`). ### Compilation Issue The `hero_proc_examples` crate failed to compile due to a breaking change: ``` error[E0609]: no field `value` on type `ActionListOutput` --> crates/hero_proc_examples/examples/basic_usage.rs:47:39 | 47 | println!("Actions ({}):", actions.value.len()); | ^^^^^ unknown field | = note: available field is: `specs` ``` The `basic_usage.rs` example references `actions.value` but the field was renamed to `actions.specs`. Tests were run with `--exclude hero_proc_examples` to work around this. _Run date: 2026-03-19_
Author
Owner

Implementation Complete

Root Cause

Field name mismatch between server and UI: action.list returns { "specs": [...] } but dashboard.js was reading result.actions (always undefined), causing the Actions tab to always show empty after demo data population.

Changes Made

crates/hero_proc_ui/static/js/dashboard.js (line 441)

- cachedActions = Array.isArray(result) ? result : (result.actions || []);
+ cachedActions = Array.isArray(result) ? result : (result.specs || []);

crates/hero_proc_examples/examples/basic_usage.rs (lines 47–48)

- println!("Actions ({}):", actions.value.len());
- for a in &actions.value {
+ println!("Actions ({}):", actions.specs.len());
+ for a in &actions.specs {

Test Results

  • 366 tests passed, 0 failed
  • All workspace crates compile cleanly
## Implementation Complete ### Root Cause Field name mismatch between server and UI: `action.list` returns `{ "specs": [...] }` but `dashboard.js` was reading `result.actions` (always `undefined`), causing the Actions tab to always show empty after demo data population. ### Changes Made **`crates/hero_proc_ui/static/js/dashboard.js`** (line 441) ```diff - cachedActions = Array.isArray(result) ? result : (result.actions || []); + cachedActions = Array.isArray(result) ? result : (result.specs || []); ``` **`crates/hero_proc_examples/examples/basic_usage.rs`** (lines 47–48) ```diff - println!("Actions ({}):", actions.value.len()); - for a in &actions.value { + println!("Actions ({}):", actions.specs.len()); + for a in &actions.specs { ``` ### Test Results - 366 tests passed, 0 failed - All workspace crates compile cleanly
Author
Owner

Implementation committed: bfc7994

Browse: bfc7994

Implementation committed: `bfc7994` Browse: https://forge.ourworld.tf/lhumina_code/hero_proc/commit/bfc7994
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#7
No description provided.