Repository navigation
feat(live): add the live-messaging and live-messaging-sw rows, not yet served - #2298
Merged
Merged
Conversation
…t served
The rows wrap firebase/messaging and firebase/messaging/sw. getToken and
deleteToken records list the Installations and FCM registration requests
each call made, read from Resource Timing as API, action and status (the
status left out when the browser reports 0, the last four kept, never a
URL, FID or token). A call with no such request makes no record, unless
its error carries production's answer. onMessage and onBackgroundMessage
make one record per delivery, with no payload field. isSupported makes
none. The code is the last failing request's status name, then the
status an Installations error kept, then the SDK's code.
observe.ts gains a rejection hook beside the result hook, so a rejected
call can drop its record or name production's code, and LiveCallRecord
gains requests. page-observer.ts maps both specifiers to the messaging
service and passes requests to the host.
LIVE_ROWS does not list the rows yet (M-10), so there is no runtime path:
unit evidence only.
On main, packages/live/test/messaging-row.test.ts fails at load:
wrapLiveModule('live-messaging', ...) throws "undefined is not an object
(evaluating 'spec.hooks')", since the spec does not exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
live-messagingandlive-messaging-swrow specs to@pyric/live. Each getToken and deleteToken record lists the Installations and FCM registration requests the call made, and onMessage and onBackgroundMessage make one record per delivery. The rows are not served yet:LIVE_ROWSlists them in M-10.Risk
observe.tsgains arejectionOfhook besideresultOf. Only the Messaging row sets it. Every other row's rejections run the samereportpath as before, and all 207@pyric/livetests pass.firebase12.19 (@firebase/messaging0.13) also exportsregister,unregister,onRegisteredandonUnregistered, the FID-based registration API. They send their own requests tofcmregistrations.googleapis.com. The plan does not cover them, so this PR leaves them as the SDK's own exports: they are neither recorded nor refused. M-10 needs to decide whether to observe them or refuse them before the row is served.onRegisteredhands the app a FID, so a record of it must not carry its value.A call's requests come from Resource Timing, which never touches the request
The row starts a
PerformanceObserveronresourceentries at the realm's first getToken or deleteToken. When the call settles, the row waits one task and callstakeRecords(), so the entry for the last request is in. It then keeps the entries for the two hosts that started after the call. Each entry is reduced to an API, an action and a status while it is read, and the URL is dropped:/v1/projects/<p>/installationscreate/v1/projects/<p>/installations/<fid>/authTokens:generategenerateAuthToken/v1/projects/<p>/registrationscreate/v1/projects/<p>/registrations/<x>in deleteTokendelete/v1/projects/<p>/registrations/<x>in getTokendeletewhen acreatefollows it, elseupdateThe status is left out when
responseStatusreads 0, since the host refuses 0. A call keeps its last four requests, because another service's Installations call can start in the same window and the host takes at most four. Where the realm has noPerformanceObserver, every settled call is recorded, without requests.A call that made no request makes no record, and a denial is still recorded
A resolved or rejected call with no request entry made no request. Either the stored token was valid, there was nothing to delete, or the SDK failed locally (
messaging/permission-blocked). No record is made. A rejection whose error carries production's answer, an InstallationscustomData.serverCodeor amessaging/token-*failure, is recorded even with no entry. Capture M kept no Resource Timing entry for its three denials, so the row does not depend on one.The code is read in order:
permission_denied).customData.serverStatus, lowercased (invalid_argument).productionVerdictalready readspermission_deniedas denied.Integration test
None, because the change has no runtime path:
LIVE_ROWSdoes not list either row until M-10. The evidence ispackages/live/test/messaging-row.test.ts, which wraps stand-ins with the SDK's signatures and a stand-inPerformanceObserver. Bun has no service worker, PushManager or IndexedDB. Each record is checked with the host's ownreadObservedCallandobservedCallEvent. The real SDK runs in the replay's browser test (M-3) and the live-mode-messaging scenario (M-11).Implementation notes
packages/live/src/messaging.ts(new),packages/live/src/modules.ts,packages/live/src/observe.ts,packages/live/src/page-observer.ts,packages/live/test/messaging-row.test.ts(new).@pyric/cli/vite/internal/supplied-rowsre-exportsObservedCallfrompyric/sandbox, which already hasrequests?: ObservedRequest[](M-4).page-observer.tstypechecks against it with no change to@pyric/cli.readObservedCall, which already takesmessagingandrequests. The test reads every record through it, so nothing changes underpackages/cli/src/serve/.globalThis.PerformanceObserverand checks that the call is recorded without requests.aiCodeand is not copied, as the plan's "Left for later" asks, soai.tsstays unchanged.authsecret or payload text. The test checks every record and host call for each value, including a 22-character FID-shapedauthvalue in a delivered payload.messaging.ts.wrapLiveModule('live-messaging', ...)throwsundefined is not an object (evaluating 'spec.hooks').unshare -rn sh -c 'ip link set lo up && bun test'inpackages/live: 207 pass, 0 fail (main: 191 pass oncepackages/live/distis built).bun run typecheckinpackages/live: clean.BASE_REF=origin/main bash scripts/ci/conformance-coupling-gate.sh: exit 0.