Skip to content

feat!: new lockfile format with GitHub release support via Packslip (PoC) - #497

Closed
eitsupi wants to merge 117 commits into
columnar-tech:mainfrom
eitsupi:feat/lockfile-v2-sources
Closed

eitsupi wants to merge 117 commits into
columnar-tech:mainfrom
eitsupi:feat/lockfile-v2-sources

Conversation

@eitsupi

@eitsupi eitsupi commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

This PR is a Proof of Concept.
A subsequent independent PRs will implement the solution based on this PoC.


Summary

This PR introduces source-aware package resolution and lockfile v2.

It adds:

  • registry, local path, and signed Packslip sources behind a shared resolution model;
  • multi-platform lock snapshots with archive hashes, optional sizes, and source evidence;
  • verified installation, per-driver transactions, and installation receipts;
  • persistent Packslip trust state and Sigstore verification;
  • deterministic replay and repair from locked artifacts.

Related to #394 and #400. Most of the change is shared resolution, lockfile, and package-lifecycle infrastructure; Packslip is one consumer. This PR does not fully close either issue: release discovery, source authoring, and publication of all-platform registry hashes remain follow-up work.

User-facing workflows

Install directly from an exact signed Packslip release:

dbc install github.com/eitsupi/tokoko-adbc-iceberg=0.1.2

Signed metadata supplies the driver identity and artifact selection. Direct installation does not create or modify a project dbc.toml or dbc.lock.

For reproducible project installation, declare the source in dbc.toml:

[drivers.iceberg]
version = "0.1.2"
source = {
    type = "packslip",
    project = "github.com/eitsupi/tokoko-adbc-iceberg",
}

Run dbc sync to resolve the release, record its artifacts in lockfile v2, and install the current target. Subsequent syncs can replay a recorded target without repeating release discovery.

Exact versions are a current prototype constraint. Version discovery is required before general availability; the resulting lock will still record an exact release.

Design decisions requiring review

These contracts affect future compatibility and are the main design review points.

Area Decision Rationale
Source identity Separate source identity, artifact location, and resolution evidence; retain canonical upstream locations. Mirrors should change retrieval without changing release identity.
Artifact model Share target, archive format, location, hash, size, and host requirements across sources. Keep package metadata outside the shared artifact model. Source resolution and package metadata can evolve independently.
Runtime identity Packslip uses the signed driver ID; project paths use the configured ID; direct local files use the filename. Packslip identity must come from authenticated metadata, not an inferred repository or archive name.
Lockfile meaning Record exact releases and artifacts with required archive hashes and optional sizes. Pin distribution inputs across platforms.
Partial coverage Permit locks containing only some targets. Avoid downloading every archive solely to populate a lock; a missing target means “not recorded.”
Replay and freshness Replay checks the recorded snapshot; online resolution checks current source trust. Reproducibility and current withdrawal/signer checks have different requirements.
Sync ordering Validate and atomically save the candidate lock before changing installations. A failed installation leaves an exact desired state for retry.
Installation transaction Verification, staging, publication, registration, receipts, and cleanup are per driver. Preserve the previous usable installation on validation/registration failure. This does not promise multi-driver or full cross-platform crash atomicity.

dbc metadata in Packslip

The signed release extension declares the driver ID:

{
  "predicate": {
    "extensions": {
      "dbc": { "schema_version": 1, "driver_id": "iceberg" }
    }
  }
}

Installable artifacts carry this marker:

{ "extensions": { "dbc": {} } }
  • Only marked artifacts enter target discovery, provenance matching, and selection.
  • Signed metadata authenticates target, archive format, digest, size, and artifact identity. Locations come from signed metadata or matching GitHub Release assets.
  • Locks can be built from metadata without downloading every archive. The authenticated archive is inspected at installation and must contain supported root-level MANIFEST package metadata.
  • The release extension requires version 1 and a valid driver ID. Unknown additive fields are ignored; malformed objects are rejected. Incompatible or security-critical changes require a new extension version.

Lockfile v2 and registry coverage

Every locked artifact requires an archive SHA-256 hash. Size is optional and checked when present. Installed-library digests are tracked separately.

