Skip to content

Seal FtlOutputOptions against additive breakage#26

Merged
akesson merged 1 commit into
mainfrom
henrik/seal-ftl-output-options
Jun 3, 2026
Merged

Seal FtlOutputOptions against additive breakage#26
akesson merged 1 commit into
mainfrom
henrik/seal-ftl-output-options

Conversation

@akesson

@akesson akesson commented Jun 3, 2026

Copy link
Copy Markdown
Member

Second of the batched 0.7 breaking changes on the road to 1.0 (continues road-to-1.0 item #1, version already at 0.7.0 from #25).

What & why

FtlOutputOptions and both its variants are now #[non_exhaustive], so downstream build scripts must use the single_file(), single_compressed_file() or multi_file() constructors rather than the SingleFile { .. } / MultiFile { .. } struct-literal syntax. This makes new output modes (variants) and new fields on existing variants non-breaking minor releases.

Unlike BuildOptions (a struct, sealed with pub(crate) fields in #25), enum variant fields can't carry their own visibility — #[non_exhaustive] is the correct mechanism for an enum. In-crate construction (the three constructors, Default, and all tests) is unaffected.

Changes

  • src/build/options/ftl_output_options.rs: #[non_exhaustive] on the enum and on MultiFile / SingleFile; documented the three constructors (the variant-field docs are no longer reachable externally).
  • playground/example1/build.rs: migrated the one MultiFile { .. } literal to FtlOutputOptions::multi_file("gen/multi/") — this is the external consumer the sealing breaks, and the proof the new API covers the use case.
  • CHANGELOG.md: added to the 0.7.0 entry.

Verification (local, all green)

  • cargo test --features build,langneg — 100 unit + 1 playground integration test
  • cargo fmt --all --check, cargo clippy --all-targets --features build,langneg -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --features build,langneg
  • cargo build --benches --features bench-internals
  • playground rebuild: generated output is byte-identical (codegen path untouched)

Remaining 0.7 work

  1. Typed runtime errors (replace Result<_, String> in L10nBundle / L10nLanguageVec / L10nLanguage) — the largest, next as its own PR.
  2. Remove public-API panics (L10nLanguageVec::get, generated load()/load_all()).

🤖 Generated with Claude Code

Mark FtlOutputOptions and both its variants `#[non_exhaustive]` so the
enum can only be built through the `single_file`, `single_compressed_file`
and `multi_file` constructors, never the `SingleFile { .. }` / `MultiFile
{ .. }` struct-literal syntax. New output modes (variants) and new fields
on existing variants are then non-breaking minor releases.

Enum variant fields can't carry their own visibility, so `#[non_exhaustive]`
(not `pub(crate)`) is the mechanism here; in-crate construction — the
constructors, `Default`, and the tests — is unaffected.

Migrate the playground build script off the `MultiFile { .. }` literal to
`FtlOutputOptions::multi_file(..)`, and document the constructors (the
variant-field docs are no longer reachable from outside the crate).

Second of the batched 0.7 breaking changes; version already at 0.7.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@akesson akesson merged commit 0c474d3 into main Jun 3, 2026
5 checks passed
@akesson akesson deleted the henrik/seal-ftl-output-options branch June 3, 2026 04:42
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.

1 participant