Awesome Reviewers

Reviewer · API

Semver-stable public APIs

When designing or changing public API surfaces, optimize for long-term semver stability rather than short-term convenience: 1. Never hide public items (e.g. via `#[doc(hidden)]` renaming) just to dodge semver-checking tools. If an item is public, keep it a normal public item so tooling like cargo-semver-checks can correctly flag breaking changes; don't...

Instruction

When designing or changing public API surfaces, optimize for long-term semver stability rather than short-term convenience:

  1. Never hide public items (e.g. via #[doc(hidden)] renaming) just to dodge semver-checking tools. If an item is public, keep it a normal public item so tooling like cargo-semver-checks can correctly flag breaking changes; don’t manufacture false negatives.

  2. Avoid directly exposing third-party crate types (e.g. time::OffsetDateTime, jiff::Timestamp) in your own public API. Doing so couples your API’s stability to that dependency’s versioning — a major bump (or even a minor behavior change) upstream forces an unwanted breaking change downstream. Prefer wrapping such values in your own opaque type (e.g. a newtype around an integer timestamp) so the underlying implementation can evolve independently.

  3. Don’t thread ad-hoc boolean flags (or other loosely-typed parameters) through many layers of function signatures to convey a single piece of configuration. This bloats call sites, obscures intent, and makes future extension painful. Instead, bundle related options into a cohesive options/config struct (e.g. add the flag to an existing ResolveOpts-style struct) so new options can be added without rippling signature changes across the call graph.

  4. When introducing new enums/structs that are likely to grow new variants or fields, consider whether #[non_exhaustive] is appropriate to avoid forcing a major version bump later — but weigh this against the cost of making it harder for maintainers to find all call sites that need updating when a variant is added.

Example of preferring an opaque wrapper over a third-party type:

// Avoid tying your public API directly to an upstream type:
pub enum CacheControl {
    Expires { expiration: jiff::Timestamp },
}

// Prefer an opaque wrapper that insulates callers from upstream churn:
pub struct ExpirationTimestamp(i64);

pub enum CacheControl {
    Expires { expiration: ExpirationTimestamp },
}

Applying these practices keeps the public API surface predictable, makes breaking changes visible and intentional, and reduces churn for downstream consumers.