Repository navigation
fix(ui-egui): #1046 decide on typed error kinds, not error message text - #1132
Merged
Merged
Conversation
… missing models
EngineError gains Cancelled and ModelMissing { model: AiModel } and a
kind() -> ErrorKind, so frontends decide on what an error is rather than
on its words. The face detector, SAM 3 model checks and the Lightroom
job produce them at the source; the error text is unchanged, so control
channel and MCP clients see the same `error` strings.
Background results that cross the wire as JSON get an additive flag
instead: SAM 3 download status `cancelled`, Apple Photos import outcome
`cancelled: true` next to `skipped`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sage text LightcraftApp::run_typed keeps the engine's ErrorKind in a CommandError; run() is run_typed(..).map_err(|e| e.message), so its callers are untouched. The face detector offer and the SAM 3 download dialog decide on ModelMissing, the SAM 3 download toast and the Apple Photos note on the `cancelled` flag, and a Lightroom inspect/import on its own cancel flag only, so a failure that mentions "cancelled" is still a failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ides on error kinds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Thank you @THEtheChad! This landed on main in integration batch 35 (#1682). Your cancel test now unpacks the four-part fake import that is on main. If you haven't already, please join our Discord: https://discord.gg/artcraft. We'd love to have you there. |
Omninovas
pushed a commit
to Omninovas/lightcraft
that referenced
this pull request
Oct 14, 2026
…storytold#1412 left Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
LR-BEHAV-BG-TASKS: a background task says how it ended; the engine's own jobs do (part 1 of 3)
#1711
Open
bogusyogi
pushed a commit
to Orthic-Labs/ember
that referenced
this pull request
Oct 14, 2026
…storytold#1412 left Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit a5989d6)
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.
What and why
The interface decided several things by reading an error's English text: whether to offer the face detector or SAM 3 download, and whether a SAM 3 download, a Lightroom inspect/import or an Apple Photos import was cancelled or failed. A reworded or translated message silently changes what the app does, and the Lightroom check already misreported real failures whose text contains "cancelled" (for example a catalog path) as cancels. #1046 has the full evidence.
This PR adds a typed signal next to the message wherever the UI decides. It keeps
Stringmessages and the JSON command boundary as they are.Engine
EngineError::Cancelled(String)andEngineError::ModelMissing { model: AiModel, msg }(AiModel::{FaceDetector, Sam3}), plusEngineError::kind() -> ErrorKind, aCopyenum with one value per variant (crates/engine/src/errors.rs).face_detect::detectorreturnsNoDetector { NotInstalled, Unusable(String) }.Segmenter::require_model()returnsModelMissing(Sam3);model_dir()stays as its string form.Cancelledwhen its cancel flag is set.faces.detect: …" and "invalid parameters forlibrary.importLightroom: Lightroom import cancelled" prefixes. Control channel and MCP clients see the sameerrorstrings, and tests assert this. Dropping those misleading prefixes is a separate wording decision for maintainers.segment.model.status→download.cancelled(set fromfetch::DownloadError::Cancelled).cancelled: truenext toskipped.UI
LightcraftApp::run_typed(id, params) -> Result<Value, CommandError { message, kind }>.runis nowrun_typed(..).map_err(|e| e.message), so its 300+ callers are untouched.faces.detectoffer andai_errordecide onModelMissing.sam_download_ended) and the Apple Photos note decide oncancelled..contains(/starts_with(turns up only tests.Docs
docs/ai-masks.mdanddocs/apple-photos.mddescribe the newcancelledflags, anddocs/mcp.mddescribes the Apple Photos one.docs/localization-parity.mdnotes that the shared "translatable lower-layer errors" work no longer changes behaviour. Last updated and revision history are bumped.Tests
The new tests fail on the old string-matching logic. I checked this by putting the old
.contains/starts_withchecks back into the new code: 4 of the 5 UI tests failed.errors::tests::the_kind_does_not_depend_on_the_messagetests_face_models::detect_without_the_model_says_where_to_get_it: missing →ModelMissing(FaceDetector); unusable →BadParams, even though its text also says "Settings > Faces"; text unchanged.tests_segment::a_missing_model_is_model_missing_by_kind: background and waiting paths.tests_segmentdownload tests assertcancelled.lightroom_job::tests::a_cancelled_read_is_cancelled_by_kind: text unchanged.apple_photosoutcome test.tests_error_kinds::*: a translated message with the right kind still offers the model; a message that starts withNOT_INSTALLEDbut has the wrong kind does not.lightroom_import::tests::lightroom_cancel_is_the_flag_not_the_wordsexport_task::tests::apple_photos_outcomes_read_welldetect_faces_without_the_detector_offers_the_download…andtests_maskingtests pass, with and without--features lightcraft-engine/sam.cargo xtask ci: all 8 steps passed (fmt, clippy, heif, test, parity, layers, assets, wasm).Left out on purpose
lightroom_archive"exceeds 32 MiB" anddenoise::worth_retrying). They are listed in UI decides on error message text (offer a model, cancelled vs. failed); errors and command params are untyped #1046.codeon control channel and MCP error responses. It would changeBackend::callincrates/mcpand add a public contract, so it is proposed in UI decides on error message text (offer a model, cancelled vs. failed); errors and command params are untyped #1046 for maintainers.schemars, a migration starting withdevelop.set). This is a maintainer proposal in UI decides on error message text (offer a model, cancelled vs. failed); errors and command params are untyped #1046, not code.Result<_, String>sites.Overlap
perf/command-overhead, per-command UI-thread work) also editscrates/engine/src/cmd/face_detect.rsandcrates/engine/src/lib.rs. This PR toucheslib.rsin 9 lines only (module, re-export, two variants) and stands alone onmain.LightcraftApp::run. The changes are compatible, but whichever lands second needs a small rebase.Refs #1046 (the engine-internal matches and the wire
coderemain open)🤖 Generated with Claude Code