Conversation
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>
…uery Signed-off-by: Jean Mertz <git@jeanmertz.com>
…uery Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
Previously, if a
jp://attachment referenced a conversation that had been archived or removed,jp querywould hard-fail with an error, making the conversation unusable until the stale attachment was manually cleaned up.This change introduces a dedicated
ResolveErrorenum injp_attachment_internal, replacing the opaqueBox<dyn Error>return type onresolve(). The newConversationMissingvariant 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_attachmentshelper injp_cliuses this distinction: when ajp://attachment resolves toConversationMissing, 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. Thequerycommand now calls this helper instead of resolving attachments directly viaregister_attachment.A corresponding
AttachmentConversationMissingerror variant is added to the CLI error type so the missing-conversation case can be matched exhaustively throughout the call stack.