diff --git a/apps/ota/src/__tests__/schema.test.ts b/apps/ota/src/__tests__/schema.test.ts index e86447d0f..05386357e 100644 --- a/apps/ota/src/__tests__/schema.test.ts +++ b/apps/ota/src/__tests__/schema.test.ts @@ -61,4 +61,30 @@ describe("otaReleaseSchema", () => { }), ).toThrow("At least one platform must be provided") }) + + it("rejects metadata when platform keys exist without a real payload", () => { + const result = otaReleaseSchema.safeParse({ + schemaVersion: 1, + product: "mobile", + channel: "production", + releaseVersion: "0.4.2", + releaseKind: "ota", + runtimeVersion: "0.4.1", + publishedAt: "2026-04-10T12:00:00Z", + git: { + tag: "mobile/v0.4.2", + commit: "abcdef1234567890", + }, + policy: { + storeRequired: false, + minSupportedBinaryVersion: "0.4.1", + message: null, + }, + platforms: { + ios: undefined, + }, + }) + + expect(result.success).toBe(false) + }) }) diff --git a/apps/ota/src/lib/schema.ts b/apps/ota/src/lib/schema.ts index e2d004121..385053040 100644 --- a/apps/ota/src/lib/schema.ts +++ b/apps/ota/src/lib/schema.ts @@ -23,7 +23,7 @@ const platformsSchema = z linux: platformSchema.optional(), }) .strict() - .refine((platforms) => Object.keys(platforms).length > 0, { + .refine((platforms) => Object.values(platforms).some(Boolean), { message: "At least one platform must be provided", })