Source Hash and size recorded in the lock
Registry Optional registry hash field. All-target hashes allow a complete lock from index metadata; otherwise the host download establishes a hash for a partial lock. Measured size stays in the receipt.
Packslip Hashes and sizes from signed metadata.
Path Measured archive hash and size. Measurement alone does not authenticate the publisher.

Registry-provided sizes are not read by this PR. The YAML decoder tolerates unknown fields, leaving size support to a later change. Publishing and backfilling registry hashes is separate from this client implementation.

Verification comparison

Defaults for new installation or repair from an archive:

Source Fresh installation Installation from lockfile v2 Effect of --no-verify
Central registry Columnar library signature; registry archive hash when available Locked archive hash, recorded size, Columnar library signature Skips library signature only
Packslip Sigstore-signed metadata, source trust checks, authenticated archive hash/size Locked archive hash and recorded size; no repeated online signature/freshness check Does not bypass Packslip verification
Local file / path Columnar library signature Project path: locked archive hash, recorded size, Columnar library signature Skips library signature only
  • Common checks: expected archive hashes and recorded sizes apply even with --no-verify. Columnar signatures use dbc's embedded public key; Packslip requires no additional Columnar signature. Direct local installation creates no lockfile; local replay uses a project path source.
  • Existing installations: a matching receipt, actual library hash, and runtime registration allow reuse without repeating signatures, including after an earlier --no-verify install. Receipts record integrity, not signature history; the flag is not persisted in the lock.
  • Replay trust: the lockfile is trusted input. Replay does not refresh withdrawal, release-list, or signer-continuity state, or seed/roll back the persistent Packslip TrustStore.

Compatibility and scope

Package metadata

All sources support the existing MANIFEST format. Direct local installation derives the driver ID from the filename: local-driver_linux_amd64_v1.2.3.tar.gz becomes local-driver on Linux amd64.

A future self-describing format should remove this dependency and separate dbc-owned identity/target metadata from ADBC Driver Manifest metadata. This PR reserves only dbc-package.toml; its schema and compatibility rules remain for follow-up design. Archives containing it, alone or alongside MANIFEST, are rejected without parsing or installing it as payload. Metadata discovery and dispatch provide the future extension point.

Manifest-only packages register externally managed libraries without bundling their bytes. They remain supported and have no bundled library signature to check. They should eventually be retired in favor of explicit external-library registration: archive hashes cannot pin those external bytes, and package repair, upgrade, or uninstall cannot manage them reliably. Retirement requires a replacement workflow and migration policy.

Lockfile migration

  • v1 migration retains and verifies the platform-specific installed-library checksum as a separate proof; it never becomes an archive hash.
  • Sync writes the validated v2 candidate before applying installations.
  • Treat migration as one-way: older dbc clients cannot safely preserve or replay the v2 source, evidence, and artifact model. See also fix: reject unsupported lockfile versions #500.

Suggested review order

  1. Source resolution and locks: identity/location separation, artifact selection, partial coverage, v1 migration proofs.
  2. Packslip trust: signed extensions, provenance matching, persistent trust state, online resolution versus replay.
  3. Archive processing and installation: metadata dispatch, reserved-name rejection, safe staging, verification before publication, rollback and cleanup.
  4. Receipts and repair: lock correspondence, actual library integrity, runtime registration, preservation of a working installation on failure.
  5. CLI, tests, and documentation: all source paths, credentials, verification flags, replay, repair, migration, transaction failures, and platform handling.

End-to-end validation

Using the public tokoko-adbc-iceberg v0.1.2 release:

  • Linux amd64: direct installation, project sync, lock replay, and repair after library modification passed without --no-verify.
  • All five release archives were checked against Packslip metadata.
  • The project lock recorded Linux amd64/arm64, macOS amd64/arm64, and Windows amd64 artifacts.
Actual dbc.lock generated during manual testing
# This file is automatically @generated by dbc. Not intended for manual editing
version = 2
revision = 0

[[drivers]]
name = 'iceberg'
version = '0.1.2'

[drivers.source]
type = 'packslip'
project = 'github.com/eitsupi/tokoko-adbc-iceberg'

