Tunal/docs/DECISIONS.md
astar76 ca8e061657 S005: shadow and menu width from the design references, renumber D-031
Floating surfaces get the deeper, scheme-aware shadow of the reference
dialogs; menus are at least 180 px wide. The overlay decision clashed
with another D-029 and is now D-031.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 10:09:03 -06:00

35 lines
10 KiB
Markdown

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Decisions
`D-NNN — date — decision — why — plans affected`. Never rewrite an entry; supersede it with a new one.
D-001 — 2026-11-18 — Brief decisions adopted as binding: name Tunal / binary `tunal`; Slint 1.19 with own components on Theme + Motion globals; zbus blocking portal + material-colors 0.5; Material Symbols Rounded by codepoint; MusicBrainz + Cover Art Archive (1 req/s, User-Agent); lofty; russh + russh-sftp preferred — PROMPT.md §Decisions — all plans.
D-002 — 2026-11-18 — Workflow: at most 2 parallel sessions, look-ahead 3, Sonnet medium by default and Opus high for theming/motion, elevation, devices and SFTP; git local only (no remote, no push) — user's answers at setup — all plans.
D-003 — 2026-11-18 — 🧑 checkpoints: visual review at end of phases 2, 3, 6; real-password sudo test (phase 5); real devices (phase 9); every C library before it is added — user's answers at setup — phases 2, 3, 5, 6, 8, 9.
D-004 — 2026-11-18 — Video frame thumbnails: run the installed `ffmpeg`/`ffprobe` CLI as a subprocess (no linking); missing ffmpeg → plain icon — user, plan-generate — S017, S018.
D-005 — 2026-11-18 — Audio: symphonia decoding (pure Rust) + cpal output (links alsa-lib, approved) — user — S022, S023.
D-006 — 2026-11-18 — iOS: `idevice` crate over the system usbmuxd socket (approved); usbmuxd missing → iOS hidden — user — S024.
D-007 — 2026-11-18 — Android: own pure-Rust MTP/PTP client on `nusb` (no libmtp) — user — S025, S026.
D-008 — 2026-11-18 — Extras in scope: Open / Open with (portal OpenURI, .desktop apps), details + icon grid views, type-to-filter (no recursive search), desktop entry + install script — user — S008, S009, S012, S037.
D-009 — 2026-11-18 — Phases restructured: 11 Native drag and drop, 12 Testing, 13 Packaging added; 🧑 checks of D-003 all move to phase 12 (S035 visual, S036 password/devices/apps/server) — user ("testing after there's a solid app") — all plans; supersedes the timing in D-003.
D-010 — 2026-11-18 — Models: D-002 categories get Opus high; other design-heavy plans (location layer, ops, views, shell, DnD, tag UI, player) Opus medium; well-specified work Sonnet — plan-generate — all plans.
D-011 — 2026-11-18 — Tag editor edits one or many files (mixed values shown as Keep); lookup applies per release — user — S019–S021.
D-012 — 2026-11-18 — Planner defaults: config in `$XDG_CONFIG_HOME/tunal/*.toml`; own bookmarks file seeded from XDG user dirs; shared freedesktop thumbnail cache; trash browsable as `trash:///`; video frame at 10% of duration by default; delete on devices/SFTP is permanent with confirm; reduced motion follows portal `enable-animations` with an app override; removable drives (UDisks) and recursive search are Later — plan-generate, shown to user — S002, S003, S007, S010, S013, S017, S024–S029.
D-013 — 2026-11-18 — Less testing while building: feature plans (phases 1–11) add no tests and verify with build, clippy, fmt and a smoke run/screenshot; automated tests, the screenshot matrix, /unslop, /improve-animations and all 🧑 checks run in phase 12 once the app is solid — user — all plans; supersedes CLAUDE.md §3 "new pure logic gets a test" for phases 1–11.
D-014 — 2026-11-18 — Drag and drop: in-app (S014) plus native in/out with other apps on Wayland (wl_data_device on Slint's own libwayland connection, our own wl_pointer/wl_keyboard for serials) and X11 (XDND via x11rb); Move/Copy/Link/Cancel menu on drop, Shift = move, Ctrl = copy, Ctrl+Shift = link; file clipboard interop in the same plans. Slint 1.19's winit backend has no native DnD, hence own code — user — S014, S030, S031, S036.
D-015 — 2026-11-18 — License: GPL-3.0-or-later — user — S001.
D-016 — 2026-11-18 — No extra system packages: all crates compile into the `tunal` binary; only libraries a desktop already has are used (libwayland/libX11 via Slint, fontconfig, alsa-lib); optional runtime tools (ffmpeg, usbmuxd, polkit agent) disable only their feature when missing, without errors — user — all plans.
D-017 — 2026-11-18 — `.directory`: standard `[Desktop Entry]` `Icon` and `Name`; our view settings and Material glyph in an `[X-Tunal]` group; never write another app's groups — plan-generate — S015.
D-018 — 2026-11-18 — Elevation via pkexec/polkit: `tunal --elevated-helper` over stdin/stdout pipes; the polkit agent asks for the password, Tunal never sees it; policy file in assets/polkit, installed by the install script (needs root, printed not run) — user — S016, S036, S037.
D-019 — 2026-11-18 — TLS and SSH crypto on rustls + ring (no aws-lc-rs, no OpenSSL) — user — S020, S028.
D-020 — 2026-11-18 — Accepted SSH host keys go to `$XDG_CONFIG_HOME/tunal/known_hosts`, read together with `~/.ssh/known_hosts`; Tunal never writes under ~/.ssh — plan-generate — S027–S029.
D-021 — 2026-11-18 — Playlist sort: a sort option "Playlist sort" offered only in folders under XDG_MUSIC_DIR that contain a playlist file (.m3u, .m3u8, .pls, .xspf); listed files first in playlist order, unlisted entries after in natural name order; several playlists → one option each; desc reverses; re-sorts when the playlist changes; stored as the folder's sort in `.directory` like other sorts — user request (details chosen by orchestrator, user may revise) — S008, S015.
D-022 — 2026-11-18 — Fallback theme seed `#3F6FB5` (muted blue) when the portal gives no accent; palettes are `material-colors` 0.5 `ThemeBuilder` defaults (tonal spot, spec 2021) exported as ARGB `Palette` structs; library warnings go to stderr as one `tunal-theme: …` line (no logging crate yet) — S002 — S002, S003.
D-023 — 2026-11-18 — Window minimum size 720×480 px (preferred 960×640): fits a 240 px sidebar plus a usable content column; Slint 1.19 can't drive the icon font's variation axes (font-weight doesn't reach `wght`), so `Icon` has size only and draws the default instance (wght 400, FILL 0); easing tokens live in an internal `Motion` global and Rust sets the reduced flag through `MotionPrefs` (easing properties can't be exported) — S003 — S003 and every UI plan.
D-024 — 2026-11-18 — Location URIs are `scheme://authority/path` with the path as raw bytes (percent-encoded only in Display); every backend implements the object-safe blocking `Location` trait in `tunal-core` (chunked `list` with a `ControlFlow` sink, `watch` returning a drop guard), unsupported ops return `Error::Unsupported`, and views gate actions on `capabilities()` — S006 — S007–S014, S024–S029.
D-025 — 2026-11-18 — Controls: every control inherits `StateLayer` (tint drawn above content, `clicked` for users and `activated` for the control's own toggling; inherited properties must be written `root.x`); `TextField` is built on the builtin `TextInput` because std `LineEdit` (material) takes its colours from the fixed `MaterialPalette` and can't use our tokens; the software renderer ignores `transform-scale`, so press squeeze shows only in a real window — S004 — every UI plan, S035.
D-026 — 2026-11-18 — File operations run as jobs in `tunal-core::ops`: `Jobs::new(locations, sink)` (one worker thread runs long jobs in order; mkdir/rename get their own thread), `submit(JobKind) -> JobHandle` (`progress()`, `cancel()`); the sink gets `JobEvent::{Progress, Conflict(Box<ConflictRequest>), Error(ErrorRequest), Finished(Report)}` on the job thread, requests block the job until answered through `Reply::send` (dropped = Skip). Folder onto folder with Overwrite merges. Trash item URIs are `trash:///<id>:<name>[/sub]` with `<id>` = `home` or the hex path of a per-mount trash dir; entries' `name` is that key, `display_name` the original name; jiff 0.2 for local DeletionDate — S007 — S010, S011, S012, S013 and every plan that changes files.
D-027 — 2026-11-18 — UI sessions look at the user's other Material You apps (Damson, Mulberry, Nacre; egui) as design references for colour roles, state layers, shape, spacing and motion, porting ideas to our Slint Theme/Motion tokens; the stack (Slint 1.19) stays; library defaults that don't match are replaced by own components — user — all UI plans (S004–S031, S034, S035).
D-028 — 2026-11-18 — The user's old, buggy Tunal prototype (`/home/astar76/Documents/Apps/tunal-files/tunal/`, Python) is a UI reference only: look at its screens and elements for ideas (layout, panels, playlists, tag editor, dialogs), never copy its code, never port its bugs; the new UI should be fresh, not a re-skin — user — all UI plans, S008 (playlist sort), S021, S023.
D-029 — 2026-11-18 — Orchestration: backend-only plans whose dependencies are done and whose files are a crate of their own (S017, S019, S020, S022, S025, S027) may run out of INDEX order in the second parallel slot beside the UI chain; still at most 2 sessions at once; each commits with explicit paths — orchestrator (user asked to keep everything runnable going) — S017–S027.
D-030 — 2026-11-18 — Playlist sort refined (supersedes D-021's details, keeps its UI): candidate playlists come from the viewed folder and from <Music>/Playlists (also playlists/Playlist/playlist); only playlists with ≥ 1 track in the viewed folder are offered, one "Playlist sort" option each; preselected = the playlist named after the folder, else the one with most tracks from it; subfolders sort by their first listed track; tracks that moved still match by file name; formats .m3u .m3u8 .pls .xspf .wpl, text decoded utf-8 → utf-16 → cp1252 → latin-1; ordering stays listed-first in playlist order, rest natural name order, desc reverses — orchestrator, from the user's old prototype behaviour (D-028) — S008.
D-031 — 2026-11-18 — Floating surfaces don't use `PopupWindow` (it closes without exit motion): `Menu` and `Dialog` inherit `Overlay` and `ToastStack` is a plain layer, each placed last in the window at `width: 100%; height: 100%` in the order ToastStack, Dialog, Menu; they open with window coordinates and play exit motion by animating a `progress` that reverses mid-flight. Dialogs never close themselves (owner calls `close()` from `action`); toast models are owned outside (`closing` ends one, `removed(index)` drops it). Tooltips stay on `PopupWindow` (fade in, leave at once) — S005 — every UI plan with menus, dialogs or toasts (S010–S013, S018–S031).