hjhan
|
90d1d85b4a
|
test(infra): DbDiagnose 用例库不可达自守卫——真探测一次+进程级缓存结论
原守卫 try 挂在 GetYLDbContext() 上永远打不中(EF context 构造不连库,
Connect Timeout 发生在首个查询),无库裸跑 14 个用例逐个假红且各耗 15s。
改为 DbDiagnoseGuard.RequireTestDb():CanConnect 真探测一次并缓存,
不可达全批 Inconclusive——裸跑不再有假失败噪音,探测成本 14×15s→1×15s。
连上库的机器行为不变(照常真跑)。
|
2026-08-18 09:58:16 +08:00 |
|
hjhan
|
ef37c8e71d
|
refactor(swap): 合并多空名义本金参数为单一 posiTotalNotional 并加固测试
- DealInterests 的 posiLongNotionalValue + posiShortNotionalValue 合并为 posiTotalNotional(调用点以 posiLongNotional+posiShortNotional 求和传入),净减一个参数
- SwapDealService / SwapEodPositionService / InterestCalcRequest 同步收敛多空死管道参数
- 19 个测试调用点适配新签名
- SwapEodPositionServiceIntegrationTest 参数计数断言由裸数字改为参数名集合断言(CollectionAssert.AreEquivalent,对增删/重排/改名敏感)
|
2026-08-14 17:30:46 +08:00 |
|
hjhan
|
4a3fee9292
|
refactor(swap)+test: 删 GetInterests/CalcSwapInterests 死参数 needPrice/grossPrice;补工厂→接缝映射钉子
死参数收口(另一半):
- SwapDealService.GetInterests 删 needPrice/grossPrice(体内零消费,2026-08 验证);
InitSwapDealInterest.needPrice 同为死参数一并删
- SwapEodPositionService.CalcSwapInterests 签名+转发同步;两个 EOD 生产调用点
(SaveAutoEodInterestPosition/SaveEodInterestPositionCopy) 重排实参;
CalcEodPostCloseSettleInterests/GetIntradayUnwindInterests 委托同步
- 14 个测试文件 ~44 处直调点机械更新(8 处 override 签名 + 36 处调用实参)
- 注意:EOD 编排链(DealInterests→Save*家族)的 grossPrice(期初不含费价)有真实用途,保留未动
新增钉子:CalcEodPostCloseSettleInterests 工厂→接缝参数映射测试——
CalcSwapInterestsCapture 捕获 stub 断言 EodPostCloseSettle 的完整转发契约
(posi=平仓后剩余/closePosi=平掉额/恒1/settment:false/orginPv 等 11 项)。
该段位置转发含三个相邻同型 decimal,编译器不查错位,此测试兜底。
验证:定向 241 测试通过(含 T0/T1 Excel 验证期望值、EntrySemantics 精确值钉子——
任何 decimal 错位即红);全量 903=145失败/746通过/12跳过,与基线逐位一致。
|
2026-08-14 16:57:56 +08:00 |
|
hjhan
|
dea9c4cba5
|
docs(margin): 修复保证金计息重构后的过时文档与注释
按最新代码(CalcMarginInterest 已接生产、orginPv hack 已删、MarginAccount 未接线、保证金精度=12)修正:
- 删除 orginPv 维度重映射的孤儿 summary(方法已删)
- SwapDealService 注释:去掉 orginPv(InitSwapDealInterest)/保证金腿 引用
- SwapInterest/AccrualContext/InterestRate:去掉 Precision=11 是"保证金腿"、"保证金场景"等错误归因(保证金实际跑精度12)
- MarginAccount/MarginBalance:标注"尚未接线",生产入口指向 CalcMarginInterest,去掉"余额×利率×天数"过度简化
- 测试注释:去掉"无 orginPv/差分"(盘中保留差分)、"提交2 待切换"(已完成)
仅文档/注释,零代码行为变化。
|
2026-08-13 10:58:47 +08:00 |
|
hjhan
|
9b29211d3c
|
refactor(margin): 保证金计息切换到 CalcMarginInterest + 删 orginPv 外部维度 hack
- GetInterests 保证金分支(5/6)切到 CalcMarginInterest,不再走融资腿通用 CalcEodInterest/CalcUnwindInterest
- 删除 InitSwapDealInterest 的保证金 orginPv 维度 hack(保证金已不走该方法,成为死代码)
- CalcMarginInterest 修正三处与旧管线的对齐(全量回归发现):
· 加 endDate 参数(盘中用 InitInterestDate 的 endDate,否则少算天数)
· calcLast 合并 newCalcLast(与 CalcUnwindInterest 一致,算尾)
· 盘中保留 accrualBasis 差分(posiPrincipal 对齐状态路径相关,单一本金变量无法覆盖;orginPv 内部按 PreviousBalance 算,消除外部维度 hack)
- 更新 Shadow/GoldenReplay 测试调用点(加 endDate)
修正说明:盘中“消除差分”不可行——SPC_006(position 已对齐) 与 PrepaidPrincipalCloseTrace(position 未对齐) 期望相反,差分 accrualBasis 经 orginPv 自适应两种状态。CalcMarginInterest 真实收益收敛为:保证金领域独立 + orginPv 内聚 + 消除浮动/分段/复利死分支,而非消除差分。EOD 路径无差分(用昨日终本金)。
验证:全量 SwapModule 522/522 通过(0 失败);真实库黄金回放 60 条 0 差异。
|
2026-08-13 10:39:03 +08:00 |
|
hjhan
|
7243684839
|
test(margin): 新增真实库黄金回放验证——96库60条EOD逐日比对,新旧管线0差异
- MarginInterestGoldenReplayTest:连 192.168.2.96 测试库,对真实保证金交易(GLMS-20260701-0008/-0013/-0006)逐日 EOD 比对旧管线 GetInterests(settment=true) vs 新方法 CalcMarginInterest
- 结果:60 条腿×日比对,InterestAmount/TdInterestAmount 严格一致(容差1e-6),0 不一致
- 覆盖真实边界:追加预付金多行(base 135555/200000 各自计息)、InterestProfitSum 累计滚动、跨 EOD 续接
- 为提交2(切换生产+删 orginPv hack)建立真实数据安全网
|
2026-08-13 09:59:48 +08:00 |
|