[web] header Conditions count shows 'undefined' — stale necessary_conditions remap (#26 follow-up) #28

Closed
opened 2026-06-15 07:41:24 +00:00 by sameh-farouk · 1 comment
Member

Symptom

The planner web UI header (visible on every tab) renders the Conditions badge as undefined instead of its count (should be 4 for the main workspace).

Root cause

The web RPC shim's system.counts handler (crates/hero_planner_web/src/index.html:444) remaps:

// Server returns `conditions`; old UI reads `necessary_conditions`.
return { ...c, necessary_conditions: c.conditions };

That comment is stale. It was written when the server's EntityCounts field was conditions. After #26 renamed it to necessary_conditions, the server no longer returns a conditions field — so c.conditions is undefined, and the spread clobbers the correct value with necessary_conditions: undefined. The header (index.html:940, counts.necessary_conditions) then renders "undefined". The badge has been broken since #26 landed.

Confirmed against the live server:

system_counts(main) -> {... "necessary_conditions":4, ...}   # no `conditions` field

Fix

Drop the dead remap — the server returns necessary_conditions directly and the header already reads it:

return c;

Verification

Browser-verified after the fix: the Conditions badge shows 4 (matching system_counts.necessary_conditions=4); 0 RPC console errors. (The remaining console 404s are the unrelated optional hero_voice/hero_orchestrator widgets, not running in the dev stack.)

A 1-line follow-up to the already-closed #26.

## Symptom The planner **web** UI header (visible on every tab) renders the Conditions badge as `undefined` instead of its count (should be 4 for the `main` workspace). ## Root cause The web RPC shim's `system.counts` handler (`crates/hero_planner_web/src/index.html:444`) remaps: ```js // Server returns `conditions`; old UI reads `necessary_conditions`. return { ...c, necessary_conditions: c.conditions }; ``` That comment is stale. It was written when the server's `EntityCounts` field was `conditions`. After **#26** renamed it to `necessary_conditions`, the server no longer returns a `conditions` field — so `c.conditions` is `undefined`, and the spread **clobbers** the correct value with `necessary_conditions: undefined`. The header (`index.html:940`, `counts.necessary_conditions`) then renders "undefined". The badge has been broken since #26 landed. Confirmed against the live server: ``` system_counts(main) -> {... "necessary_conditions":4, ...} # no `conditions` field ``` ## Fix Drop the dead remap — the server returns `necessary_conditions` directly and the header already reads it: ```js return c; ``` ## Verification Browser-verified after the fix: the Conditions badge shows **4** (matching `system_counts.necessary_conditions=4`); 0 RPC console errors. (The remaining console 404s are the unrelated optional `hero_voice`/`hero_orchestrator` widgets, not running in the dev stack.) A 1-line follow-up to the already-closed #26.
Author
Member

Fixed on development (squash). Dropped the stale necessary_conditions: c.conditions remap in crates/hero_planner_web/src/index.html:444 — the server returns necessary_conditions directly since #26, so the spread was clobbering the real value with undefined. Now return c;.

Browser-verified: the header Conditions badge shows 4 (matching system_counts.necessary_conditions=4); 0 RPC console errors.

Fixed on `development` (squash). Dropped the stale `necessary_conditions: c.conditions` remap in `crates/hero_planner_web/src/index.html:444` — the server returns `necessary_conditions` directly since #26, so the spread was clobbering the real value with `undefined`. Now `return c;`. Browser-verified: the header Conditions badge shows **4** (matching `system_counts.necessary_conditions=4`); 0 RPC console errors.
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_planner#28
No description provided.