Skip to content

feat: Added optional platform selection for driver install - #466

Open
wbeardall wants to merge 1 commit into
columnar-tech:mainfrom
wbeardall:main
Open

feat: Added optional platform selection for driver install#466
wbeardall wants to merge 1 commit into
columnar-tech:mainfrom
wbeardall:main

Conversation

@wbeardall

@wbeardall wbeardall commented Aug 22, 2026

Copy link
Copy Markdown

Summary

This is a contribution in response to Issue #50

The idea is to expand platform resolution, enabling users to install drivers which target non-host platforms when using the dbc install command.

Goals and Constraints

  • Do not change default dbc install behaviour; non-host always opt-in
  • WASM lib invocations are unmodified; the WASM / JS interface does not expose platform selection, as this PR is only intended to target
  • Non-host targets are validated ASAP during CLI parse; this does mean that the set of accepted platforms is hard-coded in platform.go, worth considering in case someone ends up adding weird and wonderful supported platforms to the CDN
  • Selected platforms are not validated against the available set of platforms for the specific driver requested (e.g. someone requests windows_arm64 for sqlite. In this case, the standard Error: no package found for platform 'windows_arm64' path occurs.

Potential Concerns and Considerations

The main concern I have currently is that dbc list reads installed manifests without confirming that the driver is actually installed for the host machine. This has the potential for user confusion, as they might have a non-host driver installed, and assume that the entry in dbc list means that they can use that driver with ADBC now!

I deliberately haven't changed the dbc list behaviour, because it has the potential for a bigger direct impact on user experience than the rest of this PR. That said, this is how I'd go about modifying dbc list:

  1. Add a --all-platforms flag to the dbc list command
  2. In absence of this flag, dbc list should filter out any drivers without a host lib explicitly linked in the <driver>.toml, and then print exactly as current
  3. With the --all-platforms flag, the dbc list table would expand with another PLATFORM column, with the host platform being marked explicitly (e.g. linux_amd64 (*))

I've put together a follow-up PR #467 implementing this.

Tests

config/platform_test.go (new file)

TestPlatformUnmarshalText

  • All six valid tuples unmarshal successfully
  • Invalid tuples fail with "unknown platform" and list valid values
    TestPlatformResolve
  • Empty Platform resolves to PlatformTuple() (host)
  • Explicit linux_amd64 resolves to itself

config/config_api_test.go

TestInstallDriver/records_explicit_platform_in_manifest

  • InstallDriver with linux_amd64 keys Driver.shared under that tuple
  • Shared lib file exists on disk
  • Host platform key is empty when it differs from requested platform

cmd/dbc/main_test.go

TestInstallInvalidPlatformRejectedAtParse

  • dbc install --platform noos_noarch mysql fails at argv parse
  • Error contains "unknown platform" and "valid values are:"
    TestInstallHelpMentionsVersionConstraints (extended)
  • Help output includes --platform

cmd/dbc/install_test.go

TestInstallWithPlatform (SubcommandTestSuite)

  • End-to-end CLI install with Platform: linux_amd64
  • Success output, manifest keyed under linux_amd64, file on disk
  • Host platform key absent when it differs from requested platform

client_methods_test.go

TestClientInstall/installs_driver_for_explicit_platform

  • Client.Install(..., config.Platform("linux_amd64")) succeeds
  • Shared path recorded under requested platform key

Updated Tests

TestClientInstall, TestClientUninstall, TestInstallDriver/success,
TestInstallDriver/invalid_tarball — updated for new Install/InstallDriver signatures

Notes

  • Code style: I couldn't see any specific precommit / lint-staged / etc. configurations, so I've not gofmt-ed the PR specifically!
  • Tests all pass on my machine :)

…to host platform, so standard install use-case is unaffected. WASM ops do not expose platform selection.
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