feat: dispatch AuthLogin and AuthLogout, add Event.listen, AuthChannelSubscription, Str.unwrap - #203
Conversation
…lSubscription, Str.unwrap and a public key collapse AuthLogin and AuthLogout were defined and documented but never dispatched. BaseGuard.startSession now dispatches AuthLogin last, guarded by the session epoch and by the user still being the one it set, so a sign-in that a logout overtook during its own cache write stays silent (and the late cache write is undone). logout() captures the user at entry and dispatches AuthLogout after the state bump and before rethrowing a vault failure, a guest included. AuthRestored is unchanged: API-confirmed restores only. The fake guard dispatches the same events in the same order. Also adds Event.listen<T>(factory) (Laravel Event::listen), an auth-scoped private channel reconciler for broadcasting, Str.unwrap with Laravel semantics, and CollapsesIndexedErrorKeys.collapse for controllers that cannot take the mixin. Docs, skill references and CHANGELOG updated; AuthFailed is documented as defined but not dispatched. No version bump.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The auth event dispatch, Major
Minor
TestsThe new CI
I checked the rules against |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The auth event dispatch, Major
Minor
TestsNew tests cover login/logout dispatch ordering and the epoch/identity races ( CI
I skimmed the docs, skill references and CHANGELOG edits for consistency with the code but did not audit them line by line. |
…ubscription, document the teardown disconnect
|
@kodizm review. Major fixed: the subscription tracks the driver's connection state and does not call connect() while a reconnect or connect is in flight (new test, red first). Minor: documented that a null channel name disconnects the default connection, deliberately. |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The reconnect fix closes the double-socket case, but treating Since the last review: commit Major
TestsThe new test covers a name change while the connection is CI
I checked the new commit against |
…ed when reconnect is off
|
@kodizm review. Major fixed: only a reconnecting state skips connect, a failed own connect resets the tracked state so the next sync retries, and the Reverb driver now reports disconnected (not reconnecting) when reconnect is disabled. Both cases have red-first tests. |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The boot-failure strand is fixed and so is the Since the last review: commit Major
A related case: when the subscription's own connect times out, the driver arms a reconnect ( TestsThe new tests cover a failed own connect followed by a retry, and CI
In this pass I read commit |
…ription's state inference
|
@kodizm review. Root cause fixed instead of inferring driver state: ReverbBroadcastDriver.connect() is now single-flight and supersedes an armed retry, so a second call (or one during a retry, failed retry or timeout backoff) cannot open a second socket. AuthChannelSubscription goes back to a plain isConnected gate. Red-first driver tests cover concurrent connects, connect after a drop, connect during a failed-retry backoff, and connect while connected. |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The fix in the driver is correct. With single-flight Since the last review: commit Why I think the socket count is now bounded, for each path I checked:
TestsThe new
The subscription tests were changed to match the plain gate. CI
In this pass I read commit |
feat: dispatch AuthLogin and AuthLogout, add Event.listen, AuthChannelSubscription, Str.unwrap and a public key collapse
AuthLogin and AuthLogout were defined and documented but never dispatched.
BaseGuard.startSession now dispatches AuthLogin last, guarded by the session
epoch and by the user still being the one it set, so a sign-in that a logout
overtook during its own cache write stays silent (and the late cache write is
undone). logout() captures the user at entry and dispatches AuthLogout after
the state bump and before rethrowing a vault failure, a guest included.
AuthRestored is unchanged: API-confirmed restores only. The fake guard
dispatches the same events in the same order.
Also adds Event.listen(factory) (Laravel Event::listen), an auth-scoped
private channel reconciler for broadcasting, Str.unwrap with Laravel
semantics, and CollapsesIndexedErrorKeys.collapse for controllers that cannot
take the mixin. Docs, skill references and CHANGELOG updated; AuthFailed is
documented as defined but not dispatched.
No version bump.
Part of the "framework-level support" round (plan 2 of 3): code that uptizm carried because a plugin lacked a seam moves into the owning package. Companion PRs: fluttersdk/magic, fluttersdk/magic_starter, fluttersdk/magic_notifications, fluttersdk/magic_deeplink, fluttersdk/wind, fluttersdk/magic_sentry, and the uptizm adoption.
This PR compiles and tests against its siblings' current default branches; nothing here depends on another PR in the round being merged first. No version bump and no publish.