Commit Graph

1142 Commits

Author SHA1 Message Date
k88936 af0721fb78 fix(会员): 回灌后收敛充点商品目录并清理退役会员商品行
- profile.rs 新增 converge_default_profile_recharge_product_config,在存量库读取路径补齐缺失的 points_1280 / points_3280 档位。

- 同一步骤删除已退役的 membership 类型充点商品配置行,避免冲突迁移把旧 member_* 行原样带回后残留。

- 存量库充值商品目录因此幂等收敛到当前六档点卡,不再停留在旧四档 + 四行会员商品。
2026-10-03 17:24:00 +08:00
k88936 21f69ef13b fix(迁移): 补齐会员重构的破坏性迁移导入兼容
- migration.rs 为旧迁移包回填 profile_membership 的 plan / cycle_index / cycle_count / cycle_kind 默认值。

- migration.rs 为旧迁移包回填 profile_recharge_order 的 14 个 membership_* 快照默认值,避免回灌导入因缺列失败。

- 新增两条单元测试守护会员表与订单快照的旧包默认值。

- 同步后端架构文档的 profile_membership / profile_recharge_product_config / profile_recharge_order 表目录。

- 记录 SpacetimeDB 2.8.3 持久表删列需显式迁移的实测结论与既有 run_conflict_migration_publish 路径。
2026-10-03 17:11:04 +08:00
k88936 1a106eadef 每日免费发放额为 0 时前端隐藏该池
- 后端:module-runtime 的 daily_free_points_per_day 校验由「必须大于 0」放宽为只校验上界,错误变体改名 DailyFreePointsPerDayOverflow
- 前端共享层:mudPoints 新增 shouldShowProfileDailyFreePool,判定 remaining > 0 || reset > 0,判定收口一处
- 钱包入口:PlatformMudPointWalletEntry 在每日免费发放额为 0 且无存量时隐藏该行
- 充值弹层:PlatformProfileRechargeModal 池概览按可见池渲染(三列变两列),扣点顺序提示与泥点确认页文案随可见性切换
- Admin Web:账号配置页每日免费泥点允许填 0(校验、min 与文案同步)
- 测试:删除「每日免费必然存在」断言,新增隐藏 / 有存量仍显示 / 发放额为正三类用例,并修正钱包入口测试在 HEAD 上失效的选择器
- 文档:更新会员与泥点前端改造设计文档 §14 与 shared-memory 决策记录
2026-10-03 16:48:12 +08:00
k88936 43f0c51120 后台用户详情改走只读会员快照
新增只读会员快照 procedure get_profile_membership_snapshot_and_return,不刷新钱包 / 账期、不写库
module-runtime 新增 RuntimeProfileMembershipGetInput 与 RuntimeProfileMembershipSnapshotProcedureResult 及入参构造器
spacetime-client 增加 get_profile_membership_snapshot facade、From 转换与结果映射,并同步生成绑定
build_profile_membership_snapshot 拆成写库与纯读两条路径,共用 from_row 投影
admin_get_user_detail 改用只读会员快照,打开详情不再改用户钱包与会员账期
2026-10-03 16:42:48 +08:00
k88936 6f0d773dde 会员档位目录种子改由模块初始化播种
新增 init 生命周期 reducer,数据库首次创建时把 profile_membership_plan 整表播种
membership_plan_row 与 membership_plan_records 去掉懒播种,只读路径不再写库
ensure_default_profile_recharge_product_config 不再顺带初始化会员目录
存量数据库此前已由懒播种写入目录行,新建数据库由 init reducer 播种
2026-10-03 16:27:04 +08:00
k88936 4c6af9f190 会员目录响应下发推荐档位与不设并发上限标志
ProfileMembershipPlanResponse 新增 recommended 与 unlimitedConcurrency 两个派生布尔
module-runtime 新增 PROFILE_MEMBERSHIP_RECOMMENDED_PLAN 常量并导出,作为推荐档位唯一真相源
api-server 目录响应按该常量与 is_unlimited_concurrency 派生标志
前端 ProfileMembershipPlanRecord 契约补上两个字段
membershipCopy 删除硬编码的 'plus' 与 128,并发文案改读 unlimitedConcurrency
充值弹窗推荐标签改读 plan.recommended
更新充值弹窗测试夹具
2026-10-03 16:18:14 +08:00
k88936 3031f58875 会员升级结算前校验订单冻结的变更前状态
结算补差升级单前比对 settlement.plan_before / cycle_kind_before 与当前会员行,不一致直接拒绝「会员状态已变化,请重新下单」
避免用户先付更高档位升级单后,旧升级单落地把档位 / 周期覆盖回去,出现降档或「年付 + 一个月到期」的矛盾行
api-server 把该业务拒绝映射为 400
2026-10-03 16:16:07 +08:00
k88936 3e2ab3cf78 会员充值下单不再接受客户端时间参数
RuntimeProfileRechargeOrderCreateInput 删除 created_at_micros 字段,procedure 入参不再携带时间
build_runtime_profile_recharge_order_create_input 同步去掉时间参数
spacetime-module 建单时刻改用 ctx.timestamp,避免客户端把时间设到会员到期前夕压低补差金额
spacetime-client facade 与 mapper、生成绑定同步去掉该字段
api-server 不再自算 current_unix_micros 传入
更新受影响的 module-runtime 单测调用
2026-10-03 16:15:36 +08:00
k88936 f9b0cf786d 会员升级补差订单到期后按新购价校验结算
新增 check_expired_membership_upgrade_settlement:补差订单在支付前会员已到期时,订单金额必须达到目标周期当前目录价才允许按新购结算,否则拒绝
新增 RuntimeProfileMembershipUpgradeRejection::MembershipExpiredBeforeSettlement 及错误码字符串
module-runtime 导出该判定函数供结算侧复用
spacetime-module 结算分支调用该判定,目录缺档位时返回明确错误
api-server 把「会员已到期,请按新购价格重新下单」映射为 400 业务错误
补充过期补差订单必须覆盖整期新购价的单元用例
2026-10-03 16:06:06 +08:00
k88936 4621f76a58 会员升级报价拒绝已刷新账期的过期窗口
修正 upgrade.rs 报价校验:now 必须落在 [cycle_started_at, cycle_resets_at) 内,越界按 InvalidQuoteInput 拒绝,避免旧 cycle_index 配零剩余比例多收一个完整月
同步模块头注释、校验函数文档与 InvalidQuoteInput 枚举说明
把「过期窗口只收完整月」的用例改为「过期窗口被拒绝」,保留剩余比例自身的 0 断言

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 15:32:33 +08:00
k88936 aca58b6b25 fix(后台接口): 会员升级与档位目录的业务拒绝改为 400
- runtime_profile.rs:新增 is_runtime_profile_membership_domain_error,会员升级报价(非会员 / 重复购买 / 月年互换 / 档位下架 / 非法报价入参)与会员档位目录校验失败统一映射为 400,基础设施错误仍保持 502

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 14:59:37 +08:00
k88936 adfae5adee fix(会员计价): 零时长账期窗口按非法入参拒绝
- module-runtime/membership/upgrade.rs:账期窗口校验由 < 改为 <=,cycle_resets_at 等于 cycle_started_at 时不再退化成「剩余比例为 0」

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 14:59:26 +08:00
k88936 73b53a9dd1 fix(会员计价): ceil_div 零分母改为 debug_assert 暴露
- module-runtime/membership/upgrade.rs:ceil_div 增加 debug_assert!(denominator != 0),零分母在测试里立即失败,不再被静默算成 0 元

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 14:58:21 +08:00
k88936 14ddf09f30 Merge remote-tracking branch 'origin/master' into feat/pricing-plan
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m28s
Project CI / Backend tests (pull_request) Failing after 53s
Project CI / Native shell tests (pull_request) Failing after 1m33s
Project CI / Frontend tests (pull_request) Failing after 1m2s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 5m43s
Project CI / AI game creator shell web tests (pull_request) Failing after 45s
Project CI / Repository checks (pull_request) Failing after 1m3s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 5m24s
2026-10-03 13:36:04 +08:00
k88936 90e520fdba refactor(会员): 升级报价改为只读,不再刷新账期与钱包
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
- profile.rs:build_profile_membership_upgrade_quote_record 不再调用 refresh_profile_wallet_expiring_points,改用只读投射 project_profile_membership_cycle_at 把账期推进到当前时刻
- profile.rs:报价接口不再写库 / 发账本,不会提前消耗用户的懒刷新,同时保持与建单、结算同口径

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 13:32:54 +08:00
k88936 4eb4c6ae17 docs(会员): 补充会员账期推进与升级报价的逻辑注释
- profile.rs:advance_profile_membership_cycle_to 补充「锚点恒定、期号可推导、落库仅作单调水位、时钟回拨不重放」说明
- profile.rs:refresh_profile_membership_cycle 补充未换期(含时钟回拨)直接返回的守卫注释
- profile.rs:membership_upgrade_quote_input 注明期号即账期水位、年付补差按剩余整月折算
- profile.rs:build_profile_membership_upgrade_quote_record 与 build_profile_membership_order_snapshot 补充账期口径说明
- upgrade.rs:注明年付补差剩余整月来自单调水位、不会因重复刷新漂移

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 13:31:25 +08:00
k88936 16f92f2110 refactor(会员): 会员档位目录移除无用的 sort_order,统一按 rank 排序
- module-runtime catalog.rs:RuntimeProfileMembershipPlanRecord 与种子目录去掉 sort_order,目录单测改为按 rank 断言
- module-runtime domain.rs/commands.rs:后台改价入参与构建函数去掉 sort_order
- spacetime-module profile.rs:profile_membership_plan 表结构去掉排序列,membership_plan_records 改按 rank 升序读取
- shared-contracts runtime.rs:ProfileMembershipPlanResponse 与 AdminUpsertProfileMembershipPlanRequest 移除 sortOrder
- spacetime-client:客户端签名、mapper 与 module_bindings 同步移除 sortOrder
- api-server runtime_profile.rs:响应构建与测试夹具去掉 sortOrder
- admin-web:AdminMembershipPlanPage 移除「排序」输入,档位列表改为按 rank 排序,契约类型同步
- packages/shared:ProfileMembershipPlanRecord 去掉 sortOrder,充值弹层改为直接沿用后端的 rank 顺序
- docs:泥点三池与会员计费后端设计同步目录字段与后台能力说明

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 13:14:04 +08:00
k88936 e5de57f7f8 feat(会员): 管理接口校验调用方身份、写入侧拦倒挂目录、会员订单冻结结算快照
- profile.rs:10 个配置管理 procedure(任务/钱包/充值商品/会员档位/升级报价)补 require_editor_generation_runtime_service_identity,只允许 api-server 服务身份调用
- catalog.rs:新增 validate_runtime_profile_membership_plan_row_against_catalog,写入侧校验 rank 与月价/年价/每期泥点严格递增并拒绝倒挂
- errors.rs:新增 RuntimeProfileFieldError::InvalidMembershipPlanOrder 及中文文案
- lib.rs:导出 validate_runtime_profile_membership_plan_row_against_catalog
- catalog.rs:新增 4 个单测覆盖种子目录、单调改价、倒挂价格/泥点与重复 rank
- profile.rs:会员订单建单时冻结档位/价格/补点快照到订单行,支付结算只认快照,历史 Pending 订单回退按目录重算
- profile.rs:新增 project_profile_membership_cycle_at 只读投射账期,建单金额不再写库刷新,与预览/结算口径一致
- profile.rs:支付结算不再因档位下架拒绝已受理订单,避免付款回调卡死
- profile.rs:新增 2 个单测覆盖订单快照写入读回与无快照回退

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 12:46:50 +08:00
k88936 7acae0d308 后台契约与接口透出会员变更快照与用户会员状态
- shared-contracts 新增 AdminMembershipOrderChangePayload 与 AdminProfileMembershipPayload
- AdminProfileWalletPayload.membership_limited_points 改名 monthly_points
- AdminRechargeOrderEntryPayload 增加 membership_change 快照字段
- AdminUserDetailResponse 增加 membership 字段
- admin_recharge 映射会员订单快照与用户会员中心投影

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 11:48:24 +08:00
k88936 6d04f88f41 让充值商品默认档迁移识别旧迁移遗留的行
resolve_default_point_product_migration 同时识别停用的「首充双倍」行(赠送为 0 或等于面额)与在售的「首充加赠」行
更新迁移单测:disabled_seed 按旧迁移后的真实状态构造,并补充「首充加赠」用例

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 11:15:37 +08:00
k88936 92917f57c9 升级报价遇到目录倒挂时改为报错
quote_runtime_profile_membership_upgrade 用 checked_sub 替换 saturating_sub,价格或每期泥点倒挂时返回 InvalidQuoteInput
新增 inverted_catalog_price_and_points_are_rejected 覆盖原本会算成 0 元升级的场景

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 11:15:34 +08:00
k88936 119eb7c8b3 收紧后台会员档位与充值商品的校验和报错文案
可购买档位新增 period_points == 0 拒绝;不可购买档位固定使用目录种子的并发上限与模型权限
InvalidRechargeProductTier 拆为 InvalidRechargeProductKind 与 InvalidRechargeProductFields,报错不再误导运营

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-03 11:15:30 +08:00
k88936 06eb4e668c 修复(计费): 升级报价总期数改由周期类型推导
- 删除 RuntimeProfileMembershipUpgradeQuoteInput.cycle_count 入参,改由 target.cycle_kind.cycle_count() 推导(月付 1 / 年付 12),杜绝入参期数与周期类型不一致导致按错误期数计费
- 报价数值自检的期号上界改为相对推导出的总期数判断
- spacetime-module 构造报价入参时不再传 cycle_count
- 同步升级报价单测:年付 12 期、当前第 3 期 → 剩余完整月数 9,金额与测试夹具一并修正
- 同步设计文档 §3 入参与自检说明、§5.3 年付示例(remainingFullMonths 9 / amountCents 158334)

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 20:26:48 +08:00
k88936 bc3d8dc7da 注释(计费): 记录会员目录重建暂不缓存的原因
runtime_profile_membership_plan_catalog 加 TODO,说明每次重建只有 5 行、开销可忽略

