Support old and new Piebald database schemas - #251
Conversation
Detect Piebald's typed-parts schema and read generation metadata and tool counts from its normalized tables while retaining legacy queries. Exclude context containers and keep all reads in one read-only snapshot. Add fixtures for both layouts, equivalent normalized histories, service-tier pricing, model fallback, and malformed-schema errors.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Piebald parser now supports legacy and typed-message-parts schemas. It selects schema-specific queries, reads all data from one SQLite transaction snapshot, and adds fixture-based tests for usage, tools, normalization, migration behavior, and typed-schema errors. ChangesPiebald schema support
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This adds schema-aware Piebald parsing while preserving legacy reads during incomplete migrations, with fixtures covering both layouts, migration behavior, normalized output, and malformed typed schemas. No merge-blocking risk is identified. Sequence Diagram(s)sequenceDiagram
participant PiebaldParser
participant SQLite
participant PiebaldSchema
PiebaldParser->>SQLite: begin deferred read transaction
PiebaldParser->>PiebaldSchema: detect database schema
PiebaldSchema->>SQLite: run schema-specific queries
SQLite-->>PiebaldParser: return chats, messages, and tool calls
PiebaldParser->>SQLite: commit transaction
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The additive migration commits generation tables before tool backfill. Detect finalization by the removal of the legacy tool table so in-progress or failed backfills retain historical tool counts. Cover this intermediate schema with a regression fixture.
Why
Piebald's typed-message-parts migration moves model, token, and generation configuration fields out of
messagesand removesmessage_part_tool_call. Splitrail still queries those legacy locations, so updated databases fail withno such column: m.modeland their usage cannot be parsed.Support the new layout without requiring users on older Piebald versions to migrate.
What changed
message_generationsand removal ofmessage_part_tool_call. Keep legacy reads during the committed additive migration state, before tool backfill finishes.tool_execution_contextand exclude context-container messages.Validation
cargo build --quiet— passed.cargo test --quiet— 451 passed.cargo clippy --quiet -- -D warnings— passed.cargo doc --quiet— passed.cargo fmt --all --quiet— passed.git diff --check— passed.CLI before/after
Ran
/usr/local/bin/splitrail stats --include-messages(released 3.9.0) and the PR debug binary withstats --include-messagesagainst identical synthetic SQLite histories. Each layout used a temporaryHOMEand isolatedXDG_DATA_HOME,XDG_CONFIG_HOME, andXDG_CACHE_HOME; no real usage database or cloud upload was involved. The harness command waspython3 /tmp/splitrail-8833-cli-proof.py.Summary by CodeRabbit