feat(adbc): optional ADBC driver install/list/uninstall in ampup#14
Open
incrypto32 wants to merge 14 commits into
Open
feat(adbc): optional ADBC driver install/list/uninstall in ampup#14incrypto32 wants to merge 14 commits into
incrypto32 wants to merge 14 commits into
Conversation
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.
mitchhs12
reviewed
Jul 22, 2026
| .expect("a required asset resolves to Some or errors"); | ||
|
|
||
| let data = download_with_retry(github, &asset).await?; | ||
| verify_artifact(&asset.name, &data, asset.digest.as_deref()) |
Contributor
There was a problem hiding this comment.
Should the ADBC installation path require asset.digest to be present before calling verify_artifact? When it is None, verify_artifact only checks that the download is non-empty. Since these new driver assets should always advertise a digest, failing when it is missing would guarantee the integrity requirement.
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
marked this pull request as ready for review
July 23, 2026 09:13
Contributor
|
Quick heads-up: the library inside each archive is now |
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.
Adds
ampup adbc <install|list|uninstall>so ampup can install optional ADBCdriver libraries into an amp version for ampd to load at runtime. This is the
ampup side of edgeandnode/amp#2600 (postgres first). The release pipeline that
ships the driver assets is edgeandnode/amp#2599; the amp-side loader change is
separate and not in this PR.
What it does:
ampup adbc install <driver>— downloads the pinned driver archive from the amprelease, requires and verifies its SHA-256 against the release asset digest,
extracts it, and places it self-contained under
~/.amp/versions/<v>/drivers/<driver>/with a generatedmanifest.toml(
Driver.shared= absolute lib path) that ampd loads by path.ampup adbc list— drivers installed for a version.ampup adbc uninstall <driver>— removes a driver and prunes an emptied dir.--version, defaulting to the active one. Installing additionallyrequires that version's binaries to be present:
ampup installreplaces the wholeversion directory, so drivers placed under a binary-less version would be
destroyed by the next install.
ampup installnever pulls drivers.Notes:
siblings. Drivers are per amp version, so reinstall after upgrading.
extraction is guarded against path traversal and non-regular (symlink/hardlink)
tar entries.
placement and list filtering, plus offline integration tests that drive the full
install path against an in-process mock GitHub server — including the
missing-digest and version-not-installed rejections — and uninstall.
A real end-to-end run against published driver assets depends on
edgeandnode/amp#2599; until that lands the install path is covered by the offline
mock-server tests.