Commit Graph
16 Commits
Author SHA1 Message Date
Khawar Zamman Wani cd2250cb25 Scratch folder queries: address second review
A stuck close no longer holds up the files queued behind it (up to four
closer threads), and a query identifies the current file by the configured
folder. Tests don't read the room and the status across a late answer, and
the growth-check step proves its query is stalled.
2026-11-06 20:48:08 +05:30
Khawar Zamman Wani e01c8719a0 Scratch folder queries: address review
The whole folder change now waits 2 s at most, old files close on one
background thread, the cap counts query threads until they finish, and
writes during a query aren't counted twice. Capacity is refused if a sweep
paused spilling meanwhile, a query opens a file unless this folder has one,
and on macOS an unrelated dead mount only costs the purgeable figure.
2026-11-06 19:44:03 +05:30
Khawar Zamman Wani 2c68c07dbf A scratch folder that stops answering no longer freezes the app
Opening and measuring the folder ran under the config lock, which the UI
takes every frame, and could run on the UI thread itself. They now run on
a short-lived thread, one per folder and question and 16 overall; callers
wait at most 2 s, and a late answer applies if the folder is still current.
No answer counts as unmeasured, or pauses spilling if nothing is open yet.
2026-11-06 17:45:34 +05:30
Khawar Zamman WaniandClaude ed49cd9401 Scratch free space is asked of the folder itself, so network folders report their own numbers
Windows network folders reported unknown because sysinfo doesn't list them, and an unlisted Linux
NFS or CIFS mount used the numbers of its listed parent. GetDiskFreeSpaceEx (Windows) and statvfs
(Unix) on the directory fix both. macOS keeps sysinfo's figure, which counts purgeable space, when
the listed disk is this volume. A mount that reports no space is flagged in Preferences, in the
hard-limit refusal and in spill::stats, with a hint to set a Scratch Size Limit or use a local disk.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-06 14:58:27 +05:30
Khawar Zamman Wani eecc821ee8 Scratch room uses what the user can write; a failed volume query is unknown
sysinfo reports a Windows volume's free bytes, which a per-user disk quota can
exceed, so admission could promise room the user can't write. free_space now asks
GetDiskFreeSpaceEx for the bytes available to the caller.

sysinfo also keeps a volume whose space query failed, with both numbers zero, which
read as an empty disk and would pause spilling. A zero total now counts as unknown.

Docs: describe network scratch per platform and the size limit's import allowance.
2026-11-06 00:21:07 +05:30
Khawar Zamman Wani af2914fd17 Refusal wording holds when memory sets the 32-bit limit; keep non-UTF-8 scratch paths
On a 32-bit build, free RAM or commit headroom can set the limit instead of the
cap, and then 'install the 64-bit build' was wrong. The message now mentions the
cap and says the 64-bit build may open the file.

The verbatim prefix is now removed through path components, so a scratch path with
a non-UTF-8 name still finds its disk. The UNC rewrite is gone: sysinfo lists only
fixed and removable volumes, so a network path can never match. That limitation is
now documented.
2026-11-05 23:22:13 +05:30
FredApps 5f70428dfc Merge storytold/main (d0bff086d) into PR #10897 branch
Resolve conflicts with #5331 (EXR streaming): the block-by-block EXR import now
reads from the same identity-verified handle as the rest of the open path, and
docs/scratch-disks.md keeps both the EXR streaming pointer and the RAM/scratch
admission notes.
2026-11-03 10:33:10 +01:00
FredApps 3695186329 Consolidate RAM detection in raster::memory::system; scratch-aware PSD/TIFF admission
One RAM detector: the cgroup v1/v2, macOS reclaimable and Windows commit providers move from
photocraft-io into photocraft_raster::memory::system (L0), which the residency budget (#5330)
and photocraft_io::memory both read. Unreadable container limits still fail closed, swap is
never counted as RAM. sysinfo is unified on =0.40.1 (raster only).

While the scratch disk is spilling (on, not paused), import admission credits the tile pixels
of an estimate against spill::scratch_capacity() (free space above the reserve, within the
Scratch Size Limit); decode buffers, conversion copies and merged planes stay RAM-only. Spilling
off/paused and the web keep the RAM-only policy unchanged. PsdMemoryEstimate gains tile_bytes;
the flat TIFF streaming check credits its tile surface the same way; engine approveMemory's
fast pre-check uses the credited hard limit and the import re-checks exactly.
2026-11-03 09:48:22 +01:00
FredApps 7e29a9999c Wire EXR band streaming into main's path open
- import_file_for_open_with decodes single-part flat scanline EXR block by block into
  tiles; headers the band decoder refuses fall back to the whole-file decoder, so files
  main opened still open. Band-time failures and cancellation publish no document.
- The RAM tile budget and scratch-disk checks live in exr_native (the PSD stream module
  they came from is dropped); over-budget opens fail with IoError::OutOfMemory.
- The band decoder picks colour channels with exr_color_channels, like the byte decoder.
- Tests move into the per-crate it binaries and use import_file; an engine open-job test
  covers the OpenSource::Path route. The ui-egui sync open test is dropped: main's
  synchronous open reads bytes, and the io test covers the oversized header.
- docs/streaming-io.md, roadmap, scratch-disks and REL-212-1 describe EXR only.
2026-11-03 09:23:15 +01:00
FredApps fdab6c0a33 Merge remote-tracking branch 'upstream/main' into pr-5331 2026-11-03 09:06:31 +01:00
FredApps ed681787c3 Add a Scratch Size Limit preference and honour the web memory cap in the memory policy 2026-11-03 01:16:52 +01:00
FredApps 9eddf1d8ca Pause and retry a failed or full scratch disk instead of turning spilling off
A scratch write or create failure, or a volume about to drop below max(1 GiB, 5%)
free space, now pauses spilling with exponential backoff (1 s doubling to 60 s)
instead of disabling it for the session. Tiles stay resident, set_budget keeps
the latest budget for the resume, preference changes retry at once, and
spill::epoch lets the engine re-apply History's byte limit while paused.
spill::set_size_cap adds an explicit size limit; free space comes from sysinfo's
disk feature.
2026-11-02 22:31:56 +01:00
FredApps 44f13e5498 Scope scratch read failures to the document that holds the tile
One unreadable tile used to block editing, saving and exporting every open document
(spill::check_integrity was process-global). Add Tile/Surface/Document::scratch_health
(free while no tile has failed) and Document::for_each_surface (ops' history walk now
delegates to it). edit_with checks the document before and after, jobs the document they
captured, import the result, save/export the document written; check_since is now
generation-only so a failure or recovery during an operation refuses it once and a retry
works. Caches check their own sources and purge once per new failure instead of every
frame. Fault-injection tests use a duplicated handle (the Unix file has no name).
2026-11-02 22:23:42 +01:00
FredApps 947038d0db Unlink Unix scratch files right after opening
The spill manager is process-global and never dropped, so the Unix scratch file was only
removed by the next launch's reap. Unlink it immediately after opening and read/write
through the one handle with pread/pwrite (readers can no longer reopen it by path).
Windows keeps delete-on-close and per-thread readers. The abrupt-exit test now asserts
that no file remains on every platform; docs/scratch-disks.md updated.
2026-11-02 22:17:50 +01:00
vistaero 89ed4cb284 Stream native PSD and EXR imports through bounded seekable bands 2026-10-14 00:45:43 +02:00
vistaero 0456bc3f22 Add guarded scratch storage with owned memory supervision 2026-10-14 00:45:24 +02:00