fix: slutgranskning av dataset/search/ER-ytorna + STATUS-sanning
Security Scan (SIAX Cloud) / security (push) Successful in 16s
CI (SIAX Cloud) / security (push) Successful in 17s
CI (SIAX Cloud) / integration (push) Successful in 29s
CI (SIAX Cloud) / quality (push) Successful in 48s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 15s
CI (SIAX Cloud) / security (pull_request) Successful in 28s
CI (SIAX Cloud) / quality (pull_request) Successful in 48s
CI (SIAX Cloud) / integration (pull_request) Successful in 55s
Python Engine CI (SIAX Cloud) / python-engine (push) Failing after 4m52s
Python Engine CI (SIAX Cloud) / python-engine (pull_request) Failing after 4m48s
Security Scan (SIAX Cloud) / security (push) Successful in 16s
CI (SIAX Cloud) / security (push) Successful in 17s
CI (SIAX Cloud) / integration (push) Successful in 29s
CI (SIAX Cloud) / quality (push) Successful in 48s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 15s
CI (SIAX Cloud) / security (pull_request) Successful in 28s
CI (SIAX Cloud) / quality (pull_request) Successful in 48s
CI (SIAX Cloud) / integration (pull_request) Successful in 55s
Python Engine CI (SIAX Cloud) / python-engine (push) Failing after 4m52s
Python Engine CI (SIAX Cloud) / python-engine (pull_request) Failing after 4m48s
Slutgate inför merge (per fortsättningsplan): Kontrakt: CreateDatasetVersionInput.artifact_refs → readonly string[] (anropare får skicka 'as const'; servicen muterar aldrig); postgres.js tx.array() får muterbar kopia vid INSERT. Testkorrigeringar (stale mot starkare implementation — aldrig svagare): - entity-resolution-http: request(body, undefined) triggade default-param och skickade GILTIGT token → 200. Tomt token = 'utan token' → 401 fail-closed. - entity-resolution: /two records/ → /between 2 and 5000/ (bounds-aware validering) - search-service: omformat purpose-filter-test + NY negativ kontroll — rebuild avvisar dokument utan purpose_tags (fail closed, generation discarded) - dataset-postgres.realinfra: sätter DATABASE_URL i setup så den durabla AUD0-outboxen aktiveras (testet ljög annars om durabilitet) — 5/5 mot live Postgres STATUS.md: AUD0-klient + lineage-rader (outbox nu real-infra testad), gap-listan (persistence/routes/outbox stängda, exakt vad som återstår), P065 STÄNGD med closure-record (thin adapter, v3-semantik, hard-negative transitivitet, fail-closed 401 — 4/4 planpunkter verifierade). Verifierat: typecheck EXIT 0 · 945/945 unit · 5/5 real-Postgres · next build EXIT 0
This commit is contained in:
@@ -34,6 +34,10 @@ beforeAll(async () => {
|
||||
for (const migration of ["003_datasets.sql", "011_aud0_evidence_outbox.sql", "012_dataset_versions.sql"]) {
|
||||
await admin.unsafe(fs.readFileSync(path.join(process.cwd(), "sql", migration), "utf8"));
|
||||
}
|
||||
// Aktivera den durabla AUD0-outboxen: createAud0OutboxRepositoryFromEnv()
|
||||
// läser DATABASE_URL (se src/repositories/db.ts) — utan den blir klienten
|
||||
// Noop och inga producer-rader skrivs (testet skulle ljugit om durabilitet).
|
||||
process.env.DATABASE_URL = TEST_DATABASE_URL;
|
||||
reachable = true;
|
||||
} catch (error) {
|
||||
unreachableReason = error instanceof Error ? error.message : String(error);
|
||||
@@ -41,6 +45,7 @@ beforeAll(async () => {
|
||||
}, 30_000);
|
||||
|
||||
afterAll(async () => {
|
||||
delete process.env.DATABASE_URL;
|
||||
await admin?.end({ timeout: 5 });
|
||||
await closeRepositorySqlForTests();
|
||||
});
|
||||
|
||||
@@ -40,13 +40,15 @@ afterEach(() => {
|
||||
|
||||
describe("POST /api/0pt/internal/er/candidates", () => {
|
||||
it("fails closed without the internal service token", async () => {
|
||||
// OBS: request(body, undefined) triggar default-parametern (skickar GILTIGT
|
||||
// token) — skicka tom string för "utan token" (fail-closed → 401).
|
||||
const res = await candidatesPOST(
|
||||
request(
|
||||
baseBody([
|
||||
{ record_id: "a", fields: { name: "Acme AB", city: "Stockholm" } },
|
||||
{ record_id: "b", fields: { name: "Acme AB", city: "Stockholm" } },
|
||||
]),
|
||||
undefined,
|
||||
"",
|
||||
),
|
||||
);
|
||||
expect(res.status).toBe(401);
|
||||
|
||||
@@ -97,7 +97,7 @@ describe("EntityResolutionService — candidate API", () => {
|
||||
expect(() =>
|
||||
er.generateCandidates(request({ auto_match_threshold: 0.5, review_threshold: 0.6 }))
|
||||
).toThrowError(/review_threshold/);
|
||||
expect(() => er.generateCandidates(request({ records: [RECORDS[0]] }))).toThrowError(/two records/);
|
||||
expect(() => er.generateCandidates(request({ records: [RECORDS[0]] }))).toThrowError(/between 2 and 5000/);
|
||||
expect(() => er.generateCandidates(request({ tenant_id: "" }))).toThrowError(/tenant_id/);
|
||||
});
|
||||
|
||||
|
||||
@@ -160,12 +160,26 @@ describe("SearchService — tenant + purpose/rights enforcement (§10/§31)", ()
|
||||
const { search } = await build([
|
||||
doc("1", "t_a", "Tagged", { purpose_tags: ["company_enrichment"] }),
|
||||
doc("2", "t_a", "OtherPurpose", { purpose_tags: ["compliance"] }),
|
||||
doc("3", "t_a", "Untagged", { purpose_tags: [] }), // empty ⇒ never returnable
|
||||
]);
|
||||
const res = await search.query("companies", { tenant_id: "t_a", purpose: "company_enrichment" });
|
||||
expect(res.hits.map((h) => h.doc_id)).toEqual(["1"]);
|
||||
});
|
||||
|
||||
it("fails closed: rebuild rejects documents without purpose_tags (§10)", async () => {
|
||||
const fake = new FakeOpenSearch();
|
||||
const search = new SearchService(fake);
|
||||
search.registerIndexDefinition({ ...DEF, fields: { ...DEF.fields } });
|
||||
await expect(
|
||||
search.rebuild(
|
||||
"companies",
|
||||
docsSource([
|
||||
doc("1", "t_a", "Ok"),
|
||||
doc("3", "t_a", "Untagged", { purpose_tags: [] }), // empty ⇒ INVALID_REQUEST, generation discarded
|
||||
]),
|
||||
),
|
||||
).rejects.toThrowError(/missing purpose_tags/);
|
||||
});
|
||||
|
||||
it("rights filtering: default rights tag is 'internal'; deliverable docs need the tag", async () => {
|
||||
const { search } = await build([
|
||||
doc("1", "t_a", "Internal", { rights_tags: ["internal"] }),
|
||||
|
||||
Reference in New Issue
Block a user