Skip to content

refactor(mobile): move the bridge connection snapshot into its own module - #36818

Merged
nwparker merged 1 commit into
mainfrom
nwparker/mobile-bridge-connection-snapshot
Nov 1, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/mobile-bridge-connection-snapshot

Conversation

@nwparker

@nwparker nwparker commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​57 $\color{#cf222e}{\Huge{\mathbf{−}}}$​39 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18

ELI5

Moves one piece of shared code into its own file so the next PR has room to grow. Nothing changes for users.

What Changed

  • The bridge connection snapshot (schema, state list, the shell's snapshot builder) moves from bridge-envelope.ts and bridge-host.ts into bridge/bridge-connection-snapshot.ts.
  • The page's "not ready" guard moves into BridgeConnectionCache.require().
  • bridge-envelope.ts re-exports the schema, so every import and every frame on the wire is unchanged.

Why

The next PR adds connection-path fields to this snapshot. Without this move, three bridge modules go over the 300-line cap. It's split out as a pure move so the behavior PR is reviewable on its own.

Linked Issue

N/A (internal).

Visual Proof

N/A: no behavior change.

Testing

  • Mobile src/mobile-web-shell suite passes unchanged (1401 tests); mobile typecheck passes.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

No tests added: it's a pure move covered by the existing bridge suites.

Stack 4/5. Base: compressed frames.

@nwparker
nwparker force-pushed the nwparker/mobile-compressed-frames branch from 8242c40 to 393203a Compare November 1, 2026 00:28
@nwparker
nwparker force-pushed the nwparker/mobile-bridge-connection-snapshot branch from f9bcebc to e04caaf Compare November 1, 2026 00:29
@nwparker
nwparker force-pushed the nwparker/mobile-compressed-frames branch from 393203a to 3aee9b4 Compare November 1, 2026 00:54
@nwparker
nwparker force-pushed the nwparker/mobile-bridge-connection-snapshot branch from e04caaf to 49524a4 Compare November 1, 2026 00:54
@nwparker
nwparker force-pushed the nwparker/mobile-compressed-frames branch from 3aee9b4 to 605cd7f Compare November 1, 2026 01:20
@nwparker
nwparker force-pushed the nwparker/mobile-bridge-connection-snapshot branch from 49524a4 to b09e382 Compare November 1, 2026 01:20
@nwparker
nwparker force-pushed the nwparker/mobile-compressed-frames branch from 605cd7f to f630c80 Compare November 1, 2026 01:52
@nwparker
nwparker force-pushed the nwparker/mobile-bridge-connection-snapshot branch from b09e382 to 1e16e1f Compare November 1, 2026 01:52
@nwparker
nwparker changed the base branch from nwparker/mobile-compressed-frames to main November 1, 2026 02:02
@nwparker
nwparker force-pushed the nwparker/mobile-bridge-connection-snapshot branch from 1e16e1f to 038a239 Compare November 1, 2026 02:02
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee93807b-fe00-44db-9d39-6952e9674618
Commits

Reviewing files that changed from the base of the PR and between f2379da and 71a9680.

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

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 36790c06-d580-459f-9da8-bb9b61839746
Commits

Reviewing files that changed from the base of the PR and between df2ddd9 and 038a239.

Files selected for processing: 5
  • mobile/src/mobile-web-shell/bridge-host.ts
  • mobile/src/mobile-web-shell/bridge/bridge-client-connection-cache.ts
  • mobile/src/mobile-web-shell/bridge/bridge-connection-snapshot.ts
  • mobile/src/mobile-web-shell/bridge/bridge-envelope.ts
  • mobile/src/mobile-web-shell/bridge/bridge-rpc-client.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The change moves bridge connection snapshot definitions and reading into a dedicated module. The envelope module re-exports the snapshot declarations. The bridge host uses the shared reader, and the connection cache adds a method that returns the cached snapshot or throws when the cache is unprimed. The RPC client uses this cache method.

Merge Risk: Minimal · previous review 038a2

The snapshot refactor has no identified merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: moving the bridge connection snapshot into its own module.
Description check Passed The description covers the core template sections: ELI5, changes, rationale, linked issue status, visual proof, and testing. It clearly states that the refactor preserves behavior and prepares a follo…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Description check

Explanation

The description covers the core template sections: ELI5, changes, rationale, linked issue status, visual proof, and testing. It clearly states that the refactor preserves behavior and prepares a follow-up change. Several optional or administrative template sections are omitted, but the description is otherwise complete and focused.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 5 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@nwparker
nwparker force-pushed the nwparker/mobile-bridge-connection-snapshot branch from 038a239 to f2379da Compare November 1, 2026 02:16
…dule

The connection snapshot schema, the shell's snapshot builder and the
page's not-ready guard move to bridge-connection-snapshot.ts and
BridgeConnectionCache.require(). No behavior change: the envelope
re-exports the schema, so every frame parses and serializes as before.

Prepares the next change, which adds connection path fields to the
snapshot, without pushing the bridge modules over the size cap.
@nwparker
nwparker force-pushed the nwparker/mobile-bridge-connection-snapshot branch from f2379da to 71a9680 Compare November 1, 2026 02:23
@nwparker
nwparker merged commit b903e5d into main Nov 1, 2026
26 checks passed
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