Skip to content

feat(mix_generator): generate spec stylers with parity coverage#923

Merged
tilucasoli merged 39 commits into
mainfrom
feat/styler-generator
Jun 5, 2026
Merged

feat(mix_generator): generate spec stylers with parity coverage#923
tilucasoli merged 39 commits into
mainfrom
feat/styler-generator

Conversation

@leoafarias
Copy link
Copy Markdown
Collaborator

Related issue

None.

Description

Adds the opt-in SpecStylerGenerator pipeline and cuts Mix specs over to generated .styler.g.dart stylers while preserving existing public styler behavior.

Changes

  • Adds MixableSpec/MixableField styler metadata, generator builders, curated styler surface metadata, forwarder derivation, and widget-call helpers.
  • Updates generated spec styler files/exports and removes old handwritten style files where generated output replaces them.
  • Expands generator and Mix package tests covering widget generation, styler parity, annotations, and generated spec behavior.

Review Checklist

  • Testing: Validated with focused generator tests, melos run gen:build, melos run analyze, and melos run ci --no-select.
  • Breaking Changes: No intentional public API break; generated files replace handwritten styler sources with parity coverage.
  • Documentation Updates: Generator and annotation README/build configuration updated.
  • Website Updates: No website updates included.

Additional Information (optional)

The final cleanup keeps generated spec outputs byte-identical after regeneration.

leoafarias added 30 commits May 26, 2026 12:23
…ylerGenerator

Extract deriveStylerName / extractSpecFields into shared field_model helpers (SpecGenerator and SpecStylerClassBuilder both call them now).

SpecStylerClassBuilder: drop unused BuildStep field, emit @OverRide on each generated Prop<T>? field, collapse mixin/factory branch logic via _ownerMixinsForField, fail loudly via InvalidGenerationSource when a required mixin cannot be resolved from the spec library.

MixinMethodCollector: name the public/concrete predicate.

Add fail-loudly test + shared SpacingStyleMixin stub.

Add logging dev dep used by SEVERE-log assertions.

Drop unused painting.dart import from fixture; regenerate fixture .g.dart.
Switch auto_apply from 'dependents' to 'none'. Consumers must enable explicitly in their build.yaml. Documents the SharedPartBuilder import limitation in a yaml comment.
Switch from SharedPartBuilder to LibraryBuilder so the generated styler file owns its own imports. Single 'package:mix/mix.dart' import covers runtime symbols, style mixins, mix types, and exported spec types the generator references. Resolves audit finding F1 from .context/spec-styler-audit.md.
Standalone SpecStylerGenerator outputs now import package:mix/mix.dart, Flutter widget/foundation symbols, and the source spec file. This keeps generated styler libraries self-contained for test fixtures and specs that are not visible through the package barrel.
Generated styler now lives in box_spec_for_spike.styler.g.dart with its own imports. box_spec_for_spike.g.dart shrinks to just the SpecGenerator output. Equivalence test imports the sibling library directly; surface unchanged.
@docs-page
Copy link
Copy Markdown

docs-page Bot commented May 28, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/btwld/mix~923

Documentation is deployed and generated using docs.page.

@leoafarias leoafarias changed the title Generate spec stylers with parity coverage feat(mix_generator): generate spec stylers with parity coverage May 29, 2026
@tilucasoli tilucasoli merged commit 6478afb into main Jun 5, 2026
4 checks passed
@tilucasoli tilucasoli deleted the feat/styler-generator branch June 5, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants