Этап 4 / Волна 19.1 выравнивание живого контура для слоя адресного сбора доказательной базы
This commit is contained in:
@@ -30,9 +30,18 @@ describe("assistant mode API", () => {
|
||||
expect(Array.isArray(response.body.debug?.retrieval_results)).toBe(true);
|
||||
expect(typeof response.body.debug?.temporal_guard_applied).toBe("boolean");
|
||||
expect(typeof response.body.debug?.temporal_guard_outcome).toBe("string");
|
||||
expect(typeof response.body.debug?.temporal_alignment_status).toBe("string");
|
||||
expect(typeof response.body.debug?.temporal_guard_basis).toBe("string");
|
||||
expect(response.body.debug?.domain_polarity_guard).toBeTruthy();
|
||||
expect(Array.isArray(response.body.debug?.raw_numeric_tokens)).toBe(true);
|
||||
expect(Array.isArray(response.body.debug?.classified_numeric_tokens)).toBe(true);
|
||||
expect(Array.isArray(response.body.debug?.rejected_as_non_accounts)).toBe(true);
|
||||
expect(Array.isArray(response.body.debug?.resolved_account_anchors)).toBe(true);
|
||||
expect(response.body.debug?.evidence_admissibility_gate).toBeTruthy();
|
||||
expect(response.body.debug?.grounded_answer_eligibility_guard).toBeTruthy();
|
||||
expect(typeof response.body.debug?.eligibility_time_basis).toBe("string");
|
||||
expect(typeof response.body.debug?.grounded_answer_eligibility_guard?.eligibility_time_basis).toBe("string");
|
||||
expect(typeof response.body.debug?.grounded_answer_eligibility_guard?.business_scope_passed).toBe("boolean");
|
||||
expect(Array.isArray(response.body.conversation)).toBe(true);
|
||||
expect(response.body.conversation.length).toBe(2);
|
||||
});
|
||||
|
||||
@@ -149,7 +149,10 @@ describe("stage4 blocker-pack runtime guards", () => {
|
||||
});
|
||||
expect(temporal.temporal_guard_applied).toBe(true);
|
||||
expect(temporal.temporal_guard_outcome).toBe("passed");
|
||||
expect(temporal.raw_time_scope).toBe("2023-07-06");
|
||||
expect(temporal.resolved_time_anchor).toBe("2020-07-06");
|
||||
expect(temporal.temporal_alignment_status).toBe("corrected");
|
||||
expect(temporal.temporal_guard_basis).toBe("resolved_primary_period");
|
||||
expect(temporal.normalized_anchor_drift_detected).toBe(true);
|
||||
expect(temporal.reason_codes).toContain("normalized_anchor_out_of_primary_window_overridden");
|
||||
});
|
||||
@@ -235,6 +238,25 @@ describe("stage4 blocker-pack runtime guards", () => {
|
||||
expect(units.some((item: any) => item.lifecycle_domain === "customer_settlement")).toBe(false);
|
||||
});
|
||||
|
||||
it("cleans polluted account anchors from date/amount numerics", () => {
|
||||
const guard = resolveDomainPolarityGuard({
|
||||
userMessage: "VAT 233.33 on 13 july 2020 and 15 july 2020, account 68.02 in company snapshot.",
|
||||
focusDomainHint: "vat_document_register_book"
|
||||
});
|
||||
|
||||
expect(guard.account_scope.some((item) => /^68(?:\.|$)/.test(String(item)))).toBe(true);
|
||||
expect(guard.account_scope).not.toContain("13");
|
||||
expect(guard.account_scope).not.toContain("15");
|
||||
expect(guard.rejected_as_non_accounts).toContain("13");
|
||||
expect(guard.rejected_as_non_accounts).toContain("15");
|
||||
expect(
|
||||
guard.classified_numeric_tokens.some((item) => item.token === "13" && item.classification === "date_token")
|
||||
).toBe(true);
|
||||
expect(
|
||||
guard.classified_numeric_tokens.some((item) => item.token === "33" && item.classification === "amount_token")
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects inadmissible live evidence on zero matched_rows and wrong account/date", () => {
|
||||
const userMessage = "Почему по поставщику по счету 60 в июле 2020 хвост не закрыт?";
|
||||
const temporal = resolveTemporalGuard({
|
||||
@@ -301,8 +323,16 @@ describe("stage4 blocker-pack runtime guards", () => {
|
||||
const eligibility = evaluateGroundedAnswerEligibility({
|
||||
temporal: {
|
||||
raw_time_anchor: "6 июля 2020",
|
||||
raw_time_scope: "2023-07-06",
|
||||
resolved_time_anchor: "2020-07-06",
|
||||
resolved_primary_period: {
|
||||
from: "2020-07-06",
|
||||
to: "2020-07-06",
|
||||
granularity: "day"
|
||||
},
|
||||
temporal_alignment_status: "corrected",
|
||||
temporal_resolution_source: "company_snapshot_july_day_lock",
|
||||
temporal_guard_basis: "resolved_primary_period",
|
||||
temporal_guard_applied: true,
|
||||
temporal_guard_outcome: "failed_out_of_snapshot_window",
|
||||
primary_period_window: {
|
||||
@@ -310,6 +340,10 @@ describe("stage4 blocker-pack runtime guards", () => {
|
||||
to: "2020-07-06",
|
||||
granularity: "day"
|
||||
},
|
||||
allowed_context_window: null,
|
||||
controlled_temporal_expansion_enabled: true,
|
||||
context_expansion_reasons_allowed: ["prehistory", "carryover", "post_period_closure", "long_running_contract_context"],
|
||||
normalized_anchor_drift_detected: true,
|
||||
reason_codes: ["normalized_anchor_out_of_snapshot_window"]
|
||||
},
|
||||
polarity: {
|
||||
@@ -319,6 +353,15 @@ describe("stage4 blocker-pack runtime guards", () => {
|
||||
supplier_score: 3,
|
||||
customer_score: 0,
|
||||
account_scope: ["60"],
|
||||
raw_numeric_tokens: ["6", "2020", "60"],
|
||||
classified_numeric_tokens: [
|
||||
{
|
||||
token: "60",
|
||||
classification: "account_token"
|
||||
}
|
||||
],
|
||||
rejected_as_non_accounts: ["6", "2020"],
|
||||
resolved_account_anchors: ["60"],
|
||||
rejected_problem_units: 0,
|
||||
rejected_evidence: 0,
|
||||
critical_contradiction: false,
|
||||
|
||||
Reference in New Issue
Block a user