Repository navigation
fix: counterexamples found by property tests, faster Track loading - #44
Merged
Merged
Conversation
Property tests (proptest) for the bugs fixed so far and for the invariants the code relies on. Seven of them had counterexamples: - scan: an unmounted disk leaves an empty folder, which passed for a readable Library, so every Track was deleted as an orphan. An empty Library now deletes nothing. - analyze (CLI): outside the analysis window the command waited for ever. It now ignores the window, like any Analysis asked for. - config: the Library `/media/movies` also claimed `/media/movies-4k/…`. - track: a file cut after 25 bytes, or an empty film on a grid without cells, crashed `load`. A damaged header is now refused. - render: under 28 % of spread, a Strip LED between two Edge cells read none and stayed black. It now reads the nearest one. - server: a merge patch left a nested null in over a non-object. - jellyfin: a date with a 19-digit year overflowed. Also: a Library without a folder no longer makes every file reachable through the API. Faster: - Track::load decodes straight into the grids and the Edges, undoes the differences 16 bytes at a time and reads luminance from tables: 187 ms to 131 ms for a 2 h film. - Centered smoothing reads each frame once instead of twice per sample. - Built assets are served as immutable; the status poll no longer renders the UI again when nothing changed. Tracks written before and after are identical, byte for byte.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Property tests (
proptest, dev dependency) for the bugs fixed so far and for the invariants the code relies on, the fixes for the counterexamples they found, and a few measured speed-ups.Counterexamples fixed
Each test was checked to fail without its fix (the CLI hang was reproduced on the previous binary).
queue::scanlueur analyzeConfig::local_path/media/moviesalso claimed/media/movies-4k/…Track::loadrender::Mappingserver::mergenullstayed in when patched over a non-objectparse_iso8601Also, without a test: a Library without a folder no longer makes every file reachable through the API.
The first two change visible behaviour and are the ones to review.
Property tests for past fixes
53d93fc(HDR),e714ce3(AV1),388efed(light positions),825089d/7a855d3/88ed7c6(playback clock),ddc42b7(one owner for the stream),247473a(session first seen paused).Not covered: the 7 web UI fixes (no web test harness),
fbcd44e(threads and timing),cf23705(Jellyfin HTTP call).One invariant is proven by going through every case (
analyze::part: never empty, never outside, tiles the side). The others are property-tested, not proven.Speed
Measured with
cargo test --release bench -- --ignored --nocaptureon an Apple Silicon Mac.scale_vt, LTO and an sRGB table were tried, gave nothing and are not in this PR.immutable; the status poll no longer renders the UI again when nothing changed; the barcode gradient and the Look page's film list are memoized.Clean-up
About 65 lines: the mDNS search shared by
hue.rsandwled.rs, default fields restated inTrackliterals, and dead web code (usePoll's unread error,Pill'sredtone, stale section dividers, a duplicatebodyrule).Checks
cargo test: 76 pass (43 before).cargo clippy --all-targets: clean.pnpm --filter web typecheckandbuild: pass./assets/*,/api/status, a config patch.Added files
apps/server/src/bench.rs: the timings above, as an ignored test.apps/server/proptest-regressions/: the seeds of the counterexamples, replayed first on every run.