Skip to content

fix: push@c559ab4 SOLID 审查补丁 — economy SQL/? 绑定 + service 契约对齐#14

Closed
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/bc-656c90f3-3c26-4778-872d-7848bcf77204-2995
Closed

fix: push@c559ab4 SOLID 审查补丁 — economy SQL/? 绑定 + service 契约对齐#14
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/bc-656c90f3-3c26-4778-872d-7848bcf77204-2995

Conversation

@cursor

@cursor cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

背景

审查 main push a254973..c559ab4(feature-chat v2 / economy service bridge / 删除 v1 路由 / host-config 合并 / 外迁 afk 等 4 模块)。

ootb CI 对本 push 已通过;本 PR 修的是本轮引入/恶化的 DRY · OCP · DIP · LSP · LoD 高置信运行时契约问题。

与已有 #13(config ?moduleId= + service HTTP 权限门)互补,不重复其改动。

已修复

级别 原则 问题 修复
BLOCKER LSP / DIP domain/economy.tsSQL\...${TABLE}...`把表名绑成?near "?": syntax error`,新注册的 7 个 economy handlers 全挂 表名嵌入信任常量 SQL 文本,值继续 ? 绑定
MAJOR LSP economy.dailyTasks.list 返回裸数组、submitok,与 feature-daily-task 消费契约不一致;业务失败抛 Error → 500,物品已扣却无法走 !ok 退还 list→{tasks};submit→{ok,...};领域失败 DispatchError 保留 status
MAJOR DRY / LSP ServiceRegistry 允许提供方自调用免 requires,但 TxRunner.doService 在进 dispatch 前硬拦 getProvider() + 同款自调用跳过
MAJOR DRY feature-chat import 不存在的 @sfmc/types @sfmc/sdk/contracts
MAJOR LSP claimRedPacket / land-transferdb.tx 录制器回调内按 tx.get 结果分支(恒 null) 事务外 db.get 校验后再录写步骤
MAJOR DIP core-gui 实际 import feature-land-gui 但 requires/catalog 未声明 补上 requires

仍未修(需更大改动,见 #13 报告)

  • DIP: installHostBootstrap 仍不注入 set*ModuleContext → v2 db/service 鉴权端到端未通
  • LSP: db.tx 录制器语义本身(call→undefined)
  • OCP: land.* handlers 仍未注册;economy handler 仍在 index.ts 硬编码接线
  • Money 仍打已删的 /api/sfmc/economy/* 路径(且路径形态本就与历史 v1 路由不一致)——等 module-auth 注入后再迁 service.get

验证

  • npm run build --workspaces --if-present 通过
  • 内存 SQLite 冒烟:ensureEconomyAccount / credit / insufficient_funds(409) / dailyTasks 信封 / DispatchError 透传 OK
  • node tools/check-catalog.js → OK (15 modules)
Open in Web View Automation 

cursoragent and others added 3 commits July 22, 2026 05:47
sql-template-strings 插值表名会变成 FROM ?,触发 near "?": syntax error,
导致新注册的 economy.* handlers 全部不可用。表名改为信任常量嵌入 SQL,
值继续参数化。

同时修正 dailyTasks.list/submit 与消费方契约(LSP),以及 DispatchError
透传 domain status,避免 insufficient_funds 等被压成 500 internal。

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
dispatch 已允许提供方调自己的 service 免 requires,但 TxRunner.doService
在进 dispatch 前硬拦,导致 HTTP service.get 与 tx.call 契约不一致(DRY/LSP)。
通过 getProvider() 共用提供方身份判断。

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
- feature-chat:@sfmc/types → @sfmc/sdk/contracts(权威类型源 DRY)
- claimRedPacket/land-transfer:不再在 db.tx 录制器回调内按 get 结果分支
- core-gui:声明 requires feature-land-gui(与 MainMenu 实际 import 对齐)

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
@Tanya7z

Tanya7z commented Jul 22, 2026

Copy link
Copy Markdown
Member

Superseded by main tools rewrite (e6525bb) and PR #17 CI/registry fixes. Closing as duplicate/outdated.

@Tanya7z Tanya7z closed this Jul 22, 2026
@Tanya7z
Tanya7z deleted the cursor/bc-656c90f3-3c26-4778-872d-7848bcf77204-2995 branch July 22, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants