Skip to content

Mark growing public structs, error enums, and settings domains #[non_exhaustive] before 1.0 #312

Description

@e54-bot

Parent: #252

Readiness: ready-for-implementation

Problem

After 1.0, a new field on an exhaustive struct with all-public fields, or a new variant on an exhaustive enum, is a major change. Several public types are expected to grow:

  • error enums, as new failure modes appear;
  • options, output, report, and identity records;
  • settings domains that follow Overwatch's lobby settings. SettingScope has already grown once, when Extensions was added.

ADR-0013 applied #[non_exhaustive] to Rule / Condition, and #256 applied it to PlayerEventKind / ModifyOp. The rest of the surface has not been audited for field or variant growth. Without this change, routine additions in 1.x would need major releases.

Scope

The classification below is taken from the v0.9.1 public surface. Mark these types #[non_exhaustive]:

  • Error enums: WorkshopError, SourceMappingError, actions::ElementCountError, actions::ActionLayoutError, settings::SettingOperationError, settings::NumericBoundsError, source::SourceEditError, gameplay::GameplayDataError, gameplay::AbilityLookupError, gameplay::query::GameplayQueryError, gameplay::query::AbilityNameResolutionError, gameplay::query::CooldownError, gameplay::query::CooldownPercentageError
  • Error struct: CatalogError
  • Options: emitter::EmitOptions, convert::ConvertOptions. Both already implement Default, which stays the way to construct them.
  • Outputs, reports, and records: emitter::EmitOutput, convert::Conversion, MappedText, actions::ElementCountReport, actions::ElementCountNode, roundtrip::RoundTripRecord, rules::SemanticIssue, detect::Detection
  • Identity and metadata: catalog::CatalogIdentity, catalog::TargetMeta, catalog::Provenance, catalog::LocaleCoverage, catalog::ParamCoercions, gameplay::GameplayDatasetIdentity, gameplay::SourceReference, settings::SettingSource
  • Settings domains: settings::SettingScope, settings::SettingValueDomain

Keep these exhaustive. They are closed by definition, or they are values that consumers construct:

  • source::Span, source::Position, Variable, Subroutine, gameplay::Quantity, gameplay::Fact, gameplay::query::AbilityMatch, settings::EffectiveNumber, settings::SettingOccurrence, settings::SettingPresentation, settings::Settings, settings::SettingsListElement, actions::ActionLayout
  • Action, Value, Event, EventTeam, EventTarget, catalog::Kind, and the remaining settings, gameplay, and rules classification enums, as decided in Audit externally extensible public enums and identities for 1.x semver #256. New Workshop content arrives through catalog ids and Call.

Non-goals

Constraints

  • If a WrightKit consumer builds one of the marked types with a struct literal, provide a constructor in the same PR. None were found on main at v0.9.1.
  • Pre-1.0 breaking change: the PR title uses a ! conventional-commit marker.

Acceptance criteria

  • Every type in the "mark" list is #[non_exhaustive], and every type in the "keep" list is unchanged.
  • cargo semver-checks reports exactly the listed types as newly non-exhaustive, and nothing else.
  • Out-of-crate code in this workspace (integration tests, workshop-rs-cli) compiles, with wildcard arms or .. patterns added where needed. Existing tests pass without weakened assertions.
  • The PR confirms that opy-rs and Wright compile against the change once their known exhaustive matches get a wildcard arm (see below).

Dependencies / ownership

  • Owner: workshop-rs.
  • Known downstream migrations, which the consumers own when they adopt the release:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions