Skip to content

feat: expose resolve warnings in C and Rust - #633

Merged
eitsupi merged 4 commits into
feat/version-first-resolutionfrom
feat/resolve-warning-capi
Dec 2, 2026
Merged

eitsupi merged 4 commits into
feat/version-first-resolutionfrom
feat/resolve-warning-capi

Conversation

@eitsupi

@eitsupi eitsupi commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #631, which added resolve warnings to Go and npm-wasm.

  • C API. When dbc_resolve succeeds after skipping an unavailable same-signer index, callers can read the warning with dbc_list_info(result, DBC_FIELD_WARNING).
  • Rust. ResolveResult::warning exposes the same field as an Option<String>. The existing #[non_exhaustive] annotation permits this addition.

@eitsupi
eitsupi added this pull request to stack #632 December 1, 2026 01:53
@eitsupi eitsupi changed the title feat: report skipped registries in the C API resolve result feat: expose registry warnings from dbc_resolve Dec 1, 2026
@eitsupi
eitsupi force-pushed the feat/resolve-warning-capi branch from 7be66a2 to 5392bbf Compare December 1, 2026 01:57
@eitsupi eitsupi changed the title feat: expose registry warnings from dbc_resolve feat: expose resolve warnings in C and Rust Dec 1, 2026
@eitsupi
eitsupi requested review from amoeba and zeroshade December 1, 2026 02:27
@eitsupi
eitsupi marked this pull request as ready for review December 1, 2026 02:27

@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.

LGTM. Reuses the existing DBC_FIELD_WARNING plumbing, RegistryIndexError.Error() already redacts registry credentials, and ResolveResult is #[non_exhaustive] so the new field is non-breaking. Two non-blocking nits:

  1. The new Rust test only checks that a warning exists. resolve_warns_about_a_skipped_registry_with_the_same_signer asserts warning.is_some(). Asserting that it names the unavailable registry's host would catch a regression that reports the wrong failure or a bare string.

  2. DBC_FIELD_WARNING now has two meanings. For dbc_search it means a partial result; for dbc_resolve it means skipped same-signer registries. The per-function table in capi/exports.go covers this, but the comment on #define DBC_FIELD_WARNING itself doesn't mention resolve.

@eitsupi

eitsupi commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Both done: the Rust test now checks that the warning names the unavailable registry (by port), and the DBC_FIELD_WARNING define documents both meanings.

@zeroshade

Copy link
Copy Markdown
Member

Thanks, both nits are addressed. The Rust test now checks that the warning names the unavailable registry's port and not the available one. The DBC_FIELD_WARNING define documents both meanings (partial dbc_search result, skipped same-signer registries in dbc_resolve). The bundled Rust tests pass locally, and the regenerated bindings match bindings.rs. Still LGTM.

@eitsupi
eitsupi merged commit dbccbe1 into main Dec 2, 2026
30 checks passed
@eitsupi
eitsupi deleted the feat/resolve-warning-capi branch December 2, 2026 23:22
eitsupi added a commit that referenced this pull request Dec 2, 2026
dbc used registry priority for overrides (#360), and #584 kept that
order when choosing the first registry with a matching version. This
gave order precedence over version, much as uv's default `first-index`
does to limit dependency confusion. The review of per-registry signing
keys (#595) showed that registry order could also determine the signer,
so #601 made cross-signer name collisions an error during implicit
resolution. Within that signer boundary, dbc now picks the highest
eligible version across registries, as pip does across indexes, so
drivers keep getting updates after moving to another registry.

- **Selection.** A candidate must satisfy the version requirements and
have builds for every required target in one record. Registry order
breaks ties at the highest SemVer precedence. In the winning registry, a
second eligible record of the same precedence or any duplicate of the
winning full version is an error. Exact requests include build metadata
and reject duplicate exact records even when none covers all required
targets. Errors in a selected artifact stop resolution.
- **CLI.** New resolutions can select a newer version from a
lower-priority registry. To take a driver from a specific registry, set
its `source`. Compatible lock entries still replay from their recorded
source. Successful CLI selections warn on stderr when a same-signer
index was skipped. Registry version constraints now reject build
metadata.
- **v1 lock files.** If the recorded version is no longer listed,
migration stops with or without `platforms`. A recorded version that
lacks a build for a declared platform is still resolved again.
- **Go API.** `Client.FetchIndex`, `Client.FetchRegistryIndex`, and
`SelectRegistry` replace `SigningOperation.ResolvePackage`. Requests
take a constraint or an exact version. The project planner decides
whether to keep a locked version. `Index` aliases an internal type so
public callers get complete snapshots from the client and cannot pass
filtered search results; tests outside the module can serve an index
through `NewClient` with `WithRegistries` and `WithHTTPClient`.
- **Bindings.** `Resolve` reports the highest eligible stable version as
`latest` and lists versions for the requested platform across reachable
same-signer registries, including prereleases. Go and npm-wasm expose
skipped indexes in `warning`. C and Rust warning support follows in
#633.

`Client.FetchRegistryIndex` requires exactly one configured endpoint
match before fetching. This prevents it from picking a signing policy by
list order when `WithRegistries` lists the same endpoint under different
policies.

The released `Driver` methods remain single-driver lookups. #634 aligns
`GetPackage` with exact version matching and deprecates
`GetWithConstraint`.

This branch was previously deployed

1 inactive deployment
snapshot — 95b87e69 Deployed Dec 1, 2026 by eitsupi via snapshot #1436
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