按作者意见标记 wont fix,暂不改 LazyLock / &'static 缓存

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 20:06:07 +08:00
k88936 047e6d72e4 重构(计费): 会员档位 rank 解析改为可失败返回
runtime_profile_membership_plan_rank 返回 Option<u8>,目录缺行时返回 None

去掉 unwrap_or(0),不再把目录缺失伪装成 Normal 而误报 NotUpgrade

plan_rank_follows_catalog_order 测试断言同步改为 Some(..)

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 20:05:51 +08:00
k88936 83dbd0cc77 修复(计费): 升级报价拒绝越界数值入参
- 新增 RuntimeProfileMembershipUpgradeRejection::InvalidQuoteInput 及 wire token

- 报价前校验期号范围与账期窗口,避免 saturating_sub 静默夹取

- 新增 invalid_numeric_input_is_rejected 回归测试

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:57:04 +08:00
k88936 f09701f6d4 重构(计费): module-runtime 去掉通配 re-export 改为策展导出
- lib.rs 移除 pub use civil_calendar::*,公历基元只保留 civil_calendar:: 命名空间

- lib.rs 移除 pub use membership::*,改为只重导出对外的会员契约符号

- 未改动 spacetime-module / spacetime-client / api-server,现有引用保持可用

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:56:54 +08:00
k88936 8e1471d7af 测试(计费): 固化会员目录价格与泥点随 rank 递增的不变量
在 catalog 文档写明升级补差依赖的单调性不变量,并新增回归测试断言 rank 越高月价、年价、每期泥点严格递增

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:23:36 +08:00
k88936 58a79a2e4e 修复(计费): 北京本地时间换算校验当日时刻范围
beijing_local_micros 增加 time_of_day_micros 越界即返回 0 的校验,避免越界时刻被解释成另一天

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:22:36 +08:00
k88936 5ab6f161d0 文档(计费): 修正北京本地时间换算的返回值说明
beijing_local_micros 文档由「本地日期不存在返回原值」改为「返回 0」,与实际实现一致

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:13:31 +08:00
k88936 f810064657 文档(计费): 澄清档位排序以目录 rank 为准
RuntimeProfileMembershipPlan 文档改为说明排序由目录 rank 决定、枚举不实现 Ord,避免误以为变体顺序是排序契约

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:13:10 +08:00
k88936 8b8213f0c8 修复(计费): 公历反算避免 i64 溢出
civil_from_days 用 saturating_add 计算日序号偏移,消除 date_key 接近 i64::MAX 时的加法溢出

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:12:34 +08:00
k88936 603ecb0887 修复(计费): 星期换算避免 i64 溢出
weekday_from_date_key 先按 7 取模再加偏移,消除 date_key 接近 i64::MAX 时的中间加法溢出

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:11:59 +08:00
k88936 abc92d230b chore(契约): 三池余额 DTO 交给 ts-rs 生成,同步 SpacetimeDB 绑定
- 给 ProfileMudPointBalanceResponse 加 ts-bindings 特性下的 ts_rs::TS 导出,u64 标 ts(type = "number") 避免前端分叉成 bigint
- 新增 packages/shared/src/contracts/generated/ProfileMudPointBalanceResponse.ts,runtime.ts 改为 re-export 不再手写第二份字段
- 新增 packages/shared/src/utils/mudPoints.ts:派生展示用合计与北京时间月度刷新文案
- 同步 spacetime-client 生成绑定:升级报价改名为 snapshot,与 module 侧改动对齐

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 19:00:08 +08:00
k88936 c772600d59 feat(会员): 新增补差升级报价接口、后台档位读写与订单权益快照
新增 POST /api/profile/membership/upgrade-quote:只读报价,下单时后端用同一纯函数重算

