Skip to content

feat(install): install driver archives from HTTP(S) URLs - #640

Open
eitsupi wants to merge 22 commits into
mainfrom
feat/install-direct-archive
Open

eitsupi wants to merge 22 commits into
mainfrom
feat/install-direct-archive

Conversation

@eitsupi

@eitsupi eitsupi commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Part of #394.

#621 added HTTP sources to driver lists. dbc install now accepts direct archive URLs and lets you choose the signing key for local and URL archives.

  • For direct HTTP(S) URLs, dbc downloads the archive without registry credentials and applies the 512 MiB limit. dbc takes the driver ID from <driver>_<platform>_<version> or the registry default <driver>_<platform>-<version>, with a .tar.gz or .tgz extension. Both forms accept host platform aliases and require a SemVer suffix with an optional leading v. The installed version comes from the manifest. URLs cannot contain user info, a query, or a fragment. Plain HTTP emits a warning. URL installs reject --registry and --pre.
  • Local and URL archives use the built-in Columnar key by default. --signing-key NAME selects a key from the user config's [signing_keys] before the archive is opened or downloaded. --no-signing-key treats the archive as unsigned. Only one of these options and --skip-package-signature-check can be active.
  • Local archive IDs can get shorter or longer than in v0.3.1, which took the part before the first literal _<host platform>_ or used the file name without its extension. Host platform aliases and registry-default names can now yield the shorter driver name. After _<platform>_, a non-SemVer suffix must be nonempty and contain neither _ nor -. For example, _latest still yields the short ID, while _dev-build and _custom_build now yield the file name without its extension. dbc determines the ID before opening the file and uses it in JSON progress events.
  • Registry installs clean up temporary downloads after the installation attempt.
  • Local and URL installs omit the preamble in JSON modes.

go-arg treats --no-signing-key= as enabled, skipping signature verification, and takes the next argument as the key name after --signing-key=. The maintainer confirmed that omitting support for explicit empty strings was intentional, and upstream issue alexflint/go-arg#280 was closed without a change. Fixing this in go-arg would let dbc reject both without parsing the command line a second time.

@eitsupi
eitsupi added this pull request to stack #641 December 2, 2026 13:54
@eitsupi eitsupi changed the title feat/install direct archive feat(install): install driver archives from HTTP(S) URLs Dec 2, 2026
@eitsupi
eitsupi force-pushed the feat/install-direct-archive branch from 303d97b to b01b0a4 Compare December 2, 2026 14:44
@eitsupi
eitsupi force-pushed the feat/install-direct-archive branch from b01b0a4 to efcef39 Compare December 2, 2026 15:04
@zeroshade

Copy link
Copy Markdown
Member

Looks good overall. Nothing blocks merging, but notes 1 and 2 are worth addressing. This branch includes #638 and #639, so it has to merge after them.

Checks run on e22ffc0: go build ./... and the browser build (GOOS=js GOARCH=wasm go build .) succeed, and go vet on ., ./config/ and ./cmd/dbc/ is clean. With -race, these pass:

  • ./config/
  • the root package's signing tests
  • in cmd/dbc: the new tests (TestArchiveDriverIDFor, TestParseArchiveURL, TestLooksLikeURL, TestClassifyInstallInput, TestSelectSignatureCheck, TestSigningFlags*, TestInstallPreambleNotInJSON) and the suite's archive, URL and signing install tests

What holds up

  • Validation happens before anything is fetched. classifyInstallInput and selectSignatureCheck run once, in GetModelCustom. Any error stops Init before a file is opened or a download starts.
  • A named key is resolved before the download. --signing-key is looked up only in the user config, never in a project's dbc.toml. columnar is reserved for the built-in key, and a key file that can't be read fails rather than falling back.
  • URL handling.
    • User info, queries and fragments are rejected, including a literal #.
    • Errors never quote the argument, and archiveURL.String() shows only the scheme, host and path.
    • The unescaped file name must be a plain name, and the driver ID goes through ValidateDriverID.
    • Downloads go through downloadHTTPPkg, so they get the 512 MiB cap and OpenAnonymous's rules: no registry credentials and no https-to-http redirect.
    • The file name must name this host's platform.
  • looksLikeURL treats a one-letter scheme as a Windows drive, so C://x.tar.gz stays a local path. file:// gets a clear error.
  • Signature verification. Local and URL archives default to the Columnar key. The verifier comes from the shared signatureVerifier, so a signer without a key fails instead of falling back to no verification.
  • Temporary directories. Registry and URL downloads now remove their temporary directory after the install. A local archive is never removed.

