Skip to content

fix: storage CRUD follow-up — schema placeholders, metadata, unknown item types#45

Merged
franciscojavierarceo merged 2 commits into
mainfrom
fix/storage-crud-followup
Jun 3, 2026
Merged

fix: storage CRUD follow-up — schema placeholders, metadata, unknown item types#45
franciscojavierarceo merged 2 commits into
mainfrom
fix/storage-crud-followup

Conversation

@franciscojavierarceo
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #33 addressing outstanding review feedback:

  • Schema placeholders: New migration 0002 adds tenant_id, metadata, and raw_tokens columns to avoid future schema migrations when multi-tenancy, conversation metadata, and token pass-through land
  • Conversation metadata: metadata: Option<String> added to Conversation model and ConversationData domain type with From impl coverage
  • Unknown item type fallback: #[serde(other)] Unknown variant on InputItem and OutputItem so unrecognized item types (web search, MCP, reasoning, compaction, etc.) don't silently fail deserialization
  • Observability: tracing::warn! in as_inout() when items can't be deserialized — tries InputItem first, then OutputItem, only warns if both produce Unknown

Test Plan

  • All 84 existing tests pass (cargo test)
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt -- --check clean
  • Pre-commit hooks pass

🤖 Generated with Claude Code

…item types

- Add migration 0002 with tenant_id, metadata, and raw_tokens placeholder
  columns to avoid future schema migrations
- Add metadata field to Conversation model and ConversationData domain type
- Add Unknown variant to InputItem and OutputItem enums so unrecognized
  item types are caught by serde instead of silently failing deserialization
- Add tracing::warn in as_inout() when items cannot be deserialized,
  trying both InputItem and OutputItem before falling back

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
self.as_input()
.map(InOutItem::Input)
.or_else(|| self.as_output().map(InOutItem::Output))
if let Some(input) = self.as_input() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be cleaner to just use a single match expression rather than if then match.

pub id: String,

/// Optional metadata as JSON string.
pub metadata: Option<String>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@franciscojavierarceo is this metadata different than the one stored in response table? if not I think we dont need it here cause the information already exist in response table

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplifies the if-let chain into a single match as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
@franciscojavierarceo
Copy link
Copy Markdown
Collaborator Author

@maralbahari Good call on the match — refactored the if-let chain into a single match expression in 3a2caf6.

@franciscojavierarceo franciscojavierarceo merged commit 2719ece into main Jun 3, 2026
3 checks passed
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.

3 participants