Skip to content

Give a task the host died on a state of its own (schema 281) - #1212

Merged
mastacontrola merged 1 commit into
dev-branchfrom
fix-1206-failed-task-state-15
Aug 19, 2026
Merged

Give a task the host died on a state of its own (schema 281)#1212
mastacontrola merged 1 commit into
dev-branchfrom
fix-1206-failed-task-state-15

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Port of #1211, completing #1210. Independent of anything else open — different base.

The problem

A FOS error report is recorded on 1.5 since #1210, and the task itself was left exactly where it was: Queued or In-Progress, forever. Host::loadTask() and Host::getActiveTaskCount() count those states as live, so the host could not be re-tasked until somebody noticed and cancelled the task by hand.

The change

  • taskStates row 6, Failed (schema 281)
  • TaskState::getFailedState() with a FAILED_STATE hook, plus the FOGBase passthrough its five siblings already have
  • TaskError moves the task to it on an error; a warning never does

Not Cancelled: that means an administrator stopped it, and losing the difference between "somebody stopped this" and "this broke" costs the operator the one fact they open the task list to find.

Why this is portable to a maintenance branch at all: every "is this task live" test in the tree is an allowlistgetQueuedStates() plus getProgressState() — so a state nobody listed is inactive by construction and no call site had to learn about it. 1.5 has no history pane, so a Failed task is exactly as invisible in the UI as a Complete or Cancelled one already is; what changes is that the host is free and the task has stopped claiming otherwise. (1.6 got a Recent-pane filter and a task log tab in #1211; neither of those panes exists here.)

The state is written for every task type — a Memtest the host died on is as finished as a deploy — while HOST_IMAGE_FAIL stays imaging-specific. _markFailed() is guarded on the taskStates row existing, so a web tree updated ahead of its database leaves the task alone rather than pointing it at a state that is not there.

Verification

Against an isolated copy of the real 1.5 database (podman MariaDB on :13306, shadow web tree, throwaway host on a locally-administered MAC, 2079 real hosts — nothing live touched):

case result
warning task stays Queued, taskLog row typed warning
error task → 6, getActiveTaskCount() → 0, loadTask() invalid
error / warning / unknown MAC identical ## body
step 281 on a database at schema 278 applies clean

Seven assertions mutation-tested (wrong constant, unseeded row, call removed, call moved either side of both gates, a second field written, guard removed). Full suite green.

Ported from 1.6 #1211, completing the port of #1210. A FOS error report is
recorded there, and the task itself was left exactly where it was: Queued or
In-Progress, forever. The task page still said the machine was working on
it, and because Host::loadTask() and getActiveTaskCount() count those states
as live, the host could not be re-tasked until somebody noticed and
cancelled it by hand.

Adds taskStates row 6, Failed, and moves the task to it when FOS reports an
error. A warning never does -- a warning means FOS carried on.

Not Cancelled, which was the alternative. Cancelled means an administrator
stopped it; losing the difference between "somebody stopped this" and "this
broke" costs the operator the one fact they open the task list to find.

Additive on a maintenance branch, which is why it is portable at all: every
"is this task live" test in the tree is an allowlist -- getQueuedStates()
plus getProgressState() -- so a state nobody listed is inactive by
construction, and no call site had to learn about it. 1.5 has no history
pane, so a Failed task is as invisible in the UI as a Complete or Cancelled
one already is; what changes is that the host is free and the task has
stopped claiming otherwise.

The state is written for every task type, not just imaging ones: a Memtest
the host died on is as finished as a deploy. Only HOST_IMAGE_FAIL stays
imaging-specific. Guarded on the taskStates row existing, so a web tree
updated ahead of its database leaves the task alone rather than pointing it
at a state that is not there.

Verified against an isolated copy of the 1.5 database (podman MariaDB,
shadow web tree, throwaway host on a locally-administered MAC, 2079 real
hosts): a warning left the task Queued and wrote a row typed warning; an
error moved it to 6 and dropped the host's active task count to zero; error,
warning and unknown-MAC all still answer an identical `##`. Step 281 applies
clean on a database at 278. Seven assertions mutation-tested.

Co-Authored-By: Claude <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit f794530 into dev-branch Aug 19, 2026
3 checks passed
@mastacontrola
mastacontrola deleted the fix-1206-failed-task-state-15 branch August 19, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants