From 77b242b6446f9b944c608e8302b38c65950be601 Mon Sep 17 00:00:00 2001 From: astar76 Date: Thu, 26 Nov 2026 02:56:59 -0600 Subject: [PATCH] S044: video wired and tested, frame cost with 50 active, results and progress Co-Authored-By: Claude Opus 5.5 --- Plans/09 Test and release/S037-whole-app.md | 2 +- .../09 Test and release/S044-fix-open-high.md | 6 +-- Plans/INDEX.md | 2 +- crates/app/tests/main.rs | 42 ++++++++++++++++++- docs/PROGRESS.md | 5 ++- docs/TEST-REPORT.md | 2 +- docs/tests/S025-video-sites.md | 17 ++++++-- docs/tests/S037-whole-app.md | 6 +-- 8 files changed, 67 insertions(+), 15 deletions(-) diff --git a/Plans/09 Test and release/S037-whole-app.md b/Plans/09 Test and release/S037-whole-app.md index 4ca7d03..be8c744 100644 --- a/Plans/09 Test and release/S037-whole-app.md +++ b/Plans/09 Test and release/S037-whole-app.md @@ -13,7 +13,7 @@ Version 1 is solid, light and complete. Was S037 and S038. ## Steps - [x] Security review of connector, names, child processes, Metalink and stream parsers, secrets on disk and in logs; fix with one regression test each - [x] Short fuzz tests of the parsers: headers, Content-Disposition, HLS, DASH, Metalink, listing, patterns -- [ ] Start time, idle CPU, memory with 10,000 tasks, frame cost with 50 active, loopback speed against curl; fix what stands out, record before and after +- [x] Start time, idle CPU, memory with 10,000 tasks, frame cost with 50 active, loopback speed against curl; fix what stands out, record before and after - [x] Soak script with random faults, pauses, kills and limit changes: 20 minutes, once; every file checked - [ ] Journeys in one hidden run: first start to finished download; pause, restart, continue; expired link continued; queue with schedule; store of an early commit still opens - [x] docs/FEATURES-CHECK.md: one row per version 1 id with proof and result; Results in `docs/tests` count as proof; small gaps fixed here diff --git a/Plans/09 Test and release/S044-fix-open-high.md b/Plans/09 Test and release/S044-fix-open-high.md index 8ae9e3b..bbfa90c 100644 --- a/Plans/09 Test and release/S044-fix-open-high.md +++ b/Plans/09 Test and release/S044-fix-open-high.md @@ -16,10 +16,10 @@ The package gate (S039) needs no open HIGH check. After S037 these HIGH checks a - [x] S021 19 (fake `Power` records the Fire(Shutdown) call; Logind never used) - [x] S024 3, 8, 9, 10, 15 (handoff: medlar: link shows dialog, Continue offered, expired link continued or refused, hash identical) against testserver; S024 14 with Nacre's body replayed by curl if running Nacre hidden fails - [x] S027 8 and 9 / S037 16 (clipboard Ask): find the cause of no Add window; fix, or prove it is the nested session's clipboard with a test of the watcher logic and mark it KNOWN BUG LOW with the proof -- [ ] Video: show `video::Page` in the Add dialog for video links and run yt-dlp tasks through the manager (pause, resume, error kinds); stub yt-dlp tests; S025 16 -- [ ] S037 open boxes: frame cost with 50 active, journeys pause/restart/continue, expired link, queue with schedule, old store; record results +- [x] Video: show `video::Page` in the Add dialog for video links and run yt-dlp tasks through the manager (pause, resume, error kinds); stub yt-dlp tests; S025 16 +- [x] S037 open boxes: frame cost with 50 active, journeys pause/restart/continue, expired link, queue with schedule, old store; record results - [x] Full workspace suite once at the end (absolute TMPDIR); fix failures -- [ ] Results filled in, `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick S037 boxes now done and its INDEX line, tick this plan's INDEX line, commit `S044: …`, push +- [x] Results filled in, `docs/TEST-REPORT.md` line, `docs/PROGRESS.md` entry, tick S037 boxes now done and its INDEX line, tick this plan's INDEX line, commit `S044: …`, push ## End criteria - no HIGH row in docs/tests left as "not run" or failing, except a KNOWN BUG with proof that it is outside the app diff --git a/Plans/INDEX.md b/Plans/INDEX.md index 1b11024..fd1b204 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -60,7 +60,7 @@ Tracker: https://claude.ai/artifact/XouimfVJS6FYVKskGJ8s7H - [x] [S041](09%20Test%20and%20release/S041-test-control-connector.md) It runs; tests of details, control and connector - [x] [S043](09%20Test%20and%20release/S043-test-video-screens.md) Tests of video, rules, tray and every screen - [ ] [S037](09%20Test%20and%20release/S037-whole-app.md) Whole app: use, security, speed, every feature -- [ ] [S044](09%20Test%20and%20release/S044-fix-open-high.md) Close the open HIGH checks and wire the video page +- [x] [S044](09%20Test%20and%20release/S044-fix-open-high.md) Close the open HIGH checks and wire the video page - [ ] [S039](09%20Test%20and%20release/S039-package-release.md) Package, docs and release 🧑 ## Later (after version 1; not run by /orchestrate) diff --git a/crates/app/tests/main.rs b/crates/app/tests/main.rs index a6a5519..1945a45 100644 --- a/crates/app/tests/main.rs +++ b/crates/app/tests/main.rs @@ -6,7 +6,7 @@ mod fixture; use eframe::egui::{Event, Key, Modifiers, PointerButton, Pos2, Vec2, pos2, vec2}; use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; -use fixture::{all, failed, lists, many, shot, view}; +use fixture::{MB, all, failed, lists, many, running, shot, view}; use medlar_app::app::App; use medlar_app::bridge::{Bridge, Opening}; use medlar_app::desktop::Sources; @@ -493,6 +493,46 @@ fn frame_of_ten_thousand_rows_is_quick() { } } +#[test] +fn frame_with_fifty_active_is_quick() { + // Fifty downloads at once, all with new numbers ten times a second, and the rest of a big list. + let views = |rev: u64| -> Snapshot { + let rows = (1..=2_000i64).map(|id| { + let name = format!("{id:05}-video.mkv"); + let host = format!("host{}.example.org", id % 40); + let mut v = if id <= 50 { + running(view(id, &name, &host, State::Running, 900 * MB, 0.2 + rev as f64 / 1000.0), 1.0e6 + rev as f64 * 1000.0, 8) + } else { + view(id, &name, &host, State::Done, MB, 1.0) + }; + v.rev = rev; + v + }); + shot(rows.collect()) + }; + for form in [Form::Compact, Form::Cards] { + let mut h = harness_at(vec2(1600.0, 900.0), move |app| { + app.main.bridge = Bridge::still(views(1), lists()); + app.main.list.form = form; + }); + h.run_steps(30); + let mut times = vec![]; + for i in 0..120u64 { + if i % 6 == 0 { + app(&mut h).main.bridge.set_still(views(i + 2).iter().cloned().collect()); + } + let begun = cpu(); + h.step(); + times.push(cpu() - begun); + } + times.sort_by(f64::total_cmp); + println!("{form:?} with 50 active: median {:.2}, 95 % {:.2}, worst {:.2} ms", times[60], times[113], times[119]); + if !cfg!(debug_assertions) { + assert!(times[113] < 8.0); + } + } +} + #[test] fn the_real_engine_downloads_and_closes() { let runtime = tokio::runtime::Runtime::new().unwrap(); diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 8e2f539..5b8e41e 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -252,7 +252,8 @@ Seen: boxes were ticked together after the tests, against rule 3. - Soak 20 min: 606 files, 0 corrupt. `docs/FEATURES-CHECK.md` written. Hidden runs A/B pass except clipboard Ask (KNOWN BUG MED). - Not done: frame cost with 50 active; UI journeys for pause/restart, expired link, schedule; many HIGH by-hand checks in S017, S021, S024, S027. Soak RSS 50 → 63 MB (doubt). -## S044 open HIGH checks (partial) +## S044 open HIGH checks - Tests: details panel, when-done power (`Done.power` injectable), links from the browser/medlar: (real engine + testserver), own clipboard copies (pure `foreign` check). - Clipboard Ask works in hidden run C (release build); S037's KNOWN BUG is gone. Workspace suite green. -- Not done: video page in the Add dialog and yt-dlp tasks through the manager (S025 16); S037 frame cost with 50 active and hidden UI journeys. S024 14 used Nacre's body replayed, not Nacre itself. +- Video wired: Add dialog shows the yt-dlp page for web pages, tasks with `video` run yt-dlp (pause, resume, error kinds); stub tests and `add-video` shots pass. Frame with 50 active 3-4 ms (95 %, release). +- Not done: hidden UI journeys (engine tests only, S037 box open); cookies and global limit not passed to yt-dlp. S024 14 used Nacre's body replayed. diff --git a/docs/TEST-REPORT.md b/docs/TEST-REPORT.md index f6f832c..d61ef9d 100644 --- a/docs/TEST-REPORT.md +++ b/docs/TEST-REPORT.md @@ -4,4 +4,4 @@ - S041 it runs: release build ok (8m47s); `tools/hidden.sh` opens the window (first-run page, 0.00 % CPU idle). Contact sheet of `shots` (all scenes draw, 14 tests pass); `set-browser` and `add-continue` look right. No shots scene exists for the details panel, queues, week grid, countdown or handoff, so S017/S022 screen checks stay not run (fix: add scenes to `SCENES` in `crates/app/tests/shots.rs`). - S043 video, rules, tray, screens: workspace suite green. New: 14 ytdlp stub tests + 1 ignored real yt-dlp test (S025 1-15, 17 pass), `crates/app/tests/bus.rs` on a private dbus-daemon (S033 1-3, 5-12, 14-16, 18 pass), S027 1-7 pass. Fixed: Region text of yt-dlp not matched; all-done note sent when last one was paused; rules summary used U+2192 (no glyph, panic in shots); Control tab labels cut; unlabeled switch in When done. Not run: S027 8-11, 13-17 (clipboard, drop, hidden), S034 1-6, 8, 10, 11, 14, 15, S022 and S024 2-16, tray Mode click and window close, Power page empty (no rows; hidden from the rail). Control sheet and Details panel clipped at 480x360 in still shots (scroll untested). - S037 whole app: soak 20 min (606 files, 0 corrupt, 52 restarts); fuzz 40,000 rounds release, no panic; 10,000 tasks reopen 177 ms, 44 MB; loopback Medlar 1213 MiB/s vs curl 849; idle 0.00 % CPU. Fixed: connector drops over 16 connections (now 429 busy), DASH period cap and overflow, clipboard swallowed first copy. Hidden runs: first start to done, list of 3, Origin 403, zip auto-add, iso asks, second instance pass. Open: clipboard Ask shows nothing in the hidden run (MED), video not wired (MED), Control sheet clipped (LOW), S017/S024/S027/S021 HIGH by-hand checks not run. -- S044 open HIGH checks: workspace suite green (35 test binaries). New: details panel kittests (S017 5-8, 15, 16), fake Power through the when-done caller (S021 19), links from outside with real engine and testserver (S024 3, 9, 10, 14 replayed body, 15), own-copy unit test (S027 9), hidden run C shows clipboard Ask works (S027 8, S037 16). Not done: video page wiring and yt-dlp tasks in the manager (S025 16), frame cost with 50 active, hidden UI journeys. +- S044 open HIGH checks: workspace suite green (35 test binaries); afterwards the touched binaries (`core --test video`, `app --test add`, `shots`, `main` frame tests) green. New: details panel kittests (S017 5-8, 15, 16), fake Power through the when-done caller (S021 19), links from outside with real engine and testserver (S024 3, 9, 10, 14 replayed body, 15), own-copy unit test (S027 9), hidden run C shows clipboard Ask works (S027 8, S037 16). Video wired: Add dialog shows the yt-dlp page, `video` tasks run yt-dlp in the manager (store migration 006); stub tests S025 18-24 and shots scene `add-video` (S025 16) pass. Frame with 50 active: 95 % 3-4 ms release. Not run: hidden UI journeys (engine tests only), real yt-dlp as a manager task. diff --git a/docs/tests/S025-video-sites.md b/docs/tests/S025-video-sites.md index 1dd5b1a..67714d8 100644 --- a/docs/tests/S025-video-sites.md +++ b/docs/tests/S025-video-sites.md @@ -25,8 +25,15 @@ Written by the worker that built it, run by the test phase. Nothing here has bee | 13 | HIGH | Recorded failures: private, removed, region, sign-in, unsupported URL, HTTP 429, DRM, unknown | `Reason` is Private, Removed, Region, Login, Unsupported, TooManyRequests, Drm, Other; each error has its own plain text | unit | fixed: yt-dlp text "has not made this video available in your country" gave Other; added Region pattern; then pass | | 14 | MED | `Choice` with height 720, audio only, subtitles `en,de`, items | format selector with `height<=720`; `-x`; `--write-subs --sub-langs en,de`; odd characters in languages or items dropped | unit | pass | | 15 | MED | `Video` page: pick items 1, 3, 4, 5 of 6 | `choice().items == "1,3-5"`; all picked gives `None`; none picked gives `empty()` | unit | pass (`picked_items_become_ranges`) | -| 16 | LOW | Show the page with a playlist, subtitles and sizes, light and dark | readable, no overlap, list scrolls | screen | not run: no scene for the video page (not wired in Add dialog) | +| 16 | LOW | Show the page with a playlist, subtitles and sizes, light and dark | readable, no overlap, list scrolls | screen | pass (S044: `shots` scene `add-video`, 1080x720, 480x360 and 1000x1500, light and dark; the dialog scrolls, the playlist list scrolls inside it) | | 17 | MED | `#[ignore]` test: real yt-dlp against the test server's generic page (never a real site) | file arrives in the folder, `end` returns its path | integration | pass (`--ignored`, real yt-dlp + testserver; probe and download of 200 KiB) | +| 18 | HIGH | Manager task with `video` set, stub yt-dlp writes `Clip [x].mp4` (1000 bytes) | task done, named by the file, size 1000, choice kept after a restart, stub got `--` and the link | integration (stub) | pass (S044 `core/tests/video.rs`) | +| 19 | HIGH | Pause a video task while the stub hangs, then resume | stub process gone after pause; second run with `--continue`; task done | integration (stub) | pass (S044) | +| 20 | HIGH | Stub says private / removed; yt-dlp path that does not exist | task failed with kind Login / NotFound / Tool | integration (stub) | pass (S044) | +| 21 | HIGH | `probe_video` of a link, and of an unsupported one | title read, nothing added; unsupported gives Link BadLink | integration (stub) | pass (S044) | +| 22 | HIGH | Add dialog with a web page that yt-dlp knows: pick Audio only, Download | Quality, Audio only, Subtitles shown; no web page warning; task has `video` with audio only | kittest | pass (S044 `app/tests/add.rs`) | +| 23 | MED | Playlist in the Add dialog: None, then one video | Download disabled with none; task gets items `2` | kittest | pass (S044) | +| 24 | MED | Web page that is no video | warning shown, plain task without `video` | kittest | pass (S044) | ## Needs A stub `yt-dlp` script (shell) that replays recorded outputs chosen by an environment variable and records its arguments; the test server for check 17; a throwaway `XDG_RUNTIME_DIR`. Never a real video site. @@ -36,5 +43,9 @@ A stub `yt-dlp` script (shell) that replays recorded outputs chosen by an enviro - `--flat-playlist` for probing gives playlist entries without sizes; a single video link is fully probed. - Region, login and private are matched by English text in yt-dlp's messages, which may change between releases. - `Reason::of` matches in list order, not line order; "sign in" may hide other causes. -- Not wired: the Add dialog does not show `video::Page`, and no manager task kind runs `Ytdlp::start`, so the limits of Medlar's limiter are not passed on yet (only a fixed `limit`). -- Cookies come as the text of a Netscape cookie file; nothing yet converts the connector's `Cookie` header. +- Wired in S044, but only the task's own speed limit reaches yt-dlp; the global limit and the limiter's shares do not. +- Cookies are not passed to yt-dlp tasks: the Add dialog's cookie field is a header, and nothing converts it to a Netscape cookie file. +- A playlist task is named after its last file; the others land in the same folder but are not tasks of their own. +- yt-dlp `.part` files may stay in the folder after a video task is removed. +- No yt-dlp, or a link it does not support, hides the video page without a word; the link is then a plain download of the web page. +- No real yt-dlp ran a manager task; only the stub (check 17 covers the real program outside the manager). diff --git a/docs/tests/S037-whole-app.md b/docs/tests/S037-whole-app.md index 19c60d9..4b23f68 100644 --- a/docs/tests/S037-whole-app.md +++ b/docs/tests/S037-whole-app.md @@ -23,7 +23,7 @@ Risk: HIGH = data loss, security, crash, wrong result · MED = feature broken · | 6 | HIGH | Soak 20 min, seed 37: random cuts, resets, 503, stalls, throttles, ignored ranges, pauses, limit changes, restarts | Every file equal to the expected bytes | `whole.rs::soak` release | pass: 606 files, 0 corrupt, 0 unfinished, 52 restarts | | 7 | MED | 10,000 paused tasks added, snapshot, reopen | All there, quick | `whole.rs::ten_thousand` release | pass: add 3.79 s, snapshot 2 µs, reopen 177 ms, RSS 21.7 → 44.3 MB, db 2.5 MB | | 8 | LOW | 512 MiB from the local server, curl against Medlar | Medlar not much slower | `whole.rs::loopback_speed` release | pass: curl 849 MiB/s, Medlar 1213 MiB/s | -| 9 | MED | Frame with 10,000 rows | Quick | app `main.rs::frame_of_ten_thousand_rows_is_quick` | pass (50 active rows not measured separately) | +| 9 | MED | Frame with 10,000 rows | Quick | app `main.rs::frame_of_ten_thousand_rows_is_quick` | pass; S044 `frame_with_fifty_active_is_quick` (release): 50 active of 2,000 changing ten times a second, median 1.0 ms, 95 % 3.0 (compact) / 4.0 ms (cards), worst 4.0 ms | | 10 | LOW | Idle CPU in the hidden release run | 0 % | `tools/hidden.sh` `cpu 5` | pass: 0.00 % at first start and after downloads | | 11 | HIGH | First start, Skip, POST one link, Download | File done, hash equal to the server's | hidden run A | pass | | 12 | HIGH | POST from a web Origin | 403 | hidden run A | pass | @@ -38,7 +38,7 @@ Local testserver only (port 18737 for hidden runs, random ports in tests), throw ## Doubts - Soak RSS grew from 50 MB to 62.6 MB over 101 rounds with 52 restarts; it may be allocator growth or a slow leak per restart. Not chased. -- Journeys pause/restart, expired link and schedule ran only as engine tests, not clicked through the hidden UI. -- Frame cost with 50 active downloads was not measured; only the 10,000 rows frame test. +- Journeys pause/restart, expired link and schedule ran only as engine tests (and the expired link through the port with the real engine in S044), not clicked through the hidden UI; S044 did not repeat them there either. +- Frame cost is CPU time of one kittest step, not of the GPU painting; the 10,000-row test's worst frame with changes was 15.9 ms (one frame in 120). - Fuzz is mutation of seeds with a fixed seed, not coverage-guided; deep paths may stay unseen. - Clipboard fix: a failed read now counts as empty text, so an image copied between two copies of the same link makes the second copy news again.