Skip to content

A component install reports a rising percentage on real hardware #240

Closed

Description

@V3RON

Scope

A component install reports almost no progress on real hardware. In the real-hardware check on main at 28ebddd:

  • component install android 31 (37 s): one downloading line, then fraction: 1. Nothing in between.
  • A lease with --allow-download for Android 32: percent appeared once, as 100.
  • component install ios 18.6 (402 s): one line at fraction: 0.04, then nothing for about 6.5 minutes.

The plumbing from the installer to the requester works. What the drivers read from sdkmanager and xcodebuild -downloadPlatform does not turn into steady updates.

After this task a requester sees the percentage rise during a real Android and a real iOS download.

Technical spec

File references are to main at 28ebddd. Find code by symbol name.

Cause

captureLines in src/ports/process-runner.ts ends a line only at \n (it splits on \r?\n). sdkmanager redraws its progress bar in place with a bare \r, so every update stays in the unfinished line until the final newline, and runInstallerProcess sees one line whose last percentage is 100. xcodebuild -downloadPlatform is expected to do the same; confirm it from the first seconds of its real output before relying on it.

Modules touched

  • src/ports/process-runner.ts:
    • ProcessRunOptions gains lineEnd?: "newline" | "carriage-return-too", default "newline". It only changes how spawn's stdout and stderr iterables are split; the captured ProcessResult text is unchanged.
    • With "carriage-return-too", captureLines also ends a line at a bare \r. A \r\n pair is one line end, also when the pair is split across two chunks. Empty lines are not yielded in this mode.
    • Every other caller keeps the default, so emulator and simctl output is read as before.
    • The scripted and fake runners used in tests accept the option and split the same way.
  • src/drivers/installer-process.ts: runInstallerProcess spawns with lineEnd: "carriage-return-too". parseProgressPercent is unchanged.
  • No driver change, unless the real xcodebuild output needs it (see Done when).
  • docs/internal/KNOWN-PITFALLS.md: one paragraph under "Component downloads": installers redraw progress with \r, and the port must end a line there for progress to be seen.

Contract and event changes

  • None. More component-progress and lease downloading pushes are sent during a download; their shape is unchanged.

Rules in play

  • architecture.md rule 9 (the change is inside the ProcessRunner port; drivers keep reading lines), rule 10 (one function splits process output), rule 11 (unchanged: the installer process has no timeout of its own).
  • testing.md rules 1 to 4.

Tests

  • With lineEnd: "carriage-return-too", output 10%\r20%\r30%\n yields three lines.
  • With the default, the same output yields one line.
  • A \r\n pair yields one line end, not an empty line, in both modes.
  • A \r at the end of one chunk and a \n at the start of the next yield one line end.
  • ProcessResult.stdout is identical in both modes.
  • runInstallerProcess reports 10, 20 and 30 for an installer that prints [= ] 10% a\r[== ] 20% b\r[===] 30% c\n.
  • runInstallerProcess reports each percentage while the process is still running, before it exits.
  • e2e with the fake driver is unaffected: the existing install tests pass unchanged.

Done when

  • On real hardware, an Android system image install reports at least five distinct percentages. Ask the maintainer before running this.
  • On real hardware, an iOS runtime install reports a percentage at least once a minute while it downloads. Ask the maintainer before running this. If xcodebuild prints no further progress when its output is a pipe, say so in the PR with the raw output as evidence, and hand off rather than guessing: that needs a different fix.
  • pnpm check is green.

Out of scope

  • Bytes done, speed, or time left.
  • Running an installer under a pseudo-terminal.

Depends on

Approval

  • Approved for delivery

Written by an agent.

Activity

  1. added
    task:draft
    on Oct 2, 2026
  2. V3RON commented on Oct 2, 2026

    @V3RON
    ContributorAuthor

    Spec updated: Technical spec filled in (cause: process output is split only at newlines, installers redraw with a carriage return); Done when and Out of scope amended.

    Written by an agent.

  3. added
    task:ready
    and removed
    task:draft
    on Oct 2, 2026
  4. github-actions commented on Oct 2, 2026

    @github-actions
    Contributor

    Now task:ready: approved, technical spec present.

  5. self-assigned this
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions