diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e28c6ae..e83302e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -45,6 +45,8 @@ jobs:
Move-Item artifacts/win-x64.zip artifacts/ZipXP-win-x64.zip
$hash = (Get-FileHash artifacts/ZipXP-win-x64.zip -Algorithm SHA256).Hash.ToLowerInvariant()
Set-Content -NoNewline -Encoding ascii artifacts/ZipXP-win-x64.zip.sha256 "$hash ZipXP-win-x64.zip`n"
+ # The one-line installer fetches this from releases/latest/download/zipxp-get.ps1.
+ Copy-Item scripts/get.ps1 artifacts/zipxp-get.ps1
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
@@ -54,6 +56,6 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
- gh release create '${{ github.ref_name }}' artifacts/ZipXP-win-x64.zip artifacts/ZipXP-win-x64.zip.sha256 `
+ gh release create '${{ github.ref_name }}' artifacts/ZipXP-win-x64.zip artifacts/ZipXP-win-x64.zip.sha256 artifacts/zipxp-get.ps1 `
--title '${{ github.ref_name }}' --generate-notes `
--notes 'Unsigned build. Install with the one-line command in docs/install.md, or extract the ZIP and run install.ps1.'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0b38ef..d0b7501 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,19 +4,27 @@ All notable changes to ZipXP are recorded here. The format follows [Keep a Chang
## [Unreleased]
+## [0.3.0] - 2026-11-19 (pre-release)
+
### Added
-- One-line curl installer (`scripts/get.ps1`, served at `/install.ps1` on the website): downloads the release ZIP, verifies its SHA-256 and runs the per-user `install.ps1`.
+- React + TypeScript desktop interface hosted in WebView2; launch with `--native-ui` for the original WPF screens.
+- Suggested folders on first launch, an add-folder dialog with an optional "keep compressed automatically" choice, and per-folder progress for the current run.
+- One-line curl installer (`scripts/get.ps1`, attached to each release as `zipxp-get.ps1`): downloads the release ZIP, verifies its SHA-256 and runs the per-user `install.ps1`.
- Release ZIPs get a GitHub build attestation; `get.ps1` verifies it when `gh` is installed and signed in (`-RequireAttestation` makes it mandatory).
-- Release workflow: pushing a `v*` tag builds, checks and packages the app and attaches `ZipXP-win-x64.zip` and its `.sha256` to a GitHub release.
+- Release workflow: pushing a `v*` tag builds, checks and packages the app and attaches `ZipXP-win-x64.zip`, its `.sha256` and `zipxp-get.ps1` to a GitHub release.
-### Known issues
-- After decompression, the measured allocation can be read before the file handle is closed, which overstates growth for some non-aligned file sizes and can show a small negative savings total. Tracked in [#2](https://github.com/kiranscript/zipxp/issues/2); details in [docs/validation.md](docs/validation.md).
+### Fixed
+- Allocation is now measured after the mutation handle is closed, so savings after a restore are no longer overstated for file sizes that are not cluster-aligned ([#2](https://github.com/kiranscript/zipxp/issues/2)).
+- The documented install command pointed at a website that is no longer deployed; it now downloads `zipxp-get.ps1` from the latest release.
+- Website: the install Copy button also copied the optional second install command, so pasting ran the installer twice; the 404 page loaded no styles on Cloudflare Pages; stale 0.2 claims (known issue #2, WPF-only interface, check count, "clone and run" call to action) are updated.
+- Background work on large folders. On a 50,000-file test folder, the worker no longer loads every observation for each file it compresses (CPU during a run fell from 70 s to 12 s per 3 minutes, and throughput rose from 69 to 109 files/min). Rescans reuse sampling estimates for unchanged files and write only changed records (a rescan now reads 70 MB instead of about 1 GB and writes nothing instead of 92 MB). The safety rescan runs every 30 minutes instead of every 2, because file-system notifications already trigger a scan within seconds; it stays at 2 minutes for a folder whose watcher can't start.
### Changed
- Repository reorganised into `src/`, `tests/`, `scripts/` and `docs/`; projects renamed from `StorageManager.*` to `ZipXP.*`.
- The window, tray icon and sidebar now say "ZipXP" instead of "ZipXP Storage Manager".
- README rewritten as a product front page; the technical detail moved to `docs/`.
- Added MIT license, solution file, `.editorconfig`, CI workflow and issue/PR templates.
+- Plainer wording for compression choices and savings throughout the app.
### Unchanged on purpose
- Data folder, startup entry, single-instance name, executable name and install folder keep their `StorageManager` identifiers so existing installs and saved policies continue to work.
diff --git a/Directory.Build.props b/Directory.Build.props
index e709f6c..bd72f92 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,7 +4,7 @@
enableenabletrue
- 0.2.0
+ 0.3.0ZipXPkiran kumarCopyright (c) 2026 kiran kumar
diff --git a/README.md b/README.md
index 8651456..b80c6e8 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
Docs
-> **Status: pre-release (0.2).** ZipXP is under active development and the build is unsigned. Try it on a folder of copies first. See [Safety](docs/safety.md).
+> **Status: pre-release (0.3).** ZipXP is under active development and the build is unsigned. Try it on a folder of copies first. See [Safety](docs/safety.md).
@@ -37,7 +37,7 @@
ZipXP needs Windows 11 and a local NTFS drive. Install the latest release for your user (no admin needed) from Windows PowerShell:
```powershell
-curl.exe -fsSL https://kiranscript.github.io/zipxp/install.ps1 -o "$env:TEMP\zipxp-get.ps1"; powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1"
+curl.exe -fsSL https://github.com/kiranscript/zipxp/releases/latest/download/zipxp-get.ps1 -o "$env:TEMP\zipxp-get.ps1"; powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1"
```
It downloads the release ZIP, verifies its SHA-256 and runs the installer; see [Install and uninstall](docs/install.md) for options and what it does. The React desktop interface requires the [Microsoft Edge WebView2 Runtime](https://developer.microsoft.com/microsoft-edge/webview2/).
@@ -60,7 +60,7 @@ Storage insights lists what takes the room in each folder, with every file's ori
-Compression savings depend entirely on what is in the folder. One known accounting issue (see [validation](docs/validation.md)) can overstate how much space is freed after restoring some files. Text, source code, documents and logs shrink well; photos, video and archives are already compressed and barely change. ZipXP measures the real result per file and skips files that don't benefit.
+Compression savings depend entirely on what is in the folder. Text, source code, documents and logs shrink well; photos, video and archives are already compressed and barely change. ZipXP measures the real result per file and skips files that don't benefit.
## Documentation
diff --git a/docs/install.md b/docs/install.md
index 72f956f..6b7907d 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -5,7 +5,7 @@
From Windows PowerShell (Windows 11 ships `curl.exe`):
```powershell
-curl.exe -fsSL https://kiranscript.github.io/zipxp/install.ps1 -o "$env:TEMP\zipxp-get.ps1"; powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1"
+curl.exe -fsSL https://github.com/kiranscript/zipxp/releases/latest/download/zipxp-get.ps1 -o "$env:TEMP\zipxp-get.ps1"; powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1"
```
The script downloads the latest release ZIP from GitHub, checks it against the release's SHA-256 file, extracts it to a temporary folder, runs the package's own `install.ps1`, and deletes the temporary files. It needs no administrator rights and installs per user, exactly as described below. If ZipXP is running, quit it from the tray first; nothing is force-killed.
@@ -14,7 +14,7 @@ Options go after `-File`, and are passed to `install.ps1`:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1" -StartAtLogin -Launch
-powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1" -Version 0.2.0
+powershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP\zipxp-get.ps1" -Version 0.3.0
```
`-Version` pins a release, `-Destination` and `-NoShortcut` are passed through, and the `ZIPXP_VERSION` environment variable works like `-Version`. Read the script before running it: [scripts/get.ps1](../scripts/get.ps1).
diff --git a/docs/safety.md b/docs/safety.md
index dbf1996..3ead8fc 100644
--- a/docs/safety.md
+++ b/docs/safety.md
@@ -26,4 +26,4 @@ To back up the policy/history database, exit the tray worker normally and copy t
## Known issues
-After decompression, allocation can be measured before the file handle is closed, which overstates growth for some file sizes and can show a small negative savings total. Files themselves are unaffected. Tracked in [#2](https://github.com/kiranscript/zipxp/issues/2); see [validation](validation.md).
+None open. Before 0.3.0, allocation after decompression could be measured before the file handle was closed, which overstated growth for some file sizes and could show a small negative savings total ([#2](https://github.com/kiranscript/zipxp/issues/2)). Files were never affected. 0.3.0 measures on a fresh handle after closing; see [validation](validation.md).
diff --git a/docs/validation.md b/docs/validation.md
index 2e5d033..82c1902 100644
--- a/docs/validation.md
+++ b/docs/validation.md
@@ -24,13 +24,28 @@ Runtime testing found and fixed a launch-check assumption about console-host `Wa
- Browser regressions cover compact 900px layouts, long folder names, persistent settings actions and validation, background scroll containment, full-width modal dimming, and system-colored primary buttons. Review captures use viewport dimensions and include all main pages in forced-colors emulation.
- Windows UI Automation: both React/WebView2 and native fallback launched, navigated all four pages, preserved analysis-only file attributes, and quit gracefully. A duplicate WPF resource inherited during the merge was found by the launch check and removed. The host reported 120 DPI (125% scaling); the locked Windows desktop prevented useful visual captures, so those captures were discarded.
-These are automated development checks. No manual Narrator/NVDA, real Windows contrast-theme, native-dialog visual, or additional-DPI acceptance is claimed. Browser captures use fixture data rather than the live engine. The accounting issue and release acceptance items below remain separate from UI quality.
+These are automated development checks. No manual Narrator/NVDA, real Windows contrast-theme, native-dialog visual, or additional-DPI acceptance is claimed. Browser captures use fixture data rather than the live engine. The release acceptance items below remain separate from UI quality.
-## Additional real-folder run: accounting defect found
+## Additional real-folder run: accounting defect found (fixed in 0.3.0)
A subsequent manual 35-file test (2026-11-09; its evidence files have since been removed from the repository) exercised the actual app on a local test folder, including the default quiet period, closed-window background work, restart catch-up, and GUI decompression. All original hashes and recorded file metadata were preserved and restored.
-That run found an **open allocation-accounting defect (known issue)** not covered by the earlier aligned-size fixtures: reading post-decompression allocation before closing the mutation handle overstates growth for some non-aligned lengths. Three files produced an erroneous **−84 KiB** round-trip ledger total although final allocation exactly matched the baseline. A separate 65,537-byte reproduction confirmed 131,072 allocated bytes while the mutation handle remained open versus 69,632 after close. The recommended correction is to read the allocation after the mutation handle is closed.
+That run found an **allocation-accounting defect** not covered by the earlier aligned-size fixtures: reading post-decompression allocation before closing the mutation handle overstates growth for some non-aligned lengths. Three files produced an erroneous **−84 KiB** round-trip ledger total although final allocation exactly matched the baseline. A separate 65,537-byte reproduction confirmed 131,072 allocated bytes while the mutation handle remained open versus 69,632 after close. The recommended correction is to read the allocation after the mutation handle is closed.
+
+**Fixed (2026-11-19).** The mutator now closes the mutation handle and measures on a fresh handle, and claims no saving if the file changed in between. The core suite reproduced the defect first (65,537 bytes failed), then passed 80 checks, including compress-and-restore round trips at 65,537, 100,003 and 262,147 bytes that net to exactly zero and return to the original allocation.
+
+## Large-folder load test (2026-11-19)
+
+The real engine ran against a generated 50,000-file folder (10,000 compressible text files of 100–160 KB, 40,000 of 1–8 KB, 1.4 GB) on a local NTFS SSD, with the battery and CPU gates off so they didn't hold work back. The test data was deleted afterwards.
+
+| | Before | After |
+|---|---|---|
+| Rescan of an unchanged folder | 10 s CPU, ~1 GB read, 92 MB written | 5 s CPU, 70 MB read, nothing written |
+| Rescan interval with a working watcher | 2 minutes | 30 minutes |
+| Auto-compression, 3 minutes | 69 files/min, 70 s CPU, 10.3 GB read | 109 files/min, 12 s CPU, 359 MB read |
+| Longest wait for a UI command during that run | 8.2 s (during a rescan) | 23 ms (no rescan fell in the window) |
+
+Scans still hold the engine lock, so a UI command can wait for a rescan to finish (about 5 s on this folder). The window's 3-second refresh still loads every observation (about 0.25 s CPU each time on this folder). Throughput is limited by the 500 ms pause between files by design.
## Release acceptance still required
diff --git a/src/ZipXP.Core/Persistence/Store.cs b/src/ZipXP.Core/Persistence/Store.cs
index 3077b1d..5213250 100644
--- a/src/ZipXP.Core/Persistence/Store.cs
+++ b/src/ZipXP.Core/Persistence/Store.cs
@@ -7,6 +7,8 @@ public sealed class Store : IDisposable
private readonly Sqlite db;
public string DatabasePath { get; }
public const int QueueLimit = 2000;
+ // The latest scan's files by stable identity, so the worker can follow a rename without loading every observation.
+ private readonly Dictionary> identities = [];
public Store(string path)
{
@@ -39,25 +41,59 @@ public Store(string path)
private static T Read(string? value) => JsonSerializer.Deserialize(value!)!;
public IReadOnlyList Roots() => db.Query("SELECT data FROM roots ORDER BY path").Select(row => Read(row[0])).ToArray();
public void SaveRoot(ManagedFolder root) => db.Query("INSERT INTO roots VALUES(?,?,?) ON CONFLICT(id) DO UPDATE SET path=excluded.path,data=excluded.data", root.Id, root.Path, Json(root));
- public void RemoveRoot(string id) => db.Transaction(() =>
+ public void RemoveRoot(string id)
{
- Cancel(id, true);
- db.Query("DELETE FROM roots WHERE id=?", id);
- db.Query("DELETE FROM observations WHERE root=?", id);
- db.Query("DELETE FROM decisions WHERE root=?", id);
- });
+ db.Transaction(() =>
+ {
+ Cancel(id, true);
+ db.Query("DELETE FROM roots WHERE id=?", id);
+ db.Query("DELETE FROM observations WHERE root=?", id);
+ db.Query("DELETE FROM decisions WHERE root=?", id);
+ });
+ lock (identities) identities.Remove(id);
+ }
public IReadOnlyList Observations(string root) => db.Query("SELECT data FROM observations WHERE root=?", root).Select(row => Read(row[0])).ToArray();
public IReadOnlyList Scans(string? root = null) => db.Query("SELECT data FROM scans WHERE (? IS NULL OR root=?) ORDER BY id DESC LIMIT 500", root, root).Select(row => Read(row[0])).ToArray();
- public void SaveScan(string root, IEnumerable observations, ScanSummary summary) => db.Transaction(() =>
+ /// The latest scan's entry for a file identity, wherever that file has been renamed to.
+ public Observation? Observed(string root, string identity)
+ {
+ lock (identities)
+ {
+ if (!identities.TryGetValue(root, out var map)) identities[root] = map = Index(Observations(root));
+ return map.GetValueOrDefault(identity);
+ }
+ }
+
+ private static Dictionary Index(IEnumerable observations)
{
- db.Query("DELETE FROM observations WHERE root=?", root);
- foreach (var observation in observations) db.Query("INSERT INTO observations VALUES(?,?,?)", root, observation.Path, Json(observation));
- db.Query("INSERT INTO scans(root,time,data) VALUES(?,?,?)", root, summary.Utc.ToString("O"), Json(summary));
- db.Query("DELETE FROM scans WHERE id NOT IN (SELECT id FROM scans ORDER BY id DESC LIMIT 2000)");
- db.Query("DELETE FROM decisions WHERE time < ?", DateTime.UtcNow.AddDays(-90).ToString("O"));
- db.Query("DELETE FROM jobs WHERE state NOT IN ('Queued','Retry','Running') AND id NOT IN (SELECT id FROM jobs ORDER BY created DESC LIMIT 10000)");
- });
+ var map = new Dictionary(StringComparer.Ordinal);
+ foreach (var observation in observations) if (observation.File != null) map.TryAdd(observation.File.Identity, observation);
+ return map;
+ }
+
+ public void SaveScan(string root, IEnumerable observations, ScanSummary summary)
+ {
+ var entries = observations.ToList();
+ db.Transaction(() =>
+ {
+ // Write only what changed: an idle folder's rescan should not rewrite its whole history.
+ var stored = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ foreach (var row in db.Query("SELECT path,data FROM observations WHERE root=?", root)) stored[row[0]!] = row[1]!;
+ foreach (var observation in entries)
+ {
+ var data = Json(observation);
+ if (stored.Remove(observation.Path, out var previous) && previous == data) continue;
+ db.Query("INSERT INTO observations VALUES(?,?,?) ON CONFLICT(root,path) DO UPDATE SET path=excluded.path,data=excluded.data", root, observation.Path, data);
+ }
+ foreach (var gone in stored.Keys) db.Query("DELETE FROM observations WHERE root=? AND path=?", root, gone);
+ db.Query("INSERT INTO scans(root,time,data) VALUES(?,?,?)", root, summary.Utc.ToString("O"), Json(summary));
+ db.Query("DELETE FROM scans WHERE id NOT IN (SELECT id FROM scans ORDER BY id DESC LIMIT 2000)");
+ db.Query("DELETE FROM decisions WHERE time < ?", DateTime.UtcNow.AddDays(-90).ToString("O"));
+ db.Query("DELETE FROM jobs WHERE state NOT IN ('Queued','Retry','Running') AND id NOT IN (SELECT id FROM jobs ORDER BY created DESC LIMIT 10000)");
+ });
+ lock (identities) identities[root] = Index(entries);
+ }
public IReadOnlyList Jobs() => db.Query("SELECT data FROM jobs ORDER BY created DESC").Select(row => Read(row[0])).ToArray();
public DateTime? RunStart(string root) =>
diff --git a/src/ZipXP.Core/Services/Analyzer.cs b/src/ZipXP.Core/Services/Analyzer.cs
index bca09fe..b4a560f 100644
--- a/src/ZipXP.Core/Services/Analyzer.cs
+++ b/src/ZipXP.Core/Services/Analyzer.cs
@@ -17,6 +17,10 @@ public sealed class Analyzer(Store store)
long logical = 0, allocated = 0, candidates = 0, estimate = 0;
int files = 0, unknown = 0, errors = 0, defaults = NativeFiles.Read(root.Path).Compressed ? 1 : 0;
var complete = true;
+ // Sampling reads up to 96 KB per candidate. Reuse the last estimate while a file's content is unchanged.
+ var estimates = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ foreach (var previous in store.Observations(root.Id))
+ if (previous is { File: { Directory: false } file, EstimatedSaving: long saving }) estimates.TryAdd(previous.Path, (file, saving));
while (pending.TryPop(out var directory))
{
token.ThrowIfCancellationRequested();
@@ -53,9 +57,9 @@ public sealed class Analyzer(Store store)
long? saving = null;
if (reason == null)
{
- saving = Rules.Estimate(file);
- var fresh = NativeFiles.Read(path);
- if (!file.SameContent(fresh)) reason = "Changed during sampling; rescan pending";
+ var reused = estimates.TryGetValue(path, out var cached) && cached.File.SameContent(file);
+ saving = reused ? cached.Saving : Rules.Estimate(file);
+ if (!reused && !file.SameContent(NativeFiles.Read(path))) reason = "Changed during sampling; rescan pending";
else if (saving < root.Policy.MinimumSavingBytes)
{
reason = "Permanent: low estimated benefit until content changes";
diff --git a/src/ZipXP.Core/Services/Engine.cs b/src/ZipXP.Core/Services/Engine.cs
index f4a60e2..9c9b5ff 100644
--- a/src/ZipXP.Core/Services/Engine.cs
+++ b/src/ZipXP.Core/Services/Engine.cs
@@ -4,7 +4,8 @@
namespace ZipXP.Core.Services;
-public sealed record EngineOptions(int ReconcileSeconds = 120, int DebounceMilliseconds = 2000, int ScanSpacingSeconds = 15, int FileDelayMilliseconds = 500);
+// Watcher events trigger scans within seconds; the periodic reconciliation scan only catches anything they missed.
+public sealed record EngineOptions(int ReconcileSeconds = 1800, int DebounceMilliseconds = 2000, int ScanSpacingSeconds = 15, int FileDelayMilliseconds = 500);
public sealed record JobPreview(int Files, long LogicalBytes, long RequiredHeadroom, int NativeDefaults, string Coverage);
public sealed class Engine : IAsyncDisposable
@@ -233,7 +234,9 @@ public Task CycleAsync() => Exclusive(() =>
foreach (var root in roots)
{
var last = scanned.GetValueOrDefault(root.Id, DateTime.MinValue);
- if (last.AddSeconds(options.ReconcileSeconds) <= now || (dirty.TryGetValue(root.Id, out var due) && due <= now && (due == DateTime.MinValue || last.AddSeconds(options.ScanSpacingSeconds) <= now)))
+ // Without a watcher, the periodic scan is the only way to notice changes, so keep it frequent.
+ var reconcile = watchers.ContainsKey(root.Id) ? options.ReconcileSeconds : Math.Min(options.ReconcileSeconds, 120);
+ if (last.AddSeconds(reconcile) <= now || (dirty.TryGetValue(root.Id, out var due) && due <= now && (due == DateTime.MinValue || last.AddSeconds(options.ScanSpacingSeconds) <= now)))
{
// Remove first so events arriving during a scan are retained for the next pass.
dirty.TryRemove(root.Id, out _);
@@ -275,7 +278,7 @@ public Task CycleAsync() => Exclusive(() =>
if (waiting != null) { statuses[root.Id] = waiting; waits[root.Id] = (waiting, DateTime.UtcNow); continue; }
waits.TryRemove(root.Id, out _);
// A rename is reconciled by stable identity. A replacement at the same path is never substituted.
- var observation = Store.Observations(root.Id).FirstOrDefault(o => o.File?.Identity == job.Expected.Identity);
+ var observation = Store.Observed(root.Id, job.Expected.Identity);
var executing = observation?.File != null && observation.File.SameContent(job.Expected)
? job with { Expected = job.Expected with { Path = observation.Path } } : job;
current = executing.Path; Status = job.Operation + ": " + current;
diff --git a/src/ZipXP.Core/Services/Mutator.cs b/src/ZipXP.Core/Services/Mutator.cs
index ba37332..9137243 100644
--- a/src/ZipXP.Core/Services/Mutator.cs
+++ b/src/ZipXP.Core/Services/Mutator.cs
@@ -36,7 +36,15 @@ public MutationResult Execute(ManagedFolder root, WorkItem job)
NativeFiles.SetCompression(handle, compress);
var after = NativeFiles.Read(handle, job.Path);
if (after.Compressed != compress) return new("Failed", "Expected compression state was not observed.", after);
- long? delta = !before.Directory && before.SameContent(after) && before.Allocated.HasValue && after.Allocated.HasValue
+ // NTFS reports the final allocation only after the mutation handle is closed; reading it through the open
+ // handle overstates growth for sizes that are not cluster-aligned (#2). Measure on a fresh handle instead,
+ // and claim nothing if the file changed in between.
+ handle.Dispose();
+ FileRecord? closed = null;
+ try { closed = NativeFiles.Read(job.Path); } catch (Exception ex) when (Scope.FileError(ex)) { }
+ if (closed != null && closed.SameContent(after) && closed.Compressed == compress) after = closed;
+ else closed = null;
+ long? delta = closed != null && !before.Directory && before.SameContent(after) && before.Allocated.HasValue && after.Allocated.HasValue
? before.Allocated.Value - after.Allocated.Value : null;
return new("Succeeded", before.Directory ? "Native default cleared; existing file contents unchanged."
: delta.HasValue ? $"Verified. Signed allocation reduction: {Display.Bytes(delta)}." : "State verified; allocation measurement unavailable.", after, delta);
diff --git a/src/ZipXP.UI/package-lock.json b/src/ZipXP.UI/package-lock.json
index 6e448cc..5ee5215 100644
--- a/src/ZipXP.UI/package-lock.json
+++ b/src/ZipXP.UI/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "zipxp-ui",
- "version": "0.2.0",
+ "version": "0.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "zipxp-ui",
- "version": "0.2.0",
+ "version": "0.3.0",
"dependencies": {
"lucide-react": "^0.468.0",
"react": "^19.2.0",
diff --git a/src/ZipXP.UI/package.json b/src/ZipXP.UI/package.json
index c9fa3eb..53cabce 100644
--- a/src/ZipXP.UI/package.json
+++ b/src/ZipXP.UI/package.json
@@ -1,7 +1,7 @@
{
"name": "zipxp-ui",
"private": true,
- "version": "0.2.0",
+ "version": "0.3.0",
"type": "module",
"scripts": {
"dev": "vite --host 127.0.0.1",
diff --git a/tests/ZipXP.Checks/Program.cs b/tests/ZipXP.Checks/Program.cs
index 6426102..7e1a52e 100644
--- a/tests/ZipXP.Checks/Program.cs
+++ b/tests/ZipXP.Checks/Program.cs
@@ -160,6 +160,20 @@ private static async Task Run(string fixture, string state)
Check(decompressed.State == "Succeeded" && !decompressed.After!.Compressed && decompressed.Delta < 0, "decompression reports signed allocation growth");
store.SaveJob(Job(root, result.After!, "Decompress") with { State = "Succeeded", Delta = decompressed.Delta, FinishedUtc = DateTime.UtcNow });
Check(store.MeasuredSince(DateTime.MinValue).Delta == 0, "compression followed by decompression has zero net measured reduction");
+ // Issue #2: sizes that are not cluster-aligned used to be measured while the mutation handle was still open,
+ // which overstated the growth after decompression.
+ foreach (var size in new[] { 65537, 100003, 262147 })
+ {
+ var oddPath = Path.Combine(fixture, $"odd-{size}.txt"); Text(oddPath, size);
+ var original = NativeFiles.Read(oddPath);
+ var packed = new Mutator().Execute(root, Job(root, original, "Compress"));
+ var unpacked = new Mutator().Execute(root, Job(root, packed.After!, "Decompress"));
+ var final = NativeFiles.Read(oddPath);
+ Check(packed.Delta == original.Allocated - packed.After!.Allocated && unpacked.Delta == packed.After.Allocated - final.Allocated,
+ $"{size}-byte measurements match the allocation seen after the handle closes");
+ Check(packed.Delta + unpacked.Delta == original.Allocated - final.Allocated && final.Allocated == original.Allocated,
+ $"{size}-byte compress and restore round trip nets to zero");
+ }
var locked = NativeFiles.Read(Path.Combine(fixture, "locked.txt"));
using (var exclusive = new FileStream(locked.Path, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
@@ -178,6 +192,24 @@ private static async Task Run(string fixture, string state)
var outOfScope = new Mutator().Execute(root, Job(root, source with { Path = Path.Combine(fixture + "-sibling", "file.txt") }, "Compress"));
Check(outOfScope.State != "Succeeded", "sibling-prefix path cannot escape managed root");
+ {
+ // Rescans write only changed observations; renames and deletions must still land.
+ var tracked = Path.Combine(fixture, "tracked.txt"); Text(tracked);
+ var identity = NativeFiles.Read(tracked).Identity;
+ new Analyzer(store).Scan(store.Roots().Single());
+ var firstEstimate = store.Observations(root.Id).Single(o => o.Path == tracked).EstimatedSaving;
+ new Analyzer(store).Scan(store.Roots().Single());
+ Check(store.Observations(root.Id).Single(o => o.Path == tracked).EstimatedSaving == firstEstimate, "unchanged rescan keeps the stored estimate");
+ var renamed = Path.Combine(fixture, "Tracked-Renamed.txt"); File.Move(tracked, renamed);
+ new Analyzer(store).Scan(store.Roots().Single());
+ var afterRename = store.Observations(root.Id);
+ Check(afterRename.Any(o => o.Path == renamed) && !afterRename.Any(o => o.Path == tracked) && store.Observed(root.Id, identity)?.Path == renamed,
+ "rescan records a rename and the worker finds the file by identity");
+ File.Delete(renamed);
+ new Analyzer(store).Scan(store.Roots().Single());
+ Check(!store.Observations(root.Id).Any(o => o.Path == renamed) && store.Observed(root.Id, identity) == null, "rescan drops deleted files");
+ }
+
var linkPath = Path.Combine(fixture, "reparse-child");
Junction(linkPath, Path.Combine(fixture, "child"));
{
diff --git a/website/404.html b/website/404.html
index 883c755..c4582d6 100644
--- a/website/404.html
+++ b/website/404.html
@@ -5,9 +5,9 @@
Page not found · ZipXP
-
+
-
+
@@ -16,10 +16,10 @@
404
This page compressed itself down to nothing. (It's not actually here.)