Share results anonymously: collection, outbox, sender, consent, ogc db measure #48

Manually merged
SkyfaR merged 7 commits from contrib into main 2026-10-07 10:58:26 +02:00
Owner

Phase 3 of the community database design, on top of #47 (this branch contains it; merge #47 first).

Analysis prerequisites. The directory report splits bytes into compressible, No_COW and incompressible and aggregates per extension. With sharing on, a separate methods pass runs the samples already read through zstd 1/3/6/9/15 (and XPRESS 4K/8K/16K on Windows; LZX is measured only) at background priority, only when nothing else is asked; the visible estimate never waits for it. Levels 9 and 15 come from a deterministic subset of the samples (folders with ≥ 512 samples; every 8th sample of a file read whole, every 4th of a sampled file), scaled by the folder's ratio to level 6: CPU −68 to −80 % on real Steam folders, level 15 within 0.1–2.2 ‰ of the full estimate (owner's decision). The pass runs on AC power only (the timer's battery check; desktops count as AC); ogc analyze --on-battery overrides it. estimate::GENERATION is 2. The analysis cache keeps the estimator generation and size bucket. On Windows a measurement walk after a WOF run sums GetCompressedFileSizeW and checks every file's algorithm.

Contributions. collect.rs applies §3.6 (store key and build, fully installed, complete run, no exclusions or skip list, Windows measured only after a clean walk, not again within 180 days for methods already sent; excluded games are never shared). The outbox holds core values only, one item per game; the sender adds salt, PoW and padding, POSTs exactly 1024 bytes over a fresh ureq agent (no keep-alive, no TLS resumption, no cookies, constant User-Agent, SOCKS resolving remotely), random not-before 1–24 h, ≥ 2 h apart, ≤ 8 a day, only while the app is open or on ogc db send; the timer only queues. 202 accepted; every 4xx deletes; 410 turns sharing off; 429/503 back off; 14-day expiry; a 30-day pause after failures on at least 3 days.

UI. "Share results anonymously" switch with the §9.3 confirmation dialog, the one-time card after the first analysis, the outbox page (exact JSON, remove one, remove all), notices. CLI: ogc db outbox [--show] [--clear], ogc db send, ogc db measure (curated measurement in ogc-db's format, no paths or names; on Windows real WOF runs with --restore).

Review: 13 findings from two independent reviews (10 distinct, 1 high: Windows estimates and measurements replaced each other in the outbox), all fixed. Locally: fmt, clippy (both feature sets), 1850 tests incl. GUI under Broadway pass. Not run: the Windows GTK clippy (check-gui.sh) — CI covers it.

Fixed after the first CI run: the thread id comes from the system call instead of gettid(), which glibc 2.28 (the bundle's floor) lacks.

Phase 3 of the community database design, on top of #47 (this branch contains it; merge #47 first). **Analysis prerequisites.** The directory report splits bytes into compressible, No_COW and incompressible and aggregates per extension. With sharing on, a separate methods pass runs the samples already read through zstd 1/3/6/9/15 (and XPRESS 4K/8K/16K on Windows; LZX is measured only) at background priority, only when nothing else is asked; the visible estimate never waits for it. Levels 9 and 15 come from a deterministic subset of the samples (folders with ≥ 512 samples; every 8th sample of a file read whole, every 4th of a sampled file), scaled by the folder's ratio to level 6: CPU −68 to −80 % on real Steam folders, level 15 within 0.1–2.2 ‰ of the full estimate (owner's decision). The pass runs on AC power only (the timer's battery check; desktops count as AC); `ogc analyze --on-battery` overrides it. `estimate::GENERATION` is 2. The analysis cache keeps the estimator generation and size bucket. On Windows a measurement walk after a WOF run sums `GetCompressedFileSizeW` and checks every file's algorithm. **Contributions.** `collect.rs` applies §3.6 (store key and build, fully installed, complete run, no exclusions or skip list, Windows measured only after a clean walk, not again within 180 days for methods already sent; excluded games are never shared). The outbox holds core values only, one item per game; the sender adds salt, PoW and padding, POSTs exactly 1024 bytes over a fresh ureq agent (no keep-alive, no TLS resumption, no cookies, constant User-Agent, SOCKS resolving remotely), random not-before 1–24 h, ≥ 2 h apart, ≤ 8 a day, only while the app is open or on `ogc db send`; the timer only queues. 202 accepted; every 4xx deletes; 410 turns sharing off; 429/503 back off; 14-day expiry; a 30-day pause after failures on at least 3 days. **UI.** "Share results anonymously" switch with the §9.3 confirmation dialog, the one-time card after the first analysis, the outbox page (exact JSON, remove one, remove all), notices. CLI: `ogc db outbox [--show] [--clear]`, `ogc db send`, `ogc db measure` (curated measurement in ogc-db's format, no paths or names; on Windows real WOF runs with `--restore`). Review: 13 findings from two independent reviews (10 distinct, 1 high: Windows estimates and measurements replaced each other in the outbox), all fixed. Locally: fmt, clippy (both feature sets), 1850 tests incl. GUI under Broadway pass. Not run: the Windows GTK clippy (`check-gui.sh`) — CI covers it. Fixed after the first CI run: the thread id comes from the system call instead of `gettid()`, which glibc 2.28 (the bundle's floor) lacks.
Community database in the app: shipped data, predictions, ogc db, opt-in download
All checks were successful
CI / Windows, command line (clippy with tests) (pull_request) Successful in 40s
CI / Windows, MSYS2 sysroot (pull_request) Successful in 21s
CI / Windows, command line (tests under Wine) (pull_request) Successful in 1m40s
CI / Windows, installer (tests under Wine) (pull_request) Successful in 1m43s
CI / Bundle programs, command line and helper (pull_request) Successful in 1m36s
CI / Arch package (pull_request) Successful in 2m49s
CI / Bundle programs, desktop app (pull_request) Successful in 1m59s
CI / Windows, desktop app (clippy, script tests) (pull_request) Successful in 1m6s
CI / Bundle for any distribution (pull_request) Successful in 14s
CI / Windows, desktop app (tests under Wine) (pull_request) Successful in 1m25s
CI / Windows, GTK with AccessKit (pull_request) Successful in 10s
CI / Format, lint and test (pull_request) Successful in 5m49s
CI / Windows, installer and portable zip (pull_request) Successful in 5m48s
CI / Release (pull_request) Has been skipped
VM test / Migrations in a VM (pull_request) Successful in 18m33s
de8a0b1985
The app ships a snapshot of the community database and shows its expected
savings on game cards until the local analysis replaces them; predictions
never drive compressing, skipping, the timer or the dashboard's total.
ogc db status, update and show, prediction fields in ogc list's JSON and a
community line in ogc analyze. Downloads are off until switched on in the
settings, fetch whole signed files at most once a day, and stay disabled
until the release keys are embedded.
Share results anonymously: collection, outbox, sender, consent, ogc db measure
Some checks failed
CI / Windows, command line (clippy with tests) (pull_request) Successful in 50s
CI / Windows, command line (tests under Wine) (pull_request) Successful in 2m15s
CI / Windows, MSYS2 sysroot (pull_request) Successful in 15s
CI / Windows, installer (tests under Wine) (pull_request) Successful in 1m34s
CI / Format, lint and test (pull_request) Successful in 6m24s
CI / Bundle programs, command line and helper (pull_request) Failing after 1m41s
CI / Arch package (pull_request) Successful in 3m0s
CI / Bundle programs, desktop app (pull_request) Successful in 2m13s
CI / Bundle for any distribution (pull_request) Has been skipped
CI / Windows, desktop app (clippy, script tests) (pull_request) Successful in 1m13s
CI / Windows, GTK with AccessKit (pull_request) Successful in 9s
CI / Windows, desktop app (tests under Wine) (pull_request) Successful in 1m32s
CI / Windows, installer and portable zip (pull_request) Successful in 6m34s
CI / Release (pull_request) Has been skipped
VM test / Migrations in a VM (pull_request) Successful in 18m56s
f4372be259
With sharing switched on, an analysis also estimates the zstd anchors (and
XPRESS on Windows) in a separate pass at background priority, and a complete
analysis or a WOF measurement is queued per game under the design's rules.
The outbox sends one 1024-byte record at a time with proof of work over a
fresh connection, at random times, at most eight a day and only while the
app is open or on ogc db send; the background timer only queues. Sharing is
off until confirmed in a dialog; the queue can be inspected and cleared.
ogc db measure writes a curated measurement for ogc-db without paths or
names.
Where a folder has at least 512 samples, levels 9 and 15 compress every
8th sample of a file read whole and every 2nd of a sampled one, at a
phase taken from the file's path, and scale what level 6 saves by the
folder's ratio of savings on those subsets. On Proton Experimental and
Steam's runtimes this cuts the CPU time of the pass that estimates every
method by 68 to 80 %, with level 15 within 2.2 per mille of the estimate
from every sample. Curated measurements still use every sample.

The estimator generation is 2.
The app's worker leaves the games noted while the computer runs on
battery, gives way when it is unplugged mid-pass, and resumes once a
thread finds it on AC power again. ogc analyze skips its pass on
battery with a note, unless --on-battery asks for it. The power check
is the timer's, so a computer without a battery counts as on AC power.
Where the analysis compresses at level 9 or 15 itself, its compressor
still reads every sample for the card's estimate, but the level's
estimate for the methods now comes from its subset like any other's.
The same folder then contributes the same values at any level analysed,
and level 15's ratio is bounded by level 9's before the payload's clamp.
A game made of large, sampled files kept about 56 % of the CPU time of
the methods pass with every 2nd sample. With every 4th it keeps about a
third: a twice-copied Unity game went from 47.6 to 14.9 CPU s (-69 %),
Steam's runtimes and Proton Experimental by 69 to 82 %, about 8 to 11
times a plain analysis whatever the mix of files. Level 15 stays within
2.4 per mille of the estimate from every sample.

The docs give the cost by file mix, mark the older cost figures as
measured before the subset, and say that per extension levels 9 and 15
are projections of level 6's savings.
Take the thread id from the system call, not gettid()
All checks were successful
CI / Windows, MSYS2 sysroot (pull_request) Successful in 16s
CI / Windows, installer (tests under Wine) (pull_request) Successful in 1m38s
CI / Windows, command line (tests under Wine) (pull_request) Successful in 1m56s
CI / Bundle programs, command line and helper (pull_request) Successful in 1m53s
CI / Arch package (pull_request) Successful in 3m36s
CI / Format, lint and test (pull_request) Successful in 6m19s
CI / Windows, GTK with AccessKit (pull_request) Successful in 9s
CI / Windows, command line (clippy with tests) (pull_request) Successful in 46s
CI / Bundle programs, desktop app (pull_request) Successful in 2m23s
CI / Bundle for any distribution (pull_request) Successful in 17s
CI / Windows, installer and portable zip (pull_request) Successful in 6m33s
CI / Windows, desktop app (clippy, script tests) (pull_request) Successful in 1m17s
CI / Windows, desktop app (tests under Wine) (pull_request) Successful in 1m25s
CI / Release (pull_request) Has been skipped
VM test / Migrations in a VM (pull_request) Successful in 19m2s
51de06b8e2
glibc has gettid() only since 2.30; the bundle is built for 2.28, where
linking ogc failed with an undefined gettid.
SkyfaR manually merged commit eb3ca57d53 into main 2026-10-07 10:58:26 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
LevelXStudios/OpenGameCompressor!48
No description provided.