From 6a687212a1263022bba07f4fd1bda33f71362c58 Mon Sep 17 00:00:00 2001 From: Simon Axelsson Date: Mon, 7 Sep 2026 17:59:20 +0200 Subject: [PATCH] test: pin lineage queued-vs-emitted semantics --- tests/p0/aud0-outbox.test.ts | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/p0/aud0-outbox.test.ts b/tests/p0/aud0-outbox.test.ts index c584194..ca7f5e3 100644 --- a/tests/p0/aud0-outbox.test.ts +++ b/tests/p0/aud0-outbox.test.ts @@ -9,6 +9,7 @@ import { type Aud0OutboxRepository, type Aud0OutboxStats, } from "@/src/evidence/aud0-outbox"; +import { LineageEmitter } from "@/src/lineage/lineage-emitter"; import type { OpenLineageRunEvent } from "@/src/lineage/openlineage"; import { SiaxError } from "@/src/platform/errors"; @@ -152,4 +153,43 @@ describe("AUD0 durable outbox", () => { expect(calls).toBe(0); expect(repo.dead[0].error).toBe("PERMANENT_FAILURE:0pt.aud0_outbox"); }); + + it("reports a durable client acknowledgement as queued, not emitted", async () => { + const emitter = new LineageEmitter(client({ + async ingestOpenLineageEvent(tenantId, _appId, input) { + return { + tenant_id: tenantId, + run_id: input.run.runId, + job: input.job.name, + event_id: "outbox:obx-queued-1", + }; + }, + })); + + const result = await emitter.emit({ + tenant_id: "tenant-a", + capability_id: "0pt.test.v1", + run_id: "run-queued", + event_type: "COMPLETE", + event_time: "2026-09-07T12:00:00.000Z", + }); + expect(result).toEqual({ + emitted: false, + queued: true, + run_id: "run-queued", + outbox_id: "obx-queued-1", + }); + }); + + it("reports a raw AUD0 acknowledgement as emitted, not queued", async () => { + const emitter = new LineageEmitter(client()); + const result = await emitter.emit({ + tenant_id: "tenant-a", + capability_id: "0pt.test.v1", + run_id: "run-live", + event_type: "COMPLETE", + event_time: "2026-09-07T12:00:00.000Z", + }); + expect(result).toEqual({ emitted: true, queued: false, run_id: "run-live" }); + }); });