fix(consult): keep career row hints off the planet nature
Career significator and house-lord rows now carry one presentation sentence. Values stay the same. A second three-repeat biography run still has one field conflict, so this is not accepted. Not pushed.
This commit is contained in:
@@ -16,8 +16,20 @@ export const JUDGMENT_TABLE_LABELS = {
|
||||
relationOccupant: "落入",
|
||||
relationAspect: "照",
|
||||
relationConjunctLord: "与宫主同宫",
|
||||
careerSignificatorReading: "这行只看力量与受冲,不按这颗星的本性写职业类型、做事方式或方向。",
|
||||
} as const;
|
||||
|
||||
const CAREER_JAIMINI_ROLES = new Set(["AmK", "DK", "PK", "MK", "PiK"]);
|
||||
|
||||
/** Presentation only. Career significator rows keep their copied values. */
|
||||
function careerSignificatorReading(domain: string, role: string | null): { reading: string } | Record<string, never> {
|
||||
if (domain !== "career" || !role) return {};
|
||||
const dasha = role.startsWith("Vimshottari");
|
||||
const named = role === "natural" || role === "lord" || role === "Narayana MD lord" || CAREER_JAIMINI_ROLES.has(role);
|
||||
if (!dasha && !named) return {};
|
||||
return { reading: JUDGMENT_TABLE_LABELS.careerSignificatorReading };
|
||||
}
|
||||
|
||||
const MALEFIC_BODIES = ["Saturn", "Mars", "Rahu", "Ketu"] as const;
|
||||
const ASPECT_MALEFICS = ["Saturn", "Mars"] as const;
|
||||
const DUSTHANA = new Set([6, 8, 12]);
|
||||
@@ -247,6 +259,7 @@ export function assembleJudgmentTable(facts: unknown): JsonRecord {
|
||||
const body = record(facts);
|
||||
const planets = record(body.planets);
|
||||
const houses = record(body.houses);
|
||||
const domain = typeof body.domain === "string" ? body.domain : "";
|
||||
const rows: Json[] = [];
|
||||
const factors = Array.isArray(body.factors) ? body.factors : [];
|
||||
for (const factor of factors) {
|
||||
@@ -276,6 +289,7 @@ export function assembleJudgmentTable(facts: unknown): JsonRecord {
|
||||
role: "lord",
|
||||
citation,
|
||||
...planetColumns(lord, planets, houses, "lord"),
|
||||
...careerSignificatorReading(domain, "lord"),
|
||||
});
|
||||
} else {
|
||||
rows.push({ id: `${id}:lord`, kind: "gap", citation, path: leaf(house.lord).path ?? null });
|
||||
@@ -283,12 +297,14 @@ export function assembleJudgmentTable(facts: unknown): JsonRecord {
|
||||
continue;
|
||||
}
|
||||
if (item.kind === "planet" && typeof item.planet === "string") {
|
||||
const role = typeof item.role === "string" ? item.role : null;
|
||||
rows.push({
|
||||
id,
|
||||
kind: "planet",
|
||||
role: typeof item.role === "string" ? item.role : null,
|
||||
role,
|
||||
citation,
|
||||
...planetColumns(item.planet, planets, houses, typeof item.role === "string" ? item.role : undefined),
|
||||
...planetColumns(item.planet, planets, houses, role ?? undefined),
|
||||
...careerSignificatorReading(domain, role),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
@@ -312,7 +328,7 @@ export function assembleJudgmentTable(facts: unknown): JsonRecord {
|
||||
}
|
||||
return {
|
||||
header_note: typeof body.header_note === "string" ? body.header_note : JUDGMENT_TABLE_LABELS.rahuNote,
|
||||
domain: typeof body.domain === "string" ? body.domain : "",
|
||||
domain,
|
||||
domain_varga: typeof body.domain_varga === "string" ? body.domain_varga : "",
|
||||
rows,
|
||||
};
|
||||
@@ -374,6 +390,7 @@ function compactPlanetRows(rows: Json[]): Json[] {
|
||||
const repeat: JsonRecord = { id: row.id, kind: row.kind, planet: row.planet };
|
||||
if (typeof row.role === "string") repeat.role = row.role;
|
||||
if (typeof row.citation === "string") repeat.citation = row.citation;
|
||||
if (typeof row.reading === "string") repeat.reading = row.reading;
|
||||
if (row.affliction !== undefined) repeat.affliction = row.affliction;
|
||||
return repeat;
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { buildEvidenceCard } from "../src/lib/consultation-evidence-card.ts";
|
||||
import { assembleJudgmentTable, JUDGMENT_TABLE_LABELS } from "../src/lib/consultation-judgment-table.ts";
|
||||
import { assembleJudgmentTable, judgmentTableModelView, JUDGMENT_TABLE_LABELS } from "../src/lib/consultation-judgment-table.ts";
|
||||
import type { ConsultationDomain } from "../src/lib/consultation-domain-registry.ts";
|
||||
import { createConsultationPlan } from "../src/lib/consultation-plan.ts";
|
||||
import {
|
||||
@@ -129,6 +129,47 @@ test("the judgment table copies leaves and does not turn the count into a verdic
|
||||
assert.deepEqual((rahu.co_tenants as { value: string[] }).value, ["Mars"]);
|
||||
const blocked = rows.find((row) => row.id === "jaimini");
|
||||
assert.equal(blocked?.kind, "blocked");
|
||||
const house = rows.find((row) => row.id === "house:10");
|
||||
assert.equal(house?.reading, undefined);
|
||||
assert.equal(lord.reading, JUDGMENT_TABLE_LABELS.careerSignificatorReading);
|
||||
assert.equal(rahu.reading, JUDGMENT_TABLE_LABELS.careerSignificatorReading);
|
||||
});
|
||||
|
||||
// Assertion change:
|
||||
// 原值: 事业判断表的行星行没有呈现句;重复出现的行星只留 id、角色、引用和受冲计数。
|
||||
// 新值: 事业的自然代表星、Jaimini 代表星、大运主星、Narayana 主星和宫主行带同一句呈现文字。婚恋表不带。重复行仍丢掉度数,但留下这句。行星的星座、宫位、旺弱不变。
|
||||
// 原因: 清单句之后仍有 1 次按星性写方向。模型读的是事业宫主行。只加呈现文字,不改取值(TASK-consult-career-type-residual-20261009)。
|
||||
test("career significator rows name strength only, and other domains stay unchanged", () => {
|
||||
const career = assembleJudgmentTable({
|
||||
...facts,
|
||||
factors: [
|
||||
...facts.factors,
|
||||
{ id: "jaimini:AmK", kind: "planet", planet: "Saturn", citation: "jaimini", role: "AmK" },
|
||||
{ id: "jaimini:DK", kind: "planet", planet: "Saturn", citation: "jaimini", role: "DK" },
|
||||
{ id: "vimshottari:md", kind: "planet", planet: "Sun", citation: "vim", role: "Vimshottari MD" },
|
||||
{ id: "narayana:lord", kind: "planet", planet: "Sun", citation: "narayana", role: "Narayana MD lord" },
|
||||
],
|
||||
});
|
||||
const rows = career.rows as Array<Record<string, unknown>>;
|
||||
for (const id of ["house:10:lord", "natural:Saturn", "jaimini:AmK", "jaimini:DK", "vimshottari:md", "narayana:lord"]) {
|
||||
assert.equal(rows.find((row) => row.id === id)?.reading, JUDGMENT_TABLE_LABELS.careerSignificatorReading, id);
|
||||
}
|
||||
const lord = rows.find((row) => row.id === "house:10:lord") as Record<string, unknown>;
|
||||
assert.equal(lord.planet, "Sun");
|
||||
assert.equal((lord.d1_sign as { value: string }).value, "Aries");
|
||||
assert.equal((lord.d1_house as { value: number }).value, 10);
|
||||
assert.equal((lord.d1_dignity as { value: string }).value, "落陷(Debilitated)");
|
||||
const marriage = assembleJudgmentTable({ ...facts, domain: "marriage" });
|
||||
const marriageEncoded = JSON.stringify(marriage);
|
||||
assert.equal(marriageEncoded.includes(JUDGMENT_TABLE_LABELS.careerSignificatorReading), false);
|
||||
assert.equal((marriage.rows as Array<Record<string, unknown>>).find((row) => row.id === "house:10:lord")?.planet, "Sun");
|
||||
const view = judgmentTableModelView(career) as { rows: Array<Record<string, unknown>> };
|
||||
const repeat = view.rows.find((row) => row.id === "vimshottari:md");
|
||||
assert.equal(repeat?.planet, "Sun");
|
||||
assert.equal(repeat?.role, "Vimshottari MD");
|
||||
assert.equal(repeat?.reading, JUDGMENT_TABLE_LABELS.careerSignificatorReading);
|
||||
assert.equal(repeat?.d1_sign, undefined);
|
||||
assert.equal(repeat?.d1_dignity, undefined);
|
||||
});
|
||||
|
||||
test("a card without facts keeps the old section, and facts attach one table", () => {
|
||||
@@ -219,6 +260,11 @@ test("engine facts make a model card without internal paths", () => {
|
||||
assert.equal(encoded.includes("core_chart."), false, `${chart} ${domain}`);
|
||||
assert.equal(encoded.includes("\"check\""), false, `${chart} ${domain}`);
|
||||
assert.equal(encoded.includes("两个及以上"), false);
|
||||
assert.equal(
|
||||
encoded.includes(JUDGMENT_TABLE_LABELS.careerSignificatorReading),
|
||||
domain === "career",
|
||||
`${chart} ${domain}`,
|
||||
);
|
||||
assert.ok(encoded.length <= 20_000, `${chart} ${domain} ${encoded.length}`);
|
||||
const rows = (card.domain_sections[domain as ConsultationDomain]?.judgment_table?.rows ?? []) as Array<Record<string, unknown>>;
|
||||
const hasAspect = rows.some((row) => (
|
||||
|
||||
Reference in New Issue
Block a user