skrzynka sync
Read which items Skarbiec declares, then import every new message for one mailbox or for every declared mailbox.
Invocation#
skrzynka --organization <ID> sync [--mailbox <MAILBOX>]Purpose#
Read which items Skarbiec declares, then import every new message for one mailbox or for every declared mailbox.
Inputs and options#
| Input or option | Required | Meaning |
|---|---|---|
--mailbox <MAILBOX> | No | Mailbox UUID. Omit it to reconcile with Skarbiec and process every declared mailbox in the local CLI organization. |
Global options accepted on this path are --organization <ID> (required on every command except serve, version and onboarding; none is assumed), --skarbiec-bin <PATH> (default skarbiec) and --text (print results as path: value lines for people instead of JSON).
Output and state effect#
With --mailbox, resolves that mailbox's credential, imports every unseen IMAP UID, committing each message with the cursor past it, and prints {mailbox_id, received, skipped, last_uid, completed_at}. Without --mailbox, first reconciles with Skarbiec and prints {completed_at, reconciliation, mailboxes:[...]}: reconciliation holds declared, created, updated, undeclared, and refused (each {skarbiec_item_id, code, message}); each mailbox carries ok, a summary, or normalized error fields. Undeclared mailboxes are skipped. One mailbox failure is recorded on its row and embedded in the result while the command continues and exits 0.
Refusals#
- Invalid UUID syntax is refused by Clap before dispatch with exit 2. With
--mailbox,NOT_FOUND:mailbox was not found. - Without
--mailbox, a vault that cannot be listed refuses the whole pass withSKARBIEC_UNAVAILABLE,SKARBIEC_TIMEOUT, orSKARBIEC_RESPONSE_INVALID. A declared item whose profile is invalid is areconciliation.refusedentry, not a refusal. - Credential failures are refused for a single mailbox as
SKARBIEC_ITEM_INVALID,SKARBIEC_UNAVAILABLE,SKARBIEC_TIMEOUT, orSKARBIEC_RESPONSE_INVALID. - Provider failures retain the actual operation and cause:
IMAP_UNAVAILABLEnames TLS connect and host/port;IMAP_AUTHENTICATION_FAILEDnames XOAUTH2 or LOGIN and the observed refusal or transport failure;IMAP_INBOX_UNAVAILABLEnames SELECT INBOX;IMAP_SEARCH_FAILEDnames the starting UID;IMAP_FETCH_FAILEDnames the requested UID. Supplied authentication secrets are redacted. Worker-task failures name the mailbox and retain the task cause instead of claiming a provider refusal. - When writing the failure to mailbox state also fails, the live refusal retains its original code and cause and appends the recording failure. Worker-task failures use the same persistence path. The watcher logs both errors; a previously stored last_error_message is not evidence that the current failure was recorded.
- Without
--mailbox, per-mailbox failures are result entries, not whole-command refusals; callers must inspect everyokvalue.