This repository was archived by the owner on May 13, 2026. It is now read-only.
fix(apple-import): populate error_message on failed jobs - #970
Merged
Conversation
shiba4life
enabled auto-merge
May 10, 2026 05:19
Apple-import handlers transitioned jobs into Failed by writing job.status + job.message directly, never touching job.error. The From<Job> mapping ships job.error to the API response's error_message field, so every Apple-import failure surfaced error_message: null even though is_failed=true and the human-readable text was in status_message. Add a private mark_failed helper that sets all three fields together, and sweep the 16 failure sites (notes, reminders, photos, calendar, contacts — extraction errors, task panics, non-macOS guards, plus the reminders ingestion-failure path inside build_reminders_final_job). Avoid Job::fail() because it prepends "Failed: " to message, which would alter the existing user-visible status_message text (out of scope). Strengthen reminders_final_job_tests::ingest_error_marks_failed_and_surfaces_error to assert job.error is populated — it would have passed before this fix. Add a unit test for mark_failed itself so a future "just call Job::fail" cleanup re-runs through review. Smart-folder failure paths already use job.fail / fail_progress and populate error correctly; left untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
shiba4life
force-pushed
the
fix/apple-import-error-message-d68bd
branch
from
May 10, 2026 05:24
6edf3d1 to
b6cec50
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
job.status = JobStatus::Failed+job.message = ...directly, never touchingjob.error. TheIngestionProgress::From<Job>mapping shipsjob.errorto the API response'serror_message, so every Apple-import failure surfacederror_message: nulleven thoughis_failed: true.mark_failed(job, msg)helper that sets all three fields atomically, then sweep the 16 failure sites inapple_import.rs(notes/reminders/photos/calendar/contacts — extraction errors, task panics, non-macOS guards, and the reminders ingestion-failure path insidebuild_reminders_final_job).Job::failbecause it prepends"Failed: "tomessage, which would alter the user-visiblestatus_messagetext (per OUT OF SCOPE: "Don't change the user-facing error text").job.fail/fail_progressand were never affected.Before / after
Test plan
reminders_final_job_tests::ingest_error_marks_failed_and_surfaces_errorto assertjob.error.as_deref() == Some(...). The new line fails onmainand passes here — proves the regression guard.mark_failed_tests::populates_both_message_and_errorto pin the helper's contract (so a future "just callJob::fail()" refactor can't silently re-introduce the"Failed: "prefix onstatus_message).cargo fmt --all -- --checkclean.cargo clippy --workspace --all-targetsclean (one pre-existing macOS-only dead_code warning unrelated to this change; CI runs on Linux where the gated function is not compiled).cargo nextest run --workspace --lib— 924/924 pass.🤖 Generated with Claude Code