Repository navigation
test(publish): pin the stale-file check for older versions - #10
Conversation
Publishing an older file version is allowed only while the stored file still matches the size that version recorded, and refused when there is no file store to check. Neither refusal was tested.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(publish): pin the stale-file check for older versions. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete What changedAdds a new integration test that creates a file artifact, revises it so a newer version replaces the file, then exercises publishing of the older version under three conditions: publishing v1 while its stored file still matches the recorded size succeeds; publishing v1 from a host with no file store is refused with `ArtifactsError::FileChanged`; and after the stored v1 bytes are replaced with a longer payload of the same key, publishing v1 is refused with `FileChanged` while the newest version still publishes. The description notes the size-only comparison is a known ceiling, since `FileRef` records no digest. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
Artifacts::publishfor an older file version checks that the stored file is still the one that version recorded, because later versions can replace a file: it compares the stored file's size with the recorded size, and refuses withFileChangedwhen they differ or when the host has no file store to check. That branch had no test, so a refactor could drop it and share a changed file under an old version's name. This adds a test only.Related issue
None.
API or behavior changes
None (tests only).
Validation
rustfmt --edition 2021 --checkon the new filecargo clippy --all-targets --all-features -- -D warnings: cleancargo build --all-targets --all-features: left to CIcargo test --all-features: only the new test ran locally (below); CI runs the suiteCARGO_INCREMENTAL=0 cargo test -p tiny-artifacts --all-features --test publish_file_changedok. 1 passed; 0 failed.FileChangedrefusal disabled on purpose:FAILED. 0 passed; 1 failed(at the no-file-store refusal).FAILED. 0 passed; 1 failed(at the replaced-file refusal).Tests
New
tests/publish_file_changed.rs(separate file;tests/service.rsis already long). It creates a file artifact, revises it, then:FileChanged);FileChanged);The size-only compare is a known ceiling: a same-length replacement is not detected, because
FileRefrecords no digest.Documentation
Not needed (tests only).
Checklist
#[allow(...)],#[ignore], or relaxed lints (the new file carries the sameunwrap_used/expect_usedallow astests/service.rs).envcontents in the diff or the description