feat(decision): Jev ER auto-match shadow (0PT_DECISION_ER_SHADOW)
CI (SIAX Cloud) / integration (push) Has been skipped
masterplan-lock / check (pull_request) Successful in 8s
CI (SIAX Cloud) / security (push) Successful in 24s
CI (SIAX Cloud) / security (pull_request) Successful in 40s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 1m0s
Security Scan (SIAX Cloud) / security (push) Successful in 1m34s
CI (SIAX Cloud) / integration (pull_request) Successful in 1m30s
masterplan-lock / check (push) Successful in 10s
CI (SIAX Cloud) / quality (pull_request) Failing after 24s
CI (SIAX Cloud) / quality (push) Failing after 33s

Shadow-eval av D0 auto-match: D0-tröskeln förblir auktoritet,
kvaliteten mäts fire-and-forget mot siax-decision (:4600,
decisionId 0pt.er.auto_match). Gate 0PT_DECISION_ER_SHADOW=1
(OFF by default). Fail-closed: gate-off/fel/ABSTAINED påverkar
aldrig det deterministiska svaret; decision-planen loggar inbyggt
(AUD0).

- packages/decision: erAutoMatchShadow + erAutoMatchShadowEnabled
- src/er/comparePair: void erAutoMatchShadow(...).catch(() => null)
- tests/p0/decision-er-shadow.test.ts: gate-off/on, POST-body,
  DECIDED/ABSTAINED, fetch-fel, fire-and-forget-wire (16 nya tester)
This commit is contained in:
Claude Code
2026-09-23 16:53:55 +02:00
parent 63a837ff1e
commit dd4731aa3c
3 changed files with 198 additions and 1 deletions
+12 -1
View File
@@ -9,7 +9,7 @@
* an adapter to this canonical decision engine.
*/
import crypto from "crypto";
import { erMatchDecision, erDecisionEnabled } from "@siax/0pt-decision";
import { erMatchDecision, erDecisionEnabled, erAutoMatchShadow } from "@siax/0pt-decision";
import type { N0dClient, N0dJob } from "../clients/n0d-client";
import { SiaxError } from "../platform/errors";
import { isResourceRef } from "../platform/resource-ref";
@@ -247,6 +247,17 @@ export class EntityResolutionService {
});
if (m.decided && m.label) status = m.label as ErCandidateStatus;
}
// Shadow-eval (Jev-everywhere): D0 auto-match förblir auktoritet —
// kvaliteten mäts fire-and-forget mot beslutsplanet (0PT_DECISION_ER_SHADOW,
// OFF by default). Hängande/felande fetch påverkar ALDRIG svaret.
if (rounded >= autoThreshold) {
void erAutoMatchShadow({
tenant_id: req.tenant_id,
target: { record_id: a.record_id, fields: a.fields },
candidates: [{ record_id: b.record_id, fields: b.fields }],
score: rounded,
}).catch(() => null);
}
return {
candidate_id: `erc_${crypto.randomUUID()}`,
record_a: a.record_id,