Repository navigation
Description
Parent EPIC: #1669 (Overhaul: Packages), Pre-publish API checklist.
Goal
Every public error enum with real variants in a workspace crate that will be published on crates.io is marked #[non_exhaustive], so that adding a variant later is not a breaking change. The audit also records derive and placeholder decisions.
Background
ADR 20261005145329 (return Result only for concretely fallible public APIs, from #2435) requires existing public error enums to be #[non_exhaustive] before their first publish. Enums with real variants gain variants as features grow, and without the attribute each new variant breaks downstream exhaustive matches. EPIC #1669 records this as its Pre-publish API checklist, and every workspace package is expected on crates.io within weeks.
Inventory at develop on 2026-10-06, to be confirmed:
- No item in
packages/,console/, orsrc/uses#[non_exhaustive]. - 61 public enums named
*Error*(excluding tests and benches), across the root crate (11),tracker-core(10),http-protocol(7),console/tracker-client(6),udp-server(4),udp-core(3), and twelve more packages. Some may not be public API; other error types may lackErrorin their name. torrust-tracker-configuration'sErrorhas a never-constructedInfalliblevariant ("The error for errors that can never happen."), which thehandle-errors-in-coderule "Never useInfallibleor an empty error enum as a placeholder" asks to evaluate.
Scope
In scope:
- Inventory public error enums per crate (public reachability and
std::error::Errorimplementations, not names alone). - Add
#[non_exhaustive]to each one with real variants, and fix the downstream exhaustive matches that the change breaks in other workspace crates. - Record per-enum derive decisions (keep only derives every future variant can keep).
- Evaluate placeholder variants such as
configuration::Error::Infallible; removing a never-constructed placeholder variant is in scope, with maintainer approval. - Mark the checklist done in EPIC Overhaul: Packages #1669.
Out of scope: #[non_exhaustive] on structs, non-error enums, or variants; changing error semantics or variants (except an approved placeholder removal); publishing and editing Cargo.toml versions.
Plan
- Inventory document, reviewed by the maintainer.
- Decide whether and how to guard the property (doctest, lint, or checklist only).
- Apply the attribute crate by crate, one commit per crate, in dependency order (a crate before its dependents). Per-crate completion is recorded in the step 1 inventory.
- Resolve placeholder and derive findings with maintainer approval.
- Close the checklist in EPIC Overhaul: Packages #1669.
Note: crates already on crates.io (the root torrust-tracker, torrust-tracker-configuration, torrust-tracker-primitives, torrust-tracker-test-helpers) take a breaking change. This issue edits no versions: the inventory records the required semver-major next publish, and EPIC #1669's Pre-publish API checklist item 4 makes the publish apply it (the tracker application release for the root crate, the per-package publish for the others).
Specification: docs/issues/open/2454-1669-mark-public-error-enums-non-exhaustive/ISSUE.md (spec-only PR #2456).
Activity
docs(issues): [torrust#2454] add issue specification for torrust#2454
docs(issues): [torrust#2454] make the manual verification scenario ma…
docs(issues): [torrust#2454] require toolchain-qualified verification…
docs(issues): [torrust#2454] scope the Infallible placeholder variant…
docs(issues): [torrust#2454] define crate order and the per-crate com…
docs(issues): [torrust#2454] require the test loop if T2 picks a doct…
docs(issues): [torrust#2454] assign semver bump handling to the publi…
docs(issues): [torrust#2454] add the EPIC torrust#1669 Details row for …
docs(issues): [torrust#2454] log the PR torrust#2456 review round
docs(issues): [torrust#2454] add issue specification for torrust#2454
docs(issues): [torrust#2454] make the manual verification scenario ma…
docs(issues): [torrust#2454] require toolchain-qualified verification…
53 remaining items
feat(client-lib)!: [#2454] mark public error enums non_exhaustive
feat(udp-server)!: [#2454] mark public error enums non_exhaustive
feat(axum-rest-api-server)!: [#2454] mark public error enums non_exha…
feat(torrust-tracker)!: [#2454] mark public error enums non_exhaustive
feat(tracker-client)!: [#2454] mark public error enums non_exhaustive
refactor(configuration)!: [#2454] remove the never-constructed Infall…
docs(issues): [#2454] link the error enum inventory from the EPIC #1669…
docs(issues): [#2454] record the verification evidence and the pre-PR…
chore(issues): archive closed issue #2454 spec to docs/issues/closed
Merge #2571: chore(issues): archive closed issue #2454 spec to docs/i…
docs(issues): [#1349] re-measure the http-core baseline before slice S2
test(http-core): [#1349] pin the failure reason of each tracker core …
Merge #2575: test(http-core): [#1349] pin the announce service and er…
Merge torrust#2568: feat(workspace)!: [torrust#2454] mark public erro…
Merge #2888: refactor(primitives)!: [#2876] replace peer::Id::new wit…