fix(kp): place exact angular boundaries on the opening subdivision

Upstream 8eec9a54. Floating accumulation and a 120-degree remainder put star, pada, and sub-lord on different sides of the same boundary. Random longitudes away from those boundaries are unchanged. BUG-1383.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jesse-ux
2026-10-18 16:20:35 +08:00
co-authored by Grok (agent loop) Cursor
parent 5be864a8e4
commit b5eb72343a
3 changed files with 91 additions and 33 deletions
+15
View File
@@ -36533,3 +36533,18 @@
- 相关记录:BUG-1268、BUG-1380。
- 复发自:无。
- 修复版本:分支 `codex/upstream-sync8-20261017`。上游提交 `3c2dad95`。
## BUG-1383 | KP 子分区在精确边界上落到不同半开区间
- 状态:resolved
- 首次发现 / 最近更新:2026-10-17 / 2026-10-18
- 来源:issue #80,任务书 T7。上游 `8eec9a54`。检索「get_kp_lords」「sub_sub」,没有更早的同类记录。
- 现象:星宿、四分和子主星在精确边界上各算各的。按角秒扫一圈,约 129.6 万个点里有 499 处不一致,都在精确边界上。
- 触发条件:`get_kp_lords` 用浮点累加子区间,再和 120° 取余混用。
- 根因:区间边界被重复舍入,共享边界没有固定归给新开的那一段。
- 修复:子区间起点按分数算好一次,再用二分查找。非法输入(布尔、空值、字符串、非有限数)抛出 `ValueError`。调用点已经先做 `float()`,或同时捕获 `TypeError` 和 `ValueError`,没有只依赖旧 `TypeError` 的分支。
- 验证:`tests/test_kp_exact_angular_boundaries.py`。20 万个随机经度新旧结果 0 处不同。
- 防复发:上述边界测试。
- 相关记录:BUG-1381。
- 复发自:无。
- 修复版本:分支 `codex/upstream-sync8-20261017`。上游提交 `8eec9a54`。