Repository navigation
feat(gateway): delta apply bar shows percentage only (no GB scare) - #1519
Merged
Merged
Conversation
Multi-hop chains sum newSize across hops, so the apply bar's byte total can far exceed the final binary (e.g. 930 MB shown for a 310 MB install). Switch the apply progress bar to format='pct' so users see only the percentage, not a scary inflated byte count. - progress.ts: makeByteProgress gains format: 'bytes' | 'pct' (default bytes), adds the percentage-only render branch. - delta-upgrade.ts: apply bar now passes 'pct'. - progress.test.ts: regression test for pct-only rendering. Extracted from the now-obsolete PR #1503 (which also tried to bump binpatch to ^0.3.0 — already superseded by #1515 @ ^0.3.1); this carries only the progress feature.
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 6532 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 76.42% 76.42% —%
==========================================
Files 172 172 —
Lines 27698 27700 +2
Branches 19923 19926 +3
==========================================
+ Hits 21166 21168 +2
- Misses 6532 6532 —
- Partials 2037 2037 —Generated by Codecov Action |
Comment on lines
52
to
57
| * @param out - Output stream (defaults to stderr, the CLI's progress channel). | ||
| * @param format - `"bytes"` (default) renders the accumulated/total byte | ||
| * count. `"pct"` renders only the percentage — useful when the byte total | ||
| * is misleading (e.g. a multi-hop chain where intermediate hops inflate the | ||
| * displayed size beyond the actual final binary). | ||
| */ |
There was a problem hiding this comment.
Bug: The makeByteProgress call for the apply-phase progress bar is missing the format: "pct" argument, causing it to display byte counts instead of the intended percentage.
Severity: MEDIUM
Suggested Fix
Update the call to makeByteProgress in delta-upgrade.ts to include the format parameter. The call should be bar = makeByteProgress("Applying patches", event.total, undefined, "pct"); to ensure the progress bar displays a percentage.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/gateway/src/cli/lib/progress.ts#L52-L57
Potential issue: During a multi-hop delta upgrade, the progress bar for the 'apply'
phase is intended to show a percentage to avoid user confusion from large byte counts.
However, the call to `makeByteProgress` in `delta-upgrade.ts` omits the `format: "pct"`
argument. Because the `makeByteProgress` function defaults to a `"bytes"` format, the
progress bar will incorrectly display cumulative byte sizes (e.g., "930 MB / 930 MB" for
a 310 MB binary), which is the exact issue the change was meant to resolve.
Did we get this right? 👍 / 👎 to inform future reviews.
Contributor
|
BYK
added a commit
that referenced
this pull request
Jul 28, 2026
…-up) PR #1519 added the pct format option to makeByteProgress and intended to use it for the multi-hop apply bar, but the call site in delta-upgrade.ts was never updated. The bar kept falling back to the helper's default 'bytes' mode, so the 'pct only' UX never applied — the GB scare remained. Fix: pass 'pct' as the 4th arg. Regression test: progress.test.ts now reads delta-upgrade.ts source and asserts the makeByteProgress apply call passes 'pct'. Mutation verified — without the arg, the test fails; with the arg, it passes.
BYK
added a commit
that referenced
this pull request
Jul 28, 2026
…-up) PR #1519 added the pct format option to makeByteProgress and intended to use it for the multi-hop apply bar, but the call site in delta-upgrade.ts was never updated. The bar kept falling back to the helper's default 'bytes' mode, so the 'pct only' UX never applied — the GB scare remained. Fix: pass 'pct' as the 4th arg. Regression test: progress.test.ts now reads delta-upgrade.ts source and asserts the makeByteProgress apply call passes 'pct'. Mutation verified — without the arg, the test fails; with the arg, it passes.
BYK
added a commit
that referenced
this pull request
Jul 29, 2026
…-up) PR #1519 added the pct format option to makeByteProgress and intended to use it for the multi-hop apply bar, but the call site in delta-upgrade.ts was never updated. The bar kept falling back to the helper's default 'bytes' mode, so the 'pct only' UX never applied — the GB scare remained. Fix: pass 'pct' as the 4th arg. Regression test: progress.test.ts now reads delta-upgrade.ts source and asserts the makeByteProgress apply call passes 'pct'. Mutation verified — without the arg, the test fails; with the arg, it passes.
BYK
added a commit
that referenced
this pull request
Jul 29, 2026
…p) (#1522) PR #1519 added the `pct` format option to `makeByteProgress` and intended to use it for the multi-hop apply bar, but the call site in `delta-upgrade.ts` was never updated. The bar kept falling back to the helper's default `bytes` mode, so the 'pct only' UX never applied — the GB scare remained. Fix: pass `pct` as the 4th arg. Regression test: `progress.test.ts` now reads `delta-upgrade.ts` source and asserts the makeByteProgress apply call passes `pct`. Mutation-verified: removing the `pct` arg makes the test fail; restoring it makes the test pass.
7 tasks
BYK
added a commit
to getsentry/cli
that referenced
this pull request
Aug 3, 2026
…care) (#1355) ## 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/loreai#1519](BYK/loreai#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).
BYK
added a commit
to getsentry/toolkit
that referenced
this pull request
Sep 30, 2026
…care) (#1355) ## 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/loreai#1519](BYK/loreai#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).
mr-danya
pushed a commit
to mr-danya/sentry-mcp
that referenced
this pull request
Oct 6, 2026
…care) (getsentry#1355) ## 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/loreai#1519](BYK/loreai#1519) (and follow-up getsentry#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).
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.
Multi-hop chains sum newSize across hops, so the apply bar's byte total can far exceed the final binary (e.g. 930 MB shown for a 310 MB install). Switch the apply progress bar to format='pct' so users see only the percentage, not a scary inflated byte count.
Extracted from the now-obsolete PR #1503 (which also tried to bump binpatch to ^0.3.0 — already superseded by #1515 @ ^0.3.1); this carries only the progress feature. Test: 7 passed.