feat(db): add v1.1.0 database migration for cost tracking and git config - #51
Conversation
Implements GitHub issue #29: Database migration for v1.1.0 schema changes. Changes: - Create migrations/v1.1.0.sql with copy-recreate pattern for sessions table - Add v1.1.0 columns to sessions: git_user, git_email, ssh_key_provided, budget_limit, cost_estimate, actual_cost, template_name - Add budget_tracking table for period-based spending limits - Add hasV11Columns() helper method to SessionDB - Update migrateToLatest() to target v1.1.0 - Update CLI migrate command to support 1.1.0 version - Update types.ts with BudgetPeriod, BudgetTrackingRow, BudgetTracking - Add comprehensive TDD tests for v1.1.0 migration (12 new tests) - Update CLAUDE.md with new schema documentation All 873 tests pass. Migration is backward compatible with existing v1.0.0 sessions (new columns default to NULL/0).
WalkthroughAdds v1.1.0 DB migration: extends Changes
Sequence DiagramsequenceDiagram
actor User
participant CLI as CLI (migrate/update)
participant SessionDB as SessionDB
participant Migrations as Migration Files
participant SQLite as SQLite DB
User->>CLI: migrate --version 1.1.0
CLI->>SessionDB: read current schema version
SessionDB->>SQLite: SELECT schema_metadata
SQLite-->>SessionDB: current version
alt version < 0.5.0
CLI->>Migrations: load v0.5.0 SQL
Migrations-->>SQLite: execute v0.5.0
end
alt version < 1.0.0
CLI->>Migrations: load v1.0.0 SQL
Migrations-->>SQLite: execute v1.0.0
end
alt version < 1.1.0
CLI->>Migrations: load v1.1.0 SQL (add columns + budget table)
Migrations-->>SQLite: execute v1.1.0
SQLite->>SQLite: alter sessions, create budget_tracking, recreate views/indexes
end
CLI->>SessionDB: verify hasV11Columns()
SessionDB->>SQLite: check new columns/index/table
SQLite-->>SessionDB: verification result
CLI->>SQLite: update schema_metadata to 1.1.0
SQLite-->>CLI: done
CLI-->>User: migration complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Add v1.1.0 database migration for cost tracking and git config and update CLI and DB to target schema 1.1.0
📍Where to StartStart with the Macroscope summarized 51e2b0f. |
Review SummaryThis PR implements the v1.1.0 database migration for cost tracking and git configuration. Overall, the implementation is well-structured and follows established patterns from previous migrations (v1.0.0). The test coverage is comprehensive with 12 new tests covering all key scenarios. ✅ Strengths
🐛 Issues Found1. Incorrect version message in CLI output (src/cli.ts:1056)console.log(chalk.dim('Database is now at version 1.0.0')); // ❌ WRONGShould be: console.log(chalk.dim('Database is now at version 1.1.0')); // ✅ CORRECTThis is the only actual bug. When users run
|
|
I've completed my review of PR #51 and posted a comprehensive comment. The review identified: Key Findings:
The PR is well-executed overall and requires only a trivial typo fix before merge. All other aspects (security, performance, code quality, backward compatibility, idempotency) are properly addressed. |
Adds concurrency configuration to cancel in-progress workflow runs when a PR is updated, avoiding duplicate reviews and wasted compute.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/cli.ts (1)
1021-1058: Update command still reports v1.0.0 after migrating to v1.1.0.
This output is now misleading given the new target version.🛠️ Suggested fix
- console.log(chalk.dim('Database is now at version 1.0.0')); - console.log(chalk.dim('E2B sandbox features are now available')); + console.log(chalk.dim(`Database is now at version ${result.to}`)); + console.log(chalk.dim('E2B sandbox + git/cost/template/budget tracking features are now available'));
The update command was displaying "version 1.0.0" instead of "1.1.0" after running migrations. Also updated the feature message to be more generic for v1.1.
Review SummaryThis PR implements the v1.1.0 database migration for cost tracking and git configuration. The implementation is excellent and follows established patterns from previous migrations. ✅ Strengths
✅ Bug StatusThe bug mentioned in prior reviews (incorrect version message on line 1056) has already been fixed in commit 💡 Minor Suggestions (Enhancement, Not Blocking)
✅ Code Quality
📝 Test CoverageExcellent coverage - All critical paths tested:
🎯 RecommendationApprove - The implementation is solid and ready for v1.1.0. The suggested improvements are optional enhancements for future maintainability, not blocking issues. The bug referenced in prior reviews has been fixed, and all other aspects (security, performance, code quality, backward compatibility, idempotency) are properly addressed. |
|
I've posted a comprehensive review to PR #51. The review confirms: ✅ Ready to Approve The v1.1.0 database migration is well-implemented with:
The bug mentioned in prior reviews (incorrect version message) has already been fixed in commit Minor optional suggestions were provided for future maintainability (making CLI version messages dynamic), but none are blocking issues. |


Summary
Implements GitHub issue #29: Database migration for v1.1.0 schema changes.
This migration adds the database schema required for:
git_user,git_email,ssh_key_providedbudget_limit,cost_estimate,actual_costtemplate_nameChanges
migrations/v1.1.0.sqlusing copy-recreate pattern (consistent with v1.0.0)hasV11Columns()helper method to SessionDBmigrateToLatest()to target v1.1.0migratecommand to support 1.1.0 versionupdatecommand description for v1.1.0BudgetPeriod,BudgetTrackingRow,BudgetTrackingSessionandSessionRowinterfaces with v1.1.0 fieldsTest plan
Closes
Closes #29
Summary by CodeRabbit
New Features
CLI
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.