Skip to content

fix: ship tested downloads with recoverable quarantine and a working demo - #21

Merged
amasen02 merged 5 commits into
masterfrom
feat/tested-downloads-and-safe-demo-2026-09-13
Sep 12, 2026
Merged

fix: ship tested downloads with recoverable quarantine and a working demo#21
amasen02 merged 5 commits into
masterfrom
feat/tested-downloads-and-safe-demo-2026-09-13

Conversation

@amasen02

@amasen02 amasen02 commented Sep 12, 2026

Copy link
Copy Markdown
Owner

What

Provide self-contained DupeSweep downloads with native archive tests, correct the source quickstart, and add a reproducible quarantine/restore demo.

Why

The README pointed to a nonexistent project and scan command, and the existing release had no binary assets. Reviewing the demo also exposed manifest overwrite/partial-move recovery defects and duplicate entries from overlapping scan roots.

How

Quarantine reserves and flushes a complete manifest before moving files and refuses an existing manifest. Scanning deduplicates normalized full paths. Read-only PR/manual CI builds Windows x64, Linux x64, macOS ARM64 and Intel archives, extracts each, verifies binary behavior, retains evidence, and aggregates SHA-256 checksums. Release publication follows merged-source verification.

Affected area

  • Scanning / filtering
  • Duplicate detection / hashing
  • Keep strategy
  • Quarantine / apply / delete
  • Restore verification
  • CLI parsing / options
  • Docs and release packaging

Tests

  • Unit / filesystem-backed tests added or updated
  • Tests clean up their own temp directories
  • dotnet test passes locally: 74 passed, zero failed or skipped
  • Extracted Windows archive smoke passes locally
  • Hosted native archive and PowerShell 7 demo checks: all four platforms passed at 98d7de1; run https://github.com/amasen02/dupesweep/actions/runs/34726015154. All 10 checks passed. The required ci status now derives from both build-test legs.

Checklist

  • No secrets or credentials committed
  • README updated for changed behavior
  • Conventional-commit title

Quarantine does not free same-volume disk space. Use a fresh quarantine directory for another run; retain manifests for recovery. Executables are self-contained but not publisher-signed. Normalized-path deduplication does not establish hard-link or symlink identity guarantees.

Contribution opportunities are tracked in #18, #19 and #20. This PR does not claim external contributors, adoption, or an OpenSSF criticality threshold.

Comment on lines 16 to +21
foreach (FileEntry entry in EnumerateDirectory(fullRoot, options))
yield return entry;
{
if (seenPaths.Add(entry.FullPath))
yield return entry;
}
Comment thread src/DupeSweep/Program.cs
IReadOnlyList<ManifestEntry> manifest = QuarantineService.Quarantine(resolutions, quarantineDir);
string manifestPath = Path.Combine(quarantineDir, "manifest.json");
QuarantineService.WriteManifest(manifest, manifestPath);
string manifestPath = Path.Combine(Path.GetFullPath(quarantineDir), "manifest.json");
{
Directory.CreateDirectory(quarantineDir);
string fullQuarantineDir = Path.GetFullPath(quarantineDir);
string manifestPath = Path.Combine(fullQuarantineDir, "manifest.json");

var options = new ScanOptions();
var entries = FileScanner.Enumerate(
[dir.Path, dir.Path, Path.Combine(dir.Path, "nested", ".."), nested], options).ToList();
var duplicateB = new FileEntry(dupB, 9, DateTime.UtcNow);
var resolutionSameGroupIndex = new DuplicateResolution(group, keep, [duplicateB]);
var resolution = new DuplicateResolution(group, keep, [duplicate, duplicateB]);
string groupDir = Path.Combine(quarantineDir, "0");
Assert.True(File.Exists(manifest[0].QuarantinePath));
Assert.True(File.Exists(manifest2[0].QuarantinePath));
Assert.True(File.Exists(manifest[1].QuarantinePath));
Assert.Equal("content A", File.ReadAllText(Path.Combine(groupDir, "dup.txt")));

var manifest = QuarantineService.Quarantine([resolution], quarantineDir);
string manifestPath = Path.Combine(quarantineDir, "manifest.json");
string manifestPath = Path.Combine(dir.Path, "manual-manifest.json");
string keepPath = dir.WriteFile("keep.txt", "dup content");
string dupPath = dir.WriteFile("dup.txt", "dup content");
string quarantineDir = dir.CreateSubdirectory(".dupesweep-quarantine");
string manifestPath = Path.Combine(quarantineDir, "manifest.json");
using var dir = new TempDirectory();
string keepPath = dir.WriteFile("keep.txt", "dup content");
string firstDuplicatePath = dir.WriteFile("first.txt", "dup content");
string missingDuplicatePath = Path.Combine(dir.Path, "missing.txt");

Assert.ThrowsAny<IOException>(() => QuarantineService.Quarantine([resolution], quarantineDir));

string manifestPath = Path.Combine(quarantineDir, "manifest.json");
@amasen02
amasen02 merged commit 9553a06 into master Sep 12, 2026
10 checks passed
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.

2 participants