1// Child process for the short-bytes canary in2// package/schema/conformance_test.ts. In jazz-tools@2.0.0-alpha.53 a short3// byte payload insert has been observed succeeding, failing with the4// flat-history encoder error, and hanging — context-dependent — so it runs5// behind a race in a process that force-exits.6import { createPolicyTestApp } from "jazz-tools/testing";7import { s } from "../schema/mod.ts";89const expectLike = (value: unknown) => ({10 toThrow() {11 if (typeof value === "function") value();12 },13 not: {14 toThrow() {15 if (typeof value === "function") value();16 },17 },18});1920const app = s.defineApp({ blobs: s.table({ value: s.bytes() }) });21const permissions = s.definePermissions(app, ({ policy }) => {22 policy.blobs.allowInsert.always();23 policy.blobs.allowRead.always();24 policy.blobs.allowUpdate.always();25 policy.blobs.allowDelete.always();26});2728const testApp = await createPolicyTestApp(app, permissions, expectLike);29const db = testApp.as({ user_id: "canary", claims: {}, authMode: "local-first" });3031const outcome = await Promise.race([32 db.insert(app.blobs, { value: new Uint8Array([1, 2]) }).wait({ tier: "global" }).then(33 () => "short-bytes:OK",34 (error) => {35 const message = error instanceof Error ? error.message : String(error);36 return `short-bytes:ERROR:${message}`;37 },38 ),39 new Promise<string>((resolve) => setTimeout(() => resolve("short-bytes:HUNG"), 8_000)),40]);41console.log(outcome);42Deno.exit(0);