This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
fix(upgrade): delta apply progress bar shows percentage only (no GB scare) - #1355
Merged
Merged
Conversation
…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.
Contributor
|
5 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 seesApplying 3 patch(es) [████░░░░] 1.5 GB / 3.1 GBfor 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
newSizeacross hops; the consumer bar formats them.How
packages/cli/src/lib/progress.ts—makeByteProgressgainsformat: '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.nowMs) moves into aMakeByteProgressOptionsbag ({ format?, nowMs? }). This keeps the helper under the lintuseMaxParams: 4budget; existing callers that passednowMs(tests only) are updated in the same commit. The other call site inupgrade.ts(streamDecompressToFile) doesn't usenowMsand is unaffected — it falls throughoptions = {}default.Tests
packages/cli/test/lib/progress.test.ts:[████████] 100%, noB/KB/MB/GB/TBsubstring, no/)nulltotal) counters — still shows live byte count, no%delta-upgrade.tssource and asserts the apply-phasemakeByteProgresscall passes"pct". Mutation-verified: reverting thepctarg makes the test red.progress.test.tstests pass.test/libsuite: 6540 passed | 9 skipped (6549), 308 files.pnpm run lintclean.pnpm run typecheckclean.pnpm run check:errorsclean.pnpm run check:depsclean.Out of scope
download/read) byte counters are intentional — they're honest sizes.binpatchlibrary still emitsnewSize-summed totals; the consumer chooses how to render them (this matches the establishedbinpatchcontract — library emits, consumer renders).