feat(devices): live agent-update progress in the Update agent dialog (VAPP-62) #74

Merged
David merged 2 commits from feat/VAPP-62-live-update-progress into main 2026-07-01 03:24:11 +02:00
Owner

Web-UI consumer of the agent-update progress stream. The agent emits progress (VA-97, merged) and the server relays it to browsers as an {"action":"event","event":{"action":"agentupdate",...}} frame (VS-77, merged). This renders that stream in the Update agent dialog, which was previously fire-and-forget: it showed one static "Update sent..." line, so a failed update looked identical to a successful one.

Changes

  • live.rs: decode_frame recognizes the inner event.action == "agentupdate" and parses {nodeid, session, phase, received, total, detail} into a new UpdateProgress. A new Live::update_progress signal (full node id -> latest progress) is patched by the wasm driver, mirroring connectivity.
  • device_detail.rs: the modal stays open after the push. When a stream is arriving for this node it shows the phase label, a download progress bar (received/total), and a distinct terminal state: a failure line with the agent/server-supplied detail, or a "verified, restarting" line. When no stream arrives (device skipped as already-current, or a pre-VA-97 agent) it falls back to the existing static ack summary, so behavior never regresses.
  • A guarded use_effect refetches the device once, after the terminal restarting phase plus the agent's reconnect, so the "Agent" fact and the VAPP-61 current-vs-target comparison reflect the new build without a manual reload.

Acceptance criteria

  • live.rs decodes agentupdate and exposes per-node progress via Live::update_progress. ✔
  • The dialog stays open and shows live phase + download bar + verify/terminal result. ✔
  • Distinct terminal success ("verified, restarting") and failure (with reason) states. ✔
  • Post-update device refetch updates the Agent version without a manual reload. ✔ (guarded, fires once per transfer on restarting + reconnect)
  • Degrades to the static messaging when skipped / older agent. ✔ (fallback branch)
  • just pre-commit (fmt + clippy -D warnings on server and wasm + tests) passes. ✔

Verification note

Covered by unit tests on the frame decoder and progress helpers plus the full just pre-commit. Not exercised end-to-end against a live update in a running browser, so the effect-driven refetch timing (restarting + reconnect) is reasoned, not observed.

Depends on VS-77 (merged) which depends on VA-97 (merged). Relates to VAPP-61 (merged; provides the current/target version block this builds on).

Web-UI consumer of the agent-update progress stream. The agent emits progress (VA-97, merged) and the server relays it to browsers as an `{"action":"event","event":{"action":"agentupdate",...}}` frame (VS-77, merged). This renders that stream in the Update agent dialog, which was previously fire-and-forget: it showed one static "Update sent..." line, so a failed update looked identical to a successful one. ## Changes - `live.rs`: `decode_frame` recognizes the inner `event.action == "agentupdate"` and parses `{nodeid, session, phase, received, total, detail}` into a new `UpdateProgress`. A new `Live::update_progress` signal (full node id -> latest progress) is patched by the wasm driver, mirroring `connectivity`. - `device_detail.rs`: the modal stays open after the push. When a stream is arriving for this node it shows the phase label, a download progress bar (received/total), and a distinct terminal state: a failure line with the agent/server-supplied `detail`, or a "verified, restarting" line. When no stream arrives (device skipped as already-current, or a pre-VA-97 agent) it falls back to the existing static ack summary, so behavior never regresses. - A guarded `use_effect` refetches the device once, after the terminal `restarting` phase plus the agent's reconnect, so the "Agent" fact and the VAPP-61 current-vs-target comparison reflect the new build without a manual reload. ## Acceptance criteria - `live.rs` decodes `agentupdate` and exposes per-node progress via `Live::update_progress`. ✔ - The dialog stays open and shows live phase + download bar + verify/terminal result. ✔ - Distinct terminal success ("verified, restarting") and failure (with reason) states. ✔ - Post-update device refetch updates the Agent version without a manual reload. ✔ (guarded, fires once per transfer on restarting + reconnect) - Degrades to the static messaging when skipped / older agent. ✔ (fallback branch) - `just pre-commit` (fmt + clippy -D warnings on server and wasm + tests) passes. ✔ ## Verification note Covered by unit tests on the frame decoder and progress helpers plus the full `just pre-commit`. Not exercised end-to-end against a live update in a running browser, so the effect-driven refetch timing (restarting + reconnect) is reasoned, not observed. Depends on VS-77 (merged) which depends on VA-97 (merged). Relates to VAPP-61 (merged; provides the current/target version block this builds on).
feat(devices): live agent-update progress in the Update agent dialog
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 35s
7073ab79c2
The Update agent modal was fire-and-forget: it showed one static "Update sent..." line from the push ack, so a failed update looked identical to a successful one. It now watches the live progress stream the agent emits (VA-97) and the server relays as an `agentupdate` event (VS-77).

- live.rs: `decode_frame` recognizes the inner `event.action == "agentupdate"` and parses `{nodeid, session, phase, received, total, detail}` into a new `UpdateProgress`. A new `Live::update_progress` signal maps full node id -> latest progress, patched by the wasm driver like `connectivity`.
- device_detail.rs: the modal stays open after the push and, when a stream is arriving for this node, renders the phase label, a download progress bar derived from received/total, and a distinct terminal state - a failure line (with the agent/server detail) or a "verified, restarting" line. When no stream arrives (device skipped as already-current, or a pre-VA-97 agent), it falls back to the existing static ack summary, so behavior never regresses.
- A guarded `use_effect` refetches the device once, after the terminal `restarting` phase plus the agent's reconnect, so the "Agent" fact and the VAPP-61 current-vs-target comparison reflect the new build without a manual reload.

Tests: `decode_frame` for downloading/failed/missing-nodeid agentupdate frames, and `UpdateProgress` percent/phase-label helpers. `just check` (fmt + clippy -D warnings on server and wasm + tests) passes.

#VAPP-62

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merge branch 'main' into feat/VAPP-62-live-update-progress
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 35s
Create release / Create release from merged PR (pull_request) Has been skipped
94a7dd7808
David scheduled this pull request to auto merge when all checks succeed 2026-07-01 03:23:37 +02:00
David merged commit e63751736f into main 2026-07-01 03:24:11 +02:00
David deleted branch feat/VAPP-62-live-update-progress 2026-07-01 03:24:11 +02:00
Sign in to join this conversation.
No reviewers
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
psa-systems/vervain-apps!74
No description provided.