Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ee6b7c7cd |
@@ -26274,3 +26274,16 @@
|
||||
- 验证与防复发:`tests/test_consult_qa_rulings_1954.py` 四条、`frontend/tests/consult-qa-rulings-1954.test.ts` 四条;三处被钉住的断言按原值、新值、原因更新。公开测试盘:财富关键项块的 D2 从六个宫位行变成十个 Hora 归属行(上升离分界 0.06 度),依据句相应改写;健康卡 Gulika、Mandi 和财富卡 Indu 的参与行从 blocked 变成带位置和说明的辅助行。未调用模型,没有验证回答怎么用这些改动。
|
||||
- 关联记录:BUG-1943、BUG-1944、BUG-1945、BUG-1907。
|
||||
- 修复版本:`claude/qa-rulings-1954`,未推送。
|
||||
|
||||
## BUG-1955 | 财富题判断表仍把 D2 的整宫位交给模型;个人报告解读材料同样,并把三个辅助点读成主要依据
|
||||
|
||||
- 状态:fixed-pending-verify(未推送)。
|
||||
- 首次发现 / 最近更新:2026-11-17 / 2026-11-17。
|
||||
- 触发与现象:BUG-1954 把关键项块里的 D2 改成了两座 Hora 的归属,但财富题判断表每颗星还带 `domain_varga_house`,值是 D2 里从分盘上升按整宫数出的宫位,并且落 6 / 8 / 12 宫时记一条受冲信号。个人报告的解读材料里 `varga_charts.D2` 和 `planets_in_varga` 也是同样的宫位。另外,BUG-1954 之后个人报告解读材料把 Gulika、Maandi、Indu Lagna 读成了主要依据,三条已有测试在 staging 上失败。
|
||||
- 触发条件:财富类聊天提问;个人报告的财富部分;个人报告的健康、财富参与表。
|
||||
- 根因:BUG-1907 给所有领域分盘统一补了整宫位,没有区分构造;产品算的 D2 是两座 Hora 映射,占星师 2026-11-17 Q8 裁定这种 D2 没有被认可的十二宫读法。BUG-1954 只改了关键项块,并且改领域事实时没有跑读同一份事实的个人报告测试。
|
||||
- 修复:`scripts/consult_card_domain_facts.py` 对 D2 给 `domain_varga_hora` / `domain_varga_horas`(照数据包里 D2 的落座读太阳或月亮 Hora,带核对),不再给宫位;`frontend/src/lib/consultation-judgment-table.ts` 判断表行改带 Hora,第 5 类受冲信号对 D2 不算,旧事实里的 D2 宫位在组表时去掉;`scripts/report_render/reading_facts.py` 的 D2 给 Hora 不给宫位,三个辅助点记为辅助层并带位置记录(不带经度键,不带只给聊天用的分析说明)。其余领域分盘都是十二座的具名分法,没有改。提示词和检查清单里没有要求读「D2 第几宫」的句子,没有改文字。
|
||||
- 没有做的(留给产品负责人):年度报告财富部分的「D2 上升主在第几宫」、个人报告导出的 D2「整宫宫位」表和开头导读分盘表、星盘页 D2 表的宫位列,都是用户可见的版面或文案。
|
||||
- 验证与防复发:`tests/test_d2_hora_leftovers_1955.py` 三条、`frontend/tests/consult-d2-hora-leftovers-1955.test.ts` 三条;`tests/test_reading_facts_v3_20261112.py` 与 `tests/test_reading_status_axes_20261112.py` 被钉住的断言按原值、新值、原因更新。公开测试盘财富题判断表改前改后已对比。没有调用模型。
|
||||
- 关联记录:BUG-1907、BUG-1954、BUG-1852。
|
||||
- 修复版本:`claude/d2-house-leftovers-1955`,未推送。
|
||||
|
||||
@@ -124,7 +124,11 @@ function afflictionForPlanet(
|
||||
if (debilitated(dignity)) details.push({ signal: 4, via: "d1_dignity", value: dignity as Json });
|
||||
if (leafValue(row.combust) === true) details.push({ signal: 4, via: "combust", value: true });
|
||||
const varga = leaf(row.domain_varga_house);
|
||||
if (varga.status === "withheld" || varga.status === "gap" || varga.status === undefined) {
|
||||
// BUG-1955 (占星师 2026-11-17 Q8): a two-Hora D2 has no house to read, so signal 5 does not
|
||||
// apply to it; it is not an unevaluated layer either.
|
||||
if (row.domain_varga_hora !== undefined) {
|
||||
// no house-based signal for this construction
|
||||
} else if (varga.status === "withheld" || varga.status === "gap" || varga.status === undefined) {
|
||||
unevaluated.push("domain_varga_house");
|
||||
} else if (isLord && typeof varga.value === "number" && DUSTHANA.has(varga.value)) {
|
||||
details.push({ signal: 5, via: "domain_varga_house", value: varga.value });
|
||||
@@ -143,6 +147,7 @@ function afflictionForHouse(number: number, planets: Record<string, unknown>, ho
|
||||
const unevaluated = ["aspected_by"];
|
||||
let vargaKnown = true;
|
||||
for (const name of MALEFIC_BODIES) {
|
||||
if (record(planets[name]).domain_varga_hora !== undefined) continue;
|
||||
const varga = leaf(record(planets[name]).domain_varga_house);
|
||||
if (varga.status !== "value") {
|
||||
vargaKnown = false;
|
||||
@@ -243,7 +248,9 @@ function planetColumns(
|
||||
d9_sign: leaf(row.d9_sign),
|
||||
d9_dignity: leaf(row.d9_dignity),
|
||||
vargottama: vargottama(row),
|
||||
domain_varga_house: leaf(row.domain_varga_house),
|
||||
...(row.domain_varga_hora !== undefined
|
||||
? { domain_varga_hora: leaf(row.domain_varga_hora) }
|
||||
: { domain_varga_house: leaf(row.domain_varga_house) }),
|
||||
aspected_by: leaf(row.aspected_by),
|
||||
aspects_houses: leaf(row.aspects_houses),
|
||||
relations: relationsFor(planet, planets, houses),
|
||||
@@ -252,9 +259,27 @@ function planetColumns(
|
||||
}
|
||||
|
||||
/** Assemble one domain table from copied facts. Missing leaves stay gaps. */
|
||||
/** Vargas computed as a Hora mapping (two signs): no house is read in them (BUG-1955). */
|
||||
export const JUDGMENT_HORA_VARGAS: readonly string[] = ["D2"];
|
||||
const HORA_VARGA_NO_HOUSE = { status: "not_applicable", check: "hora_varga" } as const;
|
||||
|
||||
/**
|
||||
* Facts saved before BUG-1955 carry a whole-sign house for a D2 domain varga and no Hora.
|
||||
* That house is dropped here, so an old snapshot cannot put it back in front of the model.
|
||||
*/
|
||||
function withoutHoraVargaHouse(planets: Record<string, unknown>, domainVarga: unknown): Record<string, unknown> {
|
||||
if (typeof domainVarga !== "string" || !JUDGMENT_HORA_VARGAS.includes(domainVarga)) return planets;
|
||||
return Object.fromEntries(Object.entries(planets).map(([name, value]) => {
|
||||
const row = record(value);
|
||||
if (row.domain_varga_hora !== undefined) return [name, value];
|
||||
const rest = Object.fromEntries(Object.entries(row).filter(([key]) => key !== "domain_varga_house"));
|
||||
return [name, { ...rest, domain_varga_hora: HORA_VARGA_NO_HOUSE }];
|
||||
}));
|
||||
}
|
||||
|
||||
export function assembleJudgmentTable(facts: unknown): JsonRecord {
|
||||
const body = record(facts);
|
||||
const planets = record(body.planets);
|
||||
const planets = withoutHoraVargaHouse(record(body.planets), body.domain_varga);
|
||||
const houses = record(body.houses);
|
||||
const domain = typeof body.domain === "string" ? body.domain : "";
|
||||
const rows: Json[] = [];
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// BUG-1955 (占星师 2026-11-17 问答数据口径 Q8, follow-up of BUG-1907 / BUG-1954): when a domain's
|
||||
// varga is the two-Hora D2, the judgment table gives each planet's Hora and reads no house there.
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import {
|
||||
assembleJudgmentTable,
|
||||
JUDGMENT_HORA_VARGAS,
|
||||
judgmentTableModelView,
|
||||
} from "../src/lib/consultation-judgment-table.ts";
|
||||
|
||||
type Json = Record<string, unknown>;
|
||||
const leaf = (value: unknown) => ({ status: "value", value, check: "path", path: "worksheets.x" });
|
||||
|
||||
function facts(domainVarga: string, saturn: Json, rahu: Json = {}): Json {
|
||||
return {
|
||||
domain: "wealth",
|
||||
domain_varga: domainVarga,
|
||||
houses: { "2": { lord: leaf("Saturn"), sign: leaf("Aries"), occupants: leaf([]) } },
|
||||
factors: [
|
||||
{ id: "lord:2", kind: "planet", planet: "Saturn", role: "lord", citation: "c" },
|
||||
{ id: "house:2", kind: "house", house: 2, citation: "c" },
|
||||
],
|
||||
planets: {
|
||||
Saturn: { present: true, d1_house: leaf(3), aspected_by: leaf([]), ...saturn },
|
||||
Rahu: { present: true, d1_house: leaf(5), ...rahu },
|
||||
Mars: { present: true, d1_house: leaf(6), ...rahu },
|
||||
Ketu: { present: true, d1_house: leaf(11), ...(rahu.domain_varga_hora ? rahu : { domain_varga_house: leaf(4) }) },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function rows(value: Json): Json[] {
|
||||
return (judgmentTableModelView(assembleJudgmentTable(value)) as { rows: Json[] }).rows;
|
||||
}
|
||||
|
||||
test("a D2 domain varga gives the Hora and counts no house signal", () => {
|
||||
assert.deepEqual(JUDGMENT_HORA_VARGAS, ["D2"]);
|
||||
const hora = { status: "value", value: "Moon", sign: "Cancer", check: "hora_of_sign", path: "worksheets.x" };
|
||||
const [lord, house] = rows(facts("D2", { domain_varga_hora: hora }, { domain_varga_hora: hora }));
|
||||
// 原值: 行里是 domain_varga_house(D2 里按整宫数出的宫位,落 6/8/12 时记受冲信号 5)
|
||||
// 新值: 行里是 domain_varga_hora(Sun / Moon),不再有 D2 的宫位,也不记信号 5
|
||||
// 原因: 占星师 2026-11-17 Q8:两座 Hora 的 D2 没有被认可的十二宫读法
|
||||
assert.equal(lord.domain_varga_hora, "Moon");
|
||||
assert.equal("domain_varga_house" in lord, false);
|
||||
const affliction = lord.affliction as { details: Json[]; unevaluated: string[] };
|
||||
assert.equal(affliction.details.some((item) => item.signal === 5), false);
|
||||
assert.equal(affliction.unevaluated.includes("domain_varga_house"), false);
|
||||
const houseAffliction = house.affliction as { details: Json[]; unevaluated: string[] };
|
||||
assert.equal(houseAffliction.details.some((item) => item.signal === 5), false);
|
||||
assert.equal(houseAffliction.unevaluated.includes("domain_varga_house"), false);
|
||||
});
|
||||
|
||||
test("facts saved before this change lose their D2 house instead of showing it", () => {
|
||||
const [lord, house] = rows(facts("D2", { domain_varga_house: leaf(8) }, { domain_varga_house: leaf(2) }));
|
||||
assert.equal("domain_varga_house" in lord, false);
|
||||
assert.equal(JSON.stringify(lord).includes("\"signal\":5"), false);
|
||||
assert.equal(JSON.stringify(house).includes("\"signal\":5"), false);
|
||||
});
|
||||
|
||||
test("a varga with a named twelve-sign construction keeps its house and signal five", () => {
|
||||
const [lord, house] = rows(facts("D10", { domain_varga_house: leaf(8) }, { domain_varga_house: leaf(2) }));
|
||||
assert.equal(lord.domain_varga_house, 8);
|
||||
assert.equal("domain_varga_hora" in lord, false);
|
||||
assert.deepEqual(
|
||||
(lord.affliction as { details: Json[] }).details.filter((item) => item.signal === 5),
|
||||
[{ signal: 5, via: "domain_varga_house", value: 8 }],
|
||||
);
|
||||
assert.deepEqual(
|
||||
(house.affliction as { details: Json[] }).details.filter((item) => item.signal === 5),
|
||||
[
|
||||
{ signal: 5, via: "domain_varga_house", value: ["Mars", 2] },
|
||||
{ signal: 5, via: "domain_varga_house", value: ["Rahu", 2] },
|
||||
],
|
||||
);
|
||||
});
|
||||
@@ -471,7 +471,9 @@ evidence_card.backstage records, for the backend only, that global web evidence
|
||||
- 她的裁定(2026-11-17,Q8):D2 如果是日 / 月两座 Hora 的映射,按整宫列十二个宫位只是坐标,不等于有了这种分法下的十二宫解读;优先给 D2 的具体方法、原经度与 15° 分界、每颗星的日 / 月 Hora 归属和方法敏感性;十二宫推导若保留只能放技术附录并标为坐标推导。D11 等其他分盘也要写明构造和解释来源。
|
||||
- 落地(BUG-1954):产品算的 D2 就是两座 Hora 映射(`scripts/varga.py` 的 `varga_map`:奇数星座前 15° 狮子、后 15° 巨蟹,偶数星座相反)。关键项块里 D2 不再给十二宫行,改给构造名与出处、15° 分界、上升和九颗星各自的本命星座与度数、所在 Hora、离 15° 分界的度数;依据句里 D2 改写成「太阳 Hora 有哪些、月亮 Hora 有哪些、离分界不到 1 度的有哪些」。块上加一句只供判断的说明:这里只有两座 Hora 的归属,没有十二宫,别的 Hora 分法这张卡没有算。
|
||||
- 其余分盘(D3、D4、D5、D6、D7、D8、D9、D10、D11、D12、D24、D30)每项带 `construction`:规则照 `references/shodasavarga-complete-guide.md` 的分盘表原话(D5、D6、D8、D11 照代码注明的 PVR《Integrated Approach》§6.2.5–6.2.11)。D11 的构造是「从白羊逆数到本星座定起点,再顺排十一份」。写不出构造和出处的分盘不给宫位行(目前没有这种情况)。各分盘按宫位读的解释规则出处没有逐张核对,这一点仍待她确认。
|
||||
- 仍有 D2 按整宫数出的宫位到达模型的地方(这一轮没有动):财富题判断表里每颗星的 `domain_varga_house`(BUG-1907 加的,本领域分盘是 D2 时就是 D2 的整宫位)。
|
||||
- (BUG-1955,2026-11-17)财富题判断表里每颗星原来的 `domain_varga_house`(BUG-1907 加的,本领域分盘是 D2 时就是 D2 的整宫位)改为 `domain_varga_hora`:这颗星在太阳 Hora 还是月亮 Hora,照数据包里 D2 的落座读(狮子 = 太阳,巨蟹 = 月亮),和关键项块用的是同一份事实。`domain_varga_houses` 里不再有 D2,另有 `domain_varga_horas.D2`;D11、D10 的宫位照旧。受冲的第 5 类信号(星落本领域分盘的 6 / 8 / 12 宫、凶星落本领域分盘同号宫)对 D2 不再计算,也不记为「没看到」。之前保存的事实里若还带 D2 的宫位,前端组判断表时去掉。本领域分盘是 D2 的只有财富;其余领域的分盘(D10、D9、D6、D7、D12、D24、D1)都是十二座的具名分法,宫位保留。
|
||||
- 个人报告的解读材料同步:`varga_charts.D2` 每颗星给 `hora`、不给 `house`,带 `construction: two_hora_sun_moon`;`planets_in_varga`(财富)给 Hora。Gulika、Maandi、Indu Lagna 在解读材料里也改为已执行的辅助层(`interpretation_usage: supporting`),带位置、敏感性和规则来源(BUG-1954 改了领域事实之后,这里原来把它们读成了主要依据,三条测试失败)。
|
||||
- 还显示或使用 D2 宫位、这一轮没有动的地方(都要改版面或文案,留给产品负责人决定):年度报告财富部分的「D2 上升主在第几宫」及其换座判断;个人报告导出里 D2 的「整宫宫位」数值表和开头导读的分盘表;星盘页 D2 表的「宫位」列和 D2 盘图。
|
||||
- Gulika、Maandi、Indu Lagna 改为辅助层之后仍不进这一块:这一块只列路线的主项。
|
||||
|
||||
## U. Kantaka Shani 按占星师 2026-11-16 裁定归类(产品 2026-11-16,BUG-1946,执行她的裁定)
|
||||
|
||||
@@ -387,6 +387,28 @@ def _domain_varga_house(view: dict, name: str, code: str, minute_ok: bool) -> di
|
||||
return _gap(f"varga.{code}.{name}.house")
|
||||
|
||||
|
||||
# BUG-1955 (占星师 2026-11-17 问答数据口径 Q8): D2 is computed as the two-Hora mapping
|
||||
# (scripts/varga.py varga_map: only Leo and Cancer). A house number counted there is a
|
||||
# coordinate, not an accepted reading, so D2 gives each planet's Hora instead of a house.
|
||||
HORA_VARGAS = ("D2",)
|
||||
HORA_OF_SIGN = {"Leo": "Sun", "Cancer": "Moon"}
|
||||
|
||||
|
||||
def _domain_varga_hora(view: dict, name: str, code: str, minute_ok: bool) -> dict[str, Any]:
|
||||
"""Which Hora the planet falls in, read off the packet's own D2 sign."""
|
||||
if code in PRECISION_VARGA and not minute_ok:
|
||||
return {"status": "withheld", "value": PRECISION_SENTENCE, "check": "withheld"}
|
||||
chart, chart_path = _varga_chart(view, code)
|
||||
planet_path = _varga_planet_path(chart_path, chart, name) if chart_path else None
|
||||
if not planet_path:
|
||||
return _gap(f"varga.{code}.{name}.hora")
|
||||
sign = dig(view, f"{planet_path}.sign")
|
||||
hora = HORA_OF_SIGN.get(sign) if isinstance(sign, str) else None
|
||||
if hora is None:
|
||||
return _gap(f"{planet_path}.sign")
|
||||
return {"status": "value", "path": f"{planet_path}.sign", "value": hora, "sign": sign, "check": "hora_of_sign"}
|
||||
|
||||
|
||||
def _d9(view: dict, name: str) -> tuple[dict[str, Any], dict[str, Any]]:
|
||||
chart, chart_path = _varga_chart(view, "D9")
|
||||
if not chart_path:
|
||||
@@ -494,12 +516,18 @@ def _planet_record(
|
||||
"d9_dignity": d9_dignity,
|
||||
"co_tenants": _co_tenants(view, name, house),
|
||||
}
|
||||
if varga:
|
||||
if varga in HORA_VARGAS:
|
||||
record["domain_varga_hora"] = _domain_varga_hora(view, name, varga, minute_ok)
|
||||
elif varga:
|
||||
record["domain_varga_house"] = _domain_varga_house(view, name, varga, minute_ok)
|
||||
if vargas:
|
||||
record["domain_varga_houses"] = {
|
||||
code: _domain_varga_house(view, name, code, minute_ok) for code in vargas if code != "D1"
|
||||
code: _domain_varga_house(view, name, code, minute_ok)
|
||||
for code in vargas if code != "D1" and code not in HORA_VARGAS
|
||||
}
|
||||
horas = {code: _domain_varga_hora(view, name, code, minute_ok) for code in vargas if code in HORA_VARGAS}
|
||||
if horas:
|
||||
record["domain_varga_horas"] = horas
|
||||
return record
|
||||
|
||||
|
||||
@@ -1290,6 +1318,8 @@ def assert_fact_leaves(packet: dict, facts: dict[str, Any], *, base: Mapping | N
|
||||
assert dig(view, item["path"])[item["index"]] == item["value"], item["path"]
|
||||
elif kind == "auxiliary" and item.get("status") == "value":
|
||||
assert dig(view, item["path"]) == item["value"]["position"], item["path"]
|
||||
elif kind == "hora_of_sign" and item.get("status") == "value":
|
||||
assert dig(view, item["path"]) == item["sign"] and HORA_OF_SIGN[item["sign"]] == item["value"], item["path"]
|
||||
elif kind == "nonempty" and item.get("status") == "value":
|
||||
assert dig(view, item["path"]) not in (None, {}, [], ""), item["path"]
|
||||
elif kind == "membership" and item.get("status") == "value":
|
||||
|
||||
@@ -31,6 +31,8 @@ from .technique_status_axes import technique_audit_axes
|
||||
|
||||
try:
|
||||
from scripts.consult_card_domain_facts import (
|
||||
HORA_OF_SIGN,
|
||||
HORA_VARGAS,
|
||||
PLANETS,
|
||||
PRECISION_SENTENCE,
|
||||
PRECISION_VARGA,
|
||||
@@ -51,6 +53,8 @@ try:
|
||||
from scripts.pl9_full_data_export import full_data_domain_base, read_full_data_domain
|
||||
except ModuleNotFoundError: # pragma: no cover - direct scripts/ execution path
|
||||
from consult_card_domain_facts import (
|
||||
HORA_OF_SIGN,
|
||||
HORA_VARGAS,
|
||||
PLANETS,
|
||||
PRECISION_SENTENCE,
|
||||
PRECISION_VARGA,
|
||||
@@ -103,13 +107,10 @@ CONDITIONAL_STATES = {"parameter_sensitive", "partial", "partial_verified", "con
|
||||
UNUSED_REASONS = {"not_routed", "not_in_domain_route"}
|
||||
PARTICIPATION_REASON_CODES = {
|
||||
("career", "Vighati"): "not_in_domain_route",
|
||||
("wealth", "Indu"): "not_in_domain_route",
|
||||
("wealth", "AL2"): "not_in_domain_route",
|
||||
("wealth", "AL11"): "not_in_domain_route",
|
||||
("marriage", "UL2"): "not_in_domain_route",
|
||||
("health", "navamsa64"): "not_in_domain_route",
|
||||
("health", "Gulika"): "not_in_domain_route",
|
||||
("health", "Mandi"): "not_in_domain_route",
|
||||
("health", "Pranapada"): "not_in_domain_route",
|
||||
("education", "D5"): "not_in_domain_route",
|
||||
("migration", "D12"): "not_routed",
|
||||
@@ -428,6 +429,10 @@ def _participation_axes(row: dict[str, Any], item: dict[str, Any], view: dict) -
|
||||
usage = "not_used"
|
||||
if state == "executed":
|
||||
usage = {"Badhaka": "supporting", "kp": "conditional"}.get(item_id, "primary")
|
||||
# BUG-1955 (占星师 2026-11-17 Q5, follow-up of BUG-1954): Gulika / Maandi / Indu Lagna are
|
||||
# auxiliary layers. They were read here as primary after the chat-side change.
|
||||
if item.get("check") == "auxiliary":
|
||||
usage = "supporting"
|
||||
axes = technique_audit_axes({}, {"calculation_status": "executed", "interpretation_status": usage})
|
||||
return {"execution_status": axes["calculation_status"], "interpretation_usage": axes["interpretation_status"]}
|
||||
if item.get("status") == "not_applicable" and isinstance(item.get("reason"), str) and item["reason"].strip():
|
||||
@@ -468,6 +473,16 @@ def _participation(rows: list[dict[str, Any]], domain: str, view: dict, minute_c
|
||||
elif state == "executed" and item_id in STRUCTURED_VALUES and isinstance(value, dict):
|
||||
# BUG-1853: Badhaka is a small record; the reading needs its positions, not just "executed".
|
||||
row["value"] = {key: value[key] for key in STRUCTURED_VALUES[item_id] if value.get(key) not in (None, "", [])}
|
||||
elif state == "executed" and item.get("check") == "auxiliary" and isinstance(value, dict):
|
||||
# The computed position with its record; the chat-only analysis note stays off the report.
|
||||
# Position keeps the zodiac placement only: a key named `longitude` reads as a birth
|
||||
# coordinate to the report's privacy check.
|
||||
position = value.get("position")
|
||||
if isinstance(position, dict):
|
||||
position = {key: position[key] for key in ("sign", "sign_idx", "degree_in_sign", "sign_degree", "house")
|
||||
if position.get(key) is not None}
|
||||
row["value"] = {**{key: item for key, item in value.items() if key not in ("analysis_note", "position")},
|
||||
"position": position}
|
||||
if state in UNUSED_REASONS and (value := _unused_value(view, item_id, minute_confirmed)) is not None:
|
||||
row.update(computed=True, value=value)
|
||||
if state == "withheld":
|
||||
@@ -524,10 +539,19 @@ def _varga_signs(view: dict, code: str, minute_confirmed: bool) -> Any:
|
||||
if not isinstance(node, dict) or not node.get("sign"):
|
||||
continue
|
||||
row = {"sign": node["sign"]}
|
||||
house = node.get("house")
|
||||
if not isinstance(house, int) and asc_sign in SIGN_ORDER and node["sign"] in SIGN_ORDER:
|
||||
house = (SIGN_ORDER.index(node["sign"]) - SIGN_ORDER.index(asc_sign)) % 12 + 1
|
||||
out["house_basis"] = "whole_sign_from_varga_ascendant"
|
||||
if code in HORA_VARGAS:
|
||||
# BUG-1955 (占星师 2026-11-17 Q8): D2 is the two-Hora mapping; the reading material
|
||||
# carries each planet's Hora, never a house counted in it.
|
||||
hora = HORA_OF_SIGN.get(node["sign"])
|
||||
if hora:
|
||||
row["hora"] = hora
|
||||
out["construction"] = "two_hora_sun_moon"
|
||||
house = None
|
||||
else:
|
||||
house = node.get("house")
|
||||
if not isinstance(house, int) and asc_sign in SIGN_ORDER and node["sign"] in SIGN_ORDER:
|
||||
house = (SIGN_ORDER.index(node["sign"]) - SIGN_ORDER.index(asc_sign)) % 12 + 1
|
||||
out["house_basis"] = "whole_sign_from_varga_ascendant"
|
||||
if isinstance(house, int):
|
||||
row["house"] = house
|
||||
dignity = dignities.get(planet) or node.get("dignity")
|
||||
@@ -546,7 +570,10 @@ def _domain(row: dict, view: dict, shared: set[str], checked_houses: list[int])
|
||||
houses = {}
|
||||
for planet, record in row["planets"].items():
|
||||
leaves = record.get("domain_varga_houses") or {}
|
||||
leaf = leaves.get(code) if code in leaves else (record.get("domain_varga_house") if code == primary else None)
|
||||
if code in HORA_VARGAS:
|
||||
leaves = record.get("domain_varga_horas") or {}
|
||||
leaf = leaves.get(code) if code in leaves else (
|
||||
record.get("domain_varga_hora" if code in HORA_VARGAS else "domain_varga_house") if code == primary else None)
|
||||
house = _compact(leaf)
|
||||
if house is not None:
|
||||
houses[planet] = house
|
||||
@@ -878,7 +905,7 @@ def build_report_reading_facts(
|
||||
general = rows["general"]
|
||||
planets = {}
|
||||
for name, record in general["planets"].items():
|
||||
kept = _compact({key: value for key, value in record.items() if key not in ("domain_varga_house", "domain_varga_houses")})
|
||||
kept = _compact({key: value for key, value in record.items() if key not in ("domain_varga_house", "domain_varga_houses", "domain_varga_hora", "domain_varga_horas")})
|
||||
if kept.get("present"):
|
||||
kept.pop("present")
|
||||
for key in ("d1_dignity", "d9_dignity"):
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
"""BUG-1955 (占星师 2026-11-17 问答数据口径 Q8): D2 is the two-Hora mapping, so the
|
||||
judgment facts and the report reading material give each planet's Hora, not a house.
|
||||
|
||||
Packet: the fictional density fixture (no chart of a person).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from consult_card_domain_facts import (
|
||||
HORA_OF_SIGN,
|
||||
HORA_VARGAS,
|
||||
PLANETS,
|
||||
assert_fact_leaves,
|
||||
build_domain_facts,
|
||||
)
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DENSITY = ROOT / "frontend" / "tests" / "fixtures" / "report-density-fictional-engine.json"
|
||||
|
||||
|
||||
def _packet() -> dict:
|
||||
return json.loads(DENSITY.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
def test_wealth_planet_rows_carry_the_hora_and_no_d2_house():
|
||||
packet = _packet()
|
||||
facts = build_domain_facts(packet, "wealth", minute_confirmed=True)
|
||||
assert facts["domain_varga"] == "D2" and HORA_VARGAS == ("D2",)
|
||||
seen = 0
|
||||
for name in PLANETS:
|
||||
row = facts["planets"][name]
|
||||
# 原值: row["domain_varga_house"] = D2 里从分盘上升按整宫数出的宫位(BUG-1907)
|
||||
# 新值: row["domain_varga_hora"] = 这颗星所在的 Hora(Sun / Moon),照数据包里 D2 的落座读
|
||||
# 原因: 占星师 2026-11-17 Q8:两座 Hora 的 D2 没有被认可的十二宫读法
|
||||
assert "domain_varga_house" not in row, name
|
||||
leaf = row["domain_varga_hora"]
|
||||
assert "D2" not in row.get("domain_varga_houses", {}), name
|
||||
assert row["domain_varga_horas"]["D2"] == leaf
|
||||
if leaf["status"] != "value":
|
||||
continue
|
||||
seen += 1
|
||||
assert leaf["check"] == "hora_of_sign"
|
||||
assert leaf["sign"] in HORA_OF_SIGN and leaf["value"] == HORA_OF_SIGN[leaf["sign"]]
|
||||
assert seen >= 7
|
||||
# D11 and D10 keep their houses: their constructions are named (BUG-1954).
|
||||
assert set(facts["planets"]["Sun"]["domain_varga_houses"]) == {"D11", "D10"}
|
||||
assert_fact_leaves(packet, facts)
|
||||
|
||||
|
||||
def test_other_domains_keep_the_house_in_their_named_varga():
|
||||
packet = _packet()
|
||||
for domain, varga in (("career", "D10"), ("marriage", "D9"), ("health", "D6"), ("parents", "D12")):
|
||||
facts = build_domain_facts(packet, domain, minute_confirmed=True)
|
||||
assert facts["domain_varga"] == varga
|
||||
row = facts["planets"]["Sun"]
|
||||
assert "domain_varga_house" in row and "domain_varga_hora" not in row, domain
|
||||
|
||||
|
||||
def test_report_reading_material_gives_d2_the_hora_not_a_house():
|
||||
from scripts.report_render.reading_facts import _varga_signs
|
||||
from scripts.pl9_full_data_export import read_full_data_domain
|
||||
|
||||
packet = _packet()
|
||||
view = read_full_data_domain(packet, "wealth")
|
||||
d2 = _varga_signs(view, "D2", True)
|
||||
assert d2["construction"] == "two_hora_sun_moon"
|
||||
assert "house_basis" not in d2
|
||||
rows = [d2[name] for name in PLANETS if name in d2]
|
||||
assert rows
|
||||
for row in rows:
|
||||
assert "house" not in row
|
||||
assert row["hora"] == HORA_OF_SIGN[row["sign"]]
|
||||
d11 = _varga_signs(view, "D11", True)
|
||||
assert any("house" in d11[name] for name in PLANETS if name in d11)
|
||||
@@ -67,16 +67,28 @@ def test_public_report_v3_facts(public_report):
|
||||
|
||||
blocked = facts["blocked_states"]
|
||||
assert "general:D10" in blocked["not_routed"]
|
||||
# 原值: health 的 Gulika、Mandi、Pranapada 都在 not_in_domain_route;wealth 的 Indu 状态是
|
||||
# not_in_domain_route,值只带星座,出处写「路线未列 Indu Lagna」
|
||||
# 新值: Pranapada 仍在 not_in_domain_route;Gulika、Mandi、Indu 是已执行的辅助层
|
||||
# (interpretation_usage = supporting),带位置、敏感性、规则来源,出处写她的裁定
|
||||
# 原因: 占星师 2026-11-17 问答数据口径 Q5(BUG-1954 改了领域事实,BUG-1955 把报告解读材料对齐)
|
||||
assert "health:Pranapada" in blocked["not_in_domain_route"]
|
||||
health_points = {f"health:{point}" for point in ("Gulika", "Mandi", "Pranapada")}
|
||||
assert health_points <= set(blocked["not_in_domain_route"])
|
||||
assert not (health_points | {"general:D10"}) & set(blocked["blocked"])
|
||||
assert not {"health:Gulika", "health:Mandi", "wealth:Indu"} & set(blocked["not_in_domain_route"])
|
||||
wealth = facts["domains"]["wealth"]
|
||||
indu = next(row for row in wealth["participation"] if row["id"] == "Indu")
|
||||
assert indu["reason_code"] == indu["state"] == "not_in_domain_route"
|
||||
assert indu["computed"] is True
|
||||
assert indu["value"] == dig(packet, f"{rf.LAGNAS}.Indu_Lagna.sign")
|
||||
# BUG-1852: the citation names the route that leaves Indu out, not a failed search of references/.
|
||||
assert "未找到" not in indu["source"] and "Indu Lagna" in indu["source"]
|
||||
assert indu["state"] == "executed" and indu["interpretation_usage"] == "supporting"
|
||||
indu_packet = dig(packet, f"{rf.LAGNAS}.Indu_Lagna")
|
||||
assert indu["value"]["position"]["sign"] == indu_packet["sign"]
|
||||
assert "longitude" not in indu["value"]["position"]
|
||||
assert indu["value"]["interpretation"] == "supporting" and indu["value"]["sensitivity"] == "unverified"
|
||||
assert "analysis_note" not in indu["value"]
|
||||
assert "Q5" in indu["source"]
|
||||
for point in ("Gulika", "Mandi"):
|
||||
row = next(item for item in facts["domains"]["health"]["participation"] if item["id"] == point)
|
||||
assert row["state"] == "executed" and row["interpretation_usage"] == "supporting", point
|
||||
assert row["value"]["sensitivity"] == "parameter_sensitive" and "method_note" in row["value"], point
|
||||
# BUG-1853: Badhaka is computed from the ascendant and reaches the health facts with its positions.
|
||||
badhaka = next(row for row in facts["domains"]["health"]["participation"] if row["id"] == "Badhaka")
|
||||
assert badhaka["state"] == "executed"
|
||||
|
||||
@@ -9,18 +9,19 @@ from tests.test_reading_facts_v3_20261112 import _reading_facts, _reading_reques
|
||||
|
||||
|
||||
def test_unused_results_and_absent_results_keep_distinct_axes():
|
||||
card = [{"id": "Indu", "status": "blocked"}]
|
||||
missing, = rf._participation(card, "wealth", {}, True)
|
||||
# 原值: 用 wealth 的 Indu 作「路线未列」的例子;新值: 用 health 的 Pranapada;原因: BUG-1955:Gulika、Mandi、Indu 按占星师 2026-11-17 Q5 改为辅助层,不再是「路线未列」;这里换成仍未放开的同类项
|
||||
card = [{"id": "Pranapada", "status": "blocked"}]
|
||||
missing, = rf._participation(card, "health", {}, True)
|
||||
assert (missing["state"], missing["execution_status"], missing["interpretation_usage"]) == (
|
||||
"not_in_domain_route", "not_computed", "not_used",
|
||||
)
|
||||
assert "value" not in missing and "blocked_reason" not in missing
|
||||
|
||||
view = {"worksheets": {"divisional_and_special_charts": {
|
||||
"special_lagnas": {"Indu_Lagna": {"sign": "Leo"}},
|
||||
"special_lagnas": {"Pranapada_Lagna": {"sign": "Leo"}},
|
||||
"varga_full": {"D10_Dasamsa": {"Ascendant": {"sign": "Leo"}}},
|
||||
}}}
|
||||
unused, = rf._participation(card, "wealth", view, True)
|
||||
unused, = rf._participation(card, "health", view, True)
|
||||
not_routed, = rf._participation([{"id": "D10", "status": "blocked"}], "general", view, True)
|
||||
assert unused["state"] == "not_in_domain_route"
|
||||
assert not_routed["state"] == "not_routed"
|
||||
@@ -63,15 +64,16 @@ def test_kp_method_label_is_not_a_calculation_result():
|
||||
|
||||
def test_summary_keeps_routing_separate_from_calculation_gaps():
|
||||
rows = rf._participation([
|
||||
{"id": "Gulika", "status": "blocked"},
|
||||
# 原值: Gulika;新值: navamsa64;原因: BUG-1955:Gulika、Mandi、Indu 按占星师 2026-11-17 Q5 改为辅助层,不再是「路线未列」;这里换成仍未放开的同类项
|
||||
{"id": "navamsa64", "status": "blocked"},
|
||||
{"id": "D6", "status": "withheld"},
|
||||
{"id": "D8", "status": "gap"},
|
||||
], "health", {"worksheets": {"divisional_and_special_charts": {
|
||||
"upagrahas": {"raw": {"Gulika": {"sign_idx": 7}}},
|
||||
"sensitive_points": {"navamsa_64th": {"sign": "Leo"}},
|
||||
}}}, False)
|
||||
transits = {"planets": {"Jupiter": {}}, "double_transit": {"checked_houses": [7]}}
|
||||
result = rf._blocked_states({"health": {"participation": rows}}, [], [], {}, transits, {})
|
||||
assert result["not_in_domain_route"] == ["health:Gulika"]
|
||||
assert result["not_in_domain_route"] == ["health:navamsa64"]
|
||||
assert result["withheld"] == ["health:D6"]
|
||||
assert result["blocked"] == ["health:D6"]
|
||||
assert result["not_computed"] == ["health:D8"]
|
||||
@@ -82,12 +84,19 @@ def test_public_report_axes_and_badhaka_positions(public_report):
|
||||
facts = _reading_facts(packet, reading, **_reading_request(body))
|
||||
participation = {name: {row["id"]: row for row in domain["participation"]}
|
||||
for name, domain in facts["domains"].items()}
|
||||
unused = [participation["wealth"]["Indu"]]
|
||||
unused.extend(participation["health"][name] for name in ("Gulika", "Mandi", "Pranapada"))
|
||||
# 原值: Indu、Gulika、Mandi、Pranapada 四项都是 not_in_domain_route / not_used
|
||||
# 新值: Pranapada 仍是;另外三项是已执行的辅助层(supporting),带位置记录
|
||||
# 原因: BUG-1955:Gulika、Mandi、Indu 按占星师 2026-11-17 Q5 改为辅助层,不再是「路线未列」;这里换成仍未放开的同类项
|
||||
unused = [participation["health"]["Pranapada"]]
|
||||
for row in unused:
|
||||
assert row["state"] == "not_in_domain_route"
|
||||
assert (row["execution_status"], row["interpretation_usage"]) == ("executed", "not_used")
|
||||
assert row["value"] and row["computed"] is True
|
||||
auxiliary = [participation["wealth"]["Indu"]]
|
||||
auxiliary.extend(participation["health"][name] for name in ("Gulika", "Mandi"))
|
||||
for row in auxiliary:
|
||||
assert (row["state"], row["execution_status"], row["interpretation_usage"]) == ("executed", "executed", "supporting")
|
||||
assert row["value"]["position"] and row["value"]["interpretation"] == "supporting"
|
||||
|
||||
health = participation["health"]["Badhaka"]
|
||||
assert (health["state"], health["execution_status"], health["interpretation_usage"]) == (
|
||||
|
||||
Reference in New Issue
Block a user