Skip to content

fix(attachment_internal, cli): Skip missing conversations on query#635

Merged
JeanMertz merged 3 commits into
mainfrom
prr202
May 13, 2026
Merged

fix(attachment_internal, cli): Skip missing conversations on query#635
JeanMertz merged 3 commits into
mainfrom
prr202

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

Previously, if a jp:// attachment referenced a conversation that had been archived or removed, jp query would hard-fail with an error, making the conversation unusable until the stale attachment was manually cleaned up.

This change introduces a dedicated ResolveError enum in jp_attachment_internal, replacing the opaque Box<dyn Error> return type on resolve(). The new ConversationMissing variant is surfaced separately from all other failures (Other), giving callers a structured way to distinguish "conversation is gone" from real errors.

On the CLI side, a new load_conversation_attachments helper in jp_cli uses this distinction: when a jp:// attachment resolves to ConversationMissing, it logs a warning and skips the reference instead of aborting the query. Any other failure (invalid URI, I/O error, etc.) is still treated as a hard error. The query command now calls this helper instead of resolving attachments directly via register_attachment.

A corresponding AttachmentConversationMissing error variant is added to the CLI error type so the missing-conversation case can be matched exhaustively throughout the call stack.

Previously, if a `jp://` attachment referenced a conversation that had
been archived or removed, `jp query` would hard-fail with an error,
making the conversation unusable until the stale attachment was manually
cleaned up.

This change introduces a dedicated `ResolveError` enum in
`jp_attachment_internal`, replacing the opaque `Box<dyn Error>` return
type on `resolve()`. The new `ConversationMissing` variant is surfaced
separately from all other failures (`Other`), giving callers a
structured way to distinguish "conversation is gone" from real errors.

On the CLI side, a new `load_conversation_attachments` helper in
`jp_cli` uses this distinction: when a `jp://` attachment resolves to
`ConversationMissing`, it logs a warning and skips the reference instead
of aborting the query. Any other failure (invalid URI, I/O error, etc.)
is still treated as a hard error. The `query` command now calls this
helper instead of resolving attachments directly via
`register_attachment`.

A corresponding `AttachmentConversationMissing` error variant is added
to the CLI error type so the missing-conversation case can be matched
exhaustively throughout the call stack.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
JeanMertz added 2 commits May 13, 2026 22:38
…uery

Signed-off-by: Jean Mertz <git@jeanmertz.com>
…uery

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 4d69ecb into main May 13, 2026
14 checks passed
@JeanMertz JeanMertz deleted the prr202 branch May 13, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant