Medlar/docs/tests/S024-handoff-flow.md
2026-11-26 02:36:15 -06:00

42 lines
5.1 KiB
Markdown

# S024 — Hand-off flow: test file
Written by the worker that built it, run by the test phase. Nothing here has been tested until its Result says so.
## Built
- `crates/app/src/views/incoming.rs` · `Inbox`: starts the port, sorts arrivals (relink, auto-add, Add dialog); `of_arg` parses `medlar:` links, links and `.metalink` files.
- `crates/app/src/instance.rs` · single instance by Unix socket in `$XDG_RUNTIME_DIR`, named from the home folder.
- `crates/app/src/views/connector.rs` · Settings, Browser: state, test link, sender log, Nacre steps.
- `crates/core/src/settings.rs` · `auto_types`, `auto_min_mb`, `auto_max_mb`, `Settings::auto_ok`.
- `assets/medlar.desktop` · `medlar:` scheme and metalink types.
## Checks
Risk: HIGH = data loss, security, crash, wrong result · MED = feature broken · LOW = looks or comfort.
| # | Risk | Do this | Expect | How | Result |
|---|---|---|---|---|---|
| 1 | HIGH | `medlar:` link and `/x.metalink` through `of_arg`; `--show`, `medlar:nothing` | Request with literal text / list; the last two give none | unit | pass (unit `incoming::tests::arguments`) |
| 2 | HIGH | Hidden run, throwaway home, POST one link to the port | Add dialog opens with the link filled in | by hand | pass: S037 hidden run (tools/hidden.sh, release build, testserver) |
| 3 | HIGH | Same with `add_without_asking` off and a `medlar:` link on the socket | Dialog shown, never added silently | by hand | pass: app `tests/add.rs` (S044, real engine + testserver, port on a spare number) `a_medlar_link_always_opens_the_dialog` |
| 4 | HIGH | Turn `add_without_asking` on, types `zip`, send a `.zip` and a `.iso` | zip added at once with a toast; iso opens the dialog | by hand | pass: S037 hidden run (tools/hidden.sh, release build, testserver) |
| 5 | MED | `auto_ok` with sizes: min 10 MB, max 100 MB; sizes 5, 50, 500 MB and unknown | false, true, false, true | unit | not run: unit check, no harness written |
| 6 | MED | Send a list of 3 links in one POST | One dialog in batch mode | by hand | not run: by hand check, no harness written |
| 7 | MED | Send 3 POSTs in a row | Dialogs come one after another; the window is raised once | by hand | not run: by hand check, no harness written |
| 8 | HIGH | Paused download from the same URL with new token; send the link | Dialog offers "Continue" first with the verdict | by hand | pass: app `tests/add.rs::an_unfinished_download_goes_on_first`, `the_add_dialog_continues_what_is_unfinished` |
| 9 | HIGH | Task waiting on "open source page" (expired link); send a fresh link | Check runs, the task continues, toast says so, no dialog | by hand | pass: app `tests/add.rs` (S044, real engine + testserver, port on a spare number) `a_fresh_link_from_the_browser_continues_an_expired_download` |
| 10 | HIGH | Same, but the fresh link leads to another file | Task stays, error toast with why | by hand | pass: app `tests/add.rs` (S044, real engine + testserver, port on a spare number) `a_fresh_link_to_another_file_is_refused` |
| 11 | MED | Settings, Browser: switch off, change port, press Send a test link | State line follows; test opens the Add dialog; log shows the entry | by hand | pass (layout only: shots `set-browser`, state line and Send a test link button visible; switch and port change not clicked) |
| 12 | HIGH | Start a second `medlar medlar:https://a.test/f` with the same home | It ends at once; the first window shows the Add dialog | by hand | pass: S037 hidden run (tools/hidden.sh, release build, testserver) |
| 13 | MED | Kill the first with SIGKILL, start again | Starts normally (stale socket removed) | by hand | not run: by hand check, no harness written |
| 14 | HIGH | Nacre with a throwaway home, Medlar on a spare port against testserver; click a download | It arrives and downloads; else replay Nacre's body with curl and say so | by hand | pass with replay: Nacre's body (`core/tests/connector_nacre.json`) posted to the port in app `tests/add.rs` (S044, real engine + testserver, port on a spare number) (Nacre itself not run) |
| 15 | HIGH | Download, expire the link on testserver, send a fresh one | File completes identical (hash) | by hand | pass: app `tests/add.rs` (S044, real engine + testserver, port on a spare number) `a_fresh_link_from_the_browser_continues_an_expired_download` (file equals `expected`) |
| 16 | LOW | Port taken by another program | Page shows the plain-words fix | by hand | not run: by hand check, no harness written |
## Needs
Throwaway `MEDLAR_HOME` and `XDG_*`, `tools/hidden.sh`, `crates/testserver` for expiry, a spare port (not 15151, 38151), Nacre at `~/Projects/Nacre/target/release/nacre` with a throwaway home. Never touch `~/.abdm`.
## Doubts
- Nothing was run. `medlar:` format is invented: `medlar:<link>` or `medlar://<percent-encoded link>`.
- Auto-add skips links that match any unfinished download (goes to the dialog). Unknown size passes the size rules.
- The settings page reaches the live port through a static (`connector::publish`).
- Second start with no arguments hands over nothing and the plain `medlar` run raises the first window; a second start with arguments not recognised by `wants` goes to the CLI.
- Keyring cleanup for a task's items (shared kept) was not touched.