Notes

  1. Two flags do the same thing for archives. For a local or URL archive, --no-signing-key and --skip-package-signature-check behave identically: both produce no verifier and both report the package as not verified. --no-signing-key is also rejected for registry installs. The guide says "To treat an archive as unsigned, use the new --no-signing-key flag" without saying why it exists alongside the skip flag. Please either document the difference in meaning (declaring an archive unsigned, like a type = 'none' key, versus skipping the check) or consider dropping one of them.
  2. The change to local archive driver IDs isn't documented. Some names now produce a different driver ID than in v0.3.1. For example, _dev-build and _custom_build give the file name without its extension, and platform aliases give the shorter name. This changes the name users load with a driver manager, but it's only in the PR description. "From Local Archive" should mention it, since it already tells users to note the printed name.
  3. The release contract isn't written down. downloadedArchive runs os.RemoveAll(filepath.Dir(f.Name())), so it assumes downloadPkg and downloadHTTP return a file in its own private directory. All current implementations do, but nothing on the baseModel fields says so. A future hook that returns a file in a shared directory would wipe that directory. One sentence on the fields would make this explicit.
  4. A test pins a known parser bug. TestSigningFlagsFromCommandLine asserts the go-arg quirk where --no-signing-key= turns verification off. It's marked FIXME, but its expectations will need flipping if go-arg changes.
  5. No progress for URL downloads. There's no progress bar (View skips it on purpose), and archives can be up to 512 MiB. This is a UX gap, not a bug.

dbc install left the private temporary directory of each registry
download behind. Pass the archive with how to release what fetching it
created, and remove that directory once the install returns. A local
archive is the user's file and is never removed. Test stubs that
handed out testdata files directly now return private copies, as
downloads must.
dbc install now accepts the URL of a driver archive, such as a release
asset, as well as a local path. The driver name comes from the file
name, which must contain the host platform, and the version from the
archive's manifest. The URL must not hold credentials, a query or a
fragment; it is downloaded without registry credentials and within the
download size limit, and plain HTTP prints a warning. --registry and
--pre are rejected for a URL.

Also print no preamble in JSON mode, where the local archive preamble
used to precede the JSON output.
dbc install --signing-key NAME verifies a local or URL archive with a
key from [signing_keys] in the user config, instead of the built-in
Columnar key, and --no-signing-key treats such an archive as unsigned.
The key is resolved, and its key file read, before anything is fetched.
A key in a project's dbc.toml is not used, and "columnar" names the
built-in key, which is already the default.

At most one of --signing-key, --no-signing-key and
--skip-package-signature-check may be given, and neither key flag
applies to a registry install. go-arg would take the next argument as
the value of an empty --signing-key= and keep only the last
--no-signing-key, so dbc checks those on the command line itself.

The local archive docs now use --no-signing-key for an unsigned
archive.
The checksumFormatHint constant sat between the comment and the
function, so the comment documented the constant instead.
The browser build rejects public_key_file when the signing policy is
built, so TestGlobalConfigSigningPolicy now expects that error there.
Also use strings.SplitSeq as the linter asks.
The Node build of js/wasm reads key files, so only the browser build
expects public_key_file to fail.
The check for an empty --signing-key= and a repeated or valued
--no-signing-key only knew the exact spellings -q, --quiet and a
leading install, so "--quiet=true install --no-signing-key=" or
"-no-signing-key=false" got past it. It now reads every argument as
go-arg does: any number of leading dashes, an optional =value, values
of options that take one, and nothing after --.
The install model kept what the argument named in isLocal, archiveURL
and a second archive name check in Init, and how the signature is
checked in skipSignature and the named and unsigned fields of
directSigning. The argument is now classified once into a registry,
local or URL input, and the options into one signature check: the
registry's key, the Columnar key, a named key, unsigned or skipped.

