Skip to content

Add progress reporting to npackd transactions - #11

Merged
imattau merged 1 commit into
masterfrom
phase2-progress-events
Sep 21, 2026
Merged

imattau merged 1 commit into
masterfrom
phase2-progress-events

Conversation

@imattau

@imattau imattau commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • GetTransaction now returns a live progress snapshot while a transaction is running: {"stage": "connecting"|"resolving"|"downloading"|"updating"|"installed", "package": "publisher/name", "detail": "..."}.
  • Renamed the per-transaction Arc<AtomicBool> cancellation flag into TransactionControl, which now carries both the cancellation flag and a shared progress snapshot (std::sync::Mutex<InstallProgress>), threaded through InstallRefOptions/ResolverState exactly where the existing cancellation checkpoints already were — no new checkpoints, no change to when cancellation is checked.
  • This closes the last item from the previous PR's follow-up list, completing roadmap Phase 2.

Scope

This is package-level status (resolving foo..., downloading bar (3 mirrors)...), not per-byte/per-file download progress — a GUI can show a status line without polling ps or scraping stderr, but not a byte-accurate progress bar for a single large download. That's noted as remaining work for a future phase.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features (no warnings)
  • cargo test (51 passing), including a new get_transaction_reports_progress_while_running test
  • Manual smoke test over a real socket: an async Install of npack's own real release against real relays, polled via GetTransaction every second — observed the real connecting → resolving → downloading stage transitions with the correct package name, ending in succeeded

🤖 Generated with Claude Code

GetTransaction now reports a live progress snapshot while a
transaction is running: {"stage": "connecting"|"resolving"|
"downloading"|"updating"|"installed", "package": "...", "detail":
"..."}. Renamed the per-transaction Arc<AtomicBool> cancellation flag
into a TransactionControl that carries both the cancel flag and a
shared progress snapshot, updated at the same package-level
checkpoints install_remote_package already checks for cancellation
(connecting, resolving a package, starting its download, finishing
its install) and in the Update loop (before each package).

This is package-level status, not per-byte download progress -- a
GUI can show "resolving foo...", "downloading bar (3 mirrors)..."
without polling stderr or ps. Per-file/per-byte progress remains
future work.

Verified end-to-end against a real network install: polling
GetTransaction showed the real connecting -> resolving -> downloading
stage transitions with the correct package name.

This closes out the roadmap's Phase 2 (stable service layer).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@imattau
imattau merged commit 9d06e5e into master Sep 21, 2026
3 checks passed
@imattau
imattau deleted the phase2-progress-events branch September 21, 2026 01:35
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.

1 participant