fix(bot-bridge): subjects category 白名单补齐库内实况 revenue/profit_loss — 消除库内合法值被400拒 (dama-cma-subjects-category-whitelist-20260912)
This commit is contained in:
@@ -984,7 +984,20 @@ def bot_dict_zxt_account(
|
||||
# (见 cma-fullstack-ops「账套隔离」豁免说明),故本端点不做 entity 归属校验。
|
||||
|
||||
_SUBJ_FIELDS = ("subject_code", "subject_name", "parent_code", "level", "category", "is_active")
|
||||
_SUBJ_CATEGORIES = ("asset", "liability", "equity", "cost", "income", "expense", "detail", "other")
|
||||
# category 白名单:以新30号准则科目字典的**库内实况**为准,不臆造枚举。
|
||||
# 2026-09-12 修复(dama-cma-subjects-category-whitelist-20260912):
|
||||
# 原白名单 8 值漏了库内真实存在的 revenue(5 行: 6001/6011/6051/6111/611101) 与
|
||||
# profit_loss(1 行: 6901),导致「对库内既有科目的任何合法更新」「按库内既有约定回填的
|
||||
# 批次导入」整批 400 —— DAMA 独立复核实证(3 行收入类科目被阻断)。
|
||||
# 证据:SELECT DISTINCT category FROM subjects → 9 值(2026-09-12 只读核验,207 行):
|
||||
# asset/cost/detail/equity/expense/income/liability/profit_loss/revenue。
|
||||
# 取值策略(采用任务方案 A「补齐白名单」,DAMA 反对 B 静默归一化——同一字典内同一概念
|
||||
# 出现两种取值应由 DAMA 出标准化方案后统一改值,端点不得替用户改写数据):
|
||||
# 9 个库内真实值 + 'other'(既有契约的写入口袋值,缩小白名单会引入回归,故保留)。
|
||||
# 防漂移:新增取值由 tests/test_bot_bridge.py::TestSubjectsWrite 的语料断言测试 +
|
||||
# scripts/check_subjects_category_drift.py(生产库 SELECT DISTINCT ⊄ 白名单 → 失败)兜底。
|
||||
_SUBJ_CATEGORIES = ("asset", "liability", "equity", "cost", "income", "expense", "detail", "other",
|
||||
"revenue", "profit_loss")
|
||||
_SUBJ_LEVELS = (1, 2, 3)
|
||||
_SUBJ_MAX_ROWS = 2000
|
||||
# subject_code / parent_code 长度上限:任务规格为 ≤32,但 DB 列 subjects.subject_code /
|
||||
|
||||
Reference in New Issue
Block a user