Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/plugins/keychain/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("keychain plugin", () => {
return;
}

try {
yield* Effect.gen(function* () {
// Store through SDK, pinned to keychain provider
yield* executor.secrets.set(
new SetSecretInput({
Expand All @@ -61,9 +61,9 @@ describe("keychain plugin", () => {
// SDK routes through the core secret table → pinned provider
const resolved = yield* executor.secrets.get(testId);
expect(resolved).toBe("keychain-test-value");
} finally {
yield* executor.secrets.remove(testId).pipe(Effect.orElseSucceed(() => undefined));
}
}).pipe(
Effect.ensuring(executor.secrets.remove(testId).pipe(Effect.orElseSucceed(() => undefined))),
);
}),
);

Expand Down
8 changes: 6 additions & 2 deletions packages/plugins/keychain/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Effect } from "effect";

import { StorageError, type SecretProvider } from "@executor-js/sdk/core";

import type { KeychainError } from "./errors";
import { getPassword, setPassword, deletePassword } from "./keyring";

// ---------------------------------------------------------------------------
Expand All @@ -18,8 +19,11 @@ import { getPassword, setPassword, deletePassword } from "./keyring";
// impossible to debug why secrets weren't resolving.
// ---------------------------------------------------------------------------

const toStorageError = (cause: { readonly message: string; readonly cause?: unknown }) =>
new StorageError({ message: cause.message, cause: cause.cause ?? cause });
const toStorageError = (cause: KeychainError) => {
const { cause: underlyingCause } = cause;
// oxlint-disable-next-line executor/no-unknown-error-message -- boundary: typed KeychainError message becomes StorageError message
return new StorageError({ message: cause.message, cause: underlyingCause ?? cause });
};

// Scope arg is ignored — keychain partitions by `serviceName`, which the
// host fixes per executor at construction time. A future refactor could
Expand Down
Loading