Skip to content

feat(adbc): optional ADBC driver install/list/uninstall in ampup - #14

Draft
incrypto32 wants to merge 18 commits into
mainfrom
krishna/adbc-optional-drivers
Draft

feat(adbc): optional ADBC driver install/list/uninstall in ampup#14
incrypto32 wants to merge 18 commits into
mainfrom
krishna/adbc-optional-drivers

Conversation

@incrypto32

@incrypto32 incrypto32 commented Jul 22, 2026

Copy link
Copy Markdown
Member

Adds optional ADBC driver support to ampup, tracking edgeandnode/amp#2600.

ampup adbc install <driver> downloads the pinned driver archive from the matching amp release, verifies its sha256 against the asset digest, and places the library into the version directory beside ampd/ampctl/ampsql. Also adds list and uninstall.

Currently supports the postgresql driver. --version, --platform, and --arch override the defaults (active version, host platform/arch).

Layout. The driver library lands directly in ~/.amp/versions/<version>/ as amp-adbc-driver-<driver>.{so,dylib}, beside the amp binaries. No per-driver subdirectory, no manifest — the local cache mirrors the release's flat artifact list.

Naming. The release pipeline (edgeandnode/amp#2599, PR #2714) names the library inside each archive with the final amp-adbc-driver-<driver> prefix, so ampup places it as-is. The .tar.gz asset names are unchanged.

Notes:

  • Depends on release CI (#2714) shipping the driver artifacts with the pre-named library.
  • The amp-side loader that consumes these (connect.rs resolution) lands separately and must be present for the drivers to load at runtime.

Tested against an in-process mock GitHub server: full install path (fetch → download → verify → extract → place), digest rejection, explicit-version targeting, and uninstall across platforms.

Add an `adbc` subcommand (install/list/uninstall) mirroring the existing
`self` subcommand structure. Runners are stubs that fail loudly until the
download/placement path lands.

Part of edgeandnode/amp#2600 (optional ADBC driver support in ampup).
Add an `adbc` module with a `Driver` catalog (postgresql) and
`asset_name`, mapping a driver + platform/arch to the release asset
`adbc-driver-<driver>-<platform>-<arch>.tar.gz`. Wire the command
runners to validate the driver name against the catalog.

Part of edgeandnode/amp#2600.
Read the digest GitHub advertises for each release asset and verify the
downloaded bytes against it, failing with ChecksumMismatch on a mismatch.
Applies to every download (binaries and, later, drivers). Previously only
a non-empty check ran.

- github: Asset/ResolvedAsset carry an optional digest.
- download_manager: verify_artifact checks SHA-256 when a digest is present.
- tests: verify_artifact match/mismatch/prefix/no-digest, plus end-to-end
  matching and mismatched-digest cases through download_all.

Part of edgeandnode/amp#2600.
Wire `ampup adbc install <driver>` to resolve the active amp version,
download the pinned driver archive, verify its SHA-256 digest, and
extract the validated members to a staging dir. Adds a flat-tar.gz
extractor (traversal-guarded) and the driver runtime-lib naming.
Placement into the version dir is not yet wired.

Part of edgeandnode/amp#2600.
Install now moves the extracted driver into a self-contained
~/.amp/versions/<v>/drivers/<driver>/ and writes an ADBC manifest.toml
(typed via the toml crate) whose Driver.shared is the absolute library
path, so ampd can load the driver by manifest.

Staging happens inside the drivers dir so the final placement is a
same-filesystem atomic rename; reinstalls replace the existing dir.

Part of edgeandnode/amp#2600.
extract_and_validate checked only the entry name, so a symlink or
hardlink named as an allowed member would be materialized by unpack as
a link instead of the archived bytes. Reject any entry that is not a
regular file before unpacking.

Part of edgeandnode/amp#2600.
adbc install downloads a single asset directly, so the -j/--jobs flag
was accepted and silently ignored. Remove it from the subcommand and the
install signature.

Part of edgeandnode/amp#2600.
list shows the complete drivers installed for the active amp version
(directories that match the catalog and hold a manifest.toml, so leftover
staging dirs and partial installs are skipped). uninstall removes a
driver's directory and prunes an emptied drivers dir.

Part of edgeandnode/amp#2600.
The driver download called download_resolved_asset directly, so it
lacked the single application-level retry that binary downloads get via
download_with_retry. Reuse that wrapper (now pub(crate)) so a driver
fetch survives a transient failure the same way binaries do.

Part of edgeandnode/amp#2600.
Split install into a thin wrapper plus install_driver so a test can
inject a GitHubClient pointed at a mock server. Add an in-process mock
GitHub server and integration tests: install drives the full fetch ->
verify -> extract -> place -> manifest path against the mock, and
uninstall removes a placed driver and prunes the emptied drivers dir.

Part of edgeandnode/amp#2600.
Comment thread ampup/src/commands/adbc.rs Outdated
verify_artifact only checks that the download is non-empty when no digest
is advertised. Driver assets always carry one, so treat a missing digest
as a malformed release and refuse rather than install a library that ampd
would load unverified.

Part of edgeandnode/amp#2600.
The adbc commands were pinned to the active version, unlike `ampup
install` which takes one. Add --version to install, list, and uninstall.

Resolving the version now also requires it to be installed. Installing
amp replaces the whole version directory, so drivers placed under a
version whose binaries are not there yet would be destroyed by the next
`ampup install`.

Part of edgeandnode/amp#2600.
Requiring installed binaries for list and uninstall left an orphaned
driver directory impossible to inspect or remove, and made a read-only
query fail on a stale .version. Split the check out of version
resolution so it guards installation only, and reuse VersionError so the
message matches the rest of the CLI.

Also name the flag's value VERSION in help, and cover installing for an
explicit non-active version plus uninstalling from a version whose
binaries are gone.

Part of edgeandnode/amp#2600.
build_from_local_path_with_custom_name and
rebuild_removes_stale_optional_binaries both replace the process-global
PATH to install a mock cargo. Run concurrently, one restores the original
value while the other is mid-build, so the mock disappears and the real
cargo fails against the fake repo. Share a mutex so they cannot overlap.
@incrypto32
incrypto32 marked this pull request as ready for review July 23, 2026 09:13
Drivers were installed into a self-contained drivers/<driver>/ directory
holding an ADBC manifest.toml beside the library. Install them directly
into the version directory instead, alongside the amp binaries, and drop
the manifest: with the library at a known path, a manifest naming its own
neighbour is indirection amp does not need. That also removes the toml
dependency.

The library is renamed to amp-adbc-driver-<driver>.{so,dylib} on install,
so its filename is what distinguishes it from ampd/ampctl/ampsql now that
they share a directory. License files are namespaced the same way.

list and uninstall check the catalog's expected filenames rather than
walking a directory, and cover every supported platform rather than the
host's: `adbc install --platform` can place a library this host would not
look for, which would otherwise strand a file no ampup command could
remove.

Placement is now per-file renames rather than one directory rename, so a
failed move rolls back the files that already landed; without that a
partial install would leave the library behind and list would report a
driver whose installation had errored.

Part of edgeandnode/amp#2600.
@mitchhs12

mitchhs12 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Quick heads-up: the library inside each archive is now amp-adbc-driver-postgresql.so on Linux and amp-adbc-driver-postgresql.dylib on macOS.
The four .tar.gz asset names are unchanged, and each archive still contains the library, LICENSE.txt, and NOTICE.txt at its root.
You’ll just need to update the expected library member name in #14; the asset lookup shouldn’t need to change.

The release archive now ships the driver library under its final name
(amp-adbc-driver-<driver>.{so,dylib}), so ampup places it as-is instead
of renaming it. LICENSE/NOTICE are validated in the archive but no longer
extracted onto disk; redistribution is satisfied by the release tarball.
Add ADBC driver usage to the README and the ampup feature doc: the
subcommands, per-version behavior, the version directory layout, and the
install flow. Uses the generic amp-adbc-driver-<driver> filename form.
@incrypto32
incrypto32 marked this pull request as draft July 27, 2026 07:53
The digest is already in the release metadata, so a missing one can be
caught before spending the download instead of after.
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.

2 participants