From 3eaae417baeeed7060903cdedd83c52c78a3c4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 19:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3(=E8=AE=A1=E8=B4=B9):=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=8D=87=E7=BA=A7=E6=8A=A5=E4=BB=B7=E6=95=B0?= =?UTF-8?q?=E5=80=BC=E5=85=A5=E5=8F=82=E8=87=AA=E6=A3=80=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在领域数据结构 §3 记录 quote_runtime_profile_membership_upgrade 的防御式自检与 invalid_quote_input 拒绝 Co-authored-by: Junie --- .../【技术设计】泥点三池与会员计费后端设计-2026-10-02.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/technical/【技术设计】泥点三池与会员计费后端设计-2026-10-02.md b/docs/technical/【技术设计】泥点三池与会员计费后端设计-2026-10-02.md index d34df3264..b23958b0e 100644 --- a/docs/technical/【技术设计】泥点三池与会员计费后端设计-2026-10-02.md +++ b/docs/technical/【技术设计】泥点三池与会员计费后端设计-2026-10-02.md @@ -272,6 +272,9 @@ pub struct RuntimeProfileMembershipUpgradeQuote { - `quote_runtime_profile_membership_upgrade(input) -> Result`: 入参 `RuntimeProfileMembershipUpgradeQuoteInput`(当前档位 / 周期、目标档位 / 周期、期序号 / 期总数、 本期窗口、当前月度余额、`now`);金额向上取到分、补点向下取整;月付 / 年付分支见 §6;年价取目录 `year_price_cents`。 +- 报价函数对数值入参做防御式自检:`1 <= cycle_index <= cycle_count`、`cycle_started_at <= now`、 + `cycle_started_at <= cycle_resets_at`,越界返回 `invalid_quote_input`(`InvalidQuoteInput`), + 不再被 `saturating_sub` 静默夹取;生产入口从会员行构造的入参恒满足这些不变量。 - `check_runtime_profile_membership_upgrade_allowed(...) -> Result<(), rejection>`: §3.4 允许操作矩阵的唯一实现(非会员不可升级 / 不支持月转年与年转月 / 同档与降档拒绝 / 目标不可购买拒绝)。 - `membership_cycle_remaining_ratio_ppm(cycle_started_at, cycle_resets_at, now) -> u32`:本期剩余比例(ppm,向下取整)。