Skip to content

fix(connections): delete saved queries and filters with their connection so favorite keywords work#1666

Merged
datlechin merged 2 commits into
mainfrom
fix/favorite-keyword-orphans
Jun 12, 2026
Merged

fix(connections): delete saved queries and filters with their connection so favorite keywords work#1666
datlechin merged 2 commits into
mainfrom
fix/favorite-keyword-orphans

Conversation

@datlechin

Copy link
Copy Markdown
Member

Problem

Favorite keywords appeared to do nothing. Root cause: deleting a connection cleaned up Keychain entries and favorite tables but never SQL favorites. Favorites scoped to a deleted connection stayed in storage, invisible to every sidebar list and every keyword map (both filter on connection_id), with no warning and no way to recover them. Any keyword set on such a favorite was dead.

Secondary gaps found in the same investigation:

  • Editors without a schema provider had no completions at all. The completion engine required a schema provider even though favorites and SQL keywords need none.
  • The pre-debounce completion session seeded only SQL keywords, so favorites appeared late or not at all while typing fast.
  • Quick Switcher matched a saved query's keyword only as a penalized subtitle, ranking it below name matches.
  • Accepting a completion during IME composition could corrupt marked text.

Fix

  • deleteConnection/deleteConnections cascade-delete the connection's SQL favorites and per-table filter files. The delete confirmation says so when saved queries exist.
  • The CloudKit remote-delete path runs the same cascade.
  • Already-orphaned favorites are pruned once at launch. The prune is skipped when the connection list is empty so a failed load can never wipe favorites. SQL favorites do not sync, so the prune needs no tombstones.
  • fetchKeywordMap without a connection now returns only global keywords.
  • The schema provider is optional through the completion stack, so keyword and favorite completion work with no connection.
  • Favorites are seeded into the intermediate completion session.
  • Quick Switcher ranks a keyword match on a saved query like a name match.
  • hasMarkedText() guard before applying a completion.

Tests

11 new tests: storage cascade and prune, hasFavorites, global-only keyword map, filter-file removal per connection, completions without schema provider, allFavoriteItems, Quick Switcher keyword search.

Note: SQLCompletionProviderTests has three pre-existing parallel-run flakes at main (testCommaFromScopesColumnsToAllTables, testMySQLProviderTypes, testProviderAcceptsDatabaseType); each passes when run alone on both main and this branch.

@mintlify

mintlify Bot commented Jun 12, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟢 Ready View Preview Jun 12, 2026, 9:36 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@datlechin datlechin merged commit 487b007 into main Jun 12, 2026
4 checks passed
@datlechin datlechin deleted the fix/favorite-keyword-orphans branch June 12, 2026 13:26
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