[[drivers.evidence]]
kind = 'release-metadata'
hash = 'sha256:a93c8597ee50a4d9cf09d64444ddaeea87bec0b2610247fe298d05028f842258'

[drivers.evidence.location]
kind = 'url'
value = 'https://github.com/eitsupi/tokoko-adbc-iceberg/releases/download/v0.1.2/packslip.sigstore.json'

[[drivers.artifacts]]
format = 'tar.gz'
hash = 'sha256:edfe4690140cd13ff4ec583e943bfe74dff1a01a6e4a0f7765e9f36bcde097d5'
size = 10755280

[drivers.artifacts.target]
os = 'linux'
arch = 'amd64'
libc = 'gnu'

[drivers.artifacts.location]
kind = 'url'
value = 'https://github.com/eitsupi/tokoko-adbc-iceberg/releases/download/v0.1.2/iceberg_linux_amd64_0.1.2.tar.gz'

[[drivers.artifacts]]
format = 'tar.gz'
hash = 'sha256:d6744d24cee89fa9368c1854be7b46f4ebdf844c1b91881137cde712d399f902'
size = 11014639

[drivers.artifacts.target]
os = 'linux'
arch = 'arm64'
libc = 'gnu'

[drivers.artifacts.location]
kind = 'url'
value = 'https://github.com/eitsupi/tokoko-adbc-iceberg/releases/download/v0.1.2/iceberg_linux_arm64_0.1.2.tar.gz'

[[drivers.artifacts]]
format = 'tar.gz'
hash = 'sha256:c298f7dfa20a67810e10e7c49f45d91f13e3fffdaabe97d093f7e5a3d1019a1c'
size = 9917942

[drivers.artifacts.target]
os = 'macos'
arch = 'amd64'

[drivers.artifacts.location]
kind = 'url'
value = 'https://github.com/eitsupi/tokoko-adbc-iceberg/releases/download/v0.1.2/iceberg_macos_amd64_0.1.2.tar.gz'

[[drivers.artifacts]]
format = 'tar.gz'
hash = 'sha256:da62d34d215cc6e5c941c7579c3a9049546f407db1d43e9914dca0bf215b0d56'
size = 9397572

[drivers.artifacts.target]
os = 'macos'
arch = 'arm64'

[drivers.artifacts.location]
kind = 'url'
value = 'https://github.com/eitsupi/tokoko-adbc-iceberg/releases/download/v0.1.2/iceberg_macos_arm64_0.1.2.tar.gz'

[[drivers.artifacts]]
format = 'tar.gz'
hash = 'sha256:cd20ab94b24b99a205517694f09a804c3f5fa613e5d1add2df112ef6e6428fec'
size = 9295423

[drivers.artifacts.target]
os = 'windows'
arch = 'amd64'

[drivers.artifacts.location]
kind = 'url'
value = 'https://github.com/eitsupi/tokoko-adbc-iceberg/releases/download/v0.1.2/iceberg_windows_amd64_0.1.2.tar.gz'

Current limitations

  • Packslip: exact SemVer versions and GitHub Releases only.
  • dbc add: updates existing Packslip entries; new source declarations require manual TOML edits.
  • JavaScript/Wasm: Packslip replay requires an already-recorded target; no online resolution, refresh, or missing-target completion. Registry/path behavior remains available.
  • Archives: tar.gz and tgz. Non-empty Packslip host requirements are rejected.
  • Registry locks remain partial until all-platform hashes are available.

Future work

  • Package format: self-describing dbc-package.toml; identity/target, ADBC metadata separation and mapping, migration, compatibility, trust.
  • Registry: publish/backfill all-platform hashes.
  • Mirrors: URL replacement with canonical locations and no cross-host credential forwarding (discussion).
  • Discovery: omitted versions and version requirements via GitHub releases or signed release lists, resolved exactly before locking; additional hosts. Required before general availability.
  • Source authoring: create Packslip declarations through dbc add.
  • Lock commands: dbc lock without installation; dbc sync --locked rejecting resolution or lock changes.
  • External libraries: dedicated registration command/API and manifest-only migration/deprecation policy.
  • Publishing: official GitHub Action and reusable package/Packslip workflow.
  • JavaScript/Wasm: online Sigstore verification and persistent trust; evaluate Node and browser requirements separately.
  • Host requirements: explicit capability handling.
  • Public APIs: stabilize low-level package APIs or provide a smaller high-level API before committing to compatibility.
  • Rename the --no-verify option: Because it is unclear what to verify and what not to verify, something like --no-signature (rpm like option name) would be more appropriate.

