Skip to content

Use Effect schema JSON for mobile cache#3127

Closed
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/idiomatic-effect-patterns-11a9
Closed

Use Effect schema JSON for mobile cache#3127
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/idiomatic-effect-patterns-11a9

Conversation

@cursor

@cursor cursor Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Decode and encode mobile shell snapshot cache documents with Schema.fromJsonString instead of manually parsing cache JSON before schema validation.
  • Added focused mobile storage tests for valid cache loads, malformed JSON, unsupported schema versions, and environment mismatches.
  • Updated shared Effect worker tests to use assert from @effect/vitest instead of Vitest expect.

Why

These are small idiomatic Effect cleanups that keep parsing/validation in Schema codecs and keep Effect tests aligned with the repo's @effect/vitest style.

UI Changes

Not applicable; no UI changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Verification:

  • pnpm exec vp test run src/lib/storage.test.ts (from apps/mobile): 6 tests passed
  • pnpm exec vp test run src/DrainableWorker.test.ts src/KeyedCoalescingWorker.test.ts (from packages/shared): 3 tests passed
  • pnpm exec vp check: passed with 12 existing warnings
  • pnpm exec vp run typecheck: passed
Open in Web View Automation 

Note

Use Effect schema JSON codecs for mobile shell snapshot cache read/write

  • Replaces manual JSON.parse/JSON.stringify + schema decode in storage.ts with Schema.fromJsonString-based codecs (CachedShellSnapshotJson, decodeCachedShellSnapshotJson, encodeCachedShellSnapshotJson).
  • loadCachedShellSnapshot now decodes file contents directly via the schema codec, returning null on malformed JSON or schema mismatches instead of throwing.
  • saveCachedShellSnapshot now passes { intermediates: true, overwrite: true } when creating the file, and skips writing if encoding yields None.
  • Test suite in storage.test.ts adds in-memory mocks for expo-file-system and covers malformed JSON, unsupported schema versions, and mismatched environment IDs.
  • Also migrates DrainableWorker and KeyedCoalescingWorker test assertions from expect to @effect/vitest assert.

Macroscope summarized 4966d41.

cursoragent and others added 2 commits June 17, 2026 16:06
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Jun 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint 052dc86843f08d733f88b4c444db61397f6e5117 56f0ff9f61b9906d203c2fea265e3f9507332117
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 052dc86843f08d733f88b4c444db61397f6e5117
App version: 0.1.0
Git commit: 33ba5767119ea730fea7a5ad398e0e3fe1f18efd
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 56f0ff9f61b9906d203c2fea265e3f9507332117
App version: 0.1.0
Git commit: 33ba5767119ea730fea7a5ad398e0e3fe1f18efd
Update Details Update Permalink
DetailsBranch: pr-3127
Runtime version: 052dc86843f08d733f88b4c444db61397f6e5117
Git commit: 33ba5767119ea730fea7a5ad398e0e3fe1f18efd
Update Permalink
DetailsBranch: pr-3127
Runtime version: 56f0ff9f61b9906d203c2fea265e3f9507332117
Git commit: 33ba5767119ea730fea7a5ad398e0e3fe1f18efd
Update QR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants