Skip to content

refactor(api)!: mark growing public types #[non_exhaustive] - #317

Merged
Teakowa merged 2 commits into
mainfrom
feat/non-exhaustive-312
Sep 27, 2026
Merged

Teakowa merged 2 commits into
mainfrom
feat/non-exhaustive-312

Conversation

@e54-bot

@e54-bot e54-bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Marks the 34 types in Mark growing public structs, error enums, and settings domains #[non_exhaustive] before 1.0 #312's "mark" list #[non_exhaustive]: 13 error enums, CatalogError, EmitOptions/ConvertOptions, 8 output/report/record structs, 8 identity/metadata structs, and SettingScope/SettingValueDomain. Types on the "keep" list are unchanged.
  • Adds constructors for the marked records that WrightKit consumers build with struct literals:
    • MappedText::new(text, map): opy-rs crates/opy-rs/src/compiler/mod.rs and Wright crates/wright-driver/tests/source_provider.rs build it. Mark growing public structs, error enums, and settings domains #[non_exhaustive] before 1.0 #312 said no consumer did; these call sites turned up when I built the consumers against this branch.
    • gameplay::SourceReference::new(source, locator) + with_note(..), and gameplay::GameplayDatasetIdentity::new(..): the out-of-crate gameplay integration tests build them to call GameplayCatalog::new. with_note exists because tests/gameplay_data.rs sets a note.
  • In-workspace migrations:
    • workshop-rs-cli: builds options as Default followed by field assignment, and adds a wildcard arm to the census SettingValueDomain match (unreachable!, matching the existing census capability match).
    • Integration tests: use the new constructors. No assertions changed.
    • tests/public_api.rs: adds an out-of-crate test for MappedText::new.
  • docs/compatibility-facades.md: adds a short "Growth without breaking changes" section. It says which public types are extensible, how to build them, and which stay exhaustive per Audit externally extensible public enums and identities for 1.x semver #256.

Why

After 1.0, adding a field or variant to an exhaustive public type needs a major release. The types marked here are expected to grow as new failure modes, options, report fields, and lobby settings appear.

Verification

Run locally on this branch after rebasing onto 359df0c (#316):

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo run -p workshop-rs --bin workshop-catalog-gen -- check, git diff --check: all pass.
  • cargo test --workspace --all-targets: 373 passed, 0 failed, 3 ignored. That is the same test list as main plus the new public_api::mapped_text_is_constructible_outside_the_crate.
  • cargo semver-checks -p workshop-rs --baseline-rev origin/main (0.50.0): exactly 2 failing lints, enum_marked_non_exhaustive (15 enums) and struct_marked_non_exhaustive (19 structs). Together that is the 34 listed types; some appear twice in the output because of re-export paths. Nothing else fails. The new constructors are additive.
  • Downstream (checked before the rebase, against base 311ff50/v0.9.1; refactor!: remove catalog-generated typed constructors from the public API #316 carries its own downstream migrations), using [patch.crates-io] workshop-rs = { path = ... } on each consumer's origin/main. These are throwaway local edits; the consumers own the real migrations under Migrate to the workshop-rs 1.0 public API opy-rs#359 and the Wright 1.0 candidate verification:
    • opy-rs f151daa (v0.1.60): needed a _ => None arm in workshop_error_span plus MappedText::new(..) instead of the struct literal (both in crates/opy-rs/src/compiler/mod.rs). Then cargo clippy --workspace --all-targets --all-features -D warnings is clean and cargo test --workspace --all-features passes 539/539.
    • Wright 7d111b5 (v0.2.40): needed a wildcard arm in the WorkshopError match in crates/wright-driver/src/session.rs plus MappedText::new(..) in crates/wright-driver/tests/source_provider.rs. Then clippy is clean and cargo test --workspace --all-features passes 258/258.
    • deltin-rs pins workshop-rs = "=0.3.7" and is not affected.

Closes #312

View in Indent
Tag @indent to continue the conversation here.

Teakowa and others added 2 commits September 27, 2026 19:00
Mark the error enums, error records, options, outputs, reports, identity
and metadata records, and settings domains listed in #312 as
release. Closed program-model enums and consumer-constructed values stay
exhaustive, as decided in #256.

Add constructors for the marked records that WrightKit consumers build:
MappedText::new (opy-rs, Wright tests), SourceReference::new/with_note
and GameplayDatasetIdentity::new (gameplay integration tests).

Closes #312

Co-authored-by: Indent <noreply@indent.com>
Co-authored-by: Indent <noreply@indent.com>
@e54-bot
e54-bot force-pushed the feat/non-exhaustive-312 branch from fde02d5 to 9dd704b Compare September 27, 2026 11:03
@Teakowa
Teakowa merged commit 35f1528 into main Sep 27, 2026
10 checks passed
@Teakowa
Teakowa deleted the feat/non-exhaustive-312 branch September 27, 2026 11:07
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.

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

2 participants