Make relay helpers more idiomatic Effect#3000
Draft
cursor[bot] wants to merge 3 commits into
Draft
Conversation
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
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
Data.TaggedErrorwith granularSchema.TaggedErrorClasssign/verify errors and aRelayJwtErrorschema union.@effect/vitestwithassert.JSON.parse/JSON.stringifypath with aSchema.fromJsonStringcodec backed by the existing relay contract schema.Why
These are focused idiomatic Effect improvements: structured serializable errors for auth primitives, schema-backed JSON parsing/encoding instead of ad-hoc record casts, and tests that exercise the behavior without module-level mocks.
Validation:
bun run test src/relayJwt.test.tsfrompackages/shared(3 tests passed)bun run test src/managedRelayState.test.tsfrompackages/client-runtime(5 tests passed)pnpm exec vp check(passed with pre-existing rootpackage.jsondiff temporarily stashed)pnpm exec vp run typecheck(passed with same pre-existing rootpackage.jsondiff temporarily stashed)Checklist
Note
Replace generic relay JWT errors with structured
RelayJwtSignErrorandRelayJwtVerifyErrorclassesRelayJwtErrorinrelayJwt.tswith twoSchema.TaggedErrorClasstypes:RelayJwtSignError(carriestyp,cause) andRelayJwtVerifyError(carriestyp,issuer,audience,cause).statusKeyinmanagedRelayState.tsto use schema-encoded keys instead ofJSON.stringify, so logically equivalent environment objects with different property order map to the same cache entry.parseStatusKeyschema validation so only conforming keys are accepted.RelayJwtError.Macroscope summarized cbc057a.