Task log: recent tasks with status, Enter shows the log #25

Merged
Duckboot merged 1 commits from feat/task-log-10 into main 2026-11-03 00:14:57 +01:00
Owner

What

  • Main screen: l opens "Tasks", the recent cluster tasks, newest first.
  • Info screen: l shows only that guest's tasks.
  • Columns: start, duration (or "running"), node, type, VMID (- for node tasks), user, status. A failed task gets a ! in the leading column.
  • Log: Enter opens the task's log in a plain-text widget, so the output is never parsed as markup.

task list -o json has no start or end times, so the list comes from /cluster/tasks. The upid must start with UPID:; it is checked before it is passed to the CLI as a positional argument.

Review fixes

  • A finished task without a start time no longer crashes the app. Its duration shows -.
  • "running" now means the task has no endtime. A finished task with an empty status shows "unknown" and is flagged.

Verification

  • 420 tests pass.
  • ruff check and ruff format --check report no issues.
  • betterleaks found no secrets.
  • Read-only live check: 25 tasks were listed. The log of the newest task (vzdelsnapshot 104) ends with TASK OK.

This PR is stacked on #24 (live usage), which is stacked on #22 (CI). Merge them in that order.

Closes #10

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

## What - **Main screen:** `l` opens "Tasks", the recent cluster tasks, newest first. - **Info screen:** `l` shows only that guest's tasks. - **Columns:** start, duration (or "running"), node, type, VMID (`-` for node tasks), user, status. A failed task gets a `!` in the leading column. - **Log:** Enter opens the task's log in a plain-text widget, so the output is never parsed as markup. `task list -o json` has no start or end times, so the list comes from `/cluster/tasks`. The upid must start with `UPID:`; it is checked before it is passed to the CLI as a positional argument. ## Review fixes - A finished task without a start time no longer crashes the app. Its duration shows `-`. - "running" now means the task has no endtime. A finished task with an empty status shows "unknown" and is flagged. ## Verification - 420 tests pass. - `ruff check` and `ruff format --check` report no issues. - `betterleaks` found no secrets. - Read-only live check: 25 tasks were listed. The log of the newest task (vzdelsnapshot 104) ends with `TASK OK`. This PR is stacked on #24 (live usage), which is stacked on #22 (CI). Merge them in that order. Closes #10 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Duckboot added 3 commits 2026-11-03 00:04:07 +01:00
Add CI on Gitea Actions: pytest and ruff on every PR
CI / pytest and ruff (pull_request) Successful in 3m53s
CI / pytest and ruff (push) Has been cancelled
8c2b48a04c
.gitea/workflows/ci.yaml runs on PRs into main and on pushes to main.
It installs uv, runs `uv sync --locked` with Python 3.12 (the lowest
version requires-python allows), then pytest, `ruff check` and
`ruff format --check`.

ruff is pinned in the dev group (0.17.3). The repo has no ruff config,
so the rules are ruff's defaults for that version; pinning makes CI
and local runs check the same rules. The setup follows the workflow
that already runs green on this Gitea instance (ubuntu-latest, pinned
checkout SHA, uv via the official script). The README gets a CI badge
and the lint commands.

Closes #11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Show live usage: CPU % and Mem % in the table, in-use on the info screen
CI / pytest and ruff (pull_request) Successful in 3m49s
CI / pytest and ruff (push) Has been cancelled
eec65e0585
The guest table gets two last columns, CPU % (cpu * 100) and Mem %
(mem / maxmem), each with one decimal. They show "-" for a guest that
is not running or lacks the field.

The info screen's Resources table gets a header and an "In use"
column: CPU %, memory MiB with %, swap for containers, and rootfs used
GiB with % for containers. VM disks show "-", because the API reports
0 without guest-agent disk info. The info screen reads status and
usage in one status/current call (new cli.current).

After an action, the acted guest's status and usage both come from
status/current, so a guest that has just started no longer shows the
lagging listing's 0.0 %.

One blind-written test expected a VM's CPU cell to read "4 cores". VMs
have always shown sockets ("4 cores × 1 socket", as the resources
spec and its tests define), so that expectation was corrected.

Closes #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the task log: recent tasks with status, Enter shows the log
CI / pytest and ruff (pull_request) Successful in 4m10s
CI / pytest and ruff (push) Successful in 4m32s
1ed5e5069b
l on the main screen opens "Tasks", the recent cluster tasks newest
first. l on the info screen shows only that guest's tasks. Columns:
start, duration (or "running"), node, type, VMID ("-" for node
tasks), user and status. A failed task gets a "!" in the leading
column. Enter opens the task's log in a plain-text widget, so the
output is never parsed as markup.

`task list -o json` has no start or end times, so the list comes from
`/cluster/tasks`. The upid is validated (it must start with "UPID:")
before it goes in as a positional argument.

Review fixes:
- A finished task without a start time no longer crashes the app; its
  duration shows "-".
- "running" now means there is no endtime. A finished task with an
  empty status shows "unknown" and is flagged.

Read-only live check: 25 tasks listed, and the log of the newest
(vzdelsnapshot 104) ends with TASK OK.

Closes #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Duckboot merged commit 1ed5e5069b into main 2026-11-03 00:14:57 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Duckboot/cv4pve-cli-tui#25