Skip to content

Replace the Fractal transformers with laravel-data wire objects - #2521

Open
lancepioch wants to merge 3 commits into
api/contract-freeze-snapshotsfrom
api/laravel-data-migration
Open

Replace the Fractal transformers with laravel-data wire objects#2521
lancepioch wants to merge 3 commits into
api/contract-freeze-snapshotsfrom
api/laravel-data-migration

Conversation

@lancepioch

@lancepioch lancepioch commented Aug 18, 2026

Copy link
Copy Markdown
Member

Second layer of the API freeze stack, on top of #2520. This replaces the League Fractal transformer pipeline with laravel-data backed wire objects behind an envelope layer we own. app/Data/Api holds the four core pieces: ApiResource is the laravel-data base class, Envelope renders the panel's {object, attributes} format with includes nested under relationships, IncludeContext carries the request and include paths along with the ported authorize checks, and PanelResponse is a drop-in for the injected Fractal wrapper that reproduces League's include parsing, recursion trimming, pagination block with its empty links object, and Fractalistic's addMeta union semantics. Every application and client transformer now has a corresponding Data class and every controller call site runs through the new layer, while the old transformers and Fractal extensions stay in place untouched so the next layer can delete them in one sweep.

The proof is the test fixture suite from the layer below: all 75 snapshots pass with zero changes, and the pre-existing application and client Integration suites stay green. The transformer quirks are preserved exactly, including the egg variable resource key mismatch, the plural databases include key, and the deprecated duplicate payload fields. One deliberate behavior change: the egg config and script includes and the server transfer include were declared but never implemented, so requesting them used to 500; they are now silently ignored like any other unknown include.

@lancepioch
lancepioch marked this pull request as ready for review August 18, 2026 05:39
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 97c50f18-5341-48e0-8f11-97961f6b883d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lancepioch lancepioch mentioned this pull request Aug 18, 2026
@lancepioch
lancepioch force-pushed the api/laravel-data-migration branch 2 times, most recently from 954f1ae to 14d1ece Compare August 18, 2026 12:51
Adds an owned envelope layer under app/Data/Api: ApiResource is the laravel-data
base for the wire objects, Envelope renders the panel's {object, attributes}
format with includes nested under relationships, IncludeContext carries the
request and include paths with the ported authorize checks, and PanelResponse is
the drop-in for the injected Fractal wrapper with League's include parsing,
pagination, and addMeta semantics reproduced exactly. Every application and
client transformer now has a Data class, and every controller call site runs
through the new layer, verified by the contract freeze suite with zero snapshot
changes plus the pre-existing Integration suites.

The old transformers, the Fractal extension classes, and the deprecated egg
config and script and server transfer include declarations are intentionally
still present; teardown happens in the next layer. Requesting one of those three
includes used to 500 because they were declared but never implemented, and it is
now silently ignored like any other unknown include.
The concrete Data classes are final now, which makes their new static calls in
fromModel provably safe, PluginData documents its panels element type, and the
paginated branch of PanelResponse hands Envelope::collection the paginator's
items directly since the paginator contract itself is not iterable.
Sealing the Data classes activated self_static_accessor and the brace placement
rules, so new static became new self and the formatting nits are settled.
@lancepioch
lancepioch force-pushed the api/laravel-data-migration branch from c677c74 to f844c01 Compare August 18, 2026 13:33
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