Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(upgrade): delta apply progress bar shows percentage only (no GB scare) - #1355

Merged
BYK merged 1 commit into
mainfrom
byk/fix/delta-apply-progress-pct-only
Aug 3, 2026
Merged

BYK merged 1 commit into
mainfrom
byk/fix/delta-apply-progress-pct-only

Conversation

@BYK

@BYK BYK commented Aug 3, 2026

Copy link
Copy Markdown
Member

What

The delta-upgrade apply progress bar's byte total sums every hop's newSize, so for multi-hop chains it can far exceed the final binary — e.g. the user sees Applying 3 patch(es) [████░░░░] 1.5 GB / 3.1 GB for what ends up being a 310 MB install. A scary inflated number that ticks away without ever closing the gap.

Switch the apply bar to render percentage only (no byte counter). The pre-apply phases (download, read) keep the byte counter since their totals are honest sizes.

Why

Mirror of the Lore fix at BYK/opencode-lore#1519 (and follow-up #1522). Same code path — binpatch emits byte events with summed newSize across hops; the consumer bar formats them.

How

  • packages/cli/src/lib/progress.ts — makeByteProgress gains format: 'pct' (default 'bytes'). When set, the render is ${label} [${bar}] ${pct}% (no / separator, no byte counts). Indeterminate byte counters (totalBytes: null) ignore the flag — they always show the live byte total.
  • packages/cli/src/lib/delta-upgrade.ts — apply phase passes { format: 'pct' }. Pre-apply phases default to 'bytes'. The phase-change branch was refactored to keep lint complexity ≤ 15.
  • API churn: the 4th positional arg (nowMs) moves into a MakeByteProgressOptions bag ({ format?, nowMs? }). This keeps the helper under the lint useMaxParams: 4 budget; existing callers that passed nowMs (tests only) are updated in the same commit. The other call site in upgrade.ts (streamDecompressToFile) doesn't use nowMs and is unaffected — it falls through options = {} default.

Tests

  • 3 new tests in packages/cli/test/lib/progress.test.ts:
    • pct-only rendering at 100% ([████████] 100%, no B/KB/MB/GB/TB substring, no /)
    • pct ignored for indeterminate (null total) counters — still shows live byte count, no %
    • Regression assertion: reads delta-upgrade.ts source and asserts the apply-phase makeByteProgress call passes "pct". Mutation-verified: reverting the pct arg makes the test red.
  • All 10 progress.test.ts tests pass.
  • Full test/lib suite: 6540 passed | 9 skipped (6549), 308 files.
  • pnpm run lint clean.
  • pnpm run typecheck clean.
  • pnpm run check:errors clean.
  • pnpm run check:deps clean.

Out of scope

  • Pre-apply (download/read) byte counters are intentional — they're honest sizes.
  • The binpatch library still emits newSize-summed totals; the consumer chooses how to render them (this matches the established binpatch contract — library emits, consumer renders).

…care)

Multi-hop delta chains sum newSize across every hop, so the apply bar's
byte total can far exceed the final binary (e.g. 930 MB shown for a 310
MB install). The user sees "applying 1.5 GB / 3.1 GB" for what ends up
being a 310 MB install — a scary inflated number that the surrounding
spinner ticks away without ever closing the gap.

Mirror the Lore fix (#1519, #1522): `makeByteProgress` gains a
`format: 'pct'` option that suppresses the byte counter and renders only
the percentage, and the apply-phase call site in `delta-upgrade.ts` opts
in. The download/read phases keep the byte counter since their totals are
honest sizes.

- progress.ts: `ByteProgressFormat` type, `MakeByteProgressOptions` bag
  (keeps the helper under the lint max-params budget). 4th arg moves from
  positional `nowMs` to a `{ format, nowMs }` options object — same
  effective surface for callers that didn't use `nowMs` explicitly.
- delta-upgrade.ts: apply bar passes `{ format: 'pct' }`; refactored
  the phase-change branch to keep lint complexity ≤ 15.
- progress.test.ts: 3 new tests — pct-only rendering, pct ignored on
  indeterminate counters, and a regression assertion that reads
  delta-upgrade.ts and asserts the apply call site actually wires 'pct'
  (mutation-verified: dropping the arg fails the test).

Pre-apply ("download"/"read") phases still show bytes since their
totals are honest sizes.
@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-03 23:11 UTC

@BYK
BYK merged commit 6923168 into main Aug 3, 2026
30 checks passed
@BYK
BYK deleted the byk/fix/delta-apply-progress-pct-only branch August 3, 2026 23:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant