Skip to content

Fix database schema mismatches between schema.sql and Rust implementation#10

Draft
Copilot wants to merge 2 commits intoport-to-rustfrom
copilot/sub-pr-9
Draft

Fix database schema mismatches between schema.sql and Rust implementation#10
Copilot wants to merge 2 commits intoport-to-rustfrom
copilot/sub-pr-9

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 5, 2026

The cache layer's SQL schema definition (schema.sql) and Rust implementation (mod.rs) were out of sync, causing runtime inconsistencies. The schema file defined a proper relational structure with integer primary keys and foreign key constraints, while the Rust code used a denormalized TEXT-based approach.

Database Schema Fixes

  • trace_files table: Changed from file_path TEXT PRIMARY KEY to id INTEGER PRIMARY KEY with file_path TEXT NOT NULL UNIQUE
  • edit_records table: Changed from trace_file_path TEXT to trace_file_id INTEGER NOT NULL with FOREIGN KEY (trace_file_id) REFERENCES trace_files(id)
  • Type corrections: file_mtime_ns and file_size_bytes now stored as INTEGER instead of TEXT
// Before: denormalized, text-based
CREATE TABLE trace_files (
    file_path TEXT PRIMARY KEY,
    file_mtime_ns TEXT NOT NULL,  // ❌ string conversion
    ...
)

// After: normalized, proper types
CREATE TABLE trace_files (
    id INTEGER PRIMARY KEY,
    file_path TEXT NOT NULL UNIQUE,
    file_mtime_ns INTEGER NOT NULL,  // ✅ native integer
    ...
)

Configuration Updates

  • CSP header: Added connect-src 'self' tauri: and font-src 'self' to support Tauri IPC and font loading
  • Build documentation: Clarified PNG placeholder is temporary, referencing proper icon setup in src-tauri/icons/README.md

Documentation

  • README: Added note explaining PyPI distribution provides a Rust binary, not a Python library (no API bindings)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: cmungall <50745+cmungall@users.noreply.github.com>
Copilot AI changed the title [WIP] Port ai-blame framework to Rust/Tauri Fix database schema mismatches between schema.sql and Rust implementation Jan 5, 2026
Copilot AI requested a review from cmungall January 5, 2026 03:11
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.

2 participants