History

Unwrap secret store options at call sites

Cursor Agent committed 5 months ago

Commit 0f9d8581 parent 8e7cf432 files · +8 −3Browse files

Unified · Split

2 files
  1. apps/server/src/auth/Layers/ServerSecretStore.test.ts +3 −2
  2. apps/server/src/serverSettings.ts +5 −1
apps/server/src/auth/Layers/ServerSecretStore.test.ts+3−2
@@ -208,8 +208,9 @@ it.layer(NodeServices.layer)("ServerSecretStoreLive", (it) => { · 207 unmodified lines
208208 const persisted = yield* secretStore.get("session-signing-key");
209209
210210 assert.isTrue(Option.isSome(persisted));
211− assert.deepEqual(Array.from(first), Array.from(persisted.value));
212− assert.deepEqual(Array.from(second), Array.from(persisted.value));
211+ const persistedBytes = Option.getOrThrow(persisted);
212+ assert.deepEqual(Array.from(first), Array.from(persistedBytes));
213+ assert.deepEqual(Array.from(second), Array.from(persistedBytes));
213214 }).pipe(Effect.provide(makeConcurrentCreateSecretStoreLayer())),
214215 );
215216
apps/server/src/serverSettings.ts+5−1
@@ -31,6 +31,7 @@ import * as Effect from "effect/Effect"; · 30 unmodified lines
3131 import * as Exit from "effect/Exit";
3232 import * as FileSystem from "effect/FileSystem";
3333 import * as Layer from "effect/Layer";
34+import * as Option from "effect/Option";
3435 import * as Path from "effect/Path";
3536 import * as Equal from "effect/Equal";
3637 import * as PubSub from "effect/PubSub";
@@ -349,7 +350,10 @@ const makeServerSettings = Effect.gen(function* () { · 312 unmodified lines
349350 );
350351 environment.push({
351352 ...variable,
352− value: secret ? textDecoder.decode(secret) : "",
353+ value: Option.match(secret, {
354+ onSome: (bytes) => textDecoder.decode(bytes),
355+ onNone: () => "",
356+ }),
353357 });
354358 }
355359 providerInstances[instanceId] = {