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
5 changes: 5 additions & 0 deletions .changeset/fix-dead-signer-guard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"playground-cli": patch
---

Remove unreachable null-signer guard in `resolveSignerSetup` (`signerMode.ts`). The dead `throw` could never fire because `shouldResolveUserSigner()` guarantees a signer is resolved before `resolveSignerSetup` is called when `--playground` is set. No user-visible behaviour change.
10 changes: 0 additions & 10 deletions src/utils/deploy/signerMode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ describe("resolveSignerSetup — dev mode", () => {
expect(result.publishSigner).toBeNull();
});

it("publishToPlayground without a userSigner throws a helpful message", () => {
expect(() =>
resolveSignerSetup({
mode: "dev",
userSigner: null,
publishToPlayground: true,
}),
).toThrow(/dot init|--playground/);
});

it("publishToPlayground with session userSigner adds one playground approval and leaves auth empty", () => {
const user = fakeSigner("session");
const result = resolveSignerSetup({
Expand Down
12 changes: 6 additions & 6 deletions src/utils/deploy/signerMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ export function resolveSignerSetup(opts: ResolveOptions): DeploySignerSetup {
// Playground publish always uses the user's signer so ownership ties to
// their address — otherwise the registry would record a shared dev key
// and the myApps view would be useless.
//
// userSigner is guaranteed non-null here: shouldResolveUserSigner() returns
// true whenever publishToPlayground is true, so resolveSigner() in the
// preflight has already either resolved a signer or thrown before we reach
// this point. The null guard that previously lived here was unreachable.
let publishSigner: ResolvedSigner | null = null;
if (opts.publishToPlayground) {
if (!opts.userSigner) {
throw new Error(
'Publishing to Playground requires a logged-in account. Run "dot init" first, or drop --playground.',
);
}
publishSigner = opts.userSigner;
publishSigner = opts.userSigner!;
approvals.push({ phase: "playground", label: "Publish to Playground registry" });
}

Expand Down
Loading