Repository navigation
fix(plugins): native version-based discovery, restart UX, registry hardening - #1208
Merged
Merged
Conversation
…y hardening (#1192) Discovery: scan built-in and user dirs, pick newest CFBundleShortVersionString per bundle ID. Prune user copies only when older than or equal to built-in. Read version from Info.plist instead of hardcoded principalClass.pluginVersion. isInstalling guard now wraps installFromRegistry and updateFromRegistry at their entry points; concurrent registry installs cannot race past it. waitForInitialLoad wraps the timeout in withTaskCancellationHandler so the continuation is always resumed and removed from the waiter list. installFromZip rejects multi-bundle archives instead of silently installing only the last one. Bundle load runs on a userInitiated DispatchQueue so the main actor is not blocked during dyld symbol resolution. Registry cache moved from UserDefaults binary blob to ~/Library/Caches/<bundle-id>/registry-manifest.json; legacy keys are removed on first launch. registryETag namespaced to com.TablePro.registryETag. Code signing requirement reads team identifier from Bundle.main signature at runtime via SecCodeCopySigningInformation, with a documented fallback. InstalledPluginsView restart banner gets a Quit & Reopen button that calls NSWorkspace.openApplication followed by NSApp.terminate. needsRestart is in-memory only so the banner does not persist across launches. Completed install badges auto-clear after 3 seconds. Lazy-load fallback emits a warning for user-installed plugins missing TableProProvides* keys. Default escapeStringLiteral no longer escapes backslashes; drivers that need MySQL-style escaping opt in via requiresBackslashEscapingInLiterals. MySQLPluginDriver sets the flag. Tests cover both modes.
Migrating the legacy registry ETag while deleting the manifest cache blob left the client in an inconsistent state: the server returned 304 against the carried-over ETag, but the in-memory manifest stayed nil so the Browse list rendered empty. Two defenses: drop the legacy ETag during migration (force a fresh body on first launch after upgrade), and if a 304 ever arrives with no cached manifest, retry once with forceRefresh.
Drop unreleased doc comment from the new requiresBackslashEscapingInLiterals property; collapse RegistryMetadata to a single pluginId field and remove the dead version-with-custom-Codable scaffolding. Rename performInstall to performInstallAssumingLock so the contract that the caller already holds isInstalling is encoded in the name, since the function must remain at least internal for the registry extension to call it across files. Quit & Reopen now checks the openApplication completion result and only calls NSApp.terminate when a new instance launched successfully; on failure the user sees an alert and the running app stays alive. pruneOutdatedUserCopies log differentiates equal-version pruning from truly older copies so support diagnostics do not report "outdated" for identical versions. Reorder Unreleased CHANGELOG sections to Keep a Changelog 1.1.0 order (Added, Changed, Fixed) and fold the plugin entries into the existing Changed and Fixed sections rather than appending fresh ones.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
End-to-end audit and rewrite of the plugin system. Closes #1192 and addresses 14 other issues found in the audit (P0–P3).
Plugin discovery (#1192)
Rewrote discovery to follow the native NSBundle pattern: scan both
Contents/PlugIns(built-in) and~/Library/Application Support/TablePro/Plugins(user-installed), group by bundle ID, pick the newest version byCFBundleShortVersionString. The "skip user-installed if built-in exists" branches inregisterBundleandregisterLazyManifestare gone — discovery dedupes by construction.pruneOutdatedUserCopiesonly deletes user copies that are older than or equal to the built-in version, so upgraded built-in plugins survive restart.Plugin version is now read from Info.plist (
CFBundleShortVersionString) instead of the hardcodedprincipalClass.pluginVersionstatic. The.metadata.jsonsidecar no longer stores version — only the registry plugin ID for update lookups.Concurrency hardening
installFromRegistryandupdateFromRegistrysetisInstallingat their own entry points. The internalperformInstallhelper bypasses the guard so registry methods do not double-set.waitForInitialLoadwraps the 10-second timeout inwithTaskCancellationHandlerand a UUID-keyed waiter, so the continuation is always resumed and removed frominitialLoadWaiterson cancel.installFromZiprejects multi-bundle archives.installBundleandinstallFromZipnow runbundle.load()onDispatchQueue.global(qos: .userInitiated)viavalidateAndLoadBundleAsync, off the main actor.Storage & security
~/Library/Caches/<bundle-id>/registry-manifest.json. LegacyregistryManifestCache,registryETag,registryLastFetchkeys are removed on first launch.registryETagnamespaced tocom.TablePro.registryETag.Bundle.mainat runtime viaSecCodeCopySigningInformation. Falls back to the previous hardcoded value if no signature is available (DEBUG / ad-hoc).removeRegistryMetadatalogs errors instead of swallowing them silently.HIG & UX
NSWorkspace.openApplication+NSApp.terminate).needsRestartis in-memory only; the banner no longer persists across launches.Plugin SDK
escapeStringLiteralfollows SQL standard — no longer escapes backslashes by default. Drivers opt in viarequiresBackslashEscapingInLiterals.MySQLPluginDriversets the flag.TableProProvides*Info.plist keys.Test plan
EscapedParameterValueTests(8 tests, MySQL-style) passSqlStandardEscapeTests(4 new tests, SQL-standard mode) passIsNumericLiteralTests(4 tests) passPluginLazyLoadingTests(3 tests) passRegistryClientURLTests(4 tests) pass.tablepluginbundles; verify it is rejected with a clear error