Skip to content

fix(solid@894436a): 模块鉴权注入 + configs/all modules/tokens + tx 契约 - #31

Merged
Tanya7z merged 3 commits into
mainfrom
cursor/bc-adc80dfe-5067-4925-9563-56959cb1dd81-cf93
Jul 22, 2026
Merged

fix(solid@894436a): 模块鉴权注入 + configs/all modules/tokens + tx 契约#31
Tanya7z merged 3 commits into
mainfrom
cursor/bc-adc80dfe-5067-4925-9563-56959cb1dd81-cf93

Conversation

@cursor

@cursor cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

背景

Push main@894436a(合入 #29)后 ootb 已绿。审查仍发现可验证 SOLID 缺口,尤其 SAPI 从未调用 set*ModuleContext,且 GET /api/sfmc/configs/all 硬编码 modules: [],导致 ModuleRegistry 启停与 v2 鉴权链路空转。

审查结论(DRY / OCP / DIP / LSP / Demeter)

级别 原则 处理
BLOCKER DIP set*ModuleContext 无调用方;module-tokens.json SAPI 不可读 configs/all.module_tokens + bootModule 注入
BLOCKER DRY/LSP configs/all.modules[],与 /modules 分裂 注入 listModules=buildModuleList
MAJOR OCP ModuleId 绑死旧 Modules 枚举,AFK 的 feature-afk 无法 isActive ModuleId=string + id/configKey 双索引
MAJOR LSP tx.call 伪返回 UTxError 分支被 post() 吞掉 Promise<void> + 保留 step/code
MAJOR LSP 录制期 tx.update 把 patch 假扮成整行 改为 Promise<void>
MINOR DIP 空串 authToken 挡住 HttpDB 默认回落 空则不传 opts
MINOR DRY service 错误信封 / writeJson lock / ootb 包列表 jsonV2Fail/OksaveModuleLock、发包清单派生
MINOR LSP AFK config.get("afk")/onChange 签名误用 getAll + 修正回调

未改(需设计)

  • db.tx 完整两阶段交互读回(call result 回放)
  • 运行时 enable 模块而不重启 db-server 时的 token/enabledSet 热更新

验证

  • db-server npm test:9/9
  • @sfmc-bds/sdk typecheck 通过
  • SFMC_ROOT=$PWD node tools/check-ootb.mjs:11/11
Open in Web View Automation 

cursoragent and others added 3 commits July 22, 2026 14:38
审查 main@894436a(#29) 后修复:
- DIP/DRY: configs/all.modules 与 /modules 同源注入,并下发
  module_tokens 供 SAPI 注入(无法读 data/module-tokens.json)
- LSP/DRY: jsonV2Ok 与 Fail 对称;db/service 路由统一走助手
- DRY: setModuleEnabled 走 saveModuleLock;ootb 必备包从发包清单派生

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
- DIP: bootModule 从 ConfigManager(module_tokens) 调用 set*ModuleContext
- OCP: ModuleId 改为开放 string(catalog id),启停双索引 id/configKey
- LSP: tx.call→Promise<void>;tx.update 录制期无假读回;TxError 保留 step/code
- DIP: 空 authToken 不传,避免挡住 HttpDB 默认回落;缺上下文 fail-fast
- AFK: config.getAll + 修正 onChange 签名误用

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
npm-publish tag @sfmc-bds/tools@v0.1.1 曾因 package.json 仍为 0.1.0 失败。
同步 bump;HttpDB 空串回落平台默认;publish 清单校验路径/name。

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新说明(已推送 937cb8d

本 PR 现已吸收 #30(tools@0.1.1 / HttpDB.resolveAuthToken / publish 路径·name 校验),并保留模块鉴权注入等 BLOCKER 修复。建议合本 PR 后关闭 #30

合入后请对 @sfmc-bds/tools@v0.1.1workflow_dispatch(checkout 默认分支)以真正发包。

验证:ootb 11/11;PUBLISH_TAG=@sfmc-bds/tools@v0.1.1 node tools/resolve-npm-publish-tag.mjs → Version OK。

View PR

Open in Web View Automation 

Sent by Cursor Automation: SFMC-Review

@Tanya7z
Tanya7z marked this pull request as ready for review July 22, 2026 16:59
@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Tanya7z
Tanya7z merged commit 41fe9c7 into main Jul 22, 2026
1 check passed
@Tanya7z
Tanya7z deleted the cursor/bc-adc80dfe-5067-4925-9563-56959cb1dd81-cf93 branch July 22, 2026 17:00
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