Files
Jyotisha/frontend/tests/consultation-workflow-contract.test.ts
T
732642856 4ceb3a5157 feat: enforce commercial rectification evidence contracts
* feat: enforce precise timing output contract

* fix: recognize package imports in fragment audit

* test: make workflow stream contract formatting-independent

* fix: preserve VedAstro evidence across async workflows

* feat: enforce commercial technique truth contract

* feat: add rectification technique receipt

* feat: extend rectification event evidence

* feat: score rectification arudha evidence

* feat: gate high rigor rectification confirmation

* feat: add controlled transit to rectification

* feat: include d11 in rectification finance scoring

* feat: add ashtakavarga rectification auxiliary

* feat: show rectification technique receipt

* feat: use verified shadbala components in rectification

* fix: trace transitive script references in fragment audit

* feat: run request-level rectification parity packet
2026-07-19 22:23:29 +08:00

37 lines
1.7 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
const route = readFileSync(new URL("../src/app/api/consult/route.ts", import.meta.url), "utf8");
const mastra = readFileSync(new URL("../src/mastra/index.ts", import.meta.url), "utf8");
test("runs the Jyotish workflow before streaming a commercial consultation", () => {
assert.match(route, /runConsultationWorkflow/);
assert.match(route, /await runConsultationWorkflow\(toolInput\)/);
assert.match(route, /getJyotishAgent\(selectedModel, workflowContext\)\.stream/);
assert.ok(route.indexOf("await runConsultationWorkflow(toolInput)") < route.indexOf(".stream("));
});
test("grounds the answer in the server-computed workflow without a second tool run", () => {
assert.match(mastra, /function getJyotishAgent\(model: ResolvedLanguageModel, workflowContext\?/);
assert.match(mastra, /workflowContext \? \{\} : \{ consultationTool \}/);
assert.match(mastra, /server-computed Jyotish workflow/);
});
test("validates and emits a non-sensitive workflow receipt", () => {
assert.match(mastra, /consultationWorkflowResponseSchema/);
assert.match(mastra, /safeParse\(data\)/);
assert.match(mastra, /consultationWorkflowReceipt/);
assert.match(route, /workflowReceipt/);
assert.match(route, /x-jyotish-workflow-route/);
assert.match(route, /x-jyotish-workflow-status/);
});
test("carries commercial technique truth into the model contract", () => {
assert.match(mastra, /technique_truth/);
assert.match(mastra, /deterministic_claims_forbidden_for/);
assert.match(mastra, /reference_only/);
assert.match(mastra, /Do not use a restricted technique/);
assert.match(route, /x-jyotish-technique-truth/);
});