Repository navigation
test(module): drive a download whose bytes disagree with the manifest - #106
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: FindingsNo active actionable findings. Advisory notes
Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(module): drive a download whose bytes disagree with the manifest. Purpose (title): test(module): drive a download whose bytes disagree with the manifest. This test-only pull request adds a `#[cfg(test)]` seam in `release_download_url` that lets one thread redirect release downloads to a local server, plus a new test that drives a real download through verification and asserts checksum-mismatching bytes are refused with no cache directory and no staging debris. The latest-push delta is unavailable, so no separate delta analysis is presented. Review snapshot
Completeness: Complete What changedUnder `#[cfg(test)]`, `release_download_url` reads a thread-local `TEST_RELEASE_BASE` to substitute the base for one thread's release downloads, falling back to `https://github.com`; under `#[cfg(not(test))]` the base remains the fixed constant, so release behavior is unchanged. The new test binds a local TCP listener, serves a `checksum.toml` pinning one digest and an archive of other bytes, sets the thread-local base to the listener address, and calls `acquire_cached` with `expected_sha256` set, asserting the error contains "does not match its checksum manifest", the cache directory does not exist, and no `.staging` paths remain under the temp root. A `walk` helper recursively collects paths for the debris assertion. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
9ddd6b7 to
a7df9a6
Compare
Nothing exercised the refusal of downloaded bytes that do not hash to the release manifest, nor that such a refusal leaves no cache directory or staging debris. A test-only base-URL seam lets acquire_cached download from a local server so the whole path runs without the network.
a7df9a6 to
f1a66bd
Compare
Summary
Test-only. The behaviour is correct, but nothing exercised it: when a downloaded release archive does not hash to the digest in the release's checksum manifest,
acquire_cachedmust refuse it and leave neither a cache directory nor.staging-*debris behind. Every existingacquire_cachedtest stops before the network, so the download → verify → clean-up path had no coverage.Change
cache::release_download_url: under#[cfg(test)]a thread-localTEST_RELEASE_BASEcan replacehttps://github.com, so a test can point one thread's downloads at a local server. Release builds are unchanged (#[cfg(not(test))]keeps the constant).a_download_that_disagrees_with_its_manifest_is_refused_and_cleaned_up: a local server serves achecksum.tomlpinning one digest and an archive with other bytes. The test asserts the "does not match its checksum manifest" refusal, no cache directory, and no staging debris.The REST-listing fallback (a 404 on the direct path) still has no test; it would need the API base routed through the same seam.
Validation
cargo test -p tinybus --features modules --lib -- a_download_that_disagrees_with_its_manifest_is_refused_and_cleaned_up:verify_archivecall removed fromacquire_cachedBehaviour change
None. Test code and a
#[cfg(test)]seam only.