diff --git a/src/orb/ingest.ts b/src/orb/ingest.ts index dd52d104b..5c1e006fd 100644 --- a/src/orb/ingest.ts +++ b/src/orb/ingest.ts @@ -7,6 +7,7 @@ const MAX_BATCH = 500; const MAX_INSTANCE_ID_CHARS = 64; const MAX_HASH_CHARS = 128; const MAX_BUCKET_CHARS = 64; +const MAX_VERDICT_CHARS = 32; const VALID_OUTCOMES = new Set(["merged", "closed"]); const VALID_REVERSALS = new Set(["none", "reopened", "reverted"]); const MIN_CYCLE_MS = 1_000; // <1s is implausible @@ -166,7 +167,7 @@ export async function handleOrbIngest(body: string, db: D1Database): Promise { expect(await ingest(makeDb(), [ev({ outcome: "opened" })])).toEqual({ accepted: 0 }); }); - it("stores gate_verdict string vs null", async () => { + it("stores gate_verdict string vs null, coercing an oversized value to null", async () => { const db = makeDb(); - await ingest(db, [ev({ pr_hash: "v1", gate_verdict: "merge" }), ev({ pr_hash: "v2" })]); + await ingest(db, [ev({ pr_hash: "v1", gate_verdict: "merge" }), ev({ pr_hash: "v2" }), ev({ pr_hash: "v3", gate_verdict: "v".repeat(33) })]); expect(await col(db, "v1", "gate_verdict")).toBe("merge"); expect(await col(db, "v2", "gate_verdict")).toBeNull(); + expect(await col(db, "v3", "gate_verdict")).toBeNull(); }); it("whitelists reversal_flag: valid kept, invalid + absent → 'none'", async () => {