Add progress reporting to npackd transactions - #11
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetTransactionnow returns a liveprogresssnapshot while a transaction isrunning:{"stage": "connecting"|"resolving"|"downloading"|"updating"|"installed", "package": "publisher/name", "detail": "..."}.Arc<AtomicBool>cancellation flag intoTransactionControl, which now carries both the cancellation flag and a shared progress snapshot (std::sync::Mutex<InstallProgress>), threaded throughInstallRefOptions/ResolverStateexactly where the existing cancellation checkpoints already were — no new checkpoints, no change to when cancellation is checked.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 pollingpsor 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 -- --checkcargo clippy --all-targets --all-features(no warnings)cargo test(51 passing), including a newget_transaction_reports_progress_while_runningtestInstallof npack's own real release against real relays, polled viaGetTransactionevery second — observed the realconnecting→resolving→downloadingstage transitions with the correct package name, ending insucceeded🤖 Generated with Claude Code