Use idiomatic Effect options for server secret reads#3110
Merged
Conversation
Contributor
|
🚀 Expo continuous deployment is ready!
|
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>
Co-authored-by: codex <codex@users.noreply.github.com>
e5f4455 to
1365314
Compare
Contributor
ApprovabilityVerdict: Approved Mechanical refactor replacing null-based optional values with Effect's idiomatic Option type throughout the secret store API. All call sites are updated with equivalent logic, and tests verify the same behaviors with updated assertions. You can customize Macroscope's approvability policy. Learn more. |
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
ServerSecretStore.getto returnOption<Uint8Array>instead ofUint8Array | null.SecretStoreErrorwith a serializableSchema.TaggedErrorClass.Optionexplicitly.Why
This makes the server auth/cloud secret handling more idiomatic Effect by using typed absence instead of nullable values and structured tagged errors that serialize cleanly.
UI Changes
Not applicable; this is a server/internal Effect refactor.
Checklist
Note
Replace null returns with
Optiontype inServerSecretStore.getServerSecretStoreShape.getto returnOption<Uint8Array>instead ofUint8Array | null, usingOption.nonefor missing secrets andOption.somefor found ones.Option.isSomeand unwrap.valuebefore use.getOrCreateRandomandgetOrCreateEnvironmentKeyPairFromSecretStoreare rewritten to useOption.matchbranching instead of null checks.SecretStoreErroris migrated fromData.TaggedErrortoSchema.TaggedErrorClasswith an explicit schema.!== nullon secret reads must now useOption.isSome; the newSchema.TaggedErrorClassshape may differ from the oldData.TaggedErrorin serialization.Macroscope summarized 1365314.
Note
Medium Risk
Broad refactor across auth, cloud linking, and settings secret reads; behavior should match prior null semantics, but the error class change may affect
instanceof SecretStoreErrorat boundaries.Overview
ServerSecretStore.getnow returnsOption<Uint8Array>instead ofUint8Array | null. Missing secrets areOption.none(); reads useOption.isSome/Option.isNoneand.valueinstead of null checks.SecretStoreErroris now aSchema.TaggedErrorClass(serializable schema formessageand optionalcause) instead ofData.TaggedError.getOrCreateRandomand related paths useOption.matchfor existing vs missing secrets.Call sites are updated across cloud/CLI/relay/settings (link state, OAuth tokens, environment keys, relay config, provider env secrets, agent awareness). Tests switch to
assertfrom@effect/vitestand assertOptionshapes.Reviewed by Cursor Bugbot for commit 1365314. Bugbot is set up for automated code reviews on this repo. Configure here.