Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.'
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<Version>0.2.0</Version>
<Version>0.3.0</Version>
<Product>ZipXP</Product>
<Authors>kiran kumar</Authors>
<Copyright>Copyright (c) 2026 kiran kumar</Copyright>
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<a href="docs/usage.md">Docs</a>
</p>

> **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).

<p align="center">
<img src="assets/screenshots/overview.png" alt="ZipXP overview showing 48.2 MB saved by ZipXP" width="760">
Expand All @@ -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/).
Expand All @@ -60,7 +60,7 @@ Storage insights lists what takes the room in each folder, with every file's ori
<img src="assets/screenshots/storage-insights.png" alt="ZipXP storage insights listing per-file original size, size used now and space saved" width="760">
</p>

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

Expand Down
4 changes: 2 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion docs/safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
21 changes: 18 additions & 3 deletions docs/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
64 changes: 50 additions & 14 deletions src/ZipXP.Core/Persistence/Store.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, Dictionary<string, Observation>> identities = [];

public Store(string path)
{
Expand Down Expand Up @@ -39,25 +41,59 @@ public Store(string path)
private static T Read<T>(string? value) => JsonSerializer.Deserialize<T>(value!)!;
public IReadOnlyList<ManagedFolder> Roots() => db.Query("SELECT data FROM roots ORDER BY path").Select(row => Read<ManagedFolder>(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<Observation> Observations(string root) => db.Query("SELECT data FROM observations WHERE root=?", root).Select(row => Read<Observation>(row[0])).ToArray();
public IReadOnlyList<ScanSummary> 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<ScanSummary>(row[0])).ToArray();

public void SaveScan(string root, IEnumerable<Observation> observations, ScanSummary summary) => db.Transaction(() =>
/// <summary>The latest scan's entry for a file identity, wherever that file has been renamed to.</summary>
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<string, Observation> Index(IEnumerable<Observation> 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<string, Observation>(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<Observation> 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<string, string>(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<WorkItem> Jobs() => db.Query("SELECT data FROM jobs ORDER BY created DESC").Select(row => Read<WorkItem>(row[0])).ToArray();
public DateTime? RunStart(string root) =>
Expand Down
Loading
Loading