Skip to content

fix: resilient SQLite seeding in setup.sh#4

Open
adrianluna wants to merge 1 commit into
mainfrom
fix/sqlite-seed-resilience
Open

fix: resilient SQLite seeding in setup.sh#4
adrianluna wants to merge 1 commit into
mainfrom
fix/sqlite-seed-resilience

Conversation

@adrianluna

@adrianluna adrianluna commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

The SQLite seed step in scripts/setup.sh previously checked only whether the .sqlite file existed (test -f). If the file was present but empty — or created without the expected schema — seeding was silently skipped and SqliteConnectionTest would fail.

Changes

  • Replace the file-existence check with a table-existence query (SELECT 1 FROM cache_entries LIMIT 1).
  • If the query fails (file missing, empty, or table absent), the seed SQL is applied.

Testing

  • Ran ./scripts/test.shSqliteConnectionTest now passes even when starting from an empty .sqlite file.

Summary by CodeRabbit

  • Bug Fixes
    • Improved SQLite setup so seeding now runs only when the expected table is missing, instead of relying on the database file itself.
    • Updated the setup messaging to better reflect the conditional seeding behavior.

The previous guard (test -f) skipped seeding when the .sqlite file
existed but was empty or missing the expected table. Now we attempt
a SELECT on cache_entries and only re-seed if it fails.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4f7d74aa-a380-400a-b6cb-82af82d4cfb5

📥 Commits

Reviewing files that changed from the base of the PR and between 0de1915 and f51664a.

📒 Files selected for processing (1)
  • scripts/setup.sh

📝 Walkthrough

Walkthrough

Modifies scripts/setup.sh to change the SQLite database seeding trigger from file-existence checking to table-existence checking via a guard query against the cache_entries table, updating spinner text accordingly.

Changes

Seeding guard update

Layer / File(s) Summary
Table-existence guard for SQLite seeding
scripts/setup.sh
Replaces file-existence check with a SELECT 1 FROM cache_entries LIMIT 1 guard query; seed SQL runs only when this query fails, and spinner title/comment wording is updated.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making SQLite seeding in setup.sh more resilient.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sqlite-seed-resilience

Comment @coderabbitai help to get the list of available commands.

@adrianluna
adrianluna requested a review from rlunar July 6, 2026 23:28
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.

1 participant