fix(annual): the basis shows no grade cap and no 「只作参考」 (BUG-2097)
The writer was told to put 「只作参考」 into each section's basis and saw the grade cap in its material, so stored annual reports showed 「这一块等级上限为 C」 and dozens of 「只作参考」 to readers. A shared display pass (annualBasisText) now removes those notes on the page, in the export and in what the question feature reads, keeping every date, house, sign, number and technique name; stored reports are untouched. New reports are written and stored without them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
@@ -28235,3 +28235,17 @@
|
||||
- 关联记录:BUG-2073、BUG-2081、BUG-2085、BUG-2091、BUG-2092、BUG-2061、BUG-2070。
|
||||
- 修复版本:`claude/report-questions-2093`。
|
||||
- 补修(2026-11-20,第二十二轮复测发现):上线后个人、年运、合盘三种报告的「提问」都打不开对话,`POST /api/reports/:id/questions/session` 一律 500。根因:本次把读报告行的 select 改成了 `…,subject_name:report_document->subject->>displayName`,测试环境用的自托管数据客户端(`frontend/src/lib/db/local-postgres-client-core.ts` 的 `select`)只接受纯列名,遇到 JSON 路径和别名抛「unsafe database identifier」,被路由的兜底捕获成 500;这一行在三种报告的分支之前执行,所以三种都坏。本地测试用的是假数据客户端,没有走这条校验。修复:读报告行只取纯列名;个人报告的称呼只在第一次建对话时另读 `report_document`,用已有的 `readOwnedSubjectDisplayName` 取。防复发:`frontend/tests/select-columns-plain-2093.test.ts` 扫描 `src` 里所有字面 select,列名必须是纯标识符(改动前失败、改动后通过),并钉住这条路由的 select。
|
||||
|
||||
## BUG-2097 | 年运报告的「依据」里给用户看到了「这一块等级上限为 C」和 30 处「只作参考」
|
||||
|
||||
- 状态:fixed-pending-verify
|
||||
- 现象:staging 复测第二十二轮(2026-11-20)把一份年运报告的 27 个「依据」全部展开,看到一处「这一块等级上限为 C。」和 30 处「只作参考」,例如「Narayana 只作参考。」「Vedha(行星互阻,只作参考)只作参考。」「两套方向一致只表示方向相同,不把结论说满。」「三个Saham只作参考:Artha第6宫……」。占星师 2026-11-19 分层答复:等级字母和规则用语不给用户看;产品负责人 2026-11-20 同意:「依据」保留技法名称,去掉「只作参考」这类话、等级字母和内部代号。
|
||||
- 触发条件:任何一份年运报告展开「依据」,或导出 .md。
|
||||
- 根因:写作规则让模型在 evidence 里写「只作参考」(`frontend/src/lib/annual-report-sections.ts` 的状态规则、`frontend/src/lib/annual-report-generate.ts` 的 `NARAYANA_WRITING_RULE`,BUG-2037 时定的写法),模型材料里每一节带着「证据等级」上限,模型把它抄进了 evidence;页面的 `Basis` 原样显示 evidence,导出的 `visible()` 只去掉「证据等级为 C」这一种写法。
|
||||
- 修复:
|
||||
- 显示层(旧报告也生效,不改存档):`frontend/src/lib/annual-reader-display.ts` 新增 `annualBasisText`:只是这类话的句子或分句去掉,附在内容上的只去掉这几个字(「三个Saham:Artha第6宫」「Saham(敏感点,按回归时刻白天公式)」);技法名单独标在一串内容前时留作标签(「Narayana:大运天秤……」,只在同一句的逗号之内,「;」之后不带);日期、宫位、星座、数字一个不少。页面的「依据」、应期行、窗口的为什么 / 另一面 / 要有的条件、窗口依据列表和正文段落,导出的 `visible()`,以及提问时给模型的材料(`stripAnnualBackstageSentences` 先过这一层)都用它。
|
||||
- 写作层(新报告):状态规则改成「照写它的结果,不加「只作参考」「仅供参考」这类话」;等级规则加「正文和 evidence 都不复述等级,不写等级字母,也不写「等级上限」「证据等级」」;`NARAYANA_WRITING_RULE` 不再要求写「Narayana 只作参考」;`annualReaderWording` 最后过一遍 `annualBasisText`,存下来的新报告也不带这些字。等级本身照旧计算、照旧限制写法,只是不显示。
|
||||
- 验证:在那份真实年运报告的全文上跑显示层:「只作参考」30 → 0,「等级上限」1 → 0,「只表示方向相同」2 → 0,「不把结论说满」1 → 0;全文数字序列前后完全一致,「宫」262 → 262,「座」132 → 132;Vimshottari、Muntha 次数不变,Narayana / Saham / Vedha 只少了那些只说「只作参考」的句子里的。
|
||||
- 防复发:`frontend/tests/annual-basis-2097.test.tsx`(页面和导出都不出现等级上限和「只作参考」、内容和技法名保留、存档不变;数字序列不变;「;」后不带标签;模型读到的和页面一致;新报告的规则和存下来的文字)。`annual-user-layer-2037`、`report-answers-2094` 三处钉着旧写法的断言按原值 / 新值 / 原因更新。
|
||||
- 关联记录:BUG-2037、BUG-2034、BUG-2043、BUG-2094、BUG-2095(个人报告里的代号和等级字母,另一个窗口)。
|
||||
- 修复版本:`claude/annual-basis-2097`。
|
||||
|
||||
@@ -40,7 +40,7 @@ import { ReportBirthNotices } from "@/components/personal-report/report-birth-no
|
||||
import { REPORT_BIRTH_CHANGED_FAILURE, readReportBirthScenario } from "@/lib/report-birth-marking";
|
||||
import { buildAnnualExportBlocks, hasAnnualTimeline } from "@/lib/annual-report-export";
|
||||
import { annualGradeNote, remainingTableGrade } from "@/lib/annual-report-grade";
|
||||
import { annualAreaParts, annualTimelineEntry, annualTimelineText } from "@/lib/annual-reader-display";
|
||||
import { annualAreaParts, annualBasisText, annualTimelineEntry, annualTimelineText } from "@/lib/annual-reader-display";
|
||||
import {
|
||||
ANNUAL_DOMAINS,
|
||||
ANNUAL_DOMAIN_TITLES,
|
||||
@@ -89,7 +89,8 @@ function str(value: unknown): string {
|
||||
}
|
||||
|
||||
function paragraphs(value: unknown): string[] {
|
||||
return str(value).split(/\n+/).map((line) => line.trim()).filter(Boolean);
|
||||
// BUG-2097: the same reader text as the export (no grade caps, no 「只作参考」), so a selected quote matches it.
|
||||
return annualBasisText(value).split(/\n+/).map((line) => line.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
const PROGRESS_STEPS = [
|
||||
@@ -209,12 +210,12 @@ function WindowPin({ window, item, failed, graded }: Readonly<{ window: AnnualSn
|
||||
{/* Reports written before the plain voice also carry these three. */}
|
||||
{item.support ? (
|
||||
<dl>
|
||||
<dt>为什么</dt><dd>{str(item.support)}</dd>
|
||||
<dt>另一面</dt><dd>{str(item.divergence)}</dd>
|
||||
<dt>要有的条件</dt><dd>{str(item.conditions)}</dd>
|
||||
<dt>为什么</dt><dd>{annualBasisText(item.support)}</dd>
|
||||
<dt>另一面</dt><dd>{annualBasisText(item.divergence)}</dd>
|
||||
<dt>要有的条件</dt><dd>{annualBasisText(item.conditions)}</dd>
|
||||
</dl>
|
||||
) : null}
|
||||
<ul>{window.basis.map((line) => <li key={line}>{line}</li>)}</ul>
|
||||
<ul>{window.basis.map(annualBasisText).filter(Boolean).map((line) => <li key={line}>{line}</li>)}</ul>
|
||||
</details>
|
||||
) : null}
|
||||
</>
|
||||
@@ -567,7 +568,9 @@ function renderGrade(item: Row, enabled: boolean) {
|
||||
* layers are reference only) is folded under the text it supports, with the report's existing
|
||||
* 「annual-basis」 fold. It used to open every section as a paragraph labelled 「依据:」.
|
||||
*/
|
||||
function Basis({ text }: Readonly<{ text: string }>) {
|
||||
function Basis({ text: written }: Readonly<{ text: string }>) {
|
||||
// BUG-2097: grade caps and 「只作参考」 hedges are not shown; stored reports read the same way.
|
||||
const text = annualBasisText(written);
|
||||
if (!text) return null;
|
||||
return <details className="annual-basis"><summary>依据</summary>{text.split("\n").filter(Boolean).map((line) => <p key={line} className="annual-evidence">{line}</p>)}</details>;
|
||||
}
|
||||
@@ -587,7 +590,7 @@ function SectionBody({ entry, body, snapshot, askable = false }: Readonly<{
|
||||
return <>{value.paragraphs.map((paragraph, index) => {
|
||||
const item = record(paragraph);
|
||||
return <div key={index} className="personal-report-reading-paragraph">
|
||||
<p {...ask}>{str(item.text)}</p>
|
||||
<p {...ask}>{annualBasisText(item.text)}</p>
|
||||
{renderGrade(item, true)}
|
||||
{entry.kind === "overview" ? <Basis text={str(item.evidence)} /> : null}
|
||||
</div>;
|
||||
@@ -606,7 +609,7 @@ function SectionBody({ entry, body, snapshot, askable = false }: Readonly<{
|
||||
<ol className="annual-remember">
|
||||
{remember.map((item) => {
|
||||
const window = snapshot.windows.find((row) => row.id === item.window_id);
|
||||
return <li key={str(item.window_id)}><span className="annual-when">{window?.span}</span>{str(item.text)}</li>;
|
||||
return <li key={str(item.window_id)}><span className="annual-when">{window?.span}</span>{annualBasisText(item.text)}</li>;
|
||||
})}
|
||||
</ol>
|
||||
) : null}
|
||||
@@ -656,17 +659,17 @@ function SectionBody({ entry, body, snapshot, askable = false }: Readonly<{
|
||||
<p className="annual-when">{window?.span}<span className="annual-candidate">候选</span></p>
|
||||
<h4>{str(item.theme)}</h4>
|
||||
<dl>
|
||||
<dt>依据</dt><dd>{str(item.support)}</dd>
|
||||
<dt>分歧与限制</dt><dd>{str(item.divergence)}</dd>
|
||||
<dt>要有的条件</dt><dd>{str(item.conditions)}</dd>
|
||||
<dt>依据</dt><dd>{annualBasisText(item.support)}</dd>
|
||||
<dt>分歧与限制</dt><dd>{annualBasisText(item.divergence)}</dd>
|
||||
<dt>要有的条件</dt><dd>{annualBasisText(item.conditions)}</dd>
|
||||
<dt>可以怎么做</dt><dd>{str(item.action)}</dd>
|
||||
</dl>
|
||||
{renderGrade(item, graded)}
|
||||
{window ? (
|
||||
<details className="annual-basis">
|
||||
<summary>盘面依据</summary>
|
||||
<ul>{window.basis.map((line) => <li key={line}>{line}</li>)}</ul>
|
||||
{window.limits.length > 0 ? <ul>{window.limits.map((line) => <li key={line}>{line}</li>)}</ul> : null}
|
||||
<ul>{window.basis.map(annualBasisText).filter(Boolean).map((line) => <li key={line}>{line}</li>)}</ul>
|
||||
{window.limits.length > 0 ? <ul>{window.limits.map(annualBasisText).filter(Boolean).map((line) => <li key={line}>{line}</li>)}</ul> : null}
|
||||
</details>
|
||||
) : null}
|
||||
</article>
|
||||
@@ -700,7 +703,7 @@ function SectionBody({ entry, body, snapshot, askable = false }: Readonly<{
|
||||
</>;
|
||||
}
|
||||
case "close":
|
||||
return <p className="annual-close">{str(value.line)}</p>;
|
||||
return <p className="annual-close">{annualBasisText(value.line)}</p>;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
import { buildAnnualExportBlocks, hasAnnualTimeline } from "./annual-report-export.ts";
|
||||
import type { AnnualSnapshot } from "./annual-report-generate.ts";
|
||||
import { annualAreaParts } from "./annual-reader-display.ts";
|
||||
import { annualAreaParts, annualBasisText } from "./annual-reader-display.ts";
|
||||
import { stripInternalGradeWording } from "./annual-report-sections.ts";
|
||||
|
||||
/** Material the model may hold in one turn, instructions included (the synastry follow-up's budget). */
|
||||
@@ -142,7 +142,8 @@ const BACKSTAGE_SENTENCES: readonly RegExp[] = [
|
||||
];
|
||||
|
||||
export function stripAnnualBackstageSentences(text: string): string {
|
||||
return text
|
||||
// BUG-2097: the reader's clean-up first (grade caps, 「只作参考」 hedges), so the model reads what the page shows.
|
||||
return annualBasisText(text)
|
||||
.split("\n")
|
||||
.map((line) => {
|
||||
const bullet = line.match(/^\s*(?:[-*•]\s*)?/u)?.[0] ?? "";
|
||||
|
||||
@@ -117,8 +117,9 @@ export type AnnualAreaParts = Readonly<{
|
||||
|
||||
/** The reader parts of an area section (工作、钱……) below its text. */
|
||||
export function annualAreaParts(value: Row, title: string, timingInBasis: boolean = ANNUAL_TIMING_ROW_IN_BASIS): AnnualAreaParts {
|
||||
const timing = str(value.timing);
|
||||
const evidence = str(value.evidence);
|
||||
// BUG-2097: grade caps and 「只作参考」 hedges are not shown, in the timing row and the basis alike.
|
||||
const timing = annualBasisText(value.timing);
|
||||
const evidence = annualBasisText(value.evidence);
|
||||
const remember = annualRememberText(value.remember);
|
||||
if (!timingInBasis || !timing) return { timingRow: timing, timingSentence: "", remember, evidence };
|
||||
const sentence = annualTimingPlainSentence(timing, title);
|
||||
@@ -134,3 +135,102 @@ export function annualAreaParts(value: Row, title: string, timingInBasis: boolea
|
||||
evidence: [evidence, `应期(两套计时):${timing}`].filter(Boolean).join("\n"),
|
||||
};
|
||||
}
|
||||
|
||||
// ── BUG-2097: grade caps and 「只作参考」 hedges are not shown ──────────────────────────────────────
|
||||
//
|
||||
// 占星师 2026-11-19 分层答复(等级字母、规则用语不给用户看); 产品负责人 2026-11-20 同意:数据章节和「依据」
|
||||
// 保留技法名称,去掉「只作参考」这类话、等级字母和内部代号. The writer was told to put 「只作参考」 into the
|
||||
// basis (BUG-2037) and saw each section's grade cap in its material, so stored reports carry
|
||||
// 「Narayana 只作参考。」「Vedha(行星互阻,只作参考)只作参考。」「这一块等级上限为 C。」. Display only:
|
||||
// stored sections, the snapshot and the grades are untouched, so a report saved before this change reads
|
||||
// the same way after it, minus these words. Every date, house, sign and number stays.
|
||||
|
||||
const BASIS_TRIGGER = /只作参考|仅供参考|只表示方向相同|不把(?:结论|话)说(?:得)?满|抬高把握|(?:等级|把握)(?:上限)?\s*(?:为|是|[::])?\s*[A-D](?![A-Za-z])/u;
|
||||
const HEDGE_PHRASE = /\s*(?:只作参考|仅供参考)项?/gu;
|
||||
const GRADE_PHRASE = /(?:证据)?(?:等级|把握)(?:上限)?\s*(?:为|是|[::])?\s*[A-D](?![A-Za-z])(?:\s*[级档])?/gu;
|
||||
// A clause that only says the two timing systems agreeing means no more than that.
|
||||
const DIRECTION_ONLY = /^(?:但|而)?(?:两套(?:计时|方向)?)?(?:方向)?(?:一致)?(?:只)?表示方向相同$|^(?:但|而)?不(?:因此)?把(?:结论|话)说(?:得)?满$|^(?:但|而)?不(?:因此)?抬高把握$/u;
|
||||
// What is left of a hedge clause that names nothing but its own subject: 「两者」「均」「两项标」「且」.
|
||||
const CONNECTOR_ONLY = /^(?:且|但|而|并且|都|均|也|两者|两项标?|这两项|两边|同期|这一?段(?:时间)?)*$/u;
|
||||
// A technique name, or two joined: 「Narayana」「Varsha Narayana 与 Saham」「Vedha(行星互阻)」.
|
||||
const NAME_ONLY = /^(?:且|但|而)?\s*([A-Za-z][A-Za-z\s]*?(?:\s*(?:与|和|、)\s*[A-Za-z][A-Za-z\s]*?)*(?:([^()\d]*))?)(?:\s*(?:两项标|两项|均|都|也|同期|这一?段(?:时间)?))*$/u;
|
||||
|
||||
function cleanParenthesis(text: string): string {
|
||||
return text.replace(/(([^()]*))/gu, (match: string, inner: string, offset: number, whole: string) => {
|
||||
if (!/只作参考|仅供参考/u.test(inner)) return match;
|
||||
// Only the hedge items go; every other item and its own separator stay as written
|
||||
// (「木星 5、7、9,土星 3、7、10」 keeps both 7s).
|
||||
const rest = inner.replace(/\s*(?:[,,、]\s*)?(?:只作参考|仅供参考)项?/gu, "").replace(/^\s*[,,、]\s*/u, "").trim();
|
||||
if (rest) return `(${rest})`;
|
||||
// 「Narayana(只作参考)大运天秤」: keep a space between a Latin name and what follows.
|
||||
const before = whole.charAt(offset - 1);
|
||||
const after = whole.charAt(offset + match.length);
|
||||
return /[A-Za-z]/u.test(before) && after && !/[\s,,。;;::、)]/u.test(after) ? " " : "";
|
||||
});
|
||||
}
|
||||
|
||||
type Clause = Readonly<{ kind: "keep"; text: string } | { kind: "label"; name: string } | { kind: "drop" }>;
|
||||
|
||||
function classifyClause(raw: string): Clause {
|
||||
const clause = raw.trim();
|
||||
if (!clause) return { kind: "drop" };
|
||||
if (DIRECTION_ONLY.test(clause)) return { kind: "drop" };
|
||||
const graded = clause.replace(GRADE_PHRASE, "").trim();
|
||||
if (graded !== clause) {
|
||||
// 「这一块等级上限为 C」: nothing but the cap.
|
||||
if (!/[\d宫座]/u.test(graded) && graded.replace(/^(?:这一?[块段节条项]|本[段节])/u, "").trim() === "") return { kind: "drop" };
|
||||
}
|
||||
if (!/只作参考|仅供参考/u.test(graded)) return { kind: "keep", text: graded };
|
||||
const residue = graded.replace(HEDGE_PHRASE, "").trim();
|
||||
if (CONNECTOR_ONLY.test(residue)) return { kind: "drop" };
|
||||
const name = NAME_ONLY.exec(residue)?.[1]?.trim();
|
||||
if (name && !/[\d宫座]/u.test(name)) return { kind: "label", name };
|
||||
// 「2027年5月中旬Vedha只作参考」 → 「2027年5月中旬有 Vedha」: a date followed by a bare name reads as a fragment.
|
||||
return { kind: "keep", text: residue.replace(/(旬|月|日|起|前后)\s*([A-Za-z][A-Za-z\s]*)$/u, "$1有 $2") };
|
||||
}
|
||||
|
||||
function cleanSentence(sentence: string): string {
|
||||
const end = /[。!?]$/u.test(sentence) ? sentence.slice(-1) : "";
|
||||
const body = end ? sentence.slice(0, -1) : sentence;
|
||||
const pieces = body.split(/([,,;;])/u);
|
||||
const clauses = pieces.filter((_piece, index) => index % 2 === 0).map(classifyClause);
|
||||
const separators = pieces.filter((_piece, index) => index % 2 === 1);
|
||||
if (clauses.every((clause, index) => clause.kind === "keep" && clause.text === (pieces[index * 2] ?? "").trim())) return sentence;
|
||||
let out = "";
|
||||
let pendingLabel = "";
|
||||
for (let index = 0; index < clauses.length; index += 1) {
|
||||
const clause = clauses[index];
|
||||
if (!clause || clause.kind === "drop") continue;
|
||||
if (clause.kind === "label") {
|
||||
// The name labels what follows only within one statement (「Narayana只作参考,大运天秤」); after 「;」 the next
|
||||
// clause is another statement (「Saham 只作参考;事业分盘上升……」) and the label goes.
|
||||
const next = separators[index] ?? "";
|
||||
if (/[,,]/u.test(next)) pendingLabel = pendingLabel ? `${pendingLabel}、${clause.name}` : clause.name;
|
||||
continue;
|
||||
}
|
||||
if (out) out += separators[index - 1] ?? ",";
|
||||
// 「Narayana只作参考,大运天秤」 → 「Narayana:大运天秤」: the name still says whose 大运 it is.
|
||||
out += pendingLabel ? `${pendingLabel}:${clause.text}` : clause.text;
|
||||
pendingLabel = "";
|
||||
}
|
||||
out = out.trim();
|
||||
return out ? `${out}${end || ""}` : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Any written or computed annual text as a reader sees it (BUG-2097): no grade letters or 「等级上限」, no
|
||||
* 「只作参考」-type hedges. A sentence that was only such a note goes; a hedge attached to content leaves the
|
||||
* content (「三个Saham只作参考:Artha第6宫」 → 「三个Saham:Artha第6宫」). Technique names stay.
|
||||
*/
|
||||
export function annualBasisText(value: unknown): string {
|
||||
const text = str(value);
|
||||
if (!text || !BASIS_TRIGGER.test(text)) return text;
|
||||
return text.split("\n").map((line) => {
|
||||
if (!BASIS_TRIGGER.test(line)) return line;
|
||||
const bullet = line.match(/^\s*(?:[-*•]\s*)?/u)?.[0] ?? "";
|
||||
const body = cleanParenthesis(line.slice(bullet.length));
|
||||
const sentences = (body.match(/[^。!?]+[。!?]?/gu) ?? [body]).map(cleanSentence);
|
||||
const rest = sentences.join("").replace(/([,、;:])\s*(?=[,、;。!?])/gu, "").replace(/(^|[。!?])\s*[,、;:]+/gu, "$1").trim();
|
||||
return rest ? `${bullet}${rest}` : null;
|
||||
}).filter((line): line is string => line !== null).join("\n");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { readReportBirthScenario, readReportBirthWindow, reportBirthExportPreamb
|
||||
import { withExportBirthInputState, type ReportExportBlock } from "./report-export-blocks";
|
||||
import { projectOrdinaryReportMarkdown } from "./report-public-projection";
|
||||
import { annualGradeNote, remainingTableGrade } from "./annual-report-grade";
|
||||
import { annualAreaParts, annualTimelineEntry, annualTimelineText } from "./annual-reader-display";
|
||||
import { annualAreaParts, annualBasisText, annualTimelineEntry, annualTimelineText } from "./annual-reader-display";
|
||||
|
||||
type Row = Record<string, unknown>;
|
||||
type Window = AnnualSnapshot["windows"][number];
|
||||
@@ -30,7 +30,8 @@ function rows(value: unknown): Row[] {
|
||||
|
||||
function visible(value: unknown): string {
|
||||
if (typeof value !== "string") return "";
|
||||
return value
|
||||
// BUG-2097: no grade caps or 「只作参考」 hedges in anything the export shows.
|
||||
return annualBasisText(value)
|
||||
.replace(/MEVG\s*\/\s*Global Web Evidence|Global Web Evidence|Real Case Calibration|\bMEVG\b/gi, "")
|
||||
.replace(/(?:把握(?:等级|上限)?|置信(?:度|等级)|证据等级)\s*(?:为|[::])?\s*[A-D](?:\s*[–—-]\s*[A-D])?(?:\s*[级档])?/gu, "")
|
||||
.replace(/(?:(\s*[A-D]\s*[级档]\s*)|\(\s*[A-D]\s*[级档]\s*\))/gu, "")
|
||||
|
||||
@@ -166,7 +166,10 @@ const NARAYANA_REFERENCE = "Narayana 是条件参考,不作为独立印证";
|
||||
// BUG-2037: the Narayana status is said once in evidence, in the reader's words; the body text does not carry it.
|
||||
// 原值:「提到 Narayana 时,写明这是条件参考。方向一致只表示方向相同,不抬高把握。」
|
||||
// 新值:status goes to evidence as 「Narayana 只作参考」; the body says only what the two timing systems point to.
|
||||
const NARAYANA_WRITING_RULE = `${NARAYANA_REFERENCE}。用到 Narayana 时,在 evidence 里写一次「Narayana 只作参考」;两套计时方向一致只表示方向相同,不因此把话说得更满。正文不写「条件参考」「独立印证」「把握」。未决分支分开列在 evidence,不合并,不作结论。`;
|
||||
// BUG-2097 (产品负责人 2026-11-20:依据里不写「只作参考」这类话):
|
||||
// 原值:「用到 Narayana 时,在 evidence 里写一次「Narayana 只作参考」;两套计时方向一致只表示方向相同,不因此把话说得更满。」
|
||||
// 新值:Narayana 的结果照写;两套一致不因此把话说得更满,但这句说明本身不写进 evidence。
|
||||
const NARAYANA_WRITING_RULE = `${NARAYANA_REFERENCE}。用到 Narayana 时,在 evidence 里照写它的结果,不加「只作参考」,也不写「一致只表示方向相同」这类说明;两套计时方向一致时,不因此把话说得更满。正文不写「条件参考」「独立印证」「把握」。未决分支分开列在 evidence,不合并,不作结论。`;
|
||||
|
||||
function narayanaCandidateLines(facts: unknown): string[] {
|
||||
const reference = record(record(record(facts).cards).conditional_narayana);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { z } from "zod";
|
||||
import { readerWording } from "./personal-report-reading-wording.ts";
|
||||
import { annualRememberText } from "./annual-reader-display.ts";
|
||||
import { annualBasisText, annualRememberText } from "./annual-reader-display.ts";
|
||||
import { ANNUAL_CLAIMS, ANNUAL_CLAIM_LABELS, annualBoundaryNote, annualCap, annualParagraph, annualRating, gradeEvidence, varyingAnnualReasons, weakestCap,
|
||||
type AnnualCap, type AnnualClaim } from "./annual-report-grade.ts";
|
||||
|
||||
@@ -709,9 +709,9 @@ const WRITING_RULES = [
|
||||
"- 术语主要放在 evidence,第一次出现时用半句话解释,例如「Muntha(每年顺移一宫的年度敏感点)落在年盘第 10 宫」「Mudda(年内按月亮星宿分的计时)」。正文确实要点到某个技法时,只点一次并说明它管什么。不要把术语堆成清单。",
|
||||
"- 应期看两套计时:本命计时看 Vimshottari 和 Narayana 两套,各自判断后再对照,写在 evidence 和 timing 里;两套方向一致或不一致,都在这两处照实写清楚。timing 和 evidence 一起折叠在「依据」里,读者翻开才看;timing 以「Vimshottari 在某段时间支持(或压着)什么」起句,再写 Narayana 同期怎么说。年内再用 Mudda / Patyayini 与年盘解释,它们不改写本命两套计时的判断。",
|
||||
"- 两套计时的对照不写进正文(text、base、theme、action、matter、arrange、remember、line):正文只按主要那套(Vimshottari)用日常话说哪段时间对这件事有利、哪段时间压力大,例如「6 月下旬到 7 月中旬对工作比较有利」;不写「两套计时」「两轨」「另一套计时看不出方向」「两套说法不同」「两边都留着看」「不挑一边」「不合成一个说法」,也不点 Narayana 的名字。只有两套方向相反、足以改变这段时间该推还是该守时,正文才说一次「这段时间该推还是该守,这一点目前还不能明确判断」,不解释是哪两套方法。",
|
||||
"- 状态照实保留,写在 evidence:材料里标 parameter_sensitive(如 Saham、Varsha Narayana、Vedha)的,在 evidence 里写「只作参考」;标 blocked 或「没有算出」的,在 evidence 里写明这一层没有算出,不用它下结论,也不要假装用过。正文不写「参数敏感」「条件参考」「不作为独立印证」「候选格局」「尚未完整确认」「有待核实」这类状态用语。",
|
||||
"- 状态照实保留,写在 evidence:材料里标 parameter_sensitive(如 Saham、Varsha Narayana、Vedha)的,照写它的结果,不加「只作参考」「仅供参考」这类话;标 blocked 或「没有算出」的,在 evidence 里写明这一层没有算出,不用它下结论,也不要假装用过。正文不写「参数敏感」「条件参考」「不作为独立印证」「候选格局」「尚未完整确认」「有待核实」这类状态用语。",
|
||||
"- 正文直接说判断和安排。某一点确实看不出,就说一次「这一点目前还不能明确判断」,然后接着写看得出的部分;不在判断后面加「只能当线索,不能当成结论」「不当作定论」「不细断」「仅供参考」这类话。",
|
||||
"- 按每段或每条给 claims 和 grade。等级取 C 或 D,不能高于计算依据给的上限。上限 D 的结论,正文写「这一点目前还不能明确判断」。在 evidence 中逐项写清「缺少」的依据,并原样引用「会变」中的说明和候选。「会变」的依据已经算出,任何段落都不能把它写成缺少或没有算出。需说明的项也照实写在 evidence。把上限和类型留在 JSON 字段中,正文不复述等级。",
|
||||
"- 按每段或每条给 claims 和 grade。等级取 C 或 D,不能高于计算依据给的上限。上限 D 的结论,正文写「这一点目前还不能明确判断」。在 evidence 中逐项写清「缺少」的依据,并原样引用「会变」中的说明和候选。「会变」的依据已经算出,任何段落都不能把它写成缺少或没有算出。需说明的项也照实写在 evidence。把上限和类型留在 JSON 字段中,正文和 evidence 都不复述等级,不写等级字母,也不写「等级上限」「证据等级」。",
|
||||
"- 「会变」里只有分盘上升、上限仍是 C 时,这一节照常写:不依赖那张分盘的判断直接写;依赖它的判断按现在这张盘写。出生时间对这部分的影响由程序在这一条下面加一句说明,正文不用重复,也不要因此写成不能判断。",
|
||||
"- 行星走到本命同一颗星的位置(例如土星经过本命土星),写成「回到出生时所在的位置」,不写「压到」「压在」本命某星。",
|
||||
"- Tajika 相位和九种结构只说明两颗星之间有联系,不作为判断因素,不写成「因此会成」。五分力和年盘 Shadbala 说一颗星能不能起作用,不说好坏。",
|
||||
@@ -1128,6 +1128,8 @@ export function annualReaderWording(text: string): string {
|
||||
let next = (kept.length > 0 && kept.length < sentences.length ? kept.join("") : text).replace(ANNUAL_HEDGE_CLAUSES, "").replace(ANNUAL_WRITING_NOTE_CLAUSES, "");
|
||||
for (const [pattern, replacement] of ANNUAL_READER_PATTERNS) next = next.replace(pattern, replacement);
|
||||
next = readerWording(next);
|
||||
// BUG-2097: no grade caps or 「只作参考」 hedges in what is stored for a new report either.
|
||||
next = annualBasisText(next);
|
||||
if (next === text) return text;
|
||||
return next.replace(/([,、;:])[ \t]*(?=[,、;。!?])/gu, "").replace(/(^|[。!?])[ \t]*[,、;:]+/gu, "$1").trim();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { AnnualReportView } from "../src/components/annual/annual-report-page.tsx";
|
||||
import { annualBasisText } from "../src/lib/annual-reader-display.ts";
|
||||
import { buildAnnualExportBlocks } from "../src/lib/annual-report-export.ts";
|
||||
import type { AnnualSnapshot } from "../src/lib/annual-report-generate.ts";
|
||||
import { stripAnnualBackstageSentences } from "../src/lib/annual-question-material.ts";
|
||||
import { annualReaderLayer, systemPrompt, type AnnualPlanEntry } from "../src/lib/annual-report-sections.ts";
|
||||
|
||||
// BUG-2097(staging 复测第二十二轮,2026-11-20;占星师 2026-11-19 分层答复;产品负责人 2026-11-20 同意:
|
||||
// 「依据」保留技法名,去掉「只作参考」这类话和等级字母)。句子取自那一轮在一份年运依据里看到的写法;
|
||||
// 人名和出生资料都是合成的。
|
||||
|
||||
const EVIDENCE = [
|
||||
"本命计时:Vimshottari 大运罗睺、小运太阳,2027 年 6 月下旬细运换到火星;Narayana(Rath 版)大运天秤、小运双子,对这一段时间看不出方向,Narayana 只作参考。",
|
||||
"Saham(敏感点,按回归时刻白天公式,只作参考,只作参考):事业在天秤年盘第十二宫、地位在巨蟹第九宫。",
|
||||
"行运:木星、土星按 Parashari 星座级相照(木星 5、7、9,土星 3、7、10,同座另记)。Vedha(行星互阻,只作参考)只作参考。这一块等级上限为 C。",
|
||||
"三个Saham只作参考:Artha第6宫、Dhana第11宫、Labha第5宫。",
|
||||
"Narayana只作参考,大运天秤,小运金牛到2026年12月上旬、之后双子;两套方向一致,只表示方向相同。",
|
||||
"两套方向一致只表示方向相同,不把结论说满。",
|
||||
"Vivaha(婚姻)Saham 在双子年盘第 8 宫、Preeti(情感)Saham 在摩羯年盘第 3 宫,两者只作参考项,只作参考。",
|
||||
"Varsha Narayana 与 Saham 两项标只作参考,只作参考。",
|
||||
].join("\n");
|
||||
const TIMING = "Vimshottari 在 2027 年 6 月下旬到 7 月中旬由细运火星支持工作上的推进;Narayana 同期大运天秤、小运双子,对这一段看不出方向,只作参考。";
|
||||
const BACKSTAGE = /只作参考|仅供参考|等级上限|证据等级|只表示方向相同|不把结论说满|(?:等级|把握)\s*(?:为|是)?\s*[A-D](?![A-Za-z])/u;
|
||||
|
||||
function snapshot(): AnnualSnapshot {
|
||||
return {
|
||||
kind: "annual_report_snapshot", version: 2, status: "ready", gradeContract: "report_evidence_grade_v1", gradesSha256: "0".repeat(64),
|
||||
promptSha256: "0".repeat(64), gradeCorrections: [],
|
||||
subject: { name: "小林", isSelf: true },
|
||||
range: { kind: "birthday_year", key: "annual:birthday_year:2026", label: "生日年度", span: "2026-06-15 到 2027-06-15", crossesBirthday: false, birthdays: [] },
|
||||
birthTime: { known: true, beforeMinutes: 6, afterMinutes: 1, source: "family_exact", rectification: "adopted", range: "chosen" },
|
||||
plan: [{ id: "career", kind: "area", title: "工作", disposition: "write" }],
|
||||
sections: { career: { evidence: EVIDENCE, text: "5 月下旬以后工作上的要求变严,先把流程理顺。", timing: TIMING,
|
||||
claims: ["annual_domain_career"], grade: "C", remember: "2 月上旬理顺分工。" } },
|
||||
windows: [], remaining: [], appendix: [], solarReturns: [], tithiReturns: [], factsSha256: "",
|
||||
} as unknown as AnnualSnapshot;
|
||||
}
|
||||
|
||||
function numbers(text: string): string[] {
|
||||
return text.match(/\d+/gu) ?? [];
|
||||
}
|
||||
|
||||
test("a stored annual report shows no grade cap and no 「只作参考」, on the page and in the export", () => {
|
||||
const stored = snapshot();
|
||||
const html = renderToStaticMarkup(createElement(AnnualReportView, { snapshot: stored, generating: false }));
|
||||
const markdown = buildAnnualExportBlocks(stored).map((block) => block.text).join("\n");
|
||||
for (const shown of [html, markdown]) {
|
||||
assert.doesNotMatch(shown, BACKSTAGE);
|
||||
// Every house, sign, date and technique name the basis gave is still there.
|
||||
for (const kept of ["第十二宫", "第九宫", "Artha第6宫", "Dhana第11宫", "Labha第5宫", "双子年盘第 8 宫", "摩羯年盘第 3 宫",
|
||||
"2027 年 6 月下旬", "木星 5、7、9,土星 3、7、10,同座另记", "Saham(敏感点,按回归时刻白天公式)", "Narayana:大运天秤", "Vimshottari"]) {
|
||||
assert.ok(shown.includes(kept), kept);
|
||||
}
|
||||
}
|
||||
// The stored section itself is untouched (display only).
|
||||
assert.ok((stored.sections.career as { evidence: string }).evidence.includes("这一块等级上限为 C"));
|
||||
});
|
||||
|
||||
test("the clean-up keeps every number and only removes the hedge from a line that carries content", () => {
|
||||
const cleaned = annualBasisText(`${EVIDENCE}\n${TIMING}`);
|
||||
assert.deepEqual(numbers(cleaned), numbers(`${EVIDENCE}\n${TIMING}`));
|
||||
assert.equal(annualBasisText("三个Saham只作参考:Artha第6宫。"), "三个Saham:Artha第6宫。");
|
||||
assert.equal(annualBasisText("Vedha(行星互阻,只作参考)只作参考。"), "");
|
||||
assert.equal(annualBasisText("这一块等级上限为 C。"), "");
|
||||
// After 「;」 the next clause is another statement; the name does not label it.
|
||||
assert.equal(annualBasisText("金星小运管第 10 宫;Saham 只作参考;事业分盘上升会换星座。"), "金星小运管第 10 宫;事业分盘上升会换星座。");
|
||||
assert.equal(annualBasisText("2027年5月中旬Vedha只作参考。"), "2027年5月中旬有 Vedha。");
|
||||
const clean = "Vimshottari 大运罗睺,2027 年 6 月下旬细运换到火星。";
|
||||
assert.equal(annualBasisText(clean), clean);
|
||||
});
|
||||
|
||||
test("the model reads the same text the page shows", () => {
|
||||
const read = stripAnnualBackstageSentences(`${EVIDENCE}\n${TIMING}`);
|
||||
assert.doesNotMatch(read, BACKSTAGE);
|
||||
assert.ok(read.includes("三个Saham:Artha第6宫"));
|
||||
});
|
||||
|
||||
test("a new report is written and stored without them", () => {
|
||||
const prompt = systemPrompt();
|
||||
assert.match(prompt, /不加「只作参考」「仅供参考」这类话/);
|
||||
assert.match(prompt, /正文和 evidence 都不复述等级,不写等级字母/);
|
||||
assert.doesNotMatch(prompt, /在 evidence 里写「只作参考」/);
|
||||
const entry = { id: "career", kind: "area", title: "工作", disposition: "write" } as unknown as AnnualPlanEntry;
|
||||
const written = annualReaderLayer(entry, { evidence: EVIDENCE, text: "5 月下旬以后工作上的要求变严。", timing: TIMING,
|
||||
claims: ["annual_domain_career"], grade: "C", remember: "" }, {}) as Record<string, string>;
|
||||
assert.doesNotMatch(written.evidence ?? "", BACKSTAGE);
|
||||
assert.doesNotMatch(written.timing ?? "", BACKSTAGE);
|
||||
assert.equal(written.grade, "C");
|
||||
});
|
||||
@@ -114,7 +114,11 @@ test("the reader layer puts the plain birth-time line under the dependent item a
|
||||
// 原因:BUG-2043,产品负责人 2026-11-19:两套计时的对照折叠进依据,正文不讲
|
||||
assert.equal(body.text, "5 月下旬以后工作上的要求变严。先按压力做准备。");
|
||||
assert.equal(body.timing, "两套计时都显示压力,从 5 月下旬起。");
|
||||
assert.match(body.evidence, /Saham 只作参考;/);
|
||||
// 原值:依据里保留「Saham 只作参考;」
|
||||
// 新值:这一句不再出现,后面那句出生时间的说明照旧
|
||||
// 原因:BUG-2097,产品负责人 2026-11-20:「依据」里不写「只作参考」这类话
|
||||
assert.doesNotMatch(body.evidence, /只作参考/);
|
||||
assert.match(body.evidence, /事业分盘上升在出生时间误差内会换星座/);
|
||||
assert.equal(body.gradeReason, "出生时间前后几分钟,会影响这部分判断;另一种情景下的结论还没有评估。");
|
||||
assert.equal(annualBoundaryNote(data), body.gradeReason);
|
||||
assert.equal(annualGradeNote(body, true), body.gradeReason);
|
||||
@@ -137,7 +141,9 @@ test("reader wording: status words, disclaimers and the Saturn title", () => {
|
||||
["家和学习是 Vimshottari 压力、Narayana看不出,这一节看不出,不细断。", "家和学习是 Vimshottari 压力、Narayana 没有明显指向,这一节看不出。"],
|
||||
["土星压到本命土星后的学习推进", "土星回到出生时的位置之后的学习推进"],
|
||||
["本命两轨在钱上方向一致。", "本命两套计时在钱上方向一致。"],
|
||||
["维姆肖塔里在 6 月上旬换到水星,纳拉亚纳同期只作参考。", "Vimshottari在 6 月上旬换到水星,Narayana同期只作参考。"],
|
||||
// 原值:「Vimshottari在 6 月上旬换到水星,Narayana同期只作参考。」
|
||||
// 新值:只说 Narayana 只作参考的分句去掉;原因:BUG-2097,依据和正文都不写「只作参考」
|
||||
["维姆肖塔里在 6 月上旬换到水星,纳拉亚纳同期只作参考。", "Vimshottari在 6 月上旬换到水星。"],
|
||||
["把固定支出定下来,学习计划往后排。", "把固定支出定下来,学习计划往后排。"],
|
||||
];
|
||||
for (const [before, after] of cases) assert.equal(annualReaderWording(before), after, before);
|
||||
|
||||
@@ -86,9 +86,12 @@ test("the writer's notes that say nothing about the chart are left out of what t
|
||||
for (const gone of ["- Narayana 只作参考。", "Vedha(行星互阻", "两套方向一致只表示方向相同", "Varsha Narayana 与 Saham 两项标"]) {
|
||||
assert.equal(stripped.includes(gone), false, gone);
|
||||
}
|
||||
// A line with a house, a sign or a date is kept whole, notes and all.
|
||||
assert.ok(stripped.includes("- 三个Saham只作参考:Artha第6宫、Dhana第11宫、Labha第5宫。"));
|
||||
assert.ok(stripped.includes("- Narayana(Rath 版)大运天秤、小运双子,对这一段时间看不出方向,Narayana 只作参考。"));
|
||||
// 原值:带宫位、星座或日期的一行原样保留,连「只作参考」一起
|
||||
// 新值:内容保留,「只作参考」这几个字去掉(「三个Saham:Artha第6宫……」)
|
||||
// 原因:BUG-2097,模型读到的和页面显示的是同一份读者文字,「依据」里不写「只作参考」
|
||||
assert.ok(stripped.includes("- 三个Saham:Artha第6宫、Dhana第11宫、Labha第5宫。"));
|
||||
assert.ok(stripped.includes("- Narayana(Rath 版)大运天秤、小运双子,对这一段时间看不出方向。"));
|
||||
assert.equal(stripped.includes("只作参考"), false);
|
||||
assert.ok(stripped.includes("2027 年 5 月中旬土星进白羊"));
|
||||
assert.ok(stripped.includes("五分力 12.51"));
|
||||
assert.equal(stripAnnualBackstageSentences(CLEAN), CLEAN);
|
||||
|
||||
Reference in New Issue
Block a user