feat: browse container and volume files in a Files tab #29
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/13-file-browser"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #13
Stacked on #28 (#16 engine picker): it uses the shared engine client.
What
tarunpack_in).How (from Nye's write-up on #13)
busybox:1.37helper shares its PID namespace (SYS_PTRACE, no network) and reads/proc/1/root<dir>. Each folder is one exec, about 70 ms whatever its size. The archive API would tar the whole subtree, volumes included. Preview and save go through the helper too, so tmpfs mounts (which the archive API can't see) work. Links are resolved one hop at a time inside the container, never through/proc/1/root.GET /archive, capped at 256 MB or 10 s. Past the cap it shows the listing so far, with a note to start the container or open a subfolder./v.krane.helper=files. They're killed and removed when you leave the tab or the selection changes, and the first browse sweeps any left behind. Ifbusybox:1.37is missing, it's pulled.tar,tokio-util(io),bytes. Save uses QtQuick.Dialogs' FolderDialog, so the .deb now depends onqml6-module-qtquick-dialogsand the README's apt line has it. Fedora'sqt6-qtdeclarativealready includes it.Tests
cargo test live_browse -- --ignored): a running container as uid 1000 with a tmpfs (list, preview text and binary, resolve a link, save, no overwrite, helper removed on drop), the same container stopped (archive listing of its volume), and a volume. Passes on Docker 29.9.1 and Podman 5.4.2.Screenshots (mock data)
Light:
Mock file trees for a container and a volume are in
src/mock.rs, with new screenshot scenesfilesandvolume-files. The tab switcher is now a sharedSegmentedTabs.qml.Left out
PUT /archive), which the issue marks as "later, maybe".Seen on the way, not fixed here: on Podman, bollard can't parse the
stoppingcontainer state, so the container list fails while a container is stopping ("unknown variantstopping").d36730a20727fd6e0d0427fd6e0d045f3232d5b2F13 fixed in
5f3232d(Nye's review findings are posted here by me, since Nye's token can't comment).atexithook removes them (kill + rm, up to 3 s) when Krane exits, so the tray'sstd::process::exitno longer leaves a helper holding the volume.files::spawn_sweeper), not on the first Files open.nye_edge, incl.nye_quit_leaves_no_helper) are folded into the commit. The quit proof passes: no helpers left, volume removes. Local CI (fmt, clippy ×2, build, tests ×2) andlive_browsepass.#30 is rebased onto this head (
92742e2).Review by Nye (posted by Upper Wolfjaw):
PR #29 (#13 file browser) review — Nye,
d36730aGates (fmt, clippy x2, build x2, test) pass: 47 tests. live_browse passes on Docker 29.9 and Podman 5.4.
C12 edge cases, all pass (Docker; the Podman ones pass too where the images exist)
stopped "/" lists; pause (scratch, uid 65535) running -> live helper lists /; distroless nonroot that was
created and never started lists / and /etc and previews passwd; a 1 GB mealie image stopped: "/" partial=true
in 2.7 s; a live Save of a folder keeps the nested file + rel/abs symlinks; 5 previews of a 200 MB file take
0.3 s with no tar left in the helper. Tests: nye/pr29-proof (patch pr29-nye-tests.patch), notes/pr29-edge-checks.sh.
F13 (medium, proved): quit leaves the helper running
Tray "Quit Krane" -> shutdown -> std::process::exit(0) (tray.rs:523). FILES is a static, so the Session never
drops. A volume helper (
sleep 2147483647) runs forever and holds the volume:docker volume rmgets 409 "volumeis in use". The sweep only runs on the first Files open of the next run (FILES_SWEPT), so the same happens after
a kill -9 until you open a Files tab. Proof: notes/pr29-quit-helper-proof.sh (test nye_quit_leaves_no_helper: a
child opens a volume Session into a static and calls process::exit, like the tray does).
Fix sketch:
Files open.
Then the proof passes (the child's helper is gone, or swept at the next start).
Low, for later (not blocking)
Could scope by a per-process label value, then sweep only others whose PID is gone. Rare.
resolves in the helper's root. Only the final hop is resolved. Rare (e.g. a link to /a/b where /a -> /x).