Skip to content

Conversation

@weareoutman
Copy link
Member

@weareoutman weareoutman commented Sep 26, 2025

依赖检查

组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。

请勾选以下两组选项其中之一:

  • 本次 MR 没有使用上游组件(例如框架、后台组件等)的较新版本提供的特性。

或者:

  • 本次 MR 使用了上游组件(例如框架、后台组件等)的较新版本提供的特性。
  • 在对应的文件中更新了该上游组件的依赖版本(或确认了当前声明的依赖版本已包含本次 MR 使用的新特性)。

提交信息检查

Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。

破坏性变更是针对于下游使用者而言,可以通过本次改动对下游使用者的影响来识别变更类型:

  • 下游使用者不做任何改动,仍可以正常工作时,那么它属于普通变更。
  • 反之,下游使用者不做改动就无法正常工作时,那么它属于破坏性变更。

例如,构件修改了一个属性名,小产品 Storyboard 中需要使用新属性名才能工作,那么它就是破坏性变更。
又例如,构件还没有任何下游使用者,那么它的任何变更都是普通变更。

破坏性变更:

  • ⚠️ 本次 MR 包含破坏性变更的提交,请继续确认以下所有选项:
  • 没有更好的兼容方案,必须做破坏性变更。
  • 使用了 feat 作为提交类型。
  • 标注了 BREAKING CHANGE: 你的变更说明
  • 同时更新了本仓库中所有下游使用者的调用。
  • 同时更新了本仓库中所有下游使用者对该子包的依赖为即将发布的 major 版本。
  • 同时为其它仓库的 Migrating 做好了准备,例如文档或批量改动的方法。
  • 手动验证过破坏性变更在 Migrate 后可以正常工作。
  • 破坏性变更所在的提交没有意外携带其它子包的改动。

新特性:

  • 本次 MR 包含新特性的提交,且该提交不带有破坏性变更,并使用了 feat 作为提交类型。
  • 给新特性添加了单元测试。
  • 手动验证过新特性可以正常工作。

问题修复:

  • 本次 MR 包含问题修复的提交,且该提交不带有新特性或破坏性变更,并使用了 fix 作为提交类型。
  • 给问题修复添加了单元测试。
  • 手动验证过问题修复得到解决。

杂项工作:

即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:

  • 本次 MR 包含杂项工作的提交,且该提交不带有问题修复、新特性或破坏性变更,并使用了 chore, docs, test 等作为提交类型。

Summary by CodeRabbit

  • 新功能
    • 无用户可见的新功能变更。
  • Bug 修复
    • 会话模式下由 URL 参数启用调试时,不再输出帮助提示,避免多余日志。
    • 在测试环境下抑制非调试模式的提示日志,减少控制台噪音。
  • 测试
    • 更新用例以验证初始化时不产生日志输出。

@coderabbitai
Copy link

coderabbitai bot commented Sep 26, 2025

Walkthrough

该变更在 debugManager 中为非测试环境的非调试模式日志增加了 NODE_ENV !== "test" 守卫,并相应更新了单元测试以不再期望在会话模式由 URL 参数启用调试时输出帮助日志。

Changes

Cohort / File(s) Summary of Changes
Debug manager
packages/runtime/src/internal/debugManager.ts, packages/runtime/src/internal/debugManager.spec.ts
实现:仅在 NODE_ENV !== "test" 且非调试模式时输出用法提示;测试:初始化由 URL 参数启用调试的场景中,断言不调用 console.log,替换原先期待帮助信息输出的断言。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning PR 描述仅保留了模板未填写具体依赖声明、提交类型与选项以及变更说明,简单描述和 Todo 占位符也未补充内容,导致缺失必需信息无法评估依赖和提交规范符合性。 请在依赖检查部分勾选并说明是否使用或更新了上游组件版本,在提交信息检查部分根据本次改动类型勾选相应选项并补充提交描述与测试验证情况,还需填写“简单描述”和“Todo”部分以概述本次改动和后续待办。
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed 标题“fix(): disable debugger tips in test env”简洁明了地指出了主要改动是在测试环境禁用调试提示,且符合常规提交规范,没有多余信息或歧义。
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch steve/v3-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.19%. Comparing base (26373dd) to head (14c5928).
⚠️ Report is 2 commits behind head on v3.

