feat: warn if patch_verification is in shorebird.yaml but public-key-path not set (#3479)

This commit is contained in:
Eric Seidel
2026-01-26 16:40:47 -08:00
committed by GitHub
parent b064f1e76f
commit d3cd73eb14
2 changed files with 40 additions and 0 deletions
@@ -369,6 +369,16 @@ of the iOS app that is using this module. (aar and ios-framework only)''',
Future<void> 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,
);
@@ -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;