fix(consult): marriage card drops the 7th-house "(对宫主)" twin rows to stay inside the 12,000-character budget (BUG-1185)
For house 7 the event lord and the opposite lord are the same planet, so every double-transit hit arrived twice. With the corrected aspect count the Taylor marriage turn reached 12,040 characters (budget 12,000, test consult-condensed-checklist "size"). The card now keeps the "(宫主)" row and drops its "(对宫主)" twin; values stay engine values (the "nothing rewritten" contract holds), the budget assertion is unchanged (BUG-1155 precedent: compress the format, not the budget). Taylor marriage 12,040 -> under 11,922. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
79efaf83f4
commit
8ae4cef7a6
@@ -378,6 +378,19 @@ function copy(value: unknown): Json | undefined {
|
||||
return value !== undefined && isJson(value) ? structuredClone(value) : undefined;
|
||||
}
|
||||
|
||||
// For house 7 the engine's event-house lord and opposite-house lord are the
|
||||
// same planet, so each hit arrives twice ("X(宫主)" and "X(对宫主)") with the
|
||||
// same layer and PAC. Keep the "(宫主)" row and drop its twin: the card keeps
|
||||
// engine values only, and the 7th lord is the opposite lord by definition
|
||||
// (BUG-1185: the corrected aspect count adds 7th-house rows).
|
||||
function dropOppositeLordTwins(rows: JsonRecord[]): JsonRecord[] {
|
||||
const normalized = (row: JsonRecord) => JSON.stringify({
|
||||
...row, target: typeof row.target === "string" ? row.target.replaceAll("(对宫主)", "(宫主)") : row.target,
|
||||
});
|
||||
const plain = new Set(rows.filter((row) => !String(row.target ?? "").includes("(对宫主)")).map(normalized));
|
||||
return rows.filter((row) => !String(row.target ?? "").includes("(对宫主)") || !plain.has(normalized(row)));
|
||||
}
|
||||
|
||||
function pickKeys(source: unknown, keys: readonly string[]): JsonRecord {
|
||||
const from = record(source);
|
||||
const out: JsonRecord = {};
|
||||
@@ -857,7 +870,7 @@ function domainSection(
|
||||
const ul = pickKeys(karakas.UL, KARAKA_TARGET_KEYS);
|
||||
section.double_transit = {
|
||||
...(typeof double.date === "string" ? { date: double.date } : {}),
|
||||
house_7: conclusions.filter((row) => row.house === 7).map((row) => pickKeys(row, DOUBLE_TRANSIT_ROW_KEYS)),
|
||||
house_7: dropOppositeLordTwins(conclusions.filter((row) => row.house === 7).map((row) => pickKeys(row, DOUBLE_TRANSIT_ROW_KEYS))),
|
||||
...(nonEmpty(dk) ? { DK: dk } : {}),
|
||||
...(nonEmpty(ul) ? { UL: ul } : {}),
|
||||
...(typeof record(karakas.DK).method === "string" ? { karaka_method: record(karakas.DK).method as string } : {}),
|
||||
|
||||
Reference in New Issue
Block a user