Drop the command line re-scan that rejected an empty --signing-key=
and a repeated or valued --no-signing-key. It copied go-arg's parsing
and kept drifting from it, so the signing options now mean what go-arg
makes of them, like every other option. An empty --no-signing-key=
is true, as --skip-package-signature-check= already is, and an empty
--signing-key= takes the next argument as the key name, which must
still be a key of the user config.
startInstalling checked a package with the Columnar key when the signer
had no key, so a key that was never resolved would quietly be replaced
by another one. It now uses signatureVerifier, as sync does, which
fails the verification without a key.

Also show no progress bar while an archive URL downloads, since that
download reports no progress, and say that only one of the signing
options can be active, since --no-signing-key=false is not.
Every boolean flag treats an empty value as true, so a note on this
one flag suggested the others behave differently.
The signing flag tests record that an empty --no-signing-key= skips
signature verification and an empty --signing-key= takes the next
argument. Say why they are tested, and that these cases should expect
errors once go-arg keeps an explicit empty value.
A URL or local archive named mysql_darwin_aarch64_v1.0.0.tar.gz on an arm64
Mac now installs the driver mysql, as registry builds already treat the
spellings alike. The platform is the shortest one that ends before the
version and denotes the host, so a driver ID may contain underscores.
Like a URL, a local archive gets its driver ID when the input is
classified, so every JSON progress event names the ID instead of the file
path, and an invalid ID fails before the file is opened.
A URL or local archive may also be named <driver>_<platform>-<version>, as
registries name archives by default. In both forms the version must be
SemVer, so a libc or variant after the platform, as in
mysql_linux_amd64_musl-1.0.0, is never read as part of the version. A local
archive still accepts any version without a hyphen after the underscore.
A + in the version may also be escaped as %2B in a URL; tests cover both.
@eitsupi

eitsupi commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review.

  1. The guide now explains both flags. --no-signing-key declares an archive unsigned, like signing_key = false in a registry. --skip-package-signature-check skips verification for one install, including registry installs. Both currently skip verification and leave the receipt marked unverified for local and URL archives. Recording the signing policy in the receipt, as proposed in proposal: add dbc upgrade for installed drivers #645, could preserve that distinction.
  2. “From Local Archive” now calls out driver name changes from v0.3.1 and gives the naming rules and examples in a collapsible section.
  3. Both download hooks now document that they return a file in a dedicated temporary directory and that the caller removes the whole directory.

@zeroshade

Copy link
Copy Markdown
Member

Re-reviewed at 7c1f9ab. Notes 1–3 are fixed, and nothing blocks merging.

Checks run: go build ./... succeeds and go vet ./cmd/dbc/ is clean. I didn't rerun the tests: git range-diff shows the 19 commits I reviewed are unchanged after the rebase, and the new commits change only a Go comment, the docs and mkdocs.yml.

Note Status
1. Two flags do the same thing for archives Fixed. The collapsible section explains the difference in meaning and that both currently have the same effect for archives. signing_key = false matches the registry setting in driver_registry.md.
2. Local archive driver IDs changed without docs Fixed. The rules and the v0.3.1 vs v0.4.0 table are correct against v0.3.1's split on _<host platform>_.
3. Download hooks didn't say they own their temporary directory Fixed in the baseModel doc comments.
4. Test pins the go-arg quirk No change, as expected (FIXME).
5. No progress bar for URL downloads No change; this was a UX note.

One thing to check: the ??? info sections rely on pymdownx.details, which ships with mkdocs-material. I couldn't build the docs here, so it would be worth running pixi run docs-build once to confirm the sections render.

This branch was successfully deployed

1 active deployment
snapshot — 7c1f9aba Deployed Dec 4, 2026 by eitsupi via snapshot #1478
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