* feat(engine): reload external .ecproj edits into the live session
Adds a project-file watcher on a worker thread (size + mtime stamps,
250 ms debounce, 1 s focused / 5 s unfocused) that wakes the UI only when
the open project's file changed. The UI applies the change on its own thread
through the existing file.revert -> replace_project path, so CLI/MCP edits
show in the running window without a restart.
Session.project_stamp is recorded on open/save so the app's own writes do
not reload themselves. A dirty session, active script or render job holds
the change and surfaces a status instead of discarding work; autosave is
paused while a change is pending.
Closes#4168
* fix(engine): close stamp races and correct reload guidance
- record the stamp only when the saved bytes are still on disk, so a
concurrent external write is not mistaken for our own save
- read the project and its stamp as one observation when opening, retrying
if the file changes mid-read
- install the watcher baseline with the loaded session stamp under one lock,
and advance it only after the debounced change is published
- add tests for self-save acknowledgement, dirty guard and autosave pause
- replace the misleading Save-before-Revert status with Save a Copy guidance
Addresses CodeRabbit review on PR #4170
* fix(engine): handle unverified saves and stale reload reports
A save whose post-write byte check fails is marked unverified so the watcher
reports the first stamp of that path as an external edit instead of adopting
it as a baseline. Before reverting, compare the on-disk stamp with the
session stamp so a completed self-save does not discard undo history. Defer
reload while a script is waiting on a file dialog. Drop a failed reload
observation so it is retried only after a new stamp, not every frame.
Addresses the second CodeRabbit review on PR #4170
* fix(engine): require known stamp for reload shortcut and cache disk stamp
The stamp-matching shortcut only applies when the session stamp is known;
an unknown stamp keeps the observation pending. The on-disk stamp is read
once when a watcher observation is taken and carried through deferral,
avoiding file I/O on every frame.
Addresses the final CodeRabbit review on PR #4170
* fix(ui): keep recovery auto-saves while an external edit is pending
Auto-save writes recovery copies to their own files, never the project
file, so pausing it while a reload was pending only removed crash
recovery for unsaved local work. Keep it running, and hold it only when
the recovery target would alias the open project file.
Adds a regression proving the external project and the local recovery
copy both survive, and corrects the spec's wrong premise.
* fix(ui): check the autosave alias only on a due write; test every reload guard
Move the project-alias check into the engine write path
(autosave_tick_guarded) so it runs on the final WritePlan only when
auto-save is enabled and a write is due; idle frames do no file-system
work. Add regressions holding a pending external change for an active
script render, an open script file dialog and an active render job.
* test: add ignored measurement benches for the #4168 budgets
frame_tick_cost_of_project_reload: per-frame A/B of the UI tick with and
without tick_project_reload (p50/p95/p99/max over 100k ticks).
watcher_idle_cpu_and_reload_memory: watcher-only idle CPU (focused and
background), write->detect latency and RSS over 100 external saves.
* fix: rustfmt and strict clippy on the project reload watcher
Rewrite the watcher's recv loop as a while condition (clippy::while_let_loop)
with unchanged behaviour: a wake or a poll timeout runs one check, a dropped
Watcher (channel disconnected) ends the thread. Collapse the pending-change
if into its let chain, keep unwrap() inside test functions only, format both
files, and normalise project_reload.rs to LF like the rest of the tree.
---------
Co-authored-by: matthewdonsemail-lab <matthewdonsemail-lab@users.noreply.github.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
* Render log: say why a GPU project renders on the CPU, and name the GPU adapter (#3727)
* WebM: the header, the size patch and delivering the file count as writing time; last_timing says whose it is (#3732 review)
* Export timing: label the initial compositor and attached GPU adapter, count frames that fell back to the CPU later
The timing line says "Initial compositor" and "attached GPU adapter" for the choice made at the
start. A frame asked of the GPU that ends with the GPU unavailable is counted in the new
gpu_fallback_frames, and the line reports it as "Later GPU fallback: N of M frames rendered on
the CPU after the GPU became unavailable". New test:
a_gpu_lost_after_the_start_is_reported_apart_from_the_initial_choice.
* Export timing: frames the probe drops do not count as a later GPU fallback
A device lost while Auto measures makes the job pick the CPU and drop the GPU's measured
frames, so only frames of a job that chose the GPU are counted.
* Export timing: count a GPU fallback when the frame is rendered, not from the adapter afterwards
The renderer now notes per frame whether the accelerator declined it while unavailable
(Renderer::comp_frame_noting_gpu_loss, passes::comp_frame_noting_gpu_loss), and the export
counts that. A frame the GPU rendered no longer counts when another frame in flight loses the
device before it is counted. The test renders two frames at once: frame 0 on the GPU while
frame 1 loses the device.
* Deferred readbacks: a frame that goes to the CPU after missed passes says whether the device was lost
in_passes records why it renders the frame without the accelerator (Passed::gpu_lost: the
device is no longer available, not passes run out on a healthy one), and
passes::comp_frame_noting_gpu_loss passes that on instead of dropping it with .value. New test:
a_deferred_frame_on_the_cpu_says_whether_the_device_was_lost.
---------
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
* #3328: output guard checks file identity only where an alias is possible
The output guard opened every footage file of the project, for every check
of an output that existed, on the UI thread: minutes for long sequences on
a network share. It now compares only the files that can be the output
(folders on the output's volume, folders holding symbolic links), keeps the
identities it learnt in the session (folders that changed are looked at
again; Reload Footage forgets them), and does no file system call while its
lock is held.
render.frame checks and writes with one guard. A control request whose
sender stopped waiting is not run, and one tick runs control requests for at
most a tenth of a second; the rest follow in order on the next ticks.
* #3328: output guard compares paths only, no file is opened
Comparing file identities still cost a file open per footage frame when
folders were on the output's volume, and caching them invited races (#3330
review). The guard now compares paths by name once resolved: absolute, dot
segments resolved, one separator, Windows verbatim prefixes as the plain
path, without case on Windows and macOS. A link or hard link to footage
under another name is no longer recognised; the reported data loss (#1743)
is the same-path case. Render queue duplicate outputs compare by name too.
* #3328: drop the link identity tests of the render queue; test and doc review fixes
* #3328: a mapped network drive and its UNC path are one place
On Windows the output guard resolves each drive letter's root once per guard
(std::fs::canonicalize of `X:\`) and compares a path on that letter as the
place it resolves to: a mapped network drive as its \server\share path, a
subst drive as its folder. A root that can't be resolved keeps its letter.
* #3328: drive roots are looked up only where they can matter, and kept a minute
A drive letter's root is resolved only when the output and the protected
files are not all on one letter, or not all UNC paths: footage and output on
one mapped drive never wait for a disconnected drive or an empty removable
one. Resolved roots, failures too, are kept process-wide for 60 s.
* #3328: the 13,000-frame guard test counts file system lookups instead of timing them
* #3328: note why only Windows counts lookups in the 13,000-frame guard test
* #3328: queued outputs collide under drive and UNC spellings
* #3328: queued sequences and subst drives compare by the place they name
* #3328: queued outputs keep their resolved places instead of resolving per comparison
* #3328: cache_bench's play request carries the abandoned flag (main's example met the new ControlRequest field)
* Refuse an output in a folder linked to a source's folder
An output whose name matches no protected file now has its folder resolved on disk, once per folder per guard, and is compared again by name. An output in render-alias/, a symbolic link or junction to plates/, no longer replaces plates/source.exr. No protected file is looked at.
* Resolve both folders, and only for a source with the output's file name
The footage path as imported may itself run through a link (macOS /var is /private/var, Windows 8.3 names), so resolving only the output's folder missed it. Now an output whose path matches nothing is compared again only with sources of the same file name, both folders resolved once per guard. An output named like no source asks the file system nothing.
* Helper host: video protocol types, reply rules and discovery
Part of RFC-0031, phase 1. The host side of docs/video-helper-protocol.md
that needs no process: the messages, what to do with each reply, and
finding the program. Starting the helper and the client come next.
- video::wire: encode.open/frame/flush/close, cancel, hello and the
replies, as the page documents them; control lines are at most 1 MiB.
- video::jobs: job and frame ids, the 8 frame / 256 MiB budget and the
"What EffectCraft does with each reply" table (accept, drop, job error,
protocol break) as plain logic.
- video::check_hello and find_video_helper: the version and app_min
checks, and the program is looked for only in helpers/ next to the
executable. Effect-helper scans now skip it.
* Helper host: video helper client, stand-in helper and gate tests
Part of RFC-0031, phase 1. Starts a video helper and runs encode jobs
on it, following docs/video-helper-protocol.md and the reply rules
added in the previous commit.
- video::client: VideoHelper starts the program, checks its hello,
opens encode jobs, sends pictures (waiting when 8 frames or 256 MiB
are out), flushes, cancels and closes. Packets are copied out of the
exchange file as they arrive. A crash, hang or broken reply stops the
helper and fails the export; 3 stops turn it off. A refused job ends
that job only.
- Stopping kills the helper process and waits at most 5 s, then drops
the exchange file so a stray process can't touch a reused region. The
spec no longer promises a process-group or job-object kill, which
needs unsafe code; its wording follows what is implemented.
- tests/it/video.rs: a stand-in helper (this test binary, driven by a
scenario) and 19 gate checks: crash, hang, bad and out-of-order
replies, out-of-bounds packets, version mismatch, missing helper,
lost device, packet_too_large as a job error, cancel, ignored
cancel, 3 stops and retry.
* Helper host: harden the video client against a misbehaving helper
Review fixes on the video client and its tests.
- Packets in one reply may not add up to more than their region, so
repeated references to the same bytes can't make the host copy them
many times. The reader's queue is bounded; a helper that floods it
waits on its own pipe.
- A picture is sized with checked arithmetic and refused over 256 MiB
before any layout or exchange file growth; an encode.open that can't
be written is refused before the job, its ids and regions exist.
- Waits end at their deadline even while replies keep arriving, a poll
looks at a bounded number of late replies, the flush batch and
encode.flushed share one timeout, and a timeout too long to represent
no longer panics.
- close is private: a job is closed only after encode.flushed or
cancelled. An unsent frame is given back when writing its planes
fails; a failed copy of packets stops the helper without counting it
as a crash.
- Contents/Helpers is searched only for an executable in
Contents/MacOS. An incomplete base64 group is rejected.
- Tests assert the protocol diagnostic of each malformed reply and
cover the flood, the flush deadline, oversized pictures and an
oversized encode.open. The spec table drops every reply except
cancelled for a failed job that has not been cancelled yet.
* Helper host: allow one encoder job at a time on a video helper
open_encoder accepted a second job while the first was open. If the
first job then reported an error while the client was waiting on the
second, the error was dropped and its caller only saw "no such video
job".
A second open is now refused with a request error until the first job
is finished or cancelled, so each job's error reaches its own caller.
The receiver state machine still tracks several jobs; only the client
API is single-job.
The gate test refuses a second open while one is active and accepts a
new one after finish and after cancel.
* Helper host: reject malformed base64 padding, align two protocol notes
base64_decode stripped every trailing "=", so "====" decoded to an
empty codec configuration that open_encoder then accepted. It now
accepts at most two "=" and only when the length is a multiple of 4.
The protocol page said job ids are never reused even after a restart,
but the counter is per process, and said nothing about replies that
were already queued when the frame timeout passed. Both now describe
what the client does.
* Helper host: fix two code comments about job id reuse
The comments on NEXT_JOB and Jobs::new said ids are never reused across
helper processes or restarts. The counter is per process and a new
helper starts from the highest id opened so far, so the comments now say
that, matching docs/video-helper-protocol.md.
* Helper host: cap the encoder delay a video helper may report
A helper-reported delay sized the flush region (and the exchange file) with
unchecked arithmetic. A delay over 64 is now a protocol break, the flush
region uses checked arithmetic, and the protocol page says so. Also moves a
test doc comment back onto the test it describes.
---------
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Conflict in crates/ui-egui/tests/it/ui_shortcut_scopes.rs: kept this PR's press/press_in split (press and release, shared context) and main's framework::install_headless call, now made on every context the tests create.
Supervised nightly switch-on, merged under Skylar's explicit Nightly 758 override after green CI, CodeRabbit on this head with no open threads, Sonar passing, and an independent adversarial review with no blockers.
Linux nightly packaging by @dylanmtaylor, with the per-app Nightly flavor commits stacked on his branch.
Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
- dock_ui: DockArea over the given workspace (one Arc kept while equal), a
Tracked spec model (tab names, label swatches, the Timeline's comps as
panel documents), EffectCraft's lock and panel menu in each group header,
DockConfig from the old style flags (side edge zones, Maximize Frame,
Close Other Panels in Group, float on empty drop, title bars only move,
wheel selects tabs, tab close buttons, native windows), DockArea::raise
for a floating panel shown by a command, window_files per panel,
automation ids from DockAreaOutput::sources.
- dock_command: the window.panel.* and ui.dock vocabulary, app-local.
- Lock Workspace is UiState::dock_locked, saved in the workspaces file; an
earlier file's own workspace lock carries over once.
- Native window places of earlier files are dropped: the dock places its
OS windows again (native_outer and the place sanitizing go).
- Floating-window keys and text-field edits go through the window host.
- Tests: next's constructors; ui_dock_resize goes (divider geometry is the
dock's own behaviour, with its trials).
* Scripts: a ScriptUI Browse… button opens the file dialog
Fixes#2778.
Fixes#2894.
File.openDialog, File.saveDialog, Folder.selectDialog and the instance
openDlg / saveDlg / selectDlg were stubs that returned null, so a script
dialog's or a dockable ScriptUI panel's Browse… button did nothing.
On a script-host thread, in an app that shows them, the script now asks
for the dialog (Session::script_ui.file_dialogs, each with an id), hands
the session back like a modal dialog's show() does and waits for the
answer: a File (an array with multiSelect), a Folder, or null when
cancelled. The script's filter becomes the dialog's (its name, "All Files"
for *.*); without extensions every file shows. Headless runs, the Script
Console, the web and Shutdown scripts get null at once.
The app shows the dialog after the pass's events: blocking on Windows
(Hooks::pick_file_dialog), without blocking on macOS and Linux, one at a
time; a non-blocking dialog that ends without answering counts as
cancelled. scriptui.fileDialogs lists the waiting dialogs and
scriptui.fileDialog answers one (refused while file access is confined,
and refused to scripts). A dialog leaves the list only when its script
has the answer; the script's windows refuse events meanwhile, except
scriptui.close, which cancels the file dialog first. A script host that
ends takes its dialogs with it.
* Scripts: carry a file dialog's prompt, start location and filter to the native dialog (#2778)
serve_file_dialogs collected the script's prompt, start folder and save filter
but dropped them at the host boundary. FileDialog::Script now carries prompt and
start, and new ScriptFolder and ScriptSave requests carry the folder dialog's
prompt/start and the save dialog's prompt and whole filter (label, extensions,
any file) instead of the default name's extension. Both the blocking and the
non-blocking host dialogs apply title, initial directory and filters; Save also
goes through the blocking hook where one is set. Hook-level regression test
asserts all three requests.
* Scripts: a hidden window paints so a script's file dialog is shown (#3253 review)
* Scripts: formatting (#3253)
Specify phase 1 of RFC-0031 in docs/video-helper-protocol.md, marked
proposed: how a video helper is started and found, the hello version
check, the 8-bit 4:2:0 picture format, the encode.* messages with
slots, limits, cancel and per-frame timeouts, and what happens when a
hardware export fails. Decoding is reserved for phase 2.
external-helpers.md gets a pointer to the new page.
Read nvidia-smi's output on a thread of its own and stop at the same
timeout, so a process it leaves behind holding the pipe cannot block.
Reap a program killed at the timeout, waiting at most 200 ms.
When the adapter's own nvidia-smi line (or a line of its device id) has
no size, the memory is unknown instead of another card's.
A memory cap override that is not a number now behaves like no override
for both the cap and the upload budget.
The upload-budget test sets a budget that fits before its first phase,
and the docs say how a set cap lowers the default upload budget.
The proprietary NVIDIA driver on Linux has no sysfs file for the card's
memory, so the upload budget stayed at 1.5 GiB there. When the adapter is
NVIDIA and nothing else reported its memory, run nvidia-smi once (no console
window, 3 s timeout, cached) and take the line of the adapter's PCI address,
else of its device id, else the smallest card.