Skip to content

Set up database connection with libsql - #140

Merged
malibio merged 5 commits into
mainfrom
feature/issue-101-database-connection-setup
Oct 3, 2025
Merged

malibio merged 5 commits into
mainfrom
feature/issue-101-database-connection-setup

Conversation

@malibio

@malibio malibio commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator

Closes #101

malibio and others added 4 commits October 3, 2025 19:42
Implements DatabaseService for managing libsql database connections
with user-selectable database paths via Tauri.

**Implementation:**
- DatabaseService accepts PathBuf parameter for flexible path selection
- Automatic parent directory creation for nested paths
- Database initialization with CREATE TABLE IF NOT EXISTS (idempotent)
- Pure JSON schema: nodes + node_mentions tables only
- SQLite configuration: WAL mode, foreign keys, JSON operators enabled
- Comprehensive error handling with custom DatabaseError types
- Core indexes created for optimal query performance

**Testing:**
- 8 integration tests covering all critical functionality
- Tests use tempfile for isolated test databases
- Verifies table creation, index creation, and configuration
- Tests concurrent connections and idempotent initialization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add explicit constraints to pragmatic-code-review command that the
reviewer agent MUST NOT merge PRs. The agent's sole responsibility
is to provide the code review report.

Reasoning:
- Separation of concerns: Review ≠ Approval ≠ Merge
- Allows for review iterations and fixes before merge
- Maintains explicit human control over merge decisions
- Prevents unexpected/confusing auto-merge behavior

The user will decide whether and when to merge based on review findings.
Replace origin/HEAD references with origin/main...HEAD for git commands
since origin/HEAD is not configured in this repository.

This fixes the 'ambiguous argument' error when running /pragmatic-code-review.
- Fix redundant closure in database.rs:269
- Fix assignment pattern in models/time.rs:88

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator Author

Process Violation Acknowledgment

I acknowledge that this PR was initially created with clippy linting errors, which violates our quality gate requirements.

What happened:

Corrective actions taken:

  1. ✅ Fixed both clippy errors in commit a9f1b05
  2. ✅ Verified quality gates pass: cargo clippy --all-targets -- -D warnings (0 errors)
  3. ✅ Verified all tests pass: 8/8 database tests passing
  4. ✅ This acknowledgment added to PR

Process improvements:

  • Will run cargo clippy --all-targets -- -D warnings before every PR creation
  • Will ensure all quality gates pass locally before pushing

Ready for re-review.

Address code review feedback by implementing suggested improvements:

**Code Quality Improvements:**
- Extract PRAGMA execution to helper method (execute_pragma)
  - Reduces code duplication and improves readability
  - Encapsulates the prepare().query() pattern with clear documentation

- Standardize index creation error messages
  - Include index name in all error messages for consistency
  - Format: "Failed to create index 'idx_name': error"

**Documentation:**
- Add cross-reference to schema documentation
  - Points to /docs/architecture/business-logic/database-schema.md
  - Helps developers find authoritative schema specs

**Formatting:**
- Run cargo fmt to ensure consistent code style
- Fix clippy warnings (redundant closure removed)

