Skip to content

fix(watch): use global index DB with schema migrations - #498

Merged
ajianaz merged 1 commit into
developfrom
fix/watch-db-init-498
Aug 5, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/watch-db-init-498

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What

Fix cora watch crash on projects without prior index (no such table: projects).

Why

cora watch opened a project-local SQLite database at .cora/index.db instead of the global database at ~/.codecora/cora-code/cora.db. The project-local DB never had run_migrations() called, so the projects table (and all other schema) was missing.

Every other command (index, explore, callers, dead-code, etc.) uses index::open_global_index() which calls schema::run_migrations(). cora watch was the only command that bypassed this.

How

  1. Replace project-local DB with global DB: Connection::open(project_root.join(".cora/index.db")) → index::open_global_index()
  2. Resolve project root: Add index::resolve_project_root() in main.rs for consistency with cora index and other commands
  3. Expand extension filter: Add php, scala, cs, kt, svelte, jsx, tsx to detect_changes() extension list to match all tree-sitter supported languages

Testing

  • cargo test --features tree-sitter — 903 tests, 0 failures
  • cargo clippy --all-targets --features tree-sitter -- -D warnings — 0 warnings
  • cargo fmt --all -- --check — clean
  • Manual test: cora watch on Uteke (Rust, 410 symbols/34 files) — no crash
  • Manual test: cora watch on Corin (Tauri/Svelte/TS) — no crash

Related Issues

Discovered during pre-release validation of v0.13.0.

Checklist

  • Code follows project conventions (CONTRIBUTING.md)
  • No emojis in commit messages
  • Conventional Commits format
  • Tests pass locally
  • Clippy + fmt clean

'cora watch' was opening a project-local SQLite database at
.cora/index.db without running schema migrations, causing a crash
('no such table: projects') on any project that had not been indexed
before.

Fix: use index::open_global_index() (which runs migrations) instead
of manually opening a project-local DB. Also resolve project root
via index::resolve_project_root() for consistency with other commands,
and expand the file-extension filter to cover all tree-sitter supported
languages (php, scala, cs, kt, svelte, jsx, tsx).
@ajianaz ajianaz added the bug Something isn't working label Aug 5, 2026
@ajianaz
ajianaz merged commit 356f244 into develop Aug 5, 2026
13 checks passed
@ajianaz
ajianaz deleted the fix/watch-db-init-498 branch August 5, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant