feat: durable AUD0 outbox + dataset/search/ER HTTP surfaces + P065 stängd (kod, utan workflow-ändringar) #43

Merged
admin merged 68 commits from feat/aud0-outbox-code-20260907 into main 2026-09-07 17:53:04 +00:00
Showing only changes of commit d45eb74772 - Show all commits
+91 -25
View File
@@ -72,30 +72,7 @@ describe("POST /api/0pt/internal/er/candidates", () => {
]);
});
it("allows an exact stable company identifier hard rule to emit match", async () => {
const res = await candidatesPOST(
request(
baseBody([
{
record_id: "a",
fields: { name: "Acme Sweden AB", city: "Stockholm", org_nr: "556000-0001" },
},
{
record_id: "b",
fields: { name: "Acme Sverige", city: "Stockholm", org_nr: "556000-0001" },
},
]),
),
);
expect(res.status).toBe(200);
const body = await res.json();
expect(body.pairs).toHaveLength(1);
expect(body.pairs[0].status).toBe("match");
expect(body.pairs[0].decided_by).toBe("0pt.company.stable-identifiers.v2");
expect(body.review_queue).toEqual([]);
});
it("lets conflicting stable identity evidence dominate a matching identifier", async () => {
it("allows a same-country registration number to hard-link despite punctuation differences", async () => {
const res = await candidatesPOST(
request(
baseBody([
@@ -104,6 +81,72 @@ describe("POST /api/0pt/internal/er/candidates", () => {
fields: {
name: "Acme Sweden AB",
city: "Stockholm",
registration_country: "SE",
org_nr: "556000-0001",
},
},
{
record_id: "b",
fields: {
name: "Acme Sverige",
city: "Stockholm",
registration_country: "se",
org_nr: "5560000001",
},
},
]),
),
);
expect(res.status).toBe(200);
const body = await res.json();
expect(body.pairs).toHaveLength(1);
expect(body.pairs[0].status).toBe("match");
expect(body.pairs[0].decided_by).toBe("0pt.company.stable-identifiers.v3");
expect(body.review_queue).toEqual([]);
});
it("does not treat the same national registration number in different countries as global identity", async () => {
const res = await candidatesPOST(
request(
baseBody([
{
record_id: "a",
fields: {
name: "Acme Consulting AB",
city: "Stockholm",
registration_country: "SE",
org_nr: "123456789",
},
},
{
record_id: "b",
fields: {
name: "Acme Consulting A B",
city: "Stockholm",
registration_country: "NO",
org_nr: "123456789",
},
},
]),
),
);
expect(res.status).toBe(200);
const body = await res.json();
expect(body.pairs).toHaveLength(1);
expect(body.pairs[0].decided_by).toBe("score");
expect(body.pairs[0].status).toBe("pending_review");
});
it("lets conflicting stable identity evidence dominate a matching global LEI", async () => {
const res = await candidatesPOST(
request(
baseBody([
{
record_id: "a",
fields: {
name: "Acme Sweden AB",
city: "Stockholm",
registration_country: "SE",
lei: "549300EXAMPLE123",
org_nr: "556000-0001",
},
@@ -113,6 +156,7 @@ describe("POST /api/0pt/internal/er/candidates", () => {
fields: {
name: "Acme Sweden AB",
city: "Stockholm",
registration_country: "SE",
lei: "549300EXAMPLE123",
org_nr: "556000-9999",
},
@@ -124,6 +168,28 @@ describe("POST /api/0pt/internal/er/candidates", () => {
const body = await res.json();
expect(body.pairs).toHaveLength(1);
expect(body.pairs[0].status).toBe("non_match");
expect(body.pairs[0].decided_by).toBe("0pt.company.stable-identifiers.v2");
expect(body.pairs[0].decided_by).toBe("0pt.company.stable-identifiers.v3");
});
it("can hard-link a globally matching LEI when no scoped identifier contradicts it", async () => {
const res = await candidatesPOST(
request(
baseBody([
{
record_id: "a",
fields: { name: "Acme Holding", city: "Stockholm", lei: "549300-EXAMPLE-123" },
},
{
record_id: "b",
fields: { name: "ACME Holdings Group", city: "Stockholm", lei: "549300EXAMPLE123" },
},
]),
),
);
expect(res.status).toBe(200);
const body = await res.json();
expect(body.pairs).toHaveLength(1);
expect(body.pairs[0].status).toBe("match");
expect(body.pairs[0].decided_by).toBe("0pt.company.stable-identifiers.v3");
});
});