Files with missing lines Patch % Lines
packages/runtime/src/internal/debugManager.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##               v3    #4799      +/-   ##
==========================================
- Coverage   95.21%   95.19%   -0.03%     
==========================================
  Files         212      212              
  Lines        9301     9302       +1     
  Branches     1785     1786       +1     
==========================================
- Hits         8856     8855       -1     
- Misses        327      328       +1     
- Partials      118      119       +1     
Files with missing lines Coverage Δ
packages/runtime/src/internal/debugManager.ts 94.05% <0.00%> (-1.95%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link

cypress bot commented Sep 26, 2025

next-core    Run #11706

Run Properties:  status check passed Passed #11706  •  git commit d277e7ebed ℹ️: Merge 14c59280fa1eb2716b871efeacbfd6c2c94c5a15 into 26373dd7adc3ddfb9e221bda84f8...
Project next-core
Branch Review steve/v3-test
Run status status check passed Passed #11706
Run duration 00m 23s
Commit git commit d277e7ebed ℹ️: Merge 14c59280fa1eb2716b871efeacbfd6c2c94c5a15 into 26373dd7adc3ddfb9e221bda84f8...
Committer Shenwei Wang
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 17
View all changes introduced in this branch ↗︎

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 26373dd and 14c5928.

📒 Files selected for processing (2)
  • packages/runtime/src/internal/debugManager.spec.ts (1 hunks)
  • packages/runtime/src/internal/debugManager.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build (20.x)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/runtime/src/internal/debugManager.spec.ts (1)

295-295: 断言调整正确避免测试噪音。
覆盖了默认禁用路径在测试环境下不会触发提示日志的新约束,契合对 NODE_ENV === "test" 的守卫逻辑。

Comment on lines +179 to 182
} else if (process.env.NODE_ENV !== "test") {
// eslint-disable-next-line no-console
console.log("💡 提示:使用 window.debugConsole.help() 查看使用说明");
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

避免在浏览器环境访问未定义的 process

这里直接读取 process.env,一旦在纯浏览器环境或未由打包器注入 process 的场景下运行,会立刻抛出 ReferenceError,从而阻断整个初始化流程。这条代码在改动前不存在 process 依赖,因此属于回归风险。建议在判断前先确认 process 是否存在,同时保持原有的“测试环境不输出”语义。

-    } else if (process.env.NODE_ENV !== "test") {
+    } else if (
+      typeof process === "undefined" ||
+      process.env?.NODE_ENV !== "test"
+    ) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} else if (process.env.NODE_ENV !== "test") {
// eslint-disable-next-line no-console
console.log("💡 提示:使用 window.debugConsole.help() 查看使用说明");
}
} else if (
typeof process === "undefined" ||
process.env?.NODE_ENV !== "test"
) {
// eslint-disable-next-line no-console
console.log("💡 提示:使用 window.debugConsole.help() 查看使用说明");
}
🤖 Prompt for AI Agents
In packages/runtime/src/internal/debugManager.ts around lines 179-182, the code
directly reads process.env which throws a ReferenceError in browser environments
where process is undefined; update the condition to first check that process
exists (e.g. typeof process !== "undefined" or typeof globalThis.process !==
"undefined") and then check process.env.NODE_ENV !== "test" (safely accessing
process.env), so the message is only suppressed in test env but no
ReferenceError is thrown in pure browsers.

@weareoutman weareoutman merged commit c454a93 into v3 Sep 27, 2025
7 of 9 checks passed
@weareoutman weareoutman deleted the steve/v3-test branch September 27, 2025 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants