Files
Jyotisha/docs/tasks/PROGRESS-counterexamples-20261109.md
T
jesse-uxandGrok (agent loop) 74a739b2dc feat(card): seven acceptance counterexamples end to end (BUG-1812)
- career layer gets the D1 longitudes, so the paksha has one source (Obama
  base vs career mismatch fixed)
- card carries movable_lagna_moon.reason, Narayana ad_status / ad_reason and
  the mahadasha cycle_index; running line says "sub-period undecided"
- engine keeps the MD when the AD is undecided; timingFollowing skips
  zero_duration rows explicitly
- timingKeys allowlist: adstatus / adreason / cycleindex / zeroduration
- fixtures + capture script, 16 engine tests, 7 card tests, PROGRESS, BUG-1812

Co-Authored-By: Grok (agent loop)
2026-11-09 08:38:56 +08:00

9.4 KiB
Raw Blame History

PROGRESS:占星师验收清单的七个反例(#169 / BUG-1812)

  • 分支:codex/counterexamples-20261109(基于任务书提交,代码基线 b453505d)
  • 任务书:docs/tasks/TASK-counterexamples-20261109.md
  • 开工时 docs/BUG_HISTORY.md 最大编号:BUG-1804;按任务书用 BUG-1812
  • 完成日期:2026-11-09

结论

七个反例各有引擎侧与数据卡侧测试,共 16 条 Python + 7 条 TS,全部通过。三处卡上漏字段(月相 reason、小运 ad_status / ad_reason、大运 cycle_index)已补,Obama 盘事业层与基础层「月相缺失」不一致已修。

七个反例

反例 引擎函数 卡上字段 修前结果 修后结果 测试名
(a) 缺月相 build_career_analysis → analyze_career / derive_functional_benefic_malefic base.natal.functional_benefic_malefic.movable_lagna_moon、domain_sections.career.career_analysis.*.movable_lagna_moon Obama 基础层 derived_from_table_30_note / waning / neutral,事业层 blocked / moon_paksha_missing;卡上 movable_lagna_moon 没有 reason,两种情形分不开 两层同源(事业层拿到 D1 经度);缺月相时两层都 blocked + moon_paksha_missing,卡上带 reason,只有月亮被阻塞、其余六颗照常分类 test_a_missing_moon_paksha_blocks_only_the_moon_and_both_layers_agree / (a) missing moon paksha
(b) 低档强弱未决 narayana_rath.compare_signs / calc_narayana_rath / shadbala.calc_shadbala + attach_parameter_sensitivity base.timing.narayana.method_status、domain_sections.career.shadbala 未决通过 method_status 能到卡,但没有一条测试证明「未定步骤被点名且不补当前大运」;Shadbala 的 parameter_sensitive 也没有端到端用例 comparison_status=unresolved、blocked_step=seed、unresolved_steps=["seed"]、chat_use=no_judgment、md 缺失进 gaps;Jupiter 保留 minimum_check=parameter_sensitive 与开放问题,不写达标 / 不达标 test_b_low_grade_comparison_undecided_names_the_step_and_scores_nothing / (b) undecided low-grade comparison
(c) 小运未决、大运已定 narayana_rath.antardasha / branch_under / product_narayana / build_dasha_systems base.timing.narayana.ad_status、ad_reason;dasha_systems.systems.narayana.ad_status、ad_reason;method_status.running current_dasha 在 AD 未决时干脆没有 ad,卡上「没有 ad」与「没算」分不开;running 只写主运 大运 Taurus(第 2 轮)与日期原样保留;ad_status=blocked、ad_reason=saturn_ketu_priority_unresolved;running 写「子运未决(saturn_ketu_priority_unresolved)」;没有任何补出来的 AD test_c_ad_undecided_keeps_the_md_and_names_the_reason / (c) undecided sub-period…
(d) 月亮自参照 neecha_bhanga_rows / build_yoga_conditions domain_sections.career.independence.self_reference_only、.self_reference 已有单测与 2026-11-08 的管线测试,但没有「引擎行 → fixture → 卡」这一环 自参照格局进 self_reference_only、带自参照说明;注入这一行与不注入时 support 逐项相同(一票都不加) test_d_moon_self_reference_is_never_independent_confirmation / (d) Moon-only self-reference…
(e) 出生余额 chart_dasha.birth_moment.antardashas / _consultation_dasha_sub_periods base.timing.vimshottari.antardashas_in_mahadasha[].parent_period_start / visible_period_start、base.timing.vimshottari.mahadasha golden 三张盘都是成年人,卡上的裁剪分支从未被真实数据覆盖 合成年轻盘(2020-05-01,余额 Mercury 剩 10.72 年):出生小运同时带父段起点 2020-04-12 与可见起点 2020-05-01,9 条子运边界与未裁剪版本逐日相同 test_e_birth_balance_keeps_the_full_parent_start_beside_the_visible_one / (e) birth balance…
(f) 第二轮大运 narayana_rath.mahadasha_sequence / product_narayana / birth_moment.next_cycle_mahadashas base.timing.narayana.md.cycle_index _period 不抄 cycle_index,卡上说不出「第几轮」 当前大运 Aquarius、cycle_index=2、years=11 与引擎行一致;24 行里只有一行覆盖参考年龄;Vimshottari 跨 120 年后当前段 cycle=2(Moon,10 年) test_f_second_cycle_is_named_and_the_running_row_is_unique / (f) second cycle…
(g) 0 年大运 narayana_rath.mahadasha_sequence(zero_duration) base.timing.narayana.md、narayana.next 卡上只靠 years > 0 间接排除 0 年段,引擎的 zero_duration 标记没被用上 0 年段(Sagittarius 第 1 轮、start_age == end_age == 38)留在 mahadasha 数据里并带 zero_duration;参考日恰在段起点时当前大运是 Aquarius(第 2 轮,11 年);next 不含 0 年段 test_g_zero_year_period_is_kept_in_the_data_and_never_current / (g) zero-year period…

修前 / 修后

修前用基线 b453505d 另开一次性工作树(counterexamples-before,跑完已删除),把同一批测试与 fixture 放进去:

  • 数据卡 7 条:3 条失败 —— (a)、(c)、(f),正好是卡上三处漏字段。
  • 引擎 16 条:test_fixture_is_fresh_for_every_counterexample 失败(引擎输出与 fixture 不一致),其余通过(断言读 fixture,不重跑引擎)。

修后同一条命令全绿(见下)。工作树已删,git worktree list 不再有 counterexamples-before。

改了什么

  • scripts/consultation_native_layers.py
    • build_career_analysis:把 D1 经度并入交给 analyze_career 的行(原值只给 house / sign),事业层与基础层同源。
    • build_dasha_systems:Narayana 大运带 cycle_index / zero_duration,整行带 ad_status / ad_reason(都照抄引擎)。
  • scripts/narayana_legacy_label.py
    • _period 带 cycle_index(有值时)与 zero_duration(为真时)。
    • rath_narayana_view:AD 未决时 current_dasha 照给大运,另带 ad_status=blocked / ad_reason;AD 选定时 ad_status=selected。
  • frontend/src/lib/consultation-evidence-card.ts
    • functionalProfileFields:movable_lagna_moon 带 reason。
    • NARAYANA_MD_CARD_KEYS 加 cycle_index。
    • DASHA_ROW_KEYS 加 ad_status / ad_reason。
    • baseTiming:narayana 带 ad_status / ad_reason。
    • narayanaRunningLine:AD 未决时写「子运未决(原因)」。
    • timingFollowing:显式跳过 zero_duration: true 的行。
  • frontend/src/mastra/consultation-workflow.ts:timingKeys 白名单加 adstatus / adreason / cycleindex / zeroduration(否则这些字段在投给模型的 timing 里被裁掉)。
  • 新增:scripts/research/capture_counterexample_fixtures_20261109.py、7 份 fixture、tests/test_counterexamples_engine_20261109.py、frontend/tests/consult-counterexamples-card-20261109.test.ts。

偏离与原因

  1. 卡上 MD 没有 parent_period_start / visible_period_start。 任务书要求「卡上 MD 与 AD 同时带」,但 MD 这两个字段的唯一生产者是冻结文件 scripts/jyotish_api_server.py:_consultation_birth_moment_mahadashas 只返回 lord / start / end,boundary() 因此拿不到父段起点。任务书把该文件列为只读,所以卡上只断言出生小运的两个字段,MD 的裁剪在引擎层断言(sub_periods.current.mahadasha.start 早于出生、end 晚于出生;birth_moment.antardashas 的边界不移动)。若要 MD 也上卡,需要另开一单改冻结文件。
  2. 改了 scripts/narayana_legacy_label.py。 任务书「要改的文件」没列它,但它是 current_dasha 的唯一生产者:ad_status / cycle_index 不在这里带出,卡上就没有来源。只加字段,不动 narayana_rath 的公式、规则与年数。
  3. 改了 frontend/src/mastra/consultation-workflow.ts 的 timingKeys。 不加白名单,新字段在 toModelOutput 的 timing 投影里被裁掉,卡上永远看不到。只加四个键名,不加字段、不改结构。
  4. 本工作树的环境。 frontend/node_modules 与 .venv 不随 worktree 复制:node_modules 用目录联接指向 .worktrees/agent-loop/frontend/node_modules(git 不跟踪),Python 用同一工作树的 venv(.venv\Scripts\python.exe)。不是代码改动。

跑过的命令与结果

检查 命令 结果
fixture 生成 .venv\Scripts\python scripts/research/capture_counterexample_fixtures_20261109.py 7 份写入 frontend/tests/fixtures/counterexamples-20261109/
引擎测试 .venv\Scripts\python -m pytest tests/test_counterexamples_engine_20261109.py -q 16 passed
数据卡测试 node node_modules/tsx/dist/cli.mjs --test tests/consult-counterexamples-card-20261109.test.ts 7 pass / 0 fail
相关卡片回归 同上再带 consult-self-reference-pipeline-20261108、consult-evidence-card-20260927、consult-evidence-card-v2-20260927 36 tests / 36 pass / 0 fail / 0 cancelled,退出码 0
类型检查 frontend\node_modules\.bin\tsc --noEmit -p frontend 0 错
lint npm run lint(frontend) 0 error / 62 warning(既有警告,未新增)

前端全量测试与 Python 快速门按任务书留给 Claude 验收。

没做 / 留给验收

  • 回答阶段(模型读卡后怎么写)的盲测由 Claude 另做。
  • 生产 / staging 部署核对由 Claude 在合入后做。