refactor: remove dead code and consolidate SQL escaping#1732
Conversation
|
Thank you for your contribution! Before we can merge this PR, you need to sign our Contributor License Agreement. To sign, please comment below with:
I have read the CLA Document and I hereby sign the CLA. xuhengyu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3fd9eac658
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| self.lastRefilterPrefix = prefix | ||
| self.lastRefilterItems = ranked |
There was a problem hiding this comment.
Publish the debounced ranking result
In SuggestionViewModel.cursorsUpdated, the window only replaces items with the value returned synchronously from completionOnCursorMove; nothing observes this cache. When the user types a prefix and then pauses or accepts with Tab, the debounced filterAndRank result stored here is never shown for that final prefix, so the visible list keeps the immediate filterByPrefix ordering and stale/no match ranges instead of the ranked result this task computed.
Useful? React with 👍 / 👎.
| let ranked = await Task.detached(priority: .userInitiated) { | ||
| provider.filterAndRank(fullItems, prefix: prefix, context: sqlContext) | ||
| }.value |
There was a problem hiding this comment.
Keep refilter work cancellable
When typing just slowly enough for the 30 ms debounce to elapse, canceling cursorRefilterTask on the next cursor move does not cancel the unstructured Task.detached spawned here. Stale filterAndRank calls can continue over the full suggestion list while newer prefixes start their own work, so CPU-heavy refilters pile up in the large-list fast-typing case this change is meant to fix; keep the ranking in the cancellable task or retain and cancel the detached handle.
Useful? React with 👍 / 👎.
What
Two small, verified cleanups from a read-only codebase audit. No behavior change for users.
Dead code removal
Each symbol was confirmed to have zero references repo-wide (whole-word grep across app, plugins, and test targets) before removal:
TokenPermissionFilter(whole file) and itsConnectionIdentifiableprotocol, both never used.ConnectionEnvironmentenum (badge type) never instantiated.IdentifiableURL/IdentifiableConnectionssheet-binding wrappers, never bound.SQLFunctionLiteralmarker struct, superseded by theisSQLFunctionExpressionstring check.MCPAuditLogStorage.TimeRangenested enum, never produced or consumed.SQL escaping consolidation
DatabaseDriver's defaultquoteIdentifierandescapeStringLiteralduplicated the canonicalSQLEscapinglogic verbatim. They now delegate toSQLEscaping, and a newSQLEscaping.quoteIdentifierreplaces an inline copy inQueryResultExportDataSource. The export fallback now also strips null bytes, matching the canonical ANSI rule. AddedquoteIdentifierunit tests.Verification
swiftlint lint --strictclean on all changed files.Deliberately out of scope
String(localized:)interpolation fixes in plugins (real, but behavior-neutral and touch separately-released bundles, better as a plugin PR).