All tests passing (8/8). No functional changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio
malibio merged commit 86421a9 into main Oct 3, 2025
@malibio
malibio deleted the feature/issue-101-database-connection-setup branch October 3, 2025 17:58
malibio added a commit that referenced this pull request Feb 4, 2026
* Set up database connection with libsql (addresses #101)

Implements DatabaseService for managing libsql database connections
with user-selectable database paths via Tauri.

**Implementation:**
- DatabaseService accepts PathBuf parameter for flexible path selection
- Automatic parent directory creation for nested paths
- Database initialization with CREATE TABLE IF NOT EXISTS (idempotent)
- Pure JSON schema: nodes + node_mentions tables only
- SQLite configuration: WAL mode, foreign keys, JSON operators enabled
- Comprehensive error handling with custom DatabaseError types
- Core indexes created for optimal query performance

**Testing:**
- 8 integration tests covering all critical functionality
- Tests use tempfile for isolated test databases
- Verifies table creation, index creation, and configuration
- Tests concurrent connections and idempotent initialization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: prevent code reviewer from auto-merging PRs

Add explicit constraints to pragmatic-code-review command that the
reviewer agent MUST NOT merge PRs. The agent's sole responsibility
is to provide the code review report.

Reasoning:
- Separation of concerns: Review ≠ Approval ≠ Merge
- Allows for review iterations and fixes before merge
- Maintains explicit human control over merge decisions
- Prevents unexpected/confusing auto-merge behavior

The user will decide whether and when to merge based on review findings.

* fix: use origin/main instead of origin/HEAD in code review command

Replace origin/HEAD references with origin/main...HEAD for git commands
since origin/HEAD is not configured in this repository.

This fixes the 'ambiguous argument' error when running /pragmatic-code-review.

* Fix clippy linting errors (addresses #101)

- Fix redundant closure in database.rs:269
- Fix assignment pattern in models/time.rs:88

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* refactor: apply code review improvements to DatabaseService

Address code review feedback by implementing suggested improvements:

**Code Quality Improvements:**
- Extract PRAGMA execution to helper method (execute_pragma)
  - Reduces code duplication and improves readability
  - Encapsulates the prepare().query() pattern with clear documentation

- Standardize index creation error messages
  - Include index name in all error messages for consistency
  - Format: "Failed to create index 'idx_name': error"

**Documentation:**
- Add cross-reference to schema documentation
  - Points to /docs/architecture/business-logic/database-schema.md
  - Helps developers find authoritative schema specs

**Formatting:**
- Run cargo fmt to ensure consistent code style
- Fix clippy warnings (redundant closure removed)

All tests passing (8/8). No functional changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 5, 2026
* Set up database connection with libsql (addresses #101)

Implements DatabaseService for managing libsql database connections
with user-selectable database paths via Tauri.

**Implementation:**
- DatabaseService accepts PathBuf parameter for flexible path selection
- Automatic parent directory creation for nested paths
- Database initialization with CREATE TABLE IF NOT EXISTS (idempotent)
- Pure JSON schema: nodes + node_mentions tables only
- SQLite configuration: WAL mode, foreign keys, JSON operators enabled
- Comprehensive error handling with custom DatabaseError types
- Core indexes created for optimal query performance

**Testing:**
- 8 integration tests covering all critical functionality
- Tests use tempfile for isolated test databases
- Verifies table creation, index creation, and configuration
- Tests concurrent connections and idempotent initialization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: prevent code reviewer from auto-merging PRs

Add explicit constraints to pragmatic-code-review command that the
reviewer agent MUST NOT merge PRs. The agent's sole responsibility
is to provide the code review report.

Reasoning:
- Separation of concerns: Review ≠ Approval ≠ Merge
- Allows for review iterations and fixes before merge
- Maintains explicit human control over merge decisions
- Prevents unexpected/confusing auto-merge behavior

The user will decide whether and when to merge based on review findings.

* fix: use origin/main instead of origin/HEAD in code review command

Replace origin/HEAD references with origin/main...HEAD for git commands
since origin/HEAD is not configured in this repository.

This fixes the 'ambiguous argument' error when running /pragmatic-code-review.

* Fix clippy linting errors (addresses #101)

- Fix redundant closure in database.rs:269
- Fix assignment pattern in models/time.rs:88

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* refactor: apply code review improvements to DatabaseService

Address code review feedback by implementing suggested improvements:

**Code Quality Improvements:**
- Extract PRAGMA execution to helper method (execute_pragma)
  - Reduces code duplication and improves readability
  - Encapsulates the prepare().query() pattern with clear documentation

- Standardize index creation error messages
  - Include index name in all error messages for consistency
  - Format: "Failed to create index 'idx_name': error"

**Documentation:**
- Add cross-reference to schema documentation
  - Points to /docs/architecture/business-logic/database-schema.md
  - Helps developers find authoritative schema specs

**Formatting:**
- Run cargo fmt to ensure consistent code style
- Fix clippy warnings (redundant closure removed)

All tests passing (8/8). No functional changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 26, 2026
* Set up database connection with libsql (addresses #101)

Implements DatabaseService for managing libsql database connections
with user-selectable database paths via Tauri.

**Implementation:**
- DatabaseService accepts PathBuf parameter for flexible path selection
- Automatic parent directory creation for nested paths
- Database initialization with CREATE TABLE IF NOT EXISTS (idempotent)
- Pure JSON schema: nodes + node_mentions tables only
- SQLite configuration: WAL mode, foreign keys, JSON operators enabled
- Comprehensive error handling with custom DatabaseError types
- Core indexes created for optimal query performance

**Testing:**
- 8 integration tests covering all critical functionality
- Tests use tempfile for isolated test databases
- Verifies table creation, index creation, and configuration
- Tests concurrent connections and idempotent initialization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: prevent code reviewer from auto-merging PRs

Add explicit constraints to pragmatic-code-review command that the
reviewer agent MUST NOT merge PRs. The agent's sole responsibility
is to provide the code review report.

Reasoning:
- Separation of concerns: Review ≠ Approval ≠ Merge
- Allows for review iterations and fixes before merge
- Maintains explicit human control over merge decisions
- Prevents unexpected/confusing auto-merge behavior

The user will decide whether and when to merge based on review findings.

* fix: use origin/main instead of origin/HEAD in code review command

Replace origin/HEAD references with origin/main...HEAD for git commands
since origin/HEAD is not configured in this repository.

This fixes the 'ambiguous argument' error when running /pragmatic-code-review.

* Fix clippy linting errors (addresses #101)

- Fix redundant closure in database.rs:269
- Fix assignment pattern in models/time.rs:88

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* refactor: apply code review improvements to DatabaseService

Address code review feedback by implementing suggested improvements:

**Code Quality Improvements:**
- Extract PRAGMA execution to helper method (execute_pragma)
  - Reduces code duplication and improves readability
  - Encapsulates the prepare().query() pattern with clear documentation

- Standardize index creation error messages
  - Include index name in all error messages for consistency
  - Format: "Failed to create index 'idx_name': error"

**Documentation:**
- Add cross-reference to schema documentation
  - Points to /docs/architecture/business-logic/database-schema.md
  - Helps developers find authoritative schema specs

**Formatting:**
- Run cargo fmt to ensure consistent code style
- Fix clippy warnings (redundant closure removed)

All tests passing (8/8). No functional changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
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.

Set up database connection with libsql

1 participant