Files
Jyotisha/frontend/tests/partial-support-2420.test.ts
ClaudeandClaude Opus 5.5 d070cd7809
Independent Staging Quality Gate / validate-frontend (push) Successful in 6m41s
Independent Staging Quality Gate / validate-python (push) Successful in 8m7s
Independent Staging Quality Gate / publish (push) Successful in 3m50s
fix(chat): read a partly met yoga through what is met instead of setting it aside; never write it as formed (BUG-2420)
The card's yoga row lists the met conditions with the participants' real placements and what is missing; the plain voice
asks for a synthesis of the met part with lords, dispositors, aspects, vargas and strength, support and pressure together,
and converging time windows; dismissive clauses (没有据此加强 / 强弱另评 / 还不能明确判断 / 不单独当成…依据) are dropped in
body and basis; the internal-word table and the 「解读依据」 line say 只对上一部分条件 / 盘上有这个组合. Reports unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
2026-11-26 17:18:13 +08:00

113 lines
8.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// BUG-2420 (占星师 2026-11-26 via owner, owner agrees; coordinator addition): a partly met yoga is read through what IS met
// as a tendency, never set aside (「没有据此加强结论」「还不能明确判断」「强弱另评」) and never written as formed. The card row
// lists the met conditions with the participants' real placements and what is missing; backstage status fields stay.
// Synthetic data only (public AA chart cut).
import assert from "node:assert/strict";
import test from "node:test";
import { cleanChatAnswer } from "../src/lib/chat-answer-checks.ts";
import { withoutBasisNoise } from "../src/lib/chat-basis-clean.ts";
import { evidenceKeyRows, expandEvidenceKeys } from "../src/lib/chat-evidence-keys.ts";
import type { EvidenceCard } from "../src/lib/consultation-evidence-card.ts";
import { withTechniqueEvidence } from "../src/lib/consultation-technique-evidence.ts";
import { consultAnswerBasisRows } from "../src/lib/consult-answer-basis.ts";
import { chatConversationVoice } from "../src/mastra/product-voice.ts";
import type { TechniqueAuditRow } from "../src/lib/consultation-agent-events.ts";
const SIGNS = ["Capricorn", "Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius"];
const ROWS = [
{ name: "Swaveeryaddhana Yoga", status: "candidate", claim_status: "support_only_candidate", planets: { Saturn: { owns: [1, 2], functional: "benefic", dignity: "入庙(Own Sign)" } } },
{
name: "Mahabhagya Yoga", status: "computed", formation: { status: "candidate" },
formation_checks: [
{ id: "d1_scope", passed: null }, { id: "consistent_geometry", passed: true }, { id: "sign_parity", passed: true },
{ id: "gender", passed: null }, { id: "birth_is_daytime", passed: null },
],
},
{ name: "Raja Yoga", status: "computed", formation: { status: "conditions_not_met" }, formation_checks: [{ id: "lord_structure", passed: false }], planets: { Venus: { owns: [5, 10] } } },
{ name: "Sasa Yoga", status: "computed", conditions_met: ["土星入庙在角宫"] },
// an index row carries only its rule state
{ name: "Chandra Yoga", status: "computed", evaluation_status: "candidate", card_presentation: "index" },
// a completed source check outranks the candidate status
{ name: "Amala Yoga", status: "candidate", formation: { status: "formed_under_source" } },
];
function card(): EvidenceCard {
return {
domains: ["wealth"],
domain_sections: { wealth: { yogas: { hits: ["Swaveeryaddhana Yoga", "Mahabhagya Yoga"] } } },
base: {
natal: {
ascendant: { sign: "Capricorn" },
houses: Object.fromEntries(SIGNS.map((sign, index) => [String(index + 1), sign])),
planets: {
Saturn: { sign: "Capricorn", house: 1, degree_in_sign: 3.46, nakshatra: "Uttara Ashadha", status: "入庙(Own)" },
Venus: { sign: "Gemini", house: 6, degree_in_sign: 9.92, nakshatra: "Ardra", status: "极友(Great Friend)" },
},
functional_benefic_malefic: { functional_benefics: ["Saturn"], yogakarakas: ["Venus"] },
yogas_detail: { rows: ROWS },
},
},
} as unknown as EvidenceCard;
}
test("a partly met yoga row lists what is met with real placements and what is missing; never 「有 X」", () => {
const rows = evidenceKeyRows(card()).filter((row) => row.table === "natal.yogas");
const text = (name: string) => rows.find((row) => row.label === name)?.text ?? "";
assert.equal(text("Swaveeryaddhana Yoga"), "Swaveeryaddhana Yoga:只对上一部分条件;对上的:土星(管第 1、2 宫,在第 1 宫摩羯,入庙,功能吉星)");
// computed but its executed formation is incomplete: partial, the technical checks (D1 scope, geometry) are not named.
assert.equal(text("Mahabhagya Yoga"), "Mahabhagya Yoga:只对上一部分条件;对上的:上升与太阳、月亮同为阳性或同为阴性星座;缺的:性别与星座阴阳相合没有算出、白天或夜里出生与星座阴阳相合没有算出");
assert.match(text("Raja Yoga"), /^Raja Yoga:只对上一部分条件;对上的:金星(管第 5、10 宫,在第 6 宫双子,极友,功能大吉星(Yogakaraka));缺的:角宫主与三方宫主结合不满足$/u);
assert.equal(text("Sasa Yoga"), "有 Sasa Yoga(土星入庙在角宫)");
assert.equal(text("Chandra Yoga"), "Chandra Yoga:只对上一部分条件");
assert.equal(text("Amala Yoga"), "有 Amala Yoga");
for (const name of ["Swaveeryaddhana Yoga", "Mahabhagya Yoga", "Raja Yoga"]) assert.doesNotMatch(text(name), /^有 |成立|待核|还不能明确判断/u);
// the card's backstage status is untouched
assert.equal(ROWS[0]!.status, "candidate");
});
test("a partial row cited twice is said again by its lead, not cut inside its participants", () => {
const rows = evidenceKeyRows(card());
const key = rows.find((row) => row.label === "Swaveeryaddhana Yoga")!.key;
const answer = `## 判断依据\n\n- **钱靠自己**:说明。〔${key}〕\n- **另一条**:说明。〔${key}〕\n`;
const out = expandEvidenceKeys(answer, card()).output;
assert.match(out, /Swaveeryaddhana Yoga:只对上一部分条件。?\n?/u);
assert.equal([...out.matchAll(/对上的:土星/gu)].length, 1, out);
});
test("dismissive clauses go from body and basis; tendency words stay", () => {
const answer = [
"## 结论", "你的钱主要靠自己的本事。",
"## 你在钱上的长处和短处", "**你更容易靠手艺挣钱。** 这一点可能表现为客户回头找你,倾向于一单一结。",
"## 判断依据",
"- **财富格局状态**:Swaveeryaddhana 与 Dharidhra 都只对上了一部分条件,没有据此加强结论。",
"- **客户**:两个组合都只对上了一部分条件、强弱另评。",
"- **性格**:第 7 宫主月亮入旺;Satkalatra 格局目前还不能明确判断,是长年的底色。",
// BUG-2420 real timing run: a formed yoga set aside the same way
"- **Sasa 格局**:算出有这个格局,同时记着它被太阳照而减弱,不单独当成事业成就的依据。",
].join("\n");
const out = cleanChatAnswer(answer, null).output;
assert.doesNotMatch(out, /据此加强|强弱另评|还不能明确判断|不单独当成/u, out);
assert.match(out, /同时记着它被太阳照而减弱/u);
assert.match(out, /更容易靠手艺挣钱/u);
assert.match(out, /可能表现为客户回头找你,倾向于一单一结/u);
assert.match(out, /Swaveeryaddhana 与 Dharidhra 都只对上了一部分条件/u);
// stored answers: the basis shown under an old answer drops the same clauses
assert.equal(withoutBasisNoise("Swaveeryaddhana 与 Dharidhra 都只对上了一部分条件,没有据此加强结论。"), "Swaveeryaddhana 与 Dharidhra 都只对上了一部分条件。");
});
test("the 「解读依据」 yoga line reads a partial row as partial and a detected one as present", () => {
const audit = [{ technique: "Yogas", calculation_status: "executed", interpretation_status: "observation_only" } as unknown as TechniqueAuditRow];
const result = consultAnswerBasisRows(withTechniqueEvidence(audit, card()) ?? []).find((row) => row.name === "格局")?.result ?? "";
assert.match(result, /Swaveeryaddhana Yoga、Mahabhagya Yoga:只对上一部分条件/u, result);
assert.doesNotMatch(result, /还不能明确判断|盘上有这个组合/u);
});
test("the plain voice asks for synthesis of the met part, support with pressure, and converging time windows", () => {
assert.match(chatConversationVoice, /只对上一部分条件」时,不说盘上有这个格局,也不把它丢开/u);
assert.match(chatConversationVoice, /帮的一面和压的一面一起说成一件事/u);
assert.match(chatConversationVoice, /几条时间依据指到同一段时/u);
assert.match(chatConversationVoice, /表里没有的不写/u);
// the dismissive phrases are named by meaning, never quoted (a quoted phrase primes the model)
assert.doesNotMatch(chatConversationVoice, /据此加强|强弱另评|还不能明确判断/u);
});