feat(cli): add --fetch-timeout / --fetch-retries / retry backoff flags#436
feat(cli): add --fetch-timeout / --fetch-retries / retry backoff flags#436
Conversation
c821389 to
bc86f45
Compare
Greptile SummaryThis PR adds five global CLI flags ( Confidence Score: 5/5Safe to merge — no logic errors, security issues, or behavioral regressions found. All five flags slot cleanly into the existing precedence infrastructure, the OnceLock pattern is consistent with other process-wide globals, documentation and generated files are in sync, and both a positive-path and a falsifiable negative-path test are present. Previously flagged concerns (exit-code-only test, integer-typed retry factor) are either addressed or already captured in prior review threads. No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile |
Addresses Greptile review on PR #436: - Bats timeout test asserted only `assert_failure`, which would also pass for a clap parse error or missing fixture. Pin the failure to the registry-fetch path with `assert_output --partial "failed to fetch is-odd"` (the wrapper miette context emitted by `add.rs`). Greptile suggested asserting on the substring "timeout" verbatim, but reqwest's Display swallows the inner cause — the user-visible error reads `error sending request for url ...` without the word timeout, so we anchor on the aube-side wrapper instead. - Doc-comment on `--fetch-retry-factor` now spells out that fractional factors are rejected (the underlying `FetchPolicy.retry_factor` is `u32`, matching `settings.toml`'s `int` type and the npmrc parser), so users coming from a "factors are floats" mental model see why clap rejects `1.5`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses Greptile review on PR #436: - Bats timeout test asserted only `assert_failure`, which would also pass for a clap parse error or missing fixture. Pin the failure to the registry-fetch path with `assert_output --partial "failed to fetch is-odd"` (the wrapper miette context emitted by `add.rs`). Greptile suggested asserting on the substring "timeout" verbatim, but reqwest's Display swallows the inner cause — the user-visible error reads `error sending request for url ...` without the word timeout, so we anchor on the aube-side wrapper instead. - Doc-comment on `--fetch-retry-factor` now spells out that fractional factors are rejected (the underlying `FetchPolicy.retry_factor` is `u32`, matching `settings.toml`'s `int` type and the npmrc parser), so users coming from a "factors are floats" mental model see why clap rejects `1.5`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0c4de33 to
78f3869
Compare
Mirrors pnpm's global CLI surface for the registry transport knobs.
Previously these settings were reachable only through `.npmrc` /
`pnpm-workspace.yaml` / `NPM_CONFIG_*` env vars; the pnpm parity test
in `pnpm/test/install/misc.ts:508` ('installation fails with a timeout
error') passes them as `--fetch-timeout=1 --fetch-retries=0`, so we
need the same surface.
Wires the flags as global args on the top-level Cli, populates a
process-wide `FETCH_CLI_OVERRIDES` once from `async_main`, and threads
it into `resolve_fetch_policy` as the `ResolveCtx::cli` slice — the
existing settings codegen already orders `cli > env > npmrc >
workspaceYaml`. Adds the corresponding pnpm test port in
`pnpm_install_misc.bats` (11/37 in the install/misc.ts file) plus a
positive-path smoke test in `fetch_settings.bats` covering all five
new flags.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses Greptile review on PR #436: - Bats timeout test asserted only `assert_failure`, which would also pass for a clap parse error or missing fixture. Pin the failure to the registry-fetch path with `assert_output --partial "failed to fetch is-odd"` (the wrapper miette context emitted by `add.rs`). Greptile suggested asserting on the substring "timeout" verbatim, but reqwest's Display swallows the inner cause — the user-visible error reads `error sending request for url ...` without the word timeout, so we anchor on the aube-side wrapper instead. - Doc-comment on `--fetch-retry-factor` now spells out that fractional factors are rejected (the underlying `FetchPolicy.retry_factor` is `u32`, matching `settings.toml`'s `int` type and the npmrc parser), so users coming from a "factors are floats" mental model see why clap rejects `1.5`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40f84d7 to
a7a5c3f
Compare
Benchmark changesVersions:
Public ratios: warm installs vs Bun 4x -> 3x; warm installs vs pnpm 5x -> 8x.
a7a5c3f vs 2ad5c54 | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex. |
Summary
--fetch-timeout,--fetch-retries,--fetch-retry-factor,--fetch-retry-mintimeout, and--fetch-retry-maxtimeoutCLI flags so users can drive the registry transport knobs from the command line, matching pnpm's surface.FETCH_CLI_OVERRIDESsnapshot populated once inasync_main.resolve_fetch_policyreads it as theResolveCtx::clislice, so everymake_clientcaller (install, add, publish, audit, …) honors the flags without per-command plumbing. The existing settings codegen already orderscli > env > npmrc > workspaceYaml.pnpm/test/install/misc.ts:508, 'installation fails with a timeout error') intopnpm_install_misc.bats(now 11/37 from that file) using the new flags directly, plus a positive-path smoke test infetch_settings.batscovering all five.Why
The pnpm test passes
--fetch-timeout=1 --fetch-retries=0to force a timeout failure. aube previously surfaced these settings only through.npmrc/pnpm-workspace.yaml/NPM_CONFIG_*env vars — a CLI-equivalent surface was missing. The doc-comment onmake_clientalready anticipated this ('future CLI flags Just Work without touching this function again'), so the wiring slots straight into the existing precedence chain.Test plan
cargo fmt --checkcargo clippy --all-targets -- -D warningscargo test --workspacemise run test:bats test/pnpm_install_misc.bats test/fetch_settings.bats(17/17)aube --helpshows the five new flags🤖 Generated with Claude Code
Note
Medium Risk
Adds new global network transport flags that affect registry fetch behavior across all commands; misconfiguration could cause unexpected timeouts or retry storms, but defaults remain unchanged when flags aren’t used.
Overview
Adds five new global CLI flags (
--fetch-timeout,--fetch-retries,--fetch-retry-factor,--fetch-retry-mintimeout,--fetch-retry-maxtimeout) and wires them into the settings resolver so they override.npmrc/env/workspace config for registry fetch policy.Implements a process-wide snapshot (
FETCH_CLI_OVERRIDES) populated inmainand consumed byresolve_fetch_policy, so every registry client created viamake_client(install/add/publish/audit/…) honors the overrides without per-command plumbing.Updates generated CLI/docs metadata and adds BATS coverage for the new flags, including a timeout-failure test (
aube add --fetch-timeout=1 --fetch-retries=0) and a positive-path smoke test exercising all five knobs.Reviewed by Cursor Bugbot for commit a7a5c3f. Bugbot is set up for automated code reviews on this repo. Configure here.