Skip to content

fix(plugins): update an installed plugin that lacks this Mac's architecture - #4446

Merged
datlechin merged 2 commits into
mainfrom
perf/size
Nov 23, 2026
Merged

datlechin merged 2 commits into
mainfrom
perf/size

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

Perf audit, size lane, item P1 (finding 18c-1). This is the correctness step that per-arch registry plugins need first.

  • PluginManager.validateBundleVersions now also checks that a user plugin's executable holds the running process's architecture. It reads Contents/MacOS/<CFBundleExecutable> with CFBundleCopyExecutableArchitecturesForURL, not the cached Bundle, so a bundle repaired in place passes at once. Under Rosetta the app wants x86_64.
  • All seven gates already call it: discovery, eager and lazy load, assertLoadable, applyStagedUpdates, loose-bundle and local-zip installs, and PluginInstaller.validateBundle for a registry download.
  • Built-in plugins skip the check through a new source parameter. They ship inside the sealed app, one arch per build, and build.sh already runs verify-plugin-loads.sh --arch on them. This also avoids 16 header reads on the main actor at launch.
  • New PluginError.missingArchitecture. Its message is the loader's existing sentence, moved to PluginBundleLoader.missingArchitectureReason, so no new string.
  • Discovery marks that rejection as repairable only when the bundle has a registry sidecar. The update pass then reinstalls it at once (it is not loaded), and connect waits for that repair. A sideloaded plugin keeps the architecture message, now at launch instead of at first use.
  • Today every registry zip is universal, so this matters for a same-build arch swap (for example an arm64-only copy over an Intel one), and later for per-arch registry plugins.

Before and after

  • No benchmark: this is a correctness change with no runtime cost beyond one Mach-O header read per user plugin at launch.

Deliberately not fixed here

  • P2, per-arch registry plugins and manifests (18c): decided "later" (keep plugins/v3.json). Listed in the follow-up issue.
  • P3, folding Parquet export into the DuckDB plugin (18b): declined.
  • P4, a shared framework for bundled plugins (18a), and merging the two helpers (18a2): agreed not now.
  • A local .zip or .tableplugin without the arch fails with the arch message. No test covers that path end to end: it checks the code signature first, and a test fixture cannot carry TablePro's signature. The registry-download gate, which shares the same check, is tested.

Test plan

  • New PluginArchitectureCheckTests: no executable and a non-Mach-O file pass; a thin executable passes only for its own arch; a universal one passes on both; a built-in skips the check; a bundle replaced in place passes at once; a registry download without the arch is refused; the message matches the loader's.
  • New cases in PluginRegistryUpdatePassTests: launch marks an other-arch registry plugin for repair and the pass installs it at once, not staged; a sideloaded one keeps its message and is never a target; a staged update without the arch is dropped and the installed copy stays.
  • Pinned, unchanged and green: PluginBundleVersionTests, PluginLazyRegistrationTests, PluginRegistryUpdatePassTests (including inPlaceRepairPassesKitCheck), PluginBundleLoaderDescribeLoadFailureTests, PluginInstallerHelpersTests, PluginLazyActivationVerificationTests, PluginManagerInitialLoadTests, DriverUnavailabilityTests. No test changed on purpose.
  • verify.sh test on those suites: 113 cases, all pass. verify.sh lint on every changed file: 0 violations.

@datlechin
datlechin enabled auto-merge (squash) November 23, 2026 12:34
@datlechin
datlechin merged commit 6d6e2d4 into main Nov 23, 2026
11 checks passed
@datlechin
datlechin deleted the perf/size branch November 27, 2026 16:38
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