Skip to content

Remove Fractal - #2523

Open
lancepioch wants to merge 2 commits into
mainfrom
api/fractal-teardown
Open

Remove Fractal#2523
lancepioch wants to merge 2 commits into
mainfrom
api/fractal-teardown

Conversation

@lancepioch

@lancepioch lancepioch commented Aug 18, 2026

Copy link
Copy Markdown
Member

Final step of the API contract freeze stack (#2520#2521 → this). Both predecessors are merged: the wire format is pinned by the fixture suite and every endpoint renders through the laravel-data layer, so nothing uses Fractal anymore. This PR deletes it. Net −2,424 lines, and almost all of it is pure removal.

What's removed

Removal Scope
All 31 transformer classes app/Transformers/**
Custom Fractal wrapper + serializer Extensions/Spatie/Fractalistic/Fractal, Extensions/League/Fractal/Serializers/PanelSerializer
Fractal config config/fractal.php
Composer dependency spatie/laravel-fractal and its league/fractal chain
Fractal-specific Scramble extensions FractalResponseTypeInfer, TransformerFactoryTypeInfer, TransformerModelBindingExtension

What replaces it

One new class, app/Extensions/Dedoc/Scramble/PanelResponseTypeInfer.php, takes over API doc generation from the three deleted Scramble extensions. It follows the PanelResponse fluent chain and derives attribute schemas from the Data class properties, covering:

  • MapOutputName renames
  • nullable and Optional keys
  • enum backing types
  • the same envelope, pagination, and addMeta shapes as before

Suggested review order

  1. PanelResponseTypeInfer.php: the only file with new logic (373 lines).
  2. Runtime edits: ApplicationApiController, ClientApiController, BackupController, AppServiceProvider, which just drop the Fractal wiring.
  3. Test helpers: assertJsonTransformedWith and friends now build expected attributes through the Data classes, the same container path the envelope takes in production.
  4. Everything else is deletion, safe to skim.

Verification

Known tradeoff

Array-shaped fields like limits now document as generic arrays rather than keyed objects, since the reflection doesn't parse array-shape docblocks. The old extension occasionally did better there; parsing those docblocks is the upgrade path if it matters. Runtime responses are unaffected, this is docs-only.

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

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 63656c43-7d53-445a-aefc-9a3cba2af47e

📥 Commits

Reviewing files that changed from the base of the PR and between 601d570 and aa2af6a.

📒 Files selected for processing (1)
  • tests/TestCase.php

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The API moved from Fractal transformers to PanelResponse and Laravel Data resources. Scramble now infers PanelResponse response types. Controllers, dependencies, serializers, transformers, webhook resources, and integration tests were updated or removed.

Changes

PanelResponse migration

Layer / File(s) Summary
PanelResponse type inference
app/Extensions/Dedoc/Scramble/PanelResponseTypeInfer.php
Added fluent-chain state tracking and inference for resource data, collections, metadata, includes, pagination, response status, and attribute types.
Runtime response cutover
app/Http/Controllers/Api/Application/ApplicationApiController.php, app/Http/Controllers/Api/Client/ClientApiController.php, app/Providers/AppServiceProvider.php, composer.json
Updated controllers and Scramble registration to use PanelResponse. Removed Fractal transformer wiring and the spatie/laravel-fractal dependency.
Webhook data resources and responses
app/Data/Api/Application/Webhook*Data.php, app/Http/Controllers/Api/Application/Webhooks/WebhookController.php
Added webhook configuration and delivery resources. Webhook endpoints now use these resources for collection and item responses.
Legacy transformer removal
app/Extensions/League/Fractal/..., app/Extensions/Spatie/Fractalistic/..., app/Transformers/Api/*/*Transformer.php, config/fractal.php
Removed custom Fractal serializers, Fractal integration, transformer factories, transformer bindings, and application and client transformer classes.
Data-class test expectations
tests/Feature/ApiDocumentationTest.php, tests/Integration/Api/..., tests/Integration/IntegrationTestCase.php, tests/TestCase.php
Updated documentation and integration tests to resolve data classes, call fromModel, and use ApiResource::RESPONSE_TIMEZONE. Test setup now disables Vite manifest requirements.

Merge Risk: ⚪ Minimal · up to aa2af

The PR removes unused Fractal code and dependency while replacing documentation inference, with API fixtures unchanged and relevant test suites passing; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: removing the legacy Fractal API layer.
Description check ✅ Passed The description directly explains the Fractal removal, its replacement with PanelResponseTypeInfer, affected components, and verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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 changed the title Delete the Fractal layer now that laravel-data serves the API Replace Fractal with DTO's Aug 18, 2026
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch from 8675649 to a895544 Compare August 18, 2026 12:47
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch from a895544 to 749034b Compare August 18, 2026 12:50
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch 2 times, most recently from f047b9b to f67b060 Compare August 18, 2026 13:21
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch from f67b060 to f6440a1 Compare August 18, 2026 13:33
@lancepioch lancepioch changed the title Replace Fractal with DTO's Remove Fractal Aug 18, 2026
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch from f6440a1 to 9349e21 Compare August 21, 2026 13:21
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch 2 times, most recently from 0ecbc9e to 31643bb Compare August 21, 2026 17:01
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch from 31643bb to 83acf73 Compare August 21, 2026 17:10
@lancepioch lancepioch linked an issue Aug 22, 2026 that may be closed by this pull request
Base automatically changed from api/laravel-data-migration to main August 24, 2026 18:07
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch from 83acf73 to 742c4f7 Compare August 24, 2026 18:07
Removes app/Transformers, the custom Fractal wrapper and PanelSerializer, the
config file, and the three Fractal specific Scramble extensions, and drops
spatie/laravel-fractal from composer. A new PanelResponseTypeInfer extension
documents PanelResponse endpoints instead, deriving attribute schemas from the
Data class properties including MapOutputName renames and Optional keys, and
reproducing the envelope, pagination, and addMeta shapes the old extension
modeled. Test helpers that compared responses against transformer output now
build their expected attributes through the Data classes, the same path the
envelope takes in production.

The contract freeze suite passes untouched, the full Integration and Unit
suites are green, and ApiDocumentationTest passes against the new inference.
@lancepioch
lancepioch force-pushed the api/fractal-teardown branch from aa2af6a to 51d329a Compare August 25, 2026 13:24
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.

Replace Fractal with Laravel Data

1 participant