refactor: share platform boundary contracts#33
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors “platform boundary” contracts into @t4-code/protocol, moving pairing deep-link parsing/queueing and desktop/Android updater payload decoding into shared, strict decoders, and adds fixture-driven headless tests to harden these untrusted inputs.
Changes:
- Introduces shared pairing-link parsing + validation (
parsePairDeepLink,decodePairLinkEvent) and a bounded pending-pair queue inpackages/protocol. - Centralizes strict updater payload decoders for Desktop IPC and Android (Capacitor) bridge values in
packages/protocol/src/app-update.ts. - Adds fixture-driven protocol tests and updates desktop/web call sites to use the shared contracts; removes now-duplicated desktop deep-link implementation and tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/protocol/test/platform-boundaries.test.ts | Adds headless tests for pairing link parsing, queued event validation, and strict updater decoding. |
| packages/protocol/test/fixtures/platform-boundaries.ts | Adds valid/invalid fixtures for pairing links and Android updater payloads. |
| packages/protocol/src/pair-link.ts | New shared pairing link decoder/parser and bounded queue implementation. |
| packages/protocol/src/index.ts | Re-exports new shared protocol modules. |
| packages/protocol/src/desktop-ipc.ts | Uses and re-exports shared desktop update + pair-link decoders/types. |
| packages/protocol/src/app-update.ts | New shared strict decoders for desktop update IPC state and Android updater bridge payload. |
| packages/protocol/package.json | Exposes new subpath exports (./app-update, ./pair-link). |
| apps/web/src/platform/native-mobile.ts | Switches native update state type to the shared AndroidUpdateState. |
| apps/web/src/features/updates/update-store.ts | Uses shared decodeAndroidUpdateState instead of local validation/cleaning. |
| apps/desktop/test/security.test.ts | Removes deep-link-specific assertions (moved to protocol tests). |
| apps/desktop/test/desktop-lifecycle.test.ts | Removes deep-link parsing/queue tests (moved to protocol tests). |
| apps/desktop/src/lifecycle.ts | Uses shared protocol deep-link parsing and queueing instead of desktop-local module. |
| apps/desktop/src/deep-link.ts | Deletes desktop-local deep-link parsing/queue implementation now owned by protocol. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e37cb2587
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Verification
mise exec node@24.17.0 -- pnpm checkTMPDIR=/private/tmp mise exec node@24.17.0 -- pnpm test(1,248 passed)mise exec node@24.17.0 -- pnpm build