新增后台 /admin/api/profile/membership-plans 的读取与按档位改价改权益接口

订单与管理端契约补上会员权益变更快照(变更前后档位、周期、补点、有效期与价格拆分)

报价结果统一走「模块侧快照 + application 记录侧投影」两段式,与既有 DTO 约定一致

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 17:36:26 +08:00
k88936 703a24b682 重构(计费): 余额接口并列暴露三池并去掉会员 tier 字段
- 余额响应改为每日免费 / 月度 / 永久三池并列,不再暴露总额与会员限时泥点
- 会员响应与充值中心以 plan 取代 tier,充值中心改为输出会员目录
- 微信虚拟支付按目录档位校验会员商品,不再依赖会员商品配置行
- 同步 shared-contracts 测试夹具到新的三池与 plan 口径

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 16:59:49 +08:00
k88936 e98564e13c 重构(会员): 会员目录与自然月账期落到数据库与领域层
- 领域层新增会员档位枚举、自然月账期、目录快照与补差报价入参,删除旧 tier 相关函数
- profile_membership 表以 plan 与自然月期数取代 tier 与固定 30 天周期
- profile_recharge_order 末位追加会员权益变更快照,供人工复核退款
- profile_membership_plan 目录表成为价格与权益的唯一真相源,新增后台读写接口
- 充点商品收敛为六档且取消首充赠送,旧播种行按新规则迁移
- 充值中心改为输出会员目录,不再输出会员商品行与权益矩阵
- 重新生成 SpacetimeDB 绑定并同步客户端映射与 facade

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 16:59:34 +08:00
kdletters 3a0d92b622 Anthropic 直通只用 x-api-key 出示 Router 凭据
Project CI / AI game creator shell Rust crates (push) Successful in 1m55s
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 2m20s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m36s
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 3m24s
Project CI / Frontend tests (push) Successful in 3m27s
Project CI / Repository checks (push) Successful in 3m43s
Project CI / Backend tests (push) Successful in 5m15s
Project CI / AI game creator shell web tests (push) Successful in 1m47s
Project CI / Native shell tests (push) Successful in 7m34s
- llm:原生 Anthropic 直通不再同时带 Authorization: Bearer,只发 Anthropic 规范的 x-api-key
- 实测:Router 对同一次 /v1/messages 请求,只带 x-api-key 时 200(4.7s 返回真实回复),同时带 Bearer 时 79 秒后被断开
2026-10-02 16:14:56 +08:00
k88936 03073564b1 重构(会员): 会员表列改为 plan 与自然月账期,订单落权益变更快照
profile_membership 删除 tier / cycle_period_days 与四个会员商品权益列,末位追加 plan、cycle_index、cycle_count、cycle_kind

