feat: add repositories, session scope, actions, form objects and broadcast listeners - #205
Conversation
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. Solid, well-tested set of primitives; two correctness issues are worth fixing before the plugin PRs start depending on this API. Major
Minor
TestsEvery new primitive has its own test file (repository, query, session scope, actions, form object, timers, broadcast listeners, rules, generators). No test covers a multi-alias broadcast teardown or CI
What I read: the core |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
runAction answered null for a void success, a failure and a refused same-key re-entry alike, so callers read a refused double tap as success. It now answers ActionSucceeded, ActionFailed or ActionRefused. A ValidationException on a host without ValidatesRequests reaches onFailure or the toast instead of vanishing, and the fallback toast no longer shows the raw exception text. Also: RepositoryQuery clears only its own first load, Magic.delete disposes through ChangeNotifier without importing the http layer, and the MagicAction doc samples compile.
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The new commits look correct. They fix my earlier What changed since my last review (87cc680 → efee6e5, incremental): Minor
Tests
CI
Read in full: all 11 files in this increment (the new |
…sing any notifier
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. These commits look correct. The What changed since my last review (efee6e5 → 89c4daa, incremental): Minor
Tests
CI
I read all 5 files in this increment in full. |
…nd record Magic.delete disposing any notifier
…teners alias goes null
|
Round 4 fixes. The two round 1 Majors were still open in code (round 2 and 3 only noted they sat in untouched files), so this round closes them too. Major,
Major,
Minor, Gates on 225bb01: @kodizm please re-review. |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. These commits fix both open Majors and the CHANGELOG Minor. I found nothing new to flag. What changed since my last review (89c4daa → 225bb01, incremental). My earlier
Tests
CI
I read the full diff of all 12 code, test and CHANGELOG files in this increment, plus the call sites I grepped for. I did not open the doc and skill markdown changes ( |
Summary
Laravel-shaped application primitives for magic apps, extracted from what Uptizm hand-rolled per controller:
Repository<T>(id-keyed cache of one remote resource:upsertFromList,showOnlyKeysmerge, 404 evicts, an epoch guard drops answers that straddle a session reset) andRepositoryQuery<T>(ordered, filtered, paginated view over a repository onMagicPaginator.fetcher; items resolve live, a non-list 2xx is a failed read, the load-start notification is deferred so a view'sinitStatemay callreload()).SessionScope/SessionScoped, a tenant-reset boundary over every cached controller and repository, attached explicitly as the lastAuth.stateNotifierlistener.Magic.delete<T>()now disposes the controller it removes (MagicController.disposeis idempotent).MagicAction<I, O>withbind/resolve/flush(Fortify's action-swap pattern) and theRunsActionsmixin;MagicFormObject, a Livewire-style form object overValidatesRequestsandCollapsesIndexedErrorKeys.LatestRead,Poll.until(sealedPollOutcome),Countdown,Debouncer,OwnsTimers.BroadcastListenersandListensToBroadcasts, oneAuthChannelSubscriptionper alias shared by every listening controller (LivewiregetListenersstyle).UrlGeneratorand the top-levelurl()helper.Event.listenAnyand theReportsBreadcrumbcontract, so a crash reporter plugin records a whitelisted breadcrumb trail without a hard dependency.Uuid,Boolean,Numeric,Integer,Gt/Gte/Lt/Lte,Between,Regex,Date,Nullable,RequiredIf,ArrayRule.make:action,make:form,make:repository.Docs, the magic-framework skill and CHANGELOG are updated.
Verification
flutter analyzeclean,flutter test2034 passing,dart format --set-exit-if-changedclean. Uptizm was rebuilt on top of these primitives and walked live on Chrome (1440 and 500 px) and the iOS simulator.Part of a coordinated set
This PR is one of eight that move reusable, app-agnostic pieces out of Uptizm into the magic framework and its plugins, so any magic app can use them the Laravel way.
Merge order:
fluttersdk/magicfirst: every plugin PR compiles against its new API (SessionScope,Repository,MagicAction,Event.listenAny,ReportsBreadcrumb).magic_deeplink,magic_notifications,magic_paymentsandmagic_sentry, in any order.magic_starter, which uses magic core'sSessionScope,magic_payments'StoreIdentitySyncandmagic_deeplink's gate.magic-starter-laravelis independent of the Flutter side.anilcancakir/uptizmlast.Until magic merges and ships, CI on the plugin PRs resolves the published magic and is expected to be red. Each branch was verified locally against the sibling working trees (analyze, the full test suite, format check).
No version bump, publish or tag is included; a release is a separate step.