Files
PSProxmoxVE/docs/decisions/0001-task-polling-must-use-taskservice-waitfortask.md
T
goodolclint-claude[bot] b90791e2bf docs: migrate DECISIONS.md to house-format ADRs, and retire the review folder (#131)
D001-D021 become ADR 0001-0021 in docs/decisions/, one decision per file.
D017's PESTER_VERSION amendment was a second decision in one entry and becomes
ADR 0022. ADR 0023 records the migration and reverses the lane2-change-plan
ruling that deliberately kept DECISIONS.md until the CI lane work landed.

DECISIONS.md is reduced to a stub with a D-to-ADR redirect table, so the four
released CHANGELOG entries and older issue bodies that cite it degrade to a
redirect rather than a dead reference.

docs/review/ and docs/lane2-change-plan.md are deleted (ADR 0024). Of 91
findings, 83 were resolved and six of the seven still open were already GitHub
issues; F021 was the exception and is now #130.

CLAUDE.md's Key Conventions list gains the two rules it was missing and becomes
the checklist, with the ADRs carrying rationale.
2026-09-02 14:49:07 +00:00

1.4 KiB

ADR 0001 — Task polling must use TaskService.WaitForTask

  • Status: Accepted
  • Date: 2026-03-22
  • Deciders: unrecorded; adopted during review scan 2026-03-22
  • Context source: docs/review/findings.json F032, F033, F036, F058

Context

Four VM/network cmdlets (Invoke-PveNetworkApply, New-PveSnapshot, Restore-PveSnapshot, Remove-PveSnapshot) and one guest exec cmdlet had copy-pasted polling loops with no timeout, so a cmdlet hung indefinitely if a PVE task stalled.

TaskService.WaitForTask already has timeout enforcement, failure detection and WriteProgress support. Every inline loop was a worse reimplementation of it.

Decision

All task-polling loops use TaskService.WaitForTask(upid, session, timeout, progress). No cmdlet file implements its own while(true) or do/while polling.

TaskService.WaitForTask(upid, session, TimeoutSeconds, this);

Rejected alternatives

An inline poll in the cmdlet. It carries no timeout, no failure detection and no progress reporting, and each copy drifts from the others:

while (true)
{
    var status = taskService.GetTask(upid, session);
    if (status.IsFinished) break;
    Thread.Sleep(1000);
}

Consequences

Five cmdlets — three container snapshot, two storage — still carried the inline form at scan 2026-03-22, and were converted on 2026-03-23 (F058, resolved).