Skip to content

fix(config): DRY ensure API + 加固 schema 播种 ootb - #69

Merged
Tanya7z merged 1 commit into
mainfrom
cursor/bc-92d2db2b-6e86-48e8-8ba5-e4e902e2d67c-f6b1
Jul 24, 2026
Merged

fix(config): DRY ensure API + 加固 schema 播种 ootb#69
Tanya7z merged 1 commit into
mainfrom
cursor/bc-92d2db2b-6e86-48e8-8ba5-e4e902e2d67c-f6b1

Conversation

@cursor

@cursor cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

背景

main@fdc936e(chore:新增并补齐配置文件schema)将 configs-default 改为 SDK DEFAULT + $schema。方向正确,但引入了可验证的 SOLID 债,且 ootb 对缺失 configs 变成「缺了也 pass」。

审查结论(针对 fdc936e

级别 原则 问题
MAJOR DRY 各服务重复 ensureJsonConfig+withConfigSchema({...DEFAULT})
MAJOR DRY bds-tools 先手动 delete meta 再 stripConfigMeta
MAJOR LSP PermissionsConfig 写成对象,schema/磁盘实为数组根
MAJOR LSP remote/loadConfig$schema 渗入业务配置
MAJOR DIP ootb 为播种拉起完整 db-server HTTP;失败仅 WARN
MAJOR check-ootb 缺 configs 仍 pass(检查被掏空)
MINOR OCP configSchemaRef 三分支同值死代码

CI:ootb @fdc936e 已 success;本 PR 加固播种路径,避免回归。

本 PR 修复

  • SDK:ensureSchemaConfig / loadEnsuredConfig / ensureCoreConfigs;修正 PermissionsConfig;简化 configSchemaRef
  • db-server / qq-bridge / bds-tools / sfmc 改走共享 helper
  • tools/seed-configs.mjs + ootb.yml 不再为写 JSON 启 HTTP
  • check-ootb:seed 后缺核心配置改为 fail

验证

  • npm run typecheck(sdk / db-server / bds-tools / qq-bridge / cli)
  • SFMC_ROOT=... node tools/seed-configs.mjs
  • npm run check-ootb → 14/0

剩余债(未改,避免扩 scope)

  1. MINOR — pack-update DEFAULTS 仍在 sfmc,未进 SDK registry
  2. MINOR — ServiceId pack-manager / ProgressHandle.setTotal(fix(progress): 补齐 #67 后 binder 首帧/非TTY LSP + 恢复 pause 契约测 #68 相关)
  3. MINOR — ootb 尚未强制跑 eslint-plugin / pack-update tests
Open in Web View Automation 

- SDK 抽出 ensureSchemaConfig/loadEnsuredConfig/ensureCoreConfigs,消除各服务重复 withConfigSchema+ensure
- 修正 PermissionsConfig 为数组根(与 schema LSP 一致);简化 configSchemaRef 死分支
- bds/qq/db/sfmc 改走共享 helper;remote 加载剥离 $schema
- 新增 tools/seed-configs.mjs,ootb 不再拉起 db-server 仅为写 JSON;check-ootb 缺配置改为 fail

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.

审查报告(main@fdc936e schema 推送 → 本补丁)

CI ootb 已通过;以下为 SOLID 维度可验证问题,已在本 PR 落地修复。

MAJOR

  1. DRY — 各服务重复 ensureJsonConfig + withConfigSchema({...DEFAULT})
    → SDK ensureSchemaConfig / loadEnsuredConfig / ensureCoreConfigs

  2. DRYbds-tools 手动删 meta 后再 stripConfigMeta
    → 统一 loadEnsuredConfig

  3. LSPPermissionsConfig 对象形态 vs schema/磁盘数组根
    → 类型改为数组

  4. LSPremote/loadConfig 渗入 $schema
    → 加载路径剥离元数据

  5. DIP — ootb 为写 JSON 拉起完整 db-server(失败仅 WARN)
    tools/seed-configs.mjs 直接调 SDK ensure

  6. 检查空洞check-ootb 缺 configs 仍 pass
    → seed 后缺核心文件改为 fail

MINOR

  • OCPconfigSchemaRef 三分支同值 → 已简化
  • 未改:pack-update DEFAULTS 仍在 sfmc(扩 scope 风险)

验证

check-ootb 14/0;相关 workspace typecheck 通过。

View PR

Open in Web View Automation 

Sent by Cursor Automation: SFMC-Review

@Tanya7z
Tanya7z marked this pull request as ready for review July 24, 2026 13:21
@cursor

cursor Bot commented Jul 24, 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 b1fc6ce into main Jul 24, 2026
1 check passed
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