upgrade.plan: rows include template user as a target — 13 noise rows per call #32

Open
opened 2026-05-25 09:08:45 +00:00 by zaelgohary · 0 comments
Member

Problem

upgrade.plan returns a row for every catalog service under every managed user — including template, which is the source of the rollout, not a target.

On herodev today:

rows total=104, will_install=91
  SKIP template/service_proc reason=user's hero_proc daemon unreachable
  SKIP template/service_router reason=user's hero_proc daemon unreachable
  SKIP template/service_mycelium reason=user's hero_proc daemon unreachable
  ... (13 template rows total)

All 13 template rows skip with "user's hero_proc daemon unreachable" because the template user intentionally has no running hero_proc on a deployed box — it's only the build/snapshot source.

Root cause

upgrade::plan() (around line 283 of crates/hero_codescalers_server/src/upgrade.rs) iterates users::list(state) and emits a row per (user, catalog_service) without excluding TEMPLATE_USER. The constant exists at upgrade.rs:59 (pub const TEMPLATE_USER: &str = "template") but isn't referenced in the plan loop.

Suggested fix

Filter the user list before the rows loop:

let users = users.into_iter().filter(|u| u.username != TEMPLATE_USER).collect::<Vec<_>>();

Or add the filter to the installed check so the template user's bin tree doesn't produce an installed=true row.

Impact

Cosmetic for now (plan output is noisier than necessary, operators have to mentally filter). Becomes a real bug if a future template user does have a daemon (e.g. snapshot validator) — the rollout would then try to overwrite its own source mid-flight.

## Problem `upgrade.plan` returns a row for **every** catalog service under **every** managed user — including `template`, which is the *source* of the rollout, not a target. On herodev today: ``` rows total=104, will_install=91 SKIP template/service_proc reason=user's hero_proc daemon unreachable SKIP template/service_router reason=user's hero_proc daemon unreachable SKIP template/service_mycelium reason=user's hero_proc daemon unreachable ... (13 template rows total) ``` All 13 template rows skip with `"user's hero_proc daemon unreachable"` because the template user intentionally has no running hero_proc on a deployed box — it's only the build/snapshot source. ## Root cause `upgrade::plan()` (around line 283 of `crates/hero_codescalers_server/src/upgrade.rs`) iterates `users::list(state)` and emits a row per `(user, catalog_service)` without excluding `TEMPLATE_USER`. The constant exists at `upgrade.rs:59` (`pub const TEMPLATE_USER: &str = "template"`) but isn't referenced in the plan loop. ## Suggested fix Filter the user list before the rows loop: ```rust let users = users.into_iter().filter(|u| u.username != TEMPLATE_USER).collect::<Vec<_>>(); ``` Or add the filter to the `installed` check so the template user's bin tree doesn't produce an `installed=true` row. ## Impact Cosmetic for now (plan output is noisier than necessary, operators have to mentally filter). Becomes a real bug if a future template user *does* have a daemon (e.g. snapshot validator) — the rollout would then try to overwrite its own source mid-flight.
Sign in to join this conversation.
No labels
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_codescalers#32
No description provided.