Skip to content

Fix correctness bugs, clear 9 security advisories, remove dead code (v2.5.0) - #30

Open
simeg wants to merge 19 commits into
masterfrom
fix/audit-p0-p1
Open

simeg wants to merge 19 commits into
masterfrom
fix/audit-p0-p1

Conversation

@simeg

@simeg simeg commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Audit of the codebase turned up several bugs that produce wrong results — valid URLs reported as broken, --concurrency silently ignored, invalid JSON output. This fixes those, clears 9 security advisories, and removes ~1,700 lines of unreachable code.

Split into 15 commits, each one verified independently: every commit passes cargo fmt --check, clippy -D warnings and the full test suite, so the branch is bisectable.

Bugs that caused wrong results

Valid 2xx reported as broken links. is_ok() only accepted HTTP 200, so a 201/202/204/206 endpoint failed CI. Reproduced against a local server:

$ urlsup t204.md --format minimal
204 http://127.0.0.1:8231/204
EXIT=1

The code contradicted itself — the success counter used is_success() (all 2xx) while the exit code used 200-only.

--concurrency was silently clamped. calculate_optimal_batch_size fed buffer_unordered, and every arm used min(), so it could only ever lower the requested value. Measured with 8 endpoints each sleeping 1s:

time
before (--concurrency 50) 4.068s — 4 rounds of 2
after 1.703s — all 8 concurrent

Invalid JSON output. The report was hand-built with print! and no escaping, despite serde_json already being a dependency:

$ urlsup 'we"ird.md' --format json | python3 -m json.tool
Expecting ',' delimiter

Two more streams also corrupted stdout (the dashboard message and --show-performance), so --format json combined with either was unparseable.

--allowlist matched by substring. --allowlist example.com also suppressed https://example.com.attacker.net/, hiding genuinely broken links. Now host-aware: bare hosts match that host or a true subdomain; scheme entries match by URL prefix at a path boundary.

--rate-limit allowed a burst. The token bucket seeded itself with thread_count tokens, so the first N requests ignored the limit entirely. It also busy-polled on a 10ms sleep and split its state across two mutexes. Replaced with an interval pacer.

Retries never covered status codes. Only transport errors were retried, so 429 and 503 — the cases most worth retrying — were reported immediately.

NO_COLOR was ignored. 25 sites interpolated Colors::BOLD into a format! before the capability check:

