Repository navigation
fix(ui): report find-missing failures and timeouts correctly - #1598
Merged
echelon merged 1 commit intoOct 14, 2026
Merged
Conversation
Member
|
Thank you @NavidZamanKhan! This landed on main in integration batch 35 (#1682). If you haven't already, please join our Discord: https://discord.gg/artcraft. We'd love to have you there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1528
Problem & Reproduction
When invoking
file.findMissingwith{"wait": true, "folder": <path>}, the command previously calledtasks::wait(app, &ctx, Duration::from_secs(600))and returnedSome(Ok(app.ui.last_find_missing.clone().unwrap_or(Value::Null))).Under this implementation:
last_find_missing. The caller receivesOk(null)instead of a descriptive error.last_find_missingremainsNone, also silently returningOk(null).Solution
1. Typed Task Results & Error Propagation
last_find_missing_result: Option<Result<serde_json::Value, String>>toUiState.Some(Ok(v))orSome(Err(e)).wait: trueis requested,file.findMissingtakeslast_find_missing_result:Ok(v)containing{found, missing, ambiguous}on success.Err(e)with the actionable error message if the search or relinking failed.Err("Find Missing Photos: worker terminated unexpectedly")if the background thread terminated without delivering a result.2. Task-Specific Waiting (
tasks::wait_for)tasks::waitcall withtasks::wait_for(app, ctx, label, timeout).tasks::wait_forloops and polls tasks, returningtrueas soon as the specific"Find Missing Photos"task finishes.file.findMissing.3. Strict Timeout Validation & Continuation Behavior
waitandtimeout:Duration::try_from_secs_f64fails withfile.findMissing: \timeout` is too large` (avoiding silent 600s fallback).file.findMissingreturnsErr("Find Missing Photos: search timed out (search continues in the background)").app.tasks, ensuring no work is wasted.wait: falseor omitted) continue returning{"background": true}immediately.4. Test-Only Delay Injection
_test_delay_ms) are exposed in the production command interface or public JSON schemas.#[cfg(test)] pub find_missing_test_delay: Option<Duration>toUiStateto allow integration tests to test timeouts deterministically without changing production behavior.Verification & Tests
Regression Tests Added (
crates/ui-egui/src/menubar.rs):find_missing_waited_invalid_folder_returns_error_with_zero_mutations:Ok(null).1e300) timeouts.find_missing_waited_structured_results_and_background_mode:wait: truereturns{found, missing, ambiguous}JSON directly on success.waitomitted) returns{"background": true}immediately.find_missing_waited_timeout_behavior:find_missing_test_delay.find_missing_waited_completes_while_unrelated_task_remains_active:tasks::wait_forcompletes as soon as Find Missing finishes, even while an unrelated blocked background worker remains active inapp.tasks.Test Results
cargo test -p lightcraft-ui-egui --lib find_missing: 6/6 passed (1.12s).cargo test -p lightcraft-ui-egui --lib tests_panels::a_folder_menu_locates_its_missing_tree_only: Passed.cargo fmt --all -- --check: Passed.cargo clippy -p lightcraft-ui-egui --all-targets -- -D warnings: Passed (0 warnings).cargo xtask parity: OK (568 rows, 1,244 references).cargo xtask layers: OK (31 crates, 0 layering violations).cargo xtask assets: OK (all 42 assets attributed).Pre-existing CI Failure Disclosure
The unrelated test
all_masks_overlay_shows_every_visible_mask_at_onceincrates/pipeline/src/visualize.rsfails on upstreammaindue to an unrelated color expectation mismatch in pipeline visualization. This patch does not touchcrates/pipeline/.