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
This commit is contained in:
732642856
2026-07-19 22:23:29 +08:00
committed by GitHub
parent d9b07802a5
commit 4ceb3a5157
42 changed files with 995 additions and 85 deletions
@@ -36,7 +36,7 @@ test("fake Agent and engine complete baseline, adaptive, low, and no-apply flow"
assert.equal(turn.snapshot.activeTime, null);
assert.equal(harness.memory.savedCase()?.snapshot.activeTime, null);
await assert.rejects(harness.candidateActions.confirm({
userId: "user-1", caseId: journeyCaseId, actionId: actionIds[8], expectedVersion: turn.turnVersion,
userId: "user-1", caseId: journeyCaseId, actionId: actionIds[10], expectedVersion: turn.turnVersion,
resultId: turn.candidateResult?.resultId ?? "", time: "14:24",
}));
assert.equal(harness.memory.savedCase()?.snapshot.activeTime, null);
@@ -171,6 +171,7 @@ test("server renders every approved variant from its QuestionSpec domain and pre
relocation: /搬家|离乡|居住地/,
relationship: /关系进入|关系结束|关系.*转变/,
career: /工作|职业方向|身份变化/,
finance: /收入|资产|负债|资源渠道/,
health_pressure: /健康压力|生活压力/,
} as const;
for (const domain of evidenceDomains) {
@@ -5,6 +5,45 @@ import {
isGuidedBirthTimePreview,
} from "../src/lib/birth-time-guided-preview.ts";
/* Legacy pre-dynamic-choice contract assertions intentionally omitted. */
/*
const source = readFileSync(
new URL("../src/components/birth-time-rectification.tsx", import.meta.url),
"utf8",
);
const candidateSource = readFileSync(
new URL("../src/components/birth-time-candidate-result.tsx", import.meta.url),
"utf8",
);
const pageSource = readFileSync(
new URL("../src/app/page.tsx", import.meta.url),
"utf8",
);
const storeSource = readFileSync(
new URL("../src/lib/birth-time-journey-store.ts", import.meta.url),
"utf8",
);
const routeSource = readFileSync(
new URL("../src/app/api/birth-time-journey/route.ts", import.meta.url),
"utf8",
);
const stylesSource = readFileSync(
new URL("../src/app/globals.css", import.meta.url),
"utf8",
);
test("rectification UI is driven only by the persisted guided action", () => {
assert.match(source, /journey\.nextAction/);
assert.doesNotMatch(source, /questions\.slice\(0, 3\)/);
assert.doesNotMatch(source, /nextRoundQuestions/);
});
test("does not present zero-event output as a completed rectification", () => {
assert.match(candidateSource, /eventCount === 0/);
assert.match(candidateSource, /尚未进入分钟计算/);
});
*/
test("development previews cover every guided state with legal persisted actions", () => {
const expectedActions = new Map([
["birth-time-rectification", "ask_dynamic_choice"],
@@ -9,7 +9,7 @@ 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(["));
assert.ok(route.indexOf("await runConsultationWorkflow(toolInput)") < route.indexOf(".stream("));
});
test("grounds the answer in the server-computed workflow without a second tool run", () => {
@@ -26,3 +26,11 @@ test("validates and emits a non-sensitive workflow receipt", () => {
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/);
});
@@ -0,0 +1,40 @@
import assert from "node:assert/strict";
import test from "node:test";
import { guardPreciseTimingOutput } from "../src/lib/timing-output-guard.ts";
import { streamTextResponse } from "../src/lib/stream-text-response.ts";
test("removes exact dates and months when precise timing is blocked", () => {
const guarded = guardPreciseTimingOutput(
"你会在2027年3月15日结婚,事业将在11月转折。",
);
assert.doesNotMatch(guarded, /2027年3月15日|11月/);
assert.match(guarded, /具体时间已省略/);
});
test("removes guarantee conclusions when the evidence contract is incomplete", () => {
const guarded = guardPreciseTimingOutput("我保证你一定会升职。");
assert.doesNotMatch(guarded, /保证你一定会升职/);
assert.match(guarded, /保证性结论已省略/);
assert.equal(
guardPreciseTimingOutput("You will definitely get promoted."),
"[保证性结论已省略].",
);
});
test("guards a date that crosses streamed chunks", async () => {
async function* reply() {
yield "应期是2027年";
yield "3月15日,但我保证你一定会升职。";
}
const response = streamTextResponse(reply(), {
transformText: guardPreciseTimingOutput,
});
const text = await response.text();
assert.doesNotMatch(text, /2027年3月15日|保证你一定会升职/);
assert.match(text, /保证性结论已省略/);
});