Skip to content

Show upload progress in stages: sent, ready to send, still to read - #67

Merged
pscheid92 merged 2 commits into
mainfrom
upload-progress-stages
Nov 14, 2026
Merged

pscheid92 merged 2 commits into
mainfrom
upload-progress-stages

Conversation

@pscheid92

Copy link
Copy Markdown
Contributor

The same change as secretli/web#59, for the CLI. The upload line only moved when a whole 32 MiB part was stored, so on a slow connection it sat still for long stretches, then jumped, and a retried part was invisible.

Uploading █████▓▓▓▓▓▓▓░░░░░░░░ 25% · 52.2 MB of 204.0 MB · 14.9 MB/s · 10 s left
Uploading ████████████████████ 100% · 204.0 MB of 204.0 MB · waiting for the server to confirm…

What changes

  • Byte-level progress. api.Client.UploadPart takes an optional *api.PartProgress. Its Sent hook counts the request body as the transport takes it, from zero on every attempt, the transport's own resend over a fresh connection included (through GetBody). Its Retrying hook fires before the wait for another attempt.
  • Stages. share.Params.Progress now receives share.UploadProgress: total, encrypted, sent and stored bytes, plus whether a part waits to retry. They always nest. Stored and in-flight bytes change in one step, so a finished part never counts twice; the new nesting check in the share test caught exactly that.
  • The line. A bar in three parts that always add up to the bundle: sent (█), encrypted and ready to send (▓), still to read (░). Then the amounts, and the speed and time left, or that a part is tried again, or that the server has yet to confirm. A retry shows at once. A narrow terminal loses the speed first, then the bar, so the line never wraps. Downloads are unchanged.

The network calls themselves are unchanged: three 32 MiB parts at once.

Checked

  • make test against a real server, and make lint (0 issues). New tests cover the bar's cells, the line at full and narrow widths and during a retry, the rate starting over when the count goes back, part uploads counting from zero on a retry, and progress that nests and ends at the total.
  • A real secretli share of 200 MB (two files) against the local stack, in a pseudo-terminal, through a proxy throttling the upload: the line moved smoothly from 0% to "waiting for the server to confirm…" and printed the link.

Reaches users with the next release tag.

The upload line only moved when a whole 32 MiB part was stored, so on a
slow connection it sat still for long stretches, then jumped, and a
retried part was invisible.

- A part upload reports the bytes of its body as the transport takes
  them, from zero on every attempt (the transport's own resend over a
  fresh connection included, through GetBody), and says when it will
  retry.
- share.Params.Progress reports encrypted, sent and stored bytes and
  whether a part waits to retry. Stored and in-flight bytes change in
  one step, so a part never counts twice.
- The line draws a bar in three parts that always add up to the bundle:
  sent (█), encrypted and ready to send (▓), still to read (░), then the
  amounts and the speed and time left, or that a part is tried again,
  or that the server has yet to confirm. A narrow terminal loses the
  speed first, then the bar. Downloads are unchanged.

The network calls themselves are unchanged: three 32 MiB parts at once.
govulncheck fails on Go 1.27.3: GO-2026-6859, an HTTP/1 server crash
through a MaxBytesReader header race in net/http, fixed in 1.27.4. The
CLI is a client and only its tests run a server, but CI builds and
releases with the version go.mod names.
@pscheid92
pscheid92 merged commit 391355f into main Nov 14, 2026
13 checks passed
@pscheid92
pscheid92 deleted the upload-progress-stages branch November 14, 2026 20:09
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