Expand description
Single source of truth for every time budget in the crate. Bumping a
timeout means editing here — not hunting Duration::from_secs(…)
literals across modules (they were spread over seven files, and the
user-facing messages duplicated the numbers a second time: “up to 10
min”, “after 50 s”, “waiting 60 s …”).
Shape rule: one const per concept, typed for its call site — Duration
where the API takes one, u64 seconds where it counts seconds (clap
defaults, retry loops). Messages format the const instead of restating
the number, so prose can never drift from the value.
Every value is the one the code used before this module existed: this is a re-homing, not a retune. Tiny fixture durations inside unit tests stay with those tests (they bound error paths, not real waits); the canary and the example keep their own explicitly generous budgets below rather than silently inheriting production ones.
Constants§
- BOOT_
SSH_ DEADLINE run: boot → first SSH banner. The printed “up to N min” line is derived from this, so the message can’t lie about the real budget. (installusesDEFAULT_INSTALL_SSH_DEADLINE_SECSinstead.)- CANARY_
SSH_ DEADLINE - Weekly canary: latest retail Windows ISO end-to-end, bounded by one deadline used
both as the outer
timeoutand the innerwait_for_sshbudget. - DEFAULT_
BOOT_ NARRATION_ SECS - Default narration cadence in seconds: the “… still waiting for SSH
(Ns elapsed)” pulse. Owned by
SamplingProfilelike the other cadences; explicit flags never touch it (it names log rhythm, not a wait budget). - DEFAULT_
CLASSIFY_ EVERY_ SECS - Default for
--classify-every-secs: the in-memory screen-classification cadence (screendump + nearest-exemplar match, no disk write). Faster than the disk time-lapse so phase changes and error screens surface in the log within seconds while PNGs stay minute-scale. 0 disables it. - DEFAULT_
INSTALL_ SSH_ DEADLINE_ SECS - Default for
--install-timeout-secs(install,run --win-iso): how long a still-progressing unattended install may take to report ready. Generous on purpose — a slow host applies the image for hours, and a parked guest is caught separately byIDLE_BAIL_SECS. - DEFAULT_
SCREENSHOTS_ EVERY_ SECS - Default for
--screenshots-every-secs: the install time-lapse andrun’s boot time-lapse cadence (also whatrun --win-isouses for its install-chain time-lapse, which has no flag of its own). Disk PNG writes; 0 disables saving (classification still runs on its own cadence below). - EXAMPLE_
SHUTDOWN_ GRACE examples/boot.rs: ACPI-less graceful shutdown budget.- EXAMPLE_
SSH_ DEADLINE examples/boot.rs: first-setup wait on a cold, unproven image.- GOLDEN_
TAG - Internal snapshot tag for the landed state (
qemu-img snapshot -c). - GUEST_
SHUTDOWN_ SECS - Bound for a clean guest shutdown ahead of a golden snapshot: the guest
gets this long to halt after
Stop-Computerbefore the snapshot path gives up and reports instead of capturing a dirty disk. - IDLE_
BAIL_ SECS - Stall watchdog bail: frozen disk I/O + no banner this long = parked at
an input screen (recovery, EULA). Fails fast with evidence instead of
polling SSH against a guest that has stopped moving — this is what lets
DEFAULT_INSTALL_SSH_DEADLINE_SECSstay generous. - IDLE_
WARN_ SECS - Stall watchdog: warn when block I/O has been completely frozen this long
with no SSH banner (a working boot never flatlines — local NVMe only,
no network boot). Warn-once, then
IDLE_BAIL_SECSbails with evidence. - MIGRATION_
BUDGET_ SECS - Bound for a live migration-to-file (
snapshot --live): 4 GB of guest RAM over loopback lands in seconds; this only ever fires on a wedged migration, never on a slow-but-moving one. - MIGRATION_
POLL_ SECS - Poll cadence while a live migration runs.
- MONITOR_
CONNECT_ SECS - Budget for the first successful monitor (HMP) handshake after spawn.
Never fails fast on a live-but-slow QEMU: an early bail left slow hvf
starters to
kill_on_drop. - MONITOR_
RETRY_ STEP_ SECS - Sleep between monitor connect retries — and the amount
connect_retryadds to its own accounting, so the reported elapsed time stays honest. - MONITOR_
SOCKET_ POLL_ SECS - Poll interval while waiting for the monitor socket file.
- MONITOR_
SOCKET_ WAIT_ SECS - How long to wait for the monitor socket file to appear after spawn (bind = QEMU starting).
- PROGRESS_
HEARTBEAT - Cadence of the “still installing: … — Ns elapsed, N reboot(s) so far”
heartbeat during the readiness wait. Probes run every
READINESS_PROBE_INTERVAL; printing on every one buried the log, so progress is narrated on change plus this slower pulse (proof of life, not event spam). - QMP_
QUIT_ POLL_ COUNT - How many times
stopre-probes QMP afterquitbefore declaring the VM wedged, and the sleep between probes (20 × 500 ms ≈ 10 s total). - QMP_
QUIT_ POLL_ INTERVAL - READINESS_
PROBE_ BUDGET - Hard budget for one guest-readiness probe (
probe_setup_done). A stalled handshake mid-reboot must surface as “not yet”, never hang the wait loop. - READINESS_
PROBE_ INTERVAL - Sleep between readiness probes (each probe is a full login + PowerShell cold start — no need to hammer).
- RUNTIME_
EXIT_ GRACE - Grace the runtime gives leaked blocking threads at process exit before
abandoning them (a pending
stdin.read()in the shell loop otherwise parks a pool thread forever and the CLI never exits). - SPAWN_
GUARD - Grace after spawn before checking whether QEMU rejected its argv — a healthy boot is still starting here, so a live child means success and only an exited child fails fast (instead of polling SSH for minutes against a dead process).
- SSH_
BANNER_ CONNECT_ BUDGET - Budget for the TCP connect of a single banner probe (
banner_once). Separate fromSSH_BANNER_READ_BUDGET: connect and read stall for different reasons, and shortening one shouldn’t silently shorten the other. - SSH_
BANNER_ READ_ BUDGET - Budget for reading the
SSH-2.0-…banner once TCP connects. Bounds the banner wait so a slirp half-open forward (accepts, then stalls) degrades to another poll instead of a hang. - SSH_
EXEC_ DRAIN - Bound on one exec-channel drain. PowerShell cold-start on a fresh boot can stall tens of seconds; beyond this the channel is hung, and the error must be loud instead of burning the caller’s whole budget silently.
- SSH_
PASSWORD_ ROTATION_ BUDGET - Budget for each half of a guest password rotation: the
net userexec and the verifying re-login. A stalled handshake must surface as an error, never hang the caller. - SSH_
POLL_ INTERVAL - Sleep between SSH polls. Deliberately short: at 15 s users stared at a ready desktop while the CLI still said “booting” (observed live), and a poll is one TCP SYN — latency is what the user feels.