Skip to content

Conversation

@weareoutman
Copy link
Member

@weareoutman weareoutman commented Jul 18, 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 Fixes
    • 修复了 API 合约检索逻辑,切换为批量检索接口以提升兼容性和稳定性。
    • 测试用例已同步适配新的接口和数据结构,确保功能验证准确。
  • Chores
    • 新增依赖 @next-api-sdk/next-builder-sdk 以支持最新的 API 合约检索方式。

@coderabbitai
Copy link

coderabbitai bot commented Jul 18, 2025

Walkthrough

本次变更将 @next-core/easyops-runtime 依赖的 SDK 从 @next-api-sdk/api-gateway-sdk 替换为 @next-api-sdk/next-builder-sdk,并相应调整了核心逻辑与测试代码以适配新的批量合约查询接口和数据结构。新增了错误处理和日志记录,未涉及对外部导出实体的声明更改。

Changes

文件/路径 变更摘要
packages/easyops-runtime/package.json 新增依赖 @next-api-sdk/next-builder-sdk@^1.2.2
packages/easyops-runtime/src/flowApi/FlowApi.ts 将合约查询逻辑从单合约接口改为批量合约接口,调整数据结构与错误处理。
packages/easyops-runtime/src/flowApi/FlowApi.spec.ts 测试用例适配新 SDK 和批量查询接口,调整 mock 结构与断言,增加错误日志监控。

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/easyops-runtime/src/flowApi/FlowApi.spec.ts