profile_recharge_product_config 删除 tier 与四个会员权益列,只保留充点商品;会员商品不再落该表

profile_recharge_order 末位追加会员变更快照列(变更类型、前后档位、前后周期、补点数、前后到期日 / 刷新日、价格快照)

会员周期刷新改为按北京时间自然月从原始锚点重算,到期清月度余额、永久泥点不受影响

会员购买与升级改走目录表实时价格:有效期内同周期升档按补差报价,补点向下取整、金额向上到分

会员账本幂等锚改为订单维度(membership-period-grant / membership-upgrade-grant 加订单 ID)

充点商品迁移规则改为六档无首充赠送,旧首充赠送行与停用的 ¥128 / ¥328 行一并归一

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 15:54:28 +08:00
kdletters 3e9bc76c2c Anthropic 路由改回原生优先、桥接兜底
Project CI / AI game creator shell Rust crates (push) Successful in 1m46s
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 2m31s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m38s
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 3m33s
Project CI / Frontend tests (push) Successful in 2m41s
Project CI / Backend tests (push) Successful in 4m17s
Project CI / Repository checks (push) Successful in 2m51s
Project CI / AI game creator shell web tests (push) Successful in 1m52s
Project CI / Native shell tests (push) Successful in 5m49s
- llm:/api/llm/anthropic/* 先按 Anthropic 原样直通 Router 的 /v1/messages(20 秒首包上限),拿到 2xx 就直接透传
- llm:直通返回非 2xx、连接失败或首包超时才回退到 Anthropic→Chat 协议桥接,并记录 model/status 便于定位
- 测试:两条 Anthropic 路由用例改为「原生先被拒 + 桥接命中」的两段式 mock
2026-10-02 15:49:01 +08:00
k88936 01c7cc8b66 重构(会员): 档位身份改为 plan 枚举,价格以目录表为真相源
- 领域层清理:删除 RuntimeProfileMembershipTier 及旧的 tier 别名体系
- 会员目录行改名 RuntimeProfileMembershipPlanRecord,快照新增 enabled 字段
- 补差升级报价入参改为「目录表解析出的当前/目标套餐快照」
- 新增会员商品 product_id 编解码(档位 + 周期,严格解析拒绝未知 token)
- 报价与允许操作矩阵改为读取快照 rank / enabled,不再走编译期常量

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 15:38:52 +08:00
kdletters 580c74759a Anthropic 桥接对上游一律流式,并补非流式聚合
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 2m19s
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 3m4s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m30s
Project CI / AI game creator shell Rust crates (push) Successful in 1m17s
Project CI / Frontend tests (push) Successful in 3m14s
Project CI / Repository checks (push) Successful in 3m49s
Project CI / Backend tests (push) Successful in 5m45s
Project CI / AI game creator shell web tests (push) Successful in 1m51s
Project CI / Native shell tests (push) Successful in 6m47s
- anthropic_bridge:向 Router 一律请求 stream=true,兼容只接受流式 chat 的上游
- anthropic_bridge:新增 SSE 聚合,客户端要非流式时在网关侧拼回 OpenAI 形状再转 Anthropic message
- llm:非流式分支按上游返回形状选择直读 JSON 或聚合 SSE
- 测试:新增聚合单测(文本 + tool_calls + usage → Anthropic tool_use 还原)
2026-10-02 15:29:42 +08:00
kdletters 21a8886c4c AGC Anthropic 网关改为桥接 Router 的 Chat Completions
Project CI / AI game creator shell Rust lane 1/2 (push) Failing after 3m28s
Project CI / AI game creator shell Rust lane 2/2 (push) Failing after 1m56s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m23s
Project CI / AI game creator shell Rust crates (push) Successful in 1m34s
Project CI / Frontend tests (push) Successful in 3m11s
Project CI / Repository checks (push) Successful in 3m43s
Project CI / Backend tests (push) Has been cancelled
Project CI / AI game creator shell web tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
- llm/anthropic_bridge:新增 Anthropic Messages → OpenAI Chat Completions 请求转换(system、messages、tool_use、tool_result、图片、工具名安全化与还原)
- llm/anthropic_bridge:新增 OpenAI SSE → Anthropic SSE 流式翻译(message_start、content_block_start/delta/stop、message_delta、message_stop,tool_calls 还原成 tool_use)
- llm:/api/llm/anthropic/v1/messages 不再打现网不可用的 Router /v1/messages,改走转换后的 /v1/chat/completions;非流式响应同样翻译回 Anthropic message
- llm:删除只服务旧直通的 Anthropic 流式结算辅助,结算点改为翻译器产出 message_stop 或流结束
- 测试:新增请求转换、工具名还原、流式翻译单测;Anthropic 路由测试改为断言 Chat Completions 上游与 Anthropic 形状回包
2026-10-02 15:09:52 +08:00
k88936 71c778ccee feat(会员): 会员档位目录随充值商品配置播种
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m23s
Project CI / Backend tests (pull_request) Failing after 28s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m56s
Project CI / Frontend tests (pull_request) Successful in 2m59s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m0s
Project CI / Native shell tests (pull_request) Successful in 7m6s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 11m24s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 13m27s
- 新增 ensure_default_profile_membership_plan,表为空时按会员目录种子整表播种。
- 播种入口挂在 ensure_default_profile_recharge_product_config,表非空时保留后台改价。
- 设计文档 §10 改为「已确认输入 + 实施状态」,记录三项拍板结论。
- 设计文档补充实施约束:module-runtime 与 spacetime-module 相互依赖,领域层清退必须与 schema 变更同批提交。
- 设计文档列出待落地清单(会员遗留清退、三池 DTO、报价接口、充点 6 档、前端同步)。
2026-10-02 15:02:15 +08:00
k88936 1790ddff6a Revert "重构:清退会员遗留档位与商品权益字段"
This reverts commit 103f3b548a.
2026-10-02 15:00:04 +08:00
k88936 103f3b548a 重构:清退会员遗留档位与商品权益字段
- 删除 RuntimeProfileMembershipTier 枚举与会员权益快照/记录。
- 会员快照与记录的 tier 改为 plan 枚举,新增 cycle_index / cycle_count / cycle_kind。
- 充点商品快照/记录与配置快照/记录移除 tier 及四个 membership_* 字段。
- 充值中心快照/记录改用 membership_plans,取代 membership_products 与 benefits。
- 充点商品重播种为六档并取消首充赠送,删除会员商品构造与档位查表 helper。
- 后台充值商品 upsert 只接受泥点商品,会员商品改由会员计划目录维护。
2026-10-02 14:55:31 +08:00
k88936 61d4db4610 feat(会员): 新增会员计划目录表 profile_membership_plan
- spacetime-module:新增 profile_membership_plan 表,主键为档位枚举 RuntimeProfileMembershipPlan,一行一档承载月价 / 年价 / 每期额度 / 模型权限 / 并发上限
- migration.rs:表目录登记 profile_membership_plan
- spacetime-client:重新生成绑定,新增目录表与档位 / 模型权限枚举
- docs:后端数据契约新增 profile_membership_plan 说明,并把表定义源码路径修正为 runtime/active/profile.rs

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:49:43 +08:00
k88936 f6fbd2a392 chore(会员): 删除未被引用的旧表定义副本
- spacetime-module:删除 src/runtime/profile.rs,它未被 src/runtime.rs 挂载(真正生效的是 runtime/active/profile.rs)
- 避免设计文档与实现指向失效文件,也避免后续删列改动误落两份

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:36:16 +08:00
k88936 26e1ea9e27 feat(泥点): 账本来源追加会员升级补点
- module-runtime:RuntimeProfileWalletLedgerSourceType 末尾追加 MembershipUpgradeGrant,保持枚举只追加
- shared-contracts:新增 PROFILE_WALLET_LEDGER_SOURCE_TYPE_MEMBERSHIP_UPGRADE_GRANT 常量
- api-server:后台枚举索引映射与来源格式化支持新来源,并补单测断言
- spacetime-client:手写 mapper 与生成绑定同步新增变体
- packages/shared 与主站前端:钱包流水来源标签新增「会员升级补点」

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:33:16 +08:00
k88936 ba22d178d3 重构:会员领域模块归并到 membership 目录
- 把 membership_catalog/cycle/limits/upgrade 四个文件移入 src/membership/ 并去掉公共前缀
- 新增 membership/mod.rs 统一声明子模块并按依赖顺序导出
- lib.rs 改为 pub mod membership,删除旧的四个模块声明
- membership/upgrade.rs 内部引用改为同级模块路径
- 无行为变化,cargo test -p module-runtime 全通过

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-02 14:21:01 +08:00