Services tab: Status column shows desired state, not actual runtime state #33
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_proc#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The Services tab Status column displays
ServiceWantedStatus(the configured desired state:start,stop,ignore,spec) rather than the actual runtime state of the service.This means every service whose config says "I want to be running" shows start in the Status column, regardless of whether the service is actually running, has failed, or has never been started.
Current behavior
All services show
startin the Status column because that is theirServiceWantedStatus— the intent, not the reality.Expected behavior
The Status column should show the actual runtime state:
running,success,failed,exited, orinactive. Theservice.statusRPC already computes this by checking running jobs and last terminal state — it just isn't used in the list view.Additional context
See comment below for a full terminology guide and implementation notes.
hero_proc Terminology Guide
Before diving into the fix, here's how the core concepts relate to each other:
Concepts (bottom-up)
pending → running → succeeded/failed. Tracks PID, exit code, logs, resource usage.starting → running → ok/error. Created when a service starts.start/stop/ignore/spec). The supervisor ensures reality matches the desired state.Flow
Quick Services
A quick_service is a convenience API that atomically creates:
{service_name}_action{service_name}referencing that actionThis is why the Actions tab showed
_actionsuffixed entries (fixed in #32).The Status Bug
Root cause
In
dashboard.jsrenderServices()(line ~2008):spec.statusisServiceWantedStatus— the configured desired state, not what the service is actually doing. Every service withwanted=startshows the same "start" badge.What already exists
The
service.statusRPC already computes the actual runtime state:This is called when viewing service details, but not in the list view.
Proposed fix
Option A — Show actual status in the list (recommended)
After loading service specs, batch-fetch
service.statusfor each service and display the actual runtime state in the Status column. Rename the current column to show both:running/failed/inactive)Option B — Add a separate column
Keep "Desired" column as-is, add a new "State" column showing actual runtime status.
Questions
service.statusfor each service requires N extra RPC calls (one per service). Should we add a bulkservice.status_allendpoint instead?well, if a service isnt a workflow, doesnt it define one? because after all isnt a run a played instance of a workflow, which the service defines by defining steps that depent and come after? lets explore this more in depth and respond
also see #29, here we created rhai scripts for service lifetimes and also in hero_proc examples. lets make sure these rhai scripts properly use and program against hero_proc by defining services and instantiating runs, not individual actions and instantiating jobs. this brings me to my next concern: the runs tab currently displays a bunch of runs with only 1 job, 1 per _server and 1 per _ui. however if this was a service defined with deps as one action depention on another, it wouldnt be this way, so perhaps rhai scripts may be wrong.
go with option a with fix,
Does a Service define a workflow?
Yes — a Service is a workflow definition, and a Run is a played instance of it.
The data model already supports this:
When
service.start("my-app")is called:depends_onedges →buildruns first, thenmigrate, thenserver, thenhealthcheckSo the hierarchy is:
The Rhai script problem
The current example scripts use
quick_service_set_full()which creates one action per service — this bypasses the workflow model entirely:This is why the Runs tab shows many runs with only 1 job each.
What the scripts should do instead
Using the full Service API, we can define
hero_runneras a single service with 2 actions where the UI depends on the server:This gives:
hero_runner) instead of 2However, this is a larger change (issue #29 Rhai migration scripts + the
quick_serviceconvenience API would need to be reconsidered). I'll track that separately.Implementing Option A now
I'll now implement the Status column fix: replace
ServiceWantedStatuswith actual runtime state fromservice.statusRPC. The approach:service.statusfor each onerunning/failed/inactive/etc.) in the Status columnFixed in commit
a0adc01(Option A).Changes (all in
dashboard.js):loadServices()now batch-fetchesservice.statusfor each service in parallel alongside job countsrenderServices()displays the actual runtime state (running,failed,inactive,success,exited) in the Status column instead ofServiceWantedStatus(start)Remaining from this discussion:
quick_service_set_full()calls — tracked in #29Architecture decision: No Workflow object needed
After discussion, we concluded that Rhai scripts are the workflow layer — hero_proc doesn't need a first-class Workflow object.
The model
Why no Workflow object
depends_onon ActionSpec handles the narrow case of intra-service ordering (e.g., start server before UI)What this means for #29
The Rhai scripts in
examples/rhai/should:proc_process_action()+proc.action_set()to define actions with properdepends_onedgesproc.service_register()to group related actions under one serviceNo new data model changes required — just better use of the existing APIs in the Rhai scripts.
Documented the architecture model in README Core Concepts section (commit
0d3b9b7). Concise table + explanation of each concept and the Rhai-as-workflow pattern.Resolved
Services tab now shows actual runtime state (running/failed/inactive) instead of desired state (start/stop).
loadServices()batch-fetchesservice.statusfor each service — commita0adc010d3b9b7action_set()+service_register()) — commit6c59561Closing.