From d3cd73eb149f38cc821509d0b3d65c88ac2cf6cd Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Mon, 26 Jan 2026 16:40:47 -0800 Subject: [PATCH] feat: warn if patch_verification is in shorebird.yaml but public-key-path not set (#3479) --- .../src/commands/release/release_command.dart | 10 +++++++ .../release/release_command_test.dart | 30 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/packages/shorebird_cli/lib/src/commands/release/release_command.dart b/packages/shorebird_cli/lib/src/commands/release/release_command.dart index 76c82d55..c3df9c5b 100644 --- a/packages/shorebird_cli/lib/src/commands/release/release_command.dart +++ b/packages/shorebird_cli/lib/src/commands/release/release_command.dart @@ -369,6 +369,16 @@ of the iOS app that is using this module. (aar and ios-framework only)''', Future assertArgsAreValid(Releaser releaser) async { results.assertAbsentOrValidPublicKey(); + final shorebirdYaml = shorebirdEnv.getShorebirdYaml(); + if (shorebirdYaml?.patchVerification != null && + !results.wasParsed(CommonArguments.publicKeyArg.name)) { + logger.warn( + 'patch_verification is set in shorebird.yaml but ' + '--${CommonArguments.publicKeyArg.name} was not provided.\n' + 'patch_verification configuration will have no effect.', + ); + } + final version = await shorebirdFlutter.resolveFlutterVersion( flutterVersionArg, ); diff --git a/packages/shorebird_cli/test/src/commands/release/release_command_test.dart b/packages/shorebird_cli/test/src/commands/release/release_command_test.dart index 03560afa..8f7980dc 100644 --- a/packages/shorebird_cli/test/src/commands/release/release_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/release_command_test.dart @@ -677,6 +677,36 @@ $exception'''), verify(releaser.assertArgsAreValid).called(1); }); + group( + 'when patch_verification is set but public-key-path is not provided', + () { + setUp(() { + when(() => shorebirdEnv.getShorebirdYaml()).thenReturn( + const ShorebirdYaml( + appId: appId, + patchVerification: PatchVerification.strict, + ), + ); + when( + () => argResults.wasParsed(CommonArguments.publicKeyArg.name), + ).thenReturn(false); + }); + + test('logs a warning', () async { + final releaser = MockReleaser(); + when(releaser.assertArgsAreValid).thenAnswer((_) async => {}); + await runWithOverrides(() => command.assertArgsAreValid(releaser)); + verify( + () => logger.warn( + 'patch_verification is set in shorebird.yaml but ' + '--${CommonArguments.publicKeyArg.name} was not provided.\n' + 'patch_verification configuration will have no effect.', + ), + ).called(1); + }); + }, + ); + test('exits with code 64 if flutter version is not supported', () async { final releaser = MockReleaser(); const releaseType = ReleaseType.android;