Use Effect schema JSON for mobile cache#3127
Closed
cursor[bot] wants to merge 2 commits into
Closed
Conversation
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Contributor
|
🚀 Expo continuous deployment is ready!
|
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.
What Changed
Schema.fromJsonStringinstead of manually parsing cache JSON before schema validation.assertfrom@effect/vitestinstead of Vitestexpect.Why
These are small idiomatic Effect cleanups that keep parsing/validation in Schema codecs and keep Effect tests aligned with the repo's
@effect/viteststyle.UI Changes
Not applicable; no UI changes.
Checklist
Verification:
pnpm exec vp test run src/lib/storage.test.ts(fromapps/mobile): 6 tests passedpnpm exec vp test run src/DrainableWorker.test.ts src/KeyedCoalescingWorker.test.ts(frompackages/shared): 3 tests passedpnpm exec vp check: passed with 12 existing warningspnpm exec vp run typecheck: passedNote
Use Effect schema JSON codecs for mobile shell snapshot cache read/write
JSON.parse/JSON.stringify+ schema decode in storage.ts withSchema.fromJsonString-based codecs (CachedShellSnapshotJson,decodeCachedShellSnapshotJson,encodeCachedShellSnapshotJson).loadCachedShellSnapshotnow decodes file contents directly via the schema codec, returningnullon malformed JSON or schema mismatches instead of throwing.saveCachedShellSnapshotnow passes{ intermediates: true, overwrite: true }when creating the file, and skips writing if encoding yieldsNone.expo-file-systemand covers malformed JSON, unsupported schema versions, and mismatched environment IDs.DrainableWorkerandKeyedCoalescingWorkertest assertions fromexpectto@effect/vitestassert.Macroscope summarized 4966d41.