@eitsupi

This comment was marked as resolved.

@eitsupi
eitsupi marked this pull request as draft September 26, 2026 00:59
@eitsupi
eitsupi marked this pull request as ready for review September 26, 2026 02:16
@eitsupi eitsupi changed the title feat: new lockfile format with GitHub release support feat: new lockfile format with GitHub release support via Packslip Sep 26, 2026
zeroshade pushed a commit that referenced this pull request Sep 26, 2026
Related to #497

## Summary

dbc 0.3.0 silently accepts lockfiles with unsupported versions,
including v2 files with source and artifact metadata.
During `dbc sync`, it can treat such entries as v1 registry locks and
overwrite the file as v1.

Validate the top-level version immediately after TOML decoding. Version
1 still loads; versions 2 and later, as well as a missing version, now
fail before lock entries are used.
A failed sync leaves the lockfile unchanged.

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. Tests/vet/race pass and extraction + atomic lock-write look solid, but there are regressions vs main (inline):

  • Blockers: re-download/re-verify on already-installed dbc install; registry credentials persisted into dbc.lock; sync fails on missing secondary driver roots; install lock requires every root writable.
  • Major: path source can't add a second target; v1 migration silently replaces pinned library; Ctrl+C can't stop stalled sync; undefined revision; Packslip identity policy too loose, continuity rules cause false failures, replay has no authenticity check.
  • Also: binary grows 16.5 MB → 35.8 MB (sigstore stack); docs lack packslip/path source fields, trust model/recovery, and the lock upgrade path; 8 new files have truncated Apache headers.

Given the size (136 files, +27k), consider splitting: atomicfile/fslock + install transactions → lockfile v2 (registry/path) → Packslip.

}
}

needsArchive := item.AlreadyInstalled == nil || !canReuseLockedEntry(*item)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already-installed direct installs always re-download: lock entry is nil, and hash-less registry receipts never match. install --no-verify X then install X now fails on missing signature (main: "already installed").

Comment thread cmd/dbc/sync_planning.go
return resolution.ResolvedRelease{}, fmt.Errorf("invalid registry package platform %q: %w", pkg.PlatformTuple, err)
}
release := resolution.ResolvedRelease{
DriverID: driver.Path,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registry userinfo/query (https://user:tok@…, ?token=) is persisted into dbc.lock source.url, receipts, and --json. Strip credentials from identity/locations; relative package URLs with userinfo now fail outright.

return nil, err
}
}
var ensurePackage func(context.Context, config.Config, string, config.ExpectedPackageMetadata, config.EnsurePackageCallbacks) (config.EnsurePackageResult, error)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync passes raw s.cfg; install filters via installConfigForEnsure. Missing secondary root (e.g. $CONDA_PREFIX/etc/adbc/drivers) now fails dbc sync.

Comment thread config/package_install.go
})
}
for _, root := range lockRoots {
if err := ctx.Err(); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locks every precedence root, so an unwritable secondary root (system conda env) aborts install/sync. Only the primary root is written; skip EACCES/EROFS on others.

Comment thread cmd/dbc/lockfile_v2.go
return fmt.Errorf("duplicate artifact target %q", artifactSelectorIdentity(artifact))
}
seenTargets[artifact.Target] = struct{}{}
if prior, exists := seenLocations[artifact.Location]; exists {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path sources stamp the same location on every target, so adding a second platform (different bytes) fails this shared-location check. Contradicts driver_list.md; exempt path locations.

Comment thread cmd/dbc/remove.go
if err := toml.NewDecoder(f).Decode(&m.list); err != nil {
return err
}
if err := m.list.validateSources(); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation blocks removing the malformed entry itself.

Comment thread config/package_archive.go
if err != nil {
return empty, nil, fmt.Errorf("error reading tar archive: %w", err)
}
if header.Typeflag == tar.TypeDir {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PAX global headers (git archive) are rejected; skip TypeXGlobalHeader.

Comment thread config/package_install.go
return expected, nil
}

func loadInstalledDriver(cfg Config, loc, runtimeID string) (*DriverInfo, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undecodable existing manifest now aborts install; main overwrote it.

return nil
}
var cleanupErr error
remove := func(directory string) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows, a loaded DLL survives RemoveAll while the receipt is deleted, so the generation is never reclaimed. Remove receipt last.

Comment thread cmd/dbc/sync_execution.go
item := &prepared.items[i]
ensured, err := executor.ensurePreparedPackage(ctx, item)
if err != nil {
var checksumErr syncChecksumError

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syncChecksumError is never constructed, so checksum_failed JSON is unreachable (behavior change). Also dead: writeLockFile, candidateLockSavedMsg, parsePlatformTuple, locked-mode branches.

@eitsupi
eitsupi marked this pull request as draft September 28, 2026 22:24
@eitsupi

eitsupi commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

Thank you for the detailed review! I will revise the PR to be split according to your suggestion.

@eitsupi eitsupi changed the title feat: new lockfile format with GitHub release support via Packslip feat: new lockfile format with GitHub release support via Packslip (PoC) Sep 29, 2026
@eitsupi eitsupi changed the title feat: new lockfile format with GitHub release support via Packslip (PoC) feat!: new lockfile format with GitHub release support via Packslip (PoC) Sep 29, 2026
amoeba pushed a commit that referenced this pull request Sep 30, 2026
Related to #497

## Summary

dbc 0.3.0 silently accepts lockfiles with unsupported versions,
including v2 files with source and artifact metadata.
During `dbc sync`, it can treat such entries as v1 registry locks and
overwrite the file as v1.

Validate the top-level version immediately after TOML decoding. Version
1 still loads; versions 2 and later, as well as a missing version, now
fail before lock entries are used.
A failed sync leaves the lockfile unchanged.
amoeba pushed a commit that referenced this pull request Sep 30, 2026
Related to #497

## Summary

dbc 0.3.0 silently accepts lockfiles with unsupported versions,
including v2 files with source and artifact metadata.
During `dbc sync`, it can treat such entries as v1 registry locks and
overwrite the file as v1.

Validate the top-level version immediately after TOML decoding. Version
1 still loads; versions 2 and later, as well as a missing version, now
fail before lock entries are used.
A failed sync leaves the lockfile unchanged.
amoeba pushed a commit that referenced this pull request Sep 30, 2026
Related to #497

## Summary

dbc 0.3.0 silently accepts lockfiles with unsupported versions,
including v2 files with source and artifact metadata.
During `dbc sync`, it can treat such entries as v1 registry locks and
overwrite the file as v1.

Validate the top-level version immediately after TOML decoding. Version
1 still loads; versions 2 and later, as well as a missing version, now
fail before lock entries are used.
A failed sync leaves the lockfile unchanged.
amoeba pushed a commit that referenced this pull request Sep 30, 2026
Related to #497

## Summary

dbc 0.3.0 silently accepts lockfiles with unsupported versions,
including v2 files with source and artifact metadata.
During `dbc sync`, it can treat such entries as v1 registry locks and
overwrite the file as v1.

Validate the top-level version immediately after TOML decoding. Version
1 still loads; versions 2 and later, as well as a missing version, now
fail before lock entries are used.
A failed sync leaves the lockfile unchanged.
zeroshade pushed a commit that referenced this pull request Oct 29, 2026
## Summary

This PR extracts the transactional package installation foundation from
#497 for dbc 0.4.0. Direct install, sync, and `Client.Install` prepare a
validated, dbc-owned driver payload before replacing the runtime
registration. The previous installation remains usable until commit.

It also removes **manifest-only dbc package installation**, an
undocumented feature with no known usage. Every installed package must
contain an actual `Files.driver` payload; `Driver.shared` is no longer a
fallback for a missing payload. This requirement applies even when
signature verification is disabled.

Ordinary ADBC runtime manifests that reference externally managed
libraries remain supported. Removing manifest-only **packages** does not
remove external runtime registration discovery or parsing.

## Transaction contract

```text
private staging
  -> archive validation and optional verification
  -> ownership receipt
  -> unique owned-payload generation publication
  -> runtime registration replacement [commit]
  -> conservative post-commit cleanup
```

- Pre-commit failures preserve the previous registration and payload.
Post-commit cleanup failures do not roll back a successful installation.
- Unix registrations use atomic file replacement. Windows restores
previous raw registry values after ordinary partial failure; rollback
failure preserves the candidate because registration state is uncertain.
- Driver-scoped locks serialize cooperating mutations. Install/update
writes only the primary root; lower-priority installations remain in
place.
- Cleanup retains filesystem identity, symlink/TOCTOU, cross-root
reference, and external-registration borrower checks. Receipts describe
owned payloads only and are deleted last.
- `InstallPackage(ctx, ...)` supports cancellation during lock waits and
safe pre-commit boundaries. Registration mutation completes once
started, including any rollback.

## Behavior changes in 0.4.0

| Case | Previous behavior | Behavior in this PR |
| --- | --- | --- |
| Package without `Files.driver` | Could install only a manifest
pointing to an external library; this was undocumented. | Rejected
before publication or registration changes. |
| Replacing an installed version | Some paths uninstalled the working
version before the replacement was ready. | Prepare and validate the
replacement first, then switch registration and clean up. |
| Receipt-backed dbc package uninstall | No transactional ownership
receipt. | Remove registration, then delete validated owned files
conservatively. |
| Normal pre-0.4 dbc package uninstall | Could recursively remove the
package directory. | Recognize `source = "dbc"` and a safe same-root
legacy layout; delete only the exact registered driver binary, then
remove its directory if empty. Metadata may remain. |
| External or ambiguous registration uninstall | External library bytes
could be deleted in some cases. | Remove registration and retain library
bytes. |
| `config.UninstallDriverShared` | Public API for shared-library
removal. | Removed; use `Config.UninstallDriver` or `Client.Uninstall`.
|

Legacy ownership is a compatibility assumption based on the old install
layout, not a provenance proof. Unsafe paths, uncertain filesystem
identity, conflicting references, or unknown/corrupt receipts prevent
payload deletion. No additional heuristics reconstruct legacy ownership.

## Compatibility and scope

Same-version direct install still exits before download or verification.
`Client.Install` does not gain mandatory signature or MANIFEST-version
checks. `InstallDriver` remains a deprecated, non-transactional API,
with the same owned-payload requirement.

Native locks coordinate processes; Wasm locks are runtime-local. Wasm
uninstall retains payloads because directory identity cannot be pinned
safely. Post-uninstall cleanup errors identify retained paths; recovery
of registration-less generations is deferred. Stable Windows registry
lock identity remains follow-up work. With `ADBC_DRIVER_PATH`, cleanup
scans other configured roots without taking their locks, so a manifest
created there concurrently could reference a just-removed library; dbc
never creates such cross-root references itself. Stale-generation
cleanup errors after a successful install or uninstall are currently
dropped; reporting them is follow-up work.

Owned payloads are stored in hidden `.dbc-package-g-*` directories next
to the driver manifest, created with the process umask applied. On Unix,
lock files are intentionally left in place after release.

Lockfile v2, Packslip, a new package format, external registration
commands, aliases, and replay/repair are outside this PR. This
foundation accepts prepared owned payloads so future package decoding
and reproducible-artifact locking can build on the same transaction
model.

## Validation

CI passes on Linux, macOS, Windows, and Wasm (Node and Deno). Windows
tests now use the shared registry and directory isolation from #508.
zeroshade pushed a commit that referenced this pull request Nov 18, 2026
Follow-up to #575 (`dbc lock`).

Lockfile v2 pins sources and archive hashes, but not the key signatures
are verified with. This PR adds that before v2 ships.

- **Lockfile:** each driver requires a `signer` table pinning the
OpenPGP primary key its packages must verify with. This records the
expected signer, not successful verification. A v2 lock without it is
invalid; v2 is unreleased, so there is no migration. v1 upgrades are
unchanged.

  ```toml
  [drivers.signer]
  type = 'openpgp'
  fingerprint = 'ab7766e9b341299ebc7f45dd82abd0a33a3c9e48'
  ```

- **Enforcement:** `dbc sync` and `dbc lock` verify reused
installations, new installations and hash-measuring downloads with the
pinned key. An untrusted pin, or a re-resolution that would change the
pin, fails before anything is downloaded, installed or written. There is
no fallback key. `--no-verify` skips that run's signature check without
changing or bypassing the pin.
- **API:** `dbc.SigningKey` exposes one key's fingerprint and
verification; `dbc.ColumnarSigningKey()` returns the built-in key.
`SignedByColumnar` and `VerifyPackageSignature` are unchanged.

Only Columnar's built-in key is trusted. Existing users see only the new
lock field; `dbc install`, `Client.Install` and install receipts are
unchanged.

### Other sources and verification methods

The table identifies who must authenticate a release; `type` specifies
how. It belongs to the driver release rather than its source: one
registry can serve multiple publishers.

- **Other OpenPGP keys**, including custom-registry keys, would use
`openpgp` with another fingerprint, without format changes.
- **Other authentication methods**, such as the Packslip source explored
in #497, would need no OpenPGP signature. Another `type` would pin the
verified identity (project, issuer and workflow identity for Sigstore
keyless signing), so replaying the lock elsewhere does not trust a new
identity on first use. Verified metadata hashes stay in `evidence`.

This PR defines only `openpgp`. An unknown type makes the lock invalid
rather than skipping verification, so new types are additive.
eitsupi added a commit that referenced this pull request Nov 23, 2026
Stacked on #598. Since #584, a driver comes from the highest-priority
registry that has a matching version, so which registry serves a driver
depends on the order of the registries and on what each one publishes at
the time.
This lets a driver list name the one registry a driver comes from, like
a dependency's registry in Cargo or `[tool.uv.sources]` in uv.

```toml
[[registries]]
url = "https://drivers.acme.example.com"
name = "acme"

[drivers.snowflake]
source = { type = "registry", name = "acme" }

[drivers.flightsql]
source = { type = "registry", url = "https://dbc-cdn.columnar.tech" }
```

- **Selection:** `name` refers to a `[[registries]]` entry in the same
file (a project cannot refer to a name from the user config); `url`
selects a configured registry by the identity `dbc.lock` records (no
user information, query or fragment). The source must bind to exactly
one configured registry, since registries that differ only in query
cannot be told apart in the lockfile. `type` is required so other source
types can be added later (#497).
- **Built-in registries:** `https://dbc-cdn.columnar.tech` and
`https://dbc-cdn-private.columnar.tech` have no configured name, so a
source selects them by `url`, as `flightsql` does above. Declaring one
in `[[registries]]` with a `name` also works.
- **No fallback:** the driver is resolved from that registry's index
alone. A missing driver, a missing version or a failed fetch is an
error, and the merged index is not fetched when every driver has a
source.
- **Lockfile:** nothing new is recorded; the lock keeps the registry
identity. If the source selects another registry than the lock entry,
`dbc sync` stops and `dbc lock` resolves the driver again (the pinned
signer is still compared as before). Naming the same registry another
way keeps the entry.
- **CLI:** `dbc add --registry <name|url>` records the source, and `dbc
add` without it keeps a driver's existing source. `dbc install
--registry <name|url>` installs from one registry of the user config,
and installs again when the same version is already installed, since an
installed driver does not record its registry. `GetDriverList` honors
the source too. `Client.Install` and the bindings have no registry
option yet.
- **Names:** a registry name must be unique within its file, and a
configured name now takes precedence over the name a registry's index
gives itself, so the name used in `source` is also the one `dbc search`
shows.
@eitsupi

eitsupi commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

For now, with the HTTP support introduced in #621 enabling off-registry driver installation, this PR has served its purpose and will be closed.
While Packslip support is worth adding in the future, it will likely take some time, so it's best to remove it from version 0.4.0 (lockfile v2 is still structured to support future new source types like Packslip).

@eitsupi eitsupi closed this Dec 1, 2026
@eitsupi
eitsupi deleted the feat/lockfile-v2-sources branch December 1, 2026 04:39
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