Oops! Something went wrong! :(

ESLint: 9.29.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@next-core/eslint-config-next' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)

packages/easyops-runtime/src/flowApi/FlowApi.ts

Oops! Something went wrong! :(

ESLint: 9.29.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@next-core/eslint-config-next' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:202:49)


📜 Recent 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 f4fc20d and f37d5ca.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • packages/easyops-runtime/package.json (1 hunks)
  • packages/easyops-runtime/src/flowApi/FlowApi.spec.ts (13 hunks)
  • packages/easyops-runtime/src/flowApi/FlowApi.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/easyops-runtime/src/flowApi/FlowApi.spec.ts (2)
packages/easyops-runtime/src/flowApi/FlowApi.ts (1)
  • getArgsOfFlowApi (42-63)
packages/runtime/src/internal/bindListeners.spec.ts (1)
  • getArgsOfFlowApi (38-40)
⏰ 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). (1)
  • GitHub Check: build (20.x)
🔇 Additional comments (10)
packages/easyops-runtime/package.json (1)

48-48: 新的 @next-api-sdk/next-builder-sdk 依赖已正确添加,旧的 @next-api-sdk/api-gateway-sdk 在代码中仍有多处使用,暂不建议移除

  • packages/easyops-runtime/src/auth.ts 中引入了 AuthApi_CheckLoginResponseBody
  • packages/brick-container/src/loadCheckLogin.ts 及其测试文件中调用了 AuthApi_checkLogin
  • packages/brick-container/src/loadBootstrapData.ts 及其测试文件中使用了 BootstrapData
  • packages/brick-container/src/AuthenticationChange.ts 中引入了 AuthApi_CheckLoginResponseBody

以上搜索结果表明旧依赖仍被实际引用,建议继续保留。

packages/easyops-runtime/src/flowApi/FlowApi.ts (4)

2-5: 导入语句更新正确

@next-api-sdk/api-gateway-sdk 切换到 @next-api-sdk/next-builder-sdk 的导入更新是合适的,支持新的批量合约搜索功能。


266-284: 批量搜索API实现和错误处理改进

新的批量搜索实现正确地使用了 @ 分隔符格式的合约名称,并增加了适当的错误处理。try-catch 块确保了异常情况下的优雅处理。


286-293: 错误日志记录增强了调试能力

当合约未找到时,控制台错误日志提供了有用的调试信息,包括合约名称、版本和具体错误原因。


295-306: 数据映射正确解决了serviceName缺失问题

返回的 CustomApiDefinition 对象现在正确包含了 serviceName 字段(第298行),这正是PR要解决的核心问题。数据映射使用了 namespaceId 而不是嵌套的 namespace 数组,这与新的API响应格式一致。

packages/easyops-runtime/src/flowApi/FlowApi.spec.ts (5)

2-2: 导入语句更新正确

测试文件中的导入更新与实现文件保持一致,正确使用了新的 next-builder-sdk


39-39: 模拟设置更新适当

Jest mock 正确更新为新的 SDK,确保测试环境与实际实现保持一致。


42-215: 批量API模拟实现全面且正确

模拟实现正确地处理了新的批量API格式:

  • 使用 @ 分隔符的合约名称格式
  • 返回 list 数组结构
  • 包含 serviceName 字段
  • 使用 namespaceId 而非嵌套数组
  • 涵盖了各种测试场景

231-231: URL断言更新正确反映了服务名称变更

所有相关的URL断言都正确地从 easyops.custom_api 更新为 logic.custom,这与新的批量API返回的 serviceName 字段一致,确保了测试的准确性。

Also applies to: 246-246, 265-265, 292-292, 322-322, 385-385, 416-416, 453-453, 485-485, 521-521


557-567: 错误处理测试得到改进

添加了对 console.error 的监听,确保错误日志记录功能得到正确测试。这提高了测试覆盖率并验证了错误处理逻辑的正确性。

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.21%. Comparing base (f4fc20d) to head (f37d5ca).
Report is 2 commits behind head on v3.

Files with missing lines Patch % Lines
packages/easyops-runtime/src/flowApi/FlowApi.ts 88.88% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##               v3    #4750      +/-   ##
==========================================
- Coverage   95.22%   95.21%   -0.01%     
==========================================
  Files         209      209              
  Lines        9144     9151       +7     
  Branches     1760     1760              
==========================================
+ Hits         8707     8713       +6     
- Misses        323      324       +1     
  Partials      114      114              
Files with missing lines Coverage Δ
packages/easyops-runtime/src/flowApi/FlowApi.ts 97.80% <88.88%> (-1.01%) ⬇️
🚀 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 Jul 18, 2025

next-core    Run #11497

Run Properties:  status check passed Passed #11497  •  git commit 915734004d ℹ️: Merge f37d5ca3c8d441da2087ef5e81fd26061db5e6a4 into f4fc20ddcd4ad23ed1ee6cbedff5...
Project next-core
Branch Review steve/v3-fix-search-contract
Run status status check passed Passed #11497
Run duration 00m 27s
Commit git commit 915734004d ℹ️: Merge f37d5ca3c8d441da2087ef5e81fd26061db5e6a4 into f4fc20ddcd4ad23ed1ee6cbedff5...
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 ↗︎

@weareoutman weareoutman requested a review from Copilot July 18, 2025 04:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue with API contract retrieval by switching from single search to batch search interface. The change addresses missing serviceName in the single search contract method by using the batch search contract API that provides complete contract information.

  • Switch from ContractApi_searchSingleContract to ContractCenterApi_batchSearchContract API
  • Update contract name format from namespace.name to namespace@name
  • Add improved error handling with console logging for failed contract fetches

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/easyops-runtime/src/flowApi/FlowApi.ts Updated contract fetching logic to use batch search API with enhanced error handling
packages/easyops-runtime/src/flowApi/FlowApi.spec.ts Updated test mocks and expectations to match new batch search API structure
packages/easyops-runtime/package.json Added dependency on @next-api-sdk/next-builder-sdk

@weareoutman weareoutman requested a review from qiaofengxi July 18, 2025 04:16
endpoint: contractData.endpoint,
response: contractData.response,
request: contractData.request,
try {
Copy link
Member Author

Choose a reason for hiding this comment

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

因为依赖 next builder 服务,静默接口错误

@qiaofengxi qiaofengxi merged commit 903271f into v3 Jul 18, 2025
8 of 9 checks passed
@qiaofengxi qiaofengxi deleted the steve/v3-fix-search-contract branch July 18, 2025 04:32
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