Skip to content

fix(logs/config): BDS 级别 DRY + 剥前缀误判 + BOM/ensure 对齐 - #81

Merged
Tanya7z merged 1 commit into
mainfrom
cursor/bc-fa859bf0-4dc5-4cf9-a955-83a4d1fd2bc0-34fd
Jul 26, 2026
Merged

fix(logs/config): BDS 级别 DRY + 剥前缀误判 + BOM/ensure 对齐#81
Tanya7z merged 1 commit into
mainfrom
cursor/bc-fa859bf0-4dc5-4cf9-a955-83a4d1fd2bc0-34fd

Conversation

@cursor

@cursor cursor Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

审查 main@4ce2ea1(UTF-8 BOM 兼容、log-filter、BDS 日志格式化、落盘)后的 SOLID 债,直接补丁。

本轮 push 的 ootb / changeset-release 均已 success,无新 wf 失败。

BLOCKER · LSP

pushLog 剥离 BDS [时间 等级] 后,resolveDisplayLevel → 旧 getLogLevel 松散匹配会把正文 Error on line 抬成 error(已用 WARN 入库的行展示成 ERR)。改为:有时间戳前缀则 parseBdsEmbeddedLevel,否则信任 entry.level

MAJOR · DRY / DIP

sfmc 与 SDK inferLevel 各抄一份 BDS 正则+级别映射。现将 mapBdsLevelToken / parseBdsEmbeddedLevel / stripBdsLogPrefix 收敛到 @sfmc-bds/sdk/logs,sfmc 再导出。

MAJOR · DRY / LSP(BOM 契约)

本轮主题是剥 BOM,但 SDK readJson 仍不剥;log-filter 手写 JSON.parse(readFileSync)readJson 现与 bds-tools/fsx.readJsonFile 同契约;filter 走 ensureSchemaConfig + readJson

MINOR

  • schema regex 描述与实现(仅 (?i) 前缀)对齐
  • 删除 getCompiledLogFilter 无用 bad[]

未纳入(仍建议合 #80

npm-publish / build-publishable 依赖拓扑、scanDestOccupancy/DestOccupancy.kind 等仍由 #80 覆盖。

Test plan

  • node --test sfmc/log-filter.test.mjs sfmc/wrap-log-line.test.mjs bds-tools/world-packs.test.mjs(30 pass)
  • 本地复现:剥前缀后 resolveDisplayLevel 对含 Error 的 WARN 行仍为 warn
  • readJson 读 BOM JSON → 正常对象
  • CI ootb on this PR
Open in Web View Automation 

pushLog 剥离 BDS 时间戳后,旧 getLogLevel 会把正文「Error on line」抬成 error。
将 parse/strip/map 收敛到 @sfmc-bds/sdk/logs;readJson 剥 BOM;log-filter 走 ensureSchemaConfig。

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

cursor Bot commented Jul 26, 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 631a3f6 into main Jul 26, 2026
1 check passed
cursor Bot pushed a commit that referenced this pull request Jul 26, 2026
保留 #81 扫描不中断契约(try/catch),采用完整+残缺 header 覆盖;
同步 #84 后 package-lock 中 sdk/cli 的 0.2.0-beta.1。

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
Tanya7z added a commit that referenced this pull request Jul 26, 2026
…ae77-d60c9fdf6f38-7762

fix(bds-tools): 修复 #80/#81 合并损坏的 scanDestOccupancy(恢复 ootb/发版构建)
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