Skip to content

fix(cursor_desktop): support delete on pre-table schemas and KV-only sessions - #57

Open
Adityakk9031 wants to merge 1 commit into
skillsynchq:mainfrom
Adityakk9031:fix/cursor-desktop-delete-schema-compatibility
Open

Adityakk9031 wants to merge 1 commit into
skillsynchq:mainfrom
Adityakk9031:fix/cursor-desktop-delete-schema-compatibility

Conversation

@Adityakk9031

Copy link
Copy Markdown
Contributor

In CursorDesktopStore::delete(), the store ran an unconditional DELETE FROM composerHeaders WHERE composerId = ?1 and checked whether any rows were deleted from that table alone.

This caused two issues:

  1. On older Cursor databases that lack the composerHeaders table entirely (which discover() explicitly supports by falling back to scanning cursorDiskKV), delete() failed with a SQLite error no such table: composerHeaders.
  2. Even on modern databases with composerHeaders, if a session was discovered from cursorDiskKV without an accompanying header entry, delete() cleaned up the KV entries but returned Err(Error::Malformed("no such session")) because deleted from composerHeaders was 0.

This change:

  • Checks has_table(&conn, "composerHeaders")? before attempting deletion from composerHeaders.
  • Counts both deleted header rows and deleted KV keys.
  • Only returns Error::Malformed when both counts are 0, allowing pre-table databases and KV-only sessions to be deleted cleanly.

Testing

  • Added delete_roundtrip_removes_session_and_fails_on_duplicate.
  • Added delete_succeeds_on_database_without_composer_headers_table.
  • Added delete_succeeds_on_kv_only_session_in_modern_database.
  • cargo test -p txcript --no-default-features --features opencode,hermes,search --test integration cursor_desktop (12/12 passed).
  • cargo clippy -p txcript --no-default-features --features opencode,hermes,search --all-targets -- -D warnings (clean).

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