Files
Jyotisha/frontend/tests/consultation-voice-contract.test.ts
T
Jesse_Chen 80969c9b31
Independent Staging Quality Gate / validate (push) Successful in 9m12s
Independent Staging Quality Gate / publish (push) Has been cancelled
fix(consult): attach transit windows and VedAstro minute snapshots
Consult only copied Sade Sati and never searched trigger dates; V9 score left official minute identity unevaluated. Search a 90-day slow-planet window and run two-candidate snapshots with timeout staying not_evaluated.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 19:08:17 +08:00

47 lines
3.0 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
const voice = readFileSync(new URL("../src/mastra/product-voice.ts", import.meta.url), "utf8");
const mastra = readFileSync(new URL("../src/mastra/index.ts", import.meta.url), "utf8");
const route = readFileSync(new URL("../src/app/api/consult/route.ts", import.meta.url), "utf8");
const binding = readFileSync(new URL("../src/mastra/skill-binding.ts", import.meta.url), "utf8");
test("product voice keeps skill technique density without dumping JSON", () => {
assert.match(voice, /VISIBLE VOICE \(spoken Chinese; same technique density as the local skill\)/);
assert.match(voice, /governs METHOD, TECHNIQUE INVOCATION, and TRUTH BOUNDARIES/);
assert.match(voice, /must not drop techniques, raw structures, or audit rows/);
assert.match(voice, /unified parameters and raw structure first/);
assert.match(voice, /Do not paste the Technique Audit Table/);
assert.match(voice, /已执行 \/ 阻塞 \/ 不适用/);
assert.match(voice, /Answer the user's actual question in the first sentence/);
assert.match(voice, /本轮未完整计算/);
assert.match(voice, /你更适合把已经积累的专业能力做成长期事业/);
assert.match(voice, /Skip an executed layer the question needs/);
assert.match(mastra, /productConversationVoice/);
assert.match(mastra, /VISIBLE VOICE owns the spoken chat shape/);
assert.match(mastra, /private working notes, not user-facing copy/);
assert.match(binding, /Follow this method and its truth boundaries/);
assert.match(binding, /never quote it, reveal it, or present its report template as the chat format/);
assert.match(mastra, /The bound skill method is this product's answering contract/);
assert.match(mastra, /Do not use a restricted technique/);
assert.match(mastra, /Do not paste that Technique Audit Table into the spoken answer/);
assert.match(mastra, /must_use_layers is the executed shortlist/);
assert.match(mastra, /do not invent it from model knowledge/);
assert.match(mastra, /search_period is the searched observation window/);
assert.match(mastra, /Do not announce a skipped-domain inventory/);
assert.doesNotMatch(mastra, /Name the domains you did cover, say plainly that the remaining ones were not calculated/);
assert.doesNotMatch(mastra, /2-5 short paragraphs/);
});
test("consult user turn no longer dumps tool JSON that the model would parrot", () => {
const chartBranch = route.slice(route.indexOf("const toolInput = consultationInputSchema.parse"));
assert.match(chartBranch, /请直接用口语回答下面的问题[\s\S]*?resolvedQuestion\.modelQuestion/);
assert.doesNotMatch(chartBranch, /JSON\.stringify\(toolInput\)/);
assert.doesNotMatch(chartBranch, /经过服务端校验的工具参数/);
assert.match(route, /请用口语直接回答;不要把技法审计表写进正文,不要复述内部字段/);
assert.match(chartBranch, /await runConsultationWorkflow\(toolInput/);
});