Custom sqlite migration tooling for cloud-sync-ready#5049
Conversation
Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
✅ Deploy Preview for char-cli-web canceled.
|
✅ Deploy Preview for hyprnote canceled.
|
✅ Deploy Preview for unsigned-char ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 50b6931. Configure here.
| .unwrap(); | ||
|
|
||
| assert!(tables.contains(&"templates".to_string())); | ||
| assert!(tables.contains(&"_char_migrations".to_string())); |
There was a problem hiding this comment.
Tests assert nonexistent _char_migrations table exists
High Severity
Two tests assert that a _char_migrations table exists, but nothing in the codebase creates it. The migration SQL files only create templates, calendars, and events. The migration infrastructure creates _sqlx_migrations (filtered out by NOT LIKE '_sqlx%'). The _char_migrations table appears nowhere else in the repo — both schema_declares_legacy_migrations_and_cloudsync_registry and migrations_apply_cleanly will fail.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 50b6931. Configure here.
|
|
||
| hypr_db_core2::cloudsync_commit_alter_on(&mut *self.conn, table_name) | ||
| .await | ||
| .map_err(cloudsync_error)?; |
There was a problem hiding this comment.
CloudSync alter records success before commit completes
Medium Severity
In the CloudsyncAlter apply path, execute_migration inserts into _sqlx_migrations with success = TRUE before cloudsync_commit_alter_on is called. If commit_alter fails, the migration is permanently recorded as successful, so subsequent runs skip it — leaving CloudSync's alter protocol incomplete and unrecoverable. The success record needs to be finalized only after commit_alter succeeds.
Reviewed by Cursor Bugbot for commit 50b6931. Configure here.


Apparently we need custom migration tooling if we want to enable syncing — CloudSync tracks row-level changes for replication, so schema DDL must be wrapped in begin_alter/commit_alter on the same connection, and sqlx's built-in migrator doesn't expose a hook to inject those calls.