$ NO_COLOR=1 urlsup nc.md | cat -v
^[[1mUsing threads^[[0m: 16

Others: one unreadable file aborted the entire run; a malformed --proxy was silently ignored while requests went out unproxied; HTML injection in the dashboard (URLs come from scanned documents); an integer underflow reporting 18446744073709551606 valid URLs; Display panicking; the progress bar stalling short of the total.

Security

cargo audit reported 9 vulnerabilities, four in the TLS verification path of a tool whose entire job is HTTPS requests:

  • rustls-webpki — reachable panic parsing a CRL, two name-constraint bypasses, CRL authority
  • h2, quinn-proto ×2 (remote DoS), bytes, crossbeam-epoch

All cleared by a plain cargo update — no semver-major bumps, no source changes. Also drops the unmaintained term_size (RUSTSEC-2020-0163). cargo audit now reports zero findings.

New flags

  • --no-ignore — check files .gitignore/.ignore would exclude. Previously gitignored files were silently skipped with no override, so a build could go green on broken links.
  • --no-allow-timeout, --no-insecure, --no-show-performance — override booleans set in .urlsup.toml for a single run. These were previously one-way.

Dead code

~1,700 lines nothing in the binary could reach. Verified by making each module private and confirming the compiler flagged every item while the binary still built — pub in a lib crate was hiding this from dead-code analysis.

  • rich.rs (691 lines) — zero references; contained a second hand-rolled progress bar despite indicatif being a dependency
  • theme.rs (624 lines) — reachable only from rich.rs. The URLSUP_THEME var and WCAG contrast checking the README advertised never had any effect.
  • A duplicate CLI parser and duplicate CLI validation, both kept alive only by tests
  • Dead SIMD helpers — the only users of memchr

Tests

All 8 property tests discarded their assertions (let _ = cmd.assert().try_success();) — 347 lines that could not fail. Making them assert immediately exposed one passing --retry-delay twice, so clap had been rejecting it with a usage error on every run while the test reported success. Three also fetched httpbin.org for real across up to 256 cases each.

Assertion-free tests: 93 → 41, with output.rs and cli.rs at zero. process::exit is gone from library code, which is what made the validation paths testable at all.

Build & CI

make ci was red on committed code — four rustc 1.95 clippy errors with no pinned toolchain. Fixed, plus:

  • rust-toolchain.toml pins 1.95.0; MSRV declared as 1.88 (verified with cargo +1.88.0)
  • LICENSE was excluded from the crate package — MIT code was being published with no licence text
  • overflow-checks on in release; it immediately caught a real underflow
  • CI gained macOS/Windows, MSRV, release-build, packaging and cargo audit jobs
  • make ci synced with the workflow (they had drifted in both directions)

Docs

README cut 834 → 391 lines. Removed the theming section documenting a feature that never worked, and performance claims ("15-20% faster hashing", "45-65% faster", "60-80% less memory") with no benchmark anywhere in the repo, some crediting deleted code. The usage block is now pasted from --help so it cannot drift; all 20 documented config keys verified against the Config struct in both directions.

⚠️ One behaviour change for upgraders

Bare path fragments in --allowlist (e.g. /internal/, docs/api) no longer match anything — entries are hosts or URL prefixes now. This direction is fail-safe (more failures reported, not fewer) but it would be silent, so unmatchable entries emit a warning naming the entry and the accepted forms.

Also note --rate-limit now paces each retry attempt rather than each URL, so worst case per URL is (retry + 1) × rate_limit. That's deliberate — exempting retries meant a flapping host got hit faster than requested.

Verification

Every claim above was reproduced against a local server or by command output, not inferred. Final state: 473 tests pass, fmt clean, zero clippy warnings, cargo audit clean, MSRV verified, release profile builds.

🤖 Generated with Claude Code

simeg and others added 19 commits September 1, 2026 15:09
`cargo audit` reported 9 vulnerabilities, four of them in the TLS
verification path of a tool whose entire job is making HTTPS requests:

  rustls-webpki  RUSTSEC-2026-0104  reachable panic parsing a CRL
  rustls-webpki  RUSTSEC-2026-0098  URI name constraints wrongly accepted
  rustls-webpki  RUSTSEC-2026-0099  wildcard name constraints accepted
  rustls-webpki  RUSTSEC-2026-0049  CRLs not treated as authoritative
  h2             RUSTSEC-2026-0258  unbounded empty DATA frames
  quinn-proto    RUSTSEC-2026-0185  remote memory exhaustion
  quinn-proto    RUSTSEC-2026-0037  endpoint denial of service
  bytes          RUSTSEC-2026-0007  integer overflow in BytesMut::reserve
  crossbeam-epoch RUSTSEC-2026-0204 invalid pointer dereference

The reachable-panic advisory is the sharp one: with `panic = "abort"` in
the release profile a malformed CRL becomes a hard process abort.

All are fixed by a plain `cargo update` — no semver-major bumps and no
source changes. `cargo audit` now reports zero findings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Roughly 1600 lines that nothing in the binary could reach. Verified by
making each module private and confirming the compiler reported every
item as unused while the binary still built -- `pub` in a lib crate was
hiding this from dead-code analysis.

* `src/ui/rich.rs` (691 lines) -- zero references. Included a
  hand-rolled progress bar despite `indicatif` already being a
  dependency, and was the sole user of `term_size`.
* `src/ui/theme.rs` (624 lines) -- reachable only from rich.rs. Full
  light/dark adaptive theming and WCAG contrast checking, never invoked.
  The `URLSUP_THEME` env var the README advertised had no effect.
* `parse_cli_args` -- a second, already-diverged copy of
  `cli_to_config`, kept alive by one test.
* `validate_cli_args` -- a near-verbatim duplicate of validation already
  inside `cli_to_config`, also test-only. Two copies of the same four
  checks, free to drift apart silently.
* `fast_url_scan` / `process_lines_vectorized` -- `#[allow(dead_code)]`
  SIMD helpers, and the only users of `memchr`.

Dropping `term_size` also clears RUSTSEC-2020-0163 (unmaintained).

Also fixes the two `-D warnings` clippy errors that rustc 1.95
introduced in `validator.rs` (`manual_is_multiple_of`, `useless_vec`);
the other two were in the files deleted above.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Four separate build-hygiene problems:

* No pinned toolchain. `cargo clippy -- -D warnings` failed on committed
  code under rustc 1.95 (new `derivable_impls`, `manual_is_multiple_of`
  and `useless_vec` lints), so CI was red for reasons unrelated to any
  change. `rust-toolchain.toml` pins 1.95.0 so the lint set is
  reproducible.

* No `rust-version`. `edition = "2024"` needs >=1.85, but the real floor
  is 1.88 -- set by transitive deps (globset, icu_*), verified with
  `cargo +1.88.0 check --all-targets --locked`. Without it, older
  toolchains fail with an incomprehensible edition error.

* LICENSE was not published. `include` omitted it, so `cargo package
  --list` shipped MIT-licensed code to crates.io with no licence text.

* `overflow-checks = false` in release meant arithmetic bugs were silent
  in the profile users actually run and only tripped in tests. For a
  network-bound tool the speed win is unmeasurable. Turning this on
  immediately surfaced a real underflow (fixed in a later commit).

Also adds `categories`, which drives crates.io browse pages.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`is_ok()` only accepted HTTP 200, so a valid 201, 202, 204 or 206
endpoint was reported as a broken link and failed CI. Reproduced against
a local server:

    $ urlsup t204.md --format minimal
    204 http://127.0.0.1:8231/204
    EXIT=1

The code already contradicted itself: the success counter a few lines
down used `res.status().is_success()` (all of 2xx) while the exit code
used 200-only.

A link checker asserts reachability, and any 2xx means reachable. Adds
tests covering 200-299 inclusive and confirming 1xx/3xx/4xx/5xx still
fail.

This also removes the last real use of the `http_status` constants, so
that module goes with it -- along with `defaults`, `display` and
`validation`, none of which had any reference outside their own
declaration. Their only "coverage" was a test asserting each constant
equalled its own literal. constants.rs drops from 155 to 46 lines and
every remaining value is genuinely used.

Fixes a latent doc-comment bug there too: the module docs used `///` and
ran into the next item's comment, so they were silently attached to
`output_formats` rather than the file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`calculate_optimal_batch_size` was documented as a performance
optimisation but it fed `buffer_unordered`, i.e. it *was* the concurrency
limit -- and because every arm used `min()`, it could only ever lower the
value the user asked for:

    0..=10   => min(2)
    11..=100 => min(10)

So `--concurrency 50` over 8 URLs ran 2 at a time. Measured against a
local server with 8 endpoints that each sleep 1s:

    before: 4.068s   (4 rounds of 2)
    after:  1.703s   (all 8 concurrent)

A pure pessimisation that also ignored explicit user intent. Removed; the
configured value is now used directly, capped only by the URL count since
there is no point opening more connections than there are URLs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two coupled problems in the request loop.

The token bucket was broken four ways:

* `tokens` and `last_refill` were separate `Mutex`es, so refill was not
  atomic and concurrent callers could lose tokens.
* It held a `std::sync::Mutex` in async code -- safe only because no
  `.await` sat inside the guard's scope, which is a landmine for the
  next edit.
* Callers busy-polled it on a 10ms sleep instead of the bucket computing
  the exact wait, burning thousands of wakeups on a slow rate limit.
* Its burst capacity was the thread count, so the first N requests
  ignored `--rate-limit` entirely.

Replaced with a `RateLimiter` that reserves the next slot under a short
lock (released before any await) and `sleep_until`s to it. New tests fail
at 2.87ms against a required 300ms when the limiter is disabled -- the
old CLI-level check asserted `elapsed >= 10`, which passed with rate
limiting removed entirely.

Retries previously covered only transport errors, never status codes --
so 429 and 503, the two cases most worth retrying, were reported
immediately. Now `is_retryable_status` retries 429 and 5xx, and never
4xx (a genuine 404 must not be retried three times).

The limiter is acquired per attempt rather than per URL: a retry is a
request, and exempting retries would let a flapping host burst straight
through `--rate-limit`. The cost is that worst-case time per URL is
(retry + 1) * rate_limit.

`test_validate_urls_with_config_retry` asserted `.expect(3)` on its mock
but never called `m.assert()`, so it passed while only one request was
made. Now enforced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`validate_urls_with_config` returned a plain `Vec`, so it had no way to
report a setup failure. Two consequences:

* A malformed `--proxy` was swallowed by `if let Ok(proxy) = ...`, so
  requests went out unproxied while the user believed otherwise.
* `client_builder.build().unwrap()` panicked from inside a library.

Returning an empty `Vec` was not an option either: zero results reads as
"no broken URLs" and exits 0, hiding a misconfiguration in CI.

The trait now returns `Result<Vec<ValidationResult>>`. An unusable proxy
or HTTP client is an `Err`; a URL that is merely unreachable is still a
successful run with a failing `ValidationResult`. There was exactly one
production call site, which already returned `Result`, so it needed a
single `?`.

    $ urlsup f.md --proxy "::: bad :::"
    Error: Configuration error: invalid proxy '::: bad :::': builder error.
    Refusing to send requests unproxied.
    exit=1

Also in this loop:

* `Display for ValidationResult` panicked when both `status_code` and
  `description` were `None`. A `Display` impl must never panic -- callers
  may already be formatting an error.
* `response.unwrap()` on the retry result is now an explicit error rather
  than a latent panic.
* The progress bar never reported the final count unless the total
  happened to be a multiple of 10, so it stalled short.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Five output defects, all user-visible.

**Invalid JSON.** `serde_json` was already a dependency but the report
was built with `print!` and no escaping, so a quote in a filename, URL or
reqwest error message produced unparseable output:

    $ urlsup 'we"ird.md' --format json | python3 -m json.tool
    Expecting ',' delimiter

Now serialised from dedicated `Json*` structs. The schema is kept
separate from the domain types so the public format cannot drift when
internal structs change. `description` stays a string rather than
becoming `null` -- the old code used `.unwrap_or("")`, so consumers may
do string operations on it without a null check. Output is single-line
for both success and failure (the old format was inconsistent: one line
on success, multi-line on failure).

**Two more streams corrupting stdout.** The HTML-dashboard confirmation
and the `--show-performance` summary both printed to stdout, so
`--format json` combined with either produced `Extra data` parse errors.
Both moved to stderr, where the adjacent error paths already went.

**NO_COLOR ignored.** 25 call sites interpolated `Colors::BOLD` into a
`format!` *before* passing it to `colorize`, so the escape codes were
baked in ahead of the capability check:

    $ NO_COLOR=1 urlsup nc.md | cat -v
    ^[[1mUsing threads^[[0m: 16

Added a gated `bold()` helper and rewrote every site. `performance.rs`
separately hardcoded 24 lines of raw `\x1b[` that bypassed the gate
entirely; now routed through `colorize`.

**HTML injection in the dashboard.** URLs and filenames come from
scanned documents, so they are untrusted. A file named
`<img src=x onerror=alert(1)>.md` landed verbatim in the generated HTML.
Added `escape_html` for url, filename and description.

**Stale default in the config banner.** It printed `timeout: 30` when the
real default has been 5 since 553a98d. Now reads the constant.

Every `display_*` is now split into a pure `render_*` returning `String`
plus a thin printer. This is the root cause of the JSON bug surviving 7
dedicated tests: the old functions wrote to stdout with no injectable
writer, so those tests *structurally could not* assert. The 38
assertion-free tests in output.rs are now 0, pinning the minimal format
byte-for-byte, the JSON schema, the file-list truncation and the
strictly-greater threshold comparison.

The two CLI JSON tests were substring-matching `"status": "success"`
including the whitespace; they now parse the output instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`--allowlist` used a naive substring test:

    !allowlist.iter().any(|entry| result.url.contains(entry))

So `--allowlist example.com` also suppressed
`https://example.com.attacker.net/` and `https://notexample.com/` --
silently hiding genuinely broken links.

Matching is now host-aware, deliberately keeping prefix entries working
since users rely on them:

* An entry with a scheme matches by URL prefix, but only at a path
  boundary, so `https://example.com/docs` covers `/docs/page` and not
  `/docsomething`.
* A bare host matches that host exactly or a true subdomain
  (`api.example.com`), never a suffix impersonation.
* Hosts compare case-insensitively, with userinfo, port and trailing-dot
  normalisation.

The logic lives in `allowlist_matches`/`extract_host` so it is unit
testable rather than inline in a closure.

One behaviour genuinely regresses: a bare path fragment like
`/internal/` used to match any URL containing it and now matches nothing.
That direction is fail-safe (more failures reported, not fewer) but it
would be silent, so unmatchable entries now emit a warning naming the
entry and the two accepted forms.

Also guards `determine_exit_code` against 0/0: it computed a NaN failure
rate and relied on every NaN comparison being false, which was correct
only by accident.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`find_urls` collected into `Result<Vec<Vec<UrlLocation>>, io::Error>`, so
rayon short-circuited on the first error and `results?` threw away every
other file's work. One unreadable or permission-denied file meant the
user got no results for any file -- a link checker that silently checks
nothing.

Each file now handles its own failure: read and parse errors are reported
on stderr and that file yields nothing, while the rest are still
processed. The public signature is unchanged, `par_iter().collect()` into
a `Vec` still preserves input order, and the capacity pre-allocation is
kept.

Tested with a genuinely unreadable file (mode 0o000 via `PermissionsExt`,
permissions restored before asserting so the tempdir still cleans up).
Confirmed the test fails with "Permission denied (os error 13)" when the
abort behaviour is restored, so it is not passing for the wrong reason.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
**`--no-ignore`.** `--recursive` respects `.gitignore` (documented), but
there was no way to override it. A user checking a repo where `docs/` or
`build/` is gitignored got those files silently skipped -- and a silent
false negative in a link checker is worse than a false positive, because
the build goes green. The flag disables every ignore source
(`.gitignore`, global, exclude, `.ignore`, parent lookups). Verified
end-to-end: 1 URL checked by default, 4 with the flag, across a gitignored
directory, a gitignore glob and a `.ignore` file.

Its test replaced a hollow one named `test_expand_paths__ignore_gitignore_files`
that never created a `.gitignore`, so the default behaviour had never
actually been verified. Both directions now falsified by flipping the flag
in place.

**Negating flags.** Boolean options were one-way: once `.urlsup.toml` set
`allow_timeout = true` there was no way to get strict behaviour for a
single run. Added `--no-allow-timeout`, `--no-insecure` and
`--no-show-performance`, each `conflicts_with` its positive counterpart.
Precedence is CLI negation > CLI positive > config file > default;
passing neither leaves the config value untouched. `--no-verbose` was
deliberately not added -- `--quiet` already short-circuits `verbose` in
`init_logger`, so it would be dead weight.

**`cli_to_config` returns `Result`.** It called `std::process::exit(1)`
from inside a library function -- in one case buried in a `.map_err()`
closure inside a `filter_map` -- which made every validation failure
untestable. Now returns `UrlsUpError::Config`, with the same messages and
exit codes as before. There is no longer any `process::exit` in library
code; all of them live in `main`.

That unlocked 10 tests for paths which previously killed the test process,
including boundaries the old code never checked: status 100/599 accepted,
99/600/1000 rejected, threshold 0.0/100.0 accepted, empty status entries
skipped, and an over-large timeout warning rather than erroring.

Also replaced the hardcoded `help_template` option list with clap's
`{all-args}`. Adding an `#[arg]` used to compile, pass every test, and
leave the flag invisible in `--help` -- exactly how the stale docs this
branch has been fixing came about.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
All 8 property tests ended in:

    let _ = cmd.assert().try_success();

which constructs an `Assert` and drops it. 347 lines that could not fail
-- a panic (exit 101) or a clap usage error (exit 2) passed silently.
They now assert the exit status is 0 or 1, the only codes urlsup returns.

That immediately caught a real bug: `test_configuration_combinations`
passed `--retry-delay` twice, so clap had been rejecting it with exit 2
on every run while the test reported success.

Three of them also fetched `https://httpbin.org` for real, up to 256
proptest cases each, making the suite depend on a third-party service
being up and rate-limit-free. Replaced with a local mock server started
once per run.

In logging.rs:

* `log_validation_complete` computed `url_count - issues` on `usize`.
  With `issues > url_count` that underflowed: it panicked once
  overflow-checks were enabled, and before that silently reported
  18446744073709551606 valid URLs. Now saturates, via an extracted
  `valid_url_count` so the behaviour is asserted rather than restated.
* `test_thread_safety` spawned 4 threads doing 30 log calls each and
  asserted nothing. It cannot detect a data race and would pass against
  empty function bodies. Replaced with a compile-time `Send + Sync`
  bound check, which proves something real.
* Four `init_logger` tests were pure duplication of the extracted
  `log_level_for` logic; collapsed into one idempotency check.
* `log_config_info` had the same stale `unwrap_or(30)` timeout default
  that output.rs did.
* The remaining tests wrap `log::` macros returning `()`. A module
  comment now says plainly that they are smoke tests and why, instead of
  leaving them to look like coverage.

Also guards a test that mutates process-global `HOME` with `#[serial]`.
Cargo runs tests within a binary on parallel threads, so it was a latent
flake waiting for the next test that resolves a home-relative path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The workflow ran fmt, clippy, test and coverage on ubuntu-latest only.
Gaps that let real problems through:

* **No OS matrix.** urlsup is a CLI with per-shell completion paths --
  `completion.rs` branches for bash/zsh/fish and returns `Err` for
  PowerShell/Elvish. The Windows and macOS code paths were never
  compiled, let alone run.
* **No `cargo audit`.** Directly why 9 advisories sat undetected.
* **No `--locked`.** CI silently re-resolved dependencies, so the
  committed lockfile was never validated and CI could pass on versions
  nobody had.
* **No MSRV job**, so `rust-version` was unverifiable.
* **No release build.** `lto = "fat"`, `panic = "abort"` and
  `codegen-units = 1` were never exercised; an LTO failure would surface
  at `make publish` time. Nothing built the shipped artifact.
* **No packaging check**, which is why the missing LICENSE went unnoticed.

The MSRV job derives the version from Cargo.toml rather than hardcoding
it, so the two cannot drift.

Also syncs `make ci` with the workflow. They had drifted in both
directions: the Makefile ran `check --release` and defined an `audit`
target it deliberately excluded from `ci`, while CI ran tarpaulin and
`--all-features` that the Makefile did not. "Passes locally" did not
imply "passes CI", or the reverse.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
README.md drops from 834 to 391 lines. Corrections first, since several
documented things that did not exist or were wrong:

* An "Adaptive Color Schemes" section described `URLSUP_THEME`, terminal
  theme detection and WCAG contrast compliance. All of it lived in
  theme.rs, reachable only from the dead rich.rs, so it never affected
  output. Verified against the pre-deletion tree before removing.
* `--concurrency` was documented as defaulting to CPU cores; it was in
  fact clamped to 2-100 by URL count. The code fix made the doc true.
* `use_head_requests` was advertised with no CLI flag to reach it.
* The performance section quoted "15-20% faster hashing", "45-65%
  faster", "60-80% less memory" and "30-50% less memory waste" with no
  benchmark anywhere in the repo, and credited `memchr` SIMD scanning
  and "vectorized line processing" -- both dead code. Replaced with
  claims that are true.
* `--allowlist` was described as "partial matches", which is no longer
  the semantics.

Adds what was missing and actually matters: an exit-code table, the
stdout/stderr contract, `.urlsup.toml` discovery order, and `no_ignore` /
`html_dashboard_path`, both real config keys the old README omitted. The
20 documented keys now correspond exactly to the `Config` struct in both
directions.

The usage block is pasted verbatim from `--help` so it cannot drift.

Cuts, roughly: a "What's New in v2.0" changelog section on a v2.4.0
crate (the flag-rename facts preserved as a short upgrade note); three
near-identical bash/zsh/fish completion blocks; a security and a
performance section that only restated config keys already documented;
three overlapping dashboard feature lists; and deduplicated examples
where `--include md,txt` appeared three times.

CLAUDE.md's "Performance Optimizations" section described the deleted
memchr SIMD helpers, the batch sizing that was actively harmful, and the
replaced token bucket. Corrected to match the code.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Minor bump: new flags (`--no-ignore`, plus negations for config-file
booleans) and behaviour fixes, no breaking API changes.

One behaviour change worth calling out for anyone upgrading: bare path
fragments in `--allowlist` (e.g. `/internal/`) no longer match. Entries
are hosts or URL prefixes now, and unmatchable entries emit a warning.
That direction is fail-safe -- more failures get reported, not fewer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Security audit job failed on its first run. Not a real advisory --
`rustsec/audit-check@v2` builds cargo-audit from source, and one of its
dependencies (kstring 2.0.4) requires rustc 1.96 while
`rust-toolchain.toml` pins 1.95.0, so the action could not install its
own tool:

    rustc 1.95.0 is not supported by the following package:
      kstring@2.0.4 requires rustc 1.96.0

Self-inflicted by adding the pin and the job in the same branch. The job
now overrides to stable for its own toolchain and runs
`cargo audit --deny warnings` directly, matching the `make audit` target.
Auditing a lockfile does not need the project's pinned compiler.

Also adds CHANGELOG.md to `include`; crates.io links to it and it was
being left out of the published crate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The new Windows CI job caught a genuine pre-existing bug: urlsup has
never compiled on Windows.

    error[E0283]: type annotations needed
       --> src\ui\wizard.rs:579:82
        | let codes: Result<Vec<u16>, _> = ... .map(|s| s.trim().parse()).collect();
        = note: multiple `impl`s satisfying `Vec<u16>: FromIterator<_>` found
                in the following crates: `alloc`, `encode_unicode`

On Windows `dialoguer` pulls in `encode_unicode`, which adds further
`FromIterator` impls for `Vec<u16>`, so inference can no longer pick a
target type for `parse`. An explicit turbofish removes the dependence on
which platform's impls happen to be in scope.

Also scopes a symlink test's `symlink_path` into its `#[cfg(unix)]` block;
it was declared unconditionally and warned as unused elsewhere, which
would fail the `-D warnings` gate on the new platforms.

Both are exactly what the cross-platform matrix was added to surface.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tion

Two more failures surfaced by the cross-platform matrix.

**Windows: `get_completion_directory` read `HOME` before matching on the
shell.** Windows sets `USERPROFILE`, not `HOME`, so every shell returned
"HOME environment variable not set" -- including PowerShell and Elvish,
which should report that installation is unsupported and to generate the
completion manually. Three tests asserted the specific message and
failed.

Now falls back to `USERPROFILE`, and rejects the unsupported shells
before the home lookup so their message no longer depends on the
environment. Completions were previously uninstallable on Windows for
any shell.

**macOS: `test_operation_timer` asserted an operation finished within
50ms.** That asserts the machine is not busy, which the test cannot
control; it flaked on a loaded runner. The lower bound is the real
property -- the timer must have measured the sleep -- so the upper bound
is gone and the remaining assertion reports the observed duration on
failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fallout from adding the `USERPROFILE` fallback in the previous commit:
`test_install_completion_no_home` removed only `HOME`, so on Windows the
lookup still succeeded via `USERPROFILE` and the expected error never
came.

Clears both, and restores them *before* asserting so a failure cannot
leak a cleared environment into other tests in the same binary. Uses
`expect_err` so the actual error is shown when it does not match.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant