auberge bichon rescan
Synopsis
Section titled “Synopsis”auberge bichon rescan [--host <HOST>] [--account <EMAIL>] [OPTIONS]Description
Section titled “Description”Re-archives mail the hourly archive run can never reach.
The archive cursor is a message-date watermark: each run asks Bichon only for envelopes dated after cursor − overlap (24h). Mail that enters a Synced Folder with an older Date: sits below the watermark forever — present in Bichon’s store, absent from the Email Archive, unreported. That happens when mail is:
- moved between folders upstream (IMAP
MOVEpreservesINTERNALDATE, RFC 6851 — no date the filter reads changes), - bulk-imported from an old mailbox,
- delivered with a backdated or wrong
Date:header, - brought in by
reconcile-folders --applyadding a folder whose backlog is old.
rescan resets the per-account cursor to 0 as the bichon user (the file is 0600 bichon:bichon; a root write would change its owner) and starts bichon-archive.service, waiting for the full pass to complete. The archive’s skip guard keeps the pass idempotent: already-archived bodies are skipped, only missing ones download. A second consecutive run reports processed=0.
The service processes every account each run; --account chooses whose cursors are reset. The report covers all accounts, flagging which were reset.
Refuses to run when:
- any sidecar lacks
message_id— a full pass keyed on regenerating envelope ids would multiply duplicate bodies (#389). Remediation: deploy the current bichon role and let the hourly run backfill sidecars, then retry. - an archive run is in progress — a reset mid-run would be overwritten by that run’s own cursor write.
Options
Section titled “Options”| Option | Description | Default |
|---|---|---|
| -H, –host HOST | Target host running Bichon (prompted on a TTY) | prompted |
| –account EMAIL | Only reset one account’s cursor (prompted on a TTY, [all accounts] offered first) |
All |
| -o, –output FORMAT | Output format (human, json) |
human |
Off a TTY a lone configured host is implied and a roster holding several exits 2 naming -H; --account omitted means all accounts.
The account field of --output json carries the filter that was resolved, not the flag that was typed: pick one account from the picker and that address is what the report names.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | run completed, no failures |
| 1 | the run counted failures |
| 2 | usage error, unreachable host, or refused precondition |
Access
Section titled “Access”Needs both the Bichon API (account list — same base URL resolution and bichon_api_token as reconcile-folders) and SSH to the host (cursor reset, service start, journal read). A host whose Bichon reports no accounts is refused in the same words there, because all three commands reach the API through one place.
Examples
Section titled “Examples”# Full pass, all accountsauberge bichon rescan --host auberge
# One account, structured outputauberge bichon rescan --host auberge --account me@example.com --output json
# Scriptable: exit code carries the verdictauberge bichon rescan --host auberge --output json || echo "rescan not clean: $?"When to run
Section titled “When to run”- After
reconcile-folders --applyadds folders (the command prints this hint itself). - After importing an old mailbox or reorganising folders upstream.
- When
bichon-expunge.sh’s coverage gate reports archive < IMAP for a window the hourly run should have covered.