Skip to content

refactor(oocana)!: clean up FlowConfig and BlockConfig public API#420

Merged
leavesster merged 6 commits intomainfrom
refactor/cleanup-oocana-public-api
Jan 30, 2026
Merged

refactor(oocana)!: clean up FlowConfig and BlockConfig public API#420
leavesster merged 6 commits intomainfrom
refactor/cleanup-oocana-public-api

Conversation

@leavesster
Copy link
Copy Markdown
Contributor

Summary

  • Remove deprecated inputValues and toNode parameters from FlowConfig (use nodesInputs and nodes instead)
  • Remove unused address parameter from FlowConfig
  • Move searchPaths from FlowConfig and BlockConfig into RunConfig, unify type to string[]
  • Rename buildArgs to buildRunConfigArgs for clarity

BREAKING CHANGE

  • FlowConfig.inputValues removed — use nodesInputs
  • FlowConfig.toNode removed — use nodes
  • FlowConfig.address removed (was unused; broker address comes from connect())
  • FlowConfig.searchPaths type changed from string to string[], moved to RunConfig
  • BlockConfig.searchPaths moved to RunConfig

Test plan

  • pnpm -F @oomol/oocana build passes
  • pnpm -F @oomol/oocana test — 12 tests pass

…Config

BREAKING CHANGE: Remove deprecated parameters from FlowConfig interface.
Use `nodesInputs` instead of `inputValues`, and `nodes` instead of `toNode`.
…unused address

BREAKING CHANGE:
- Move searchPaths from BlockConfig and FlowConfig into RunConfig
- Change FlowConfig.searchPaths type from string to string[]
- Remove unused address parameter from FlowConfig
Copilot AI review requested due to automatic review settings January 30, 2026 08:21
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 30, 2026

Summary by CodeRabbit

发布说明

  • 重大变更

    • searchPaths 现在以数组形式接受(从字符串变更)
    • 移除配置中的若干已弃用字段
  • 重构

    • 简化并统一运行时配置与参数构建逻辑
    • 调整运行/流程调用以使用新的共享配置结构
  • 测试

    • 测试用例已更新以传递 searchPaths 数组
  • Chores

    • 添加类型检查脚本并新增 TypeScript 配置文件

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

将运行时路径配置统一为 RunConfig.searchPaths,移除 BlockConfig/FlowConfig 中冗余与已弃用字段,重命名并调整参数构建函数为 buildRunConfigArgs,并同步更新示例与测试以传递 searchPaths: string[] 与新增 TypeScript 检查配置。

Changes

Cohort / File(s) Summary
核心重构:运行配置与参数构建
packages/oocana/src/oocana.ts
新增 RunConfig.searchPaths?: string[];从 BlockConfigFlowConfig 中移除 searchPathsaddresstoNode 与已弃用的 inputValues 样式字段;将 buildArgs 重命名为并替换为 buildRunConfigArgs(签名含 searchPaths);更新 runBlock/runFlow 的解构与调用以使用新的构建函数,删除局部 searchPaths 处理。
示例与测试:传入参数形状调整
flow-examples/test/flow.test.ts, flow-examples/test/run.ts
调用 cli.runFlow 时将 searchPaths 从单个逗号拼接的字符串改为 string[](直接传数组),以配合新的 RunConfig 类型。
示例工具链与配置
flow-examples/package.json, flow-examples/tsconfig.json
package.json 中新增 TypeScript 检查脚本 "ts-check": "tsc --noEmit";新增 flow-examples/tsconfig.json(extends 基础配置,target ESNext,noEmit: true,包含 test/**/*.ts)。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 标题遵循了 (): 的格式要求,清晰描述了主要变更内容(清理 FlowConfig 和 BlockConfig 公共 API),并正确使用了 BREAKING CHANGE 标记。
Description check ✅ Passed 描述与变更集紧密相关,详细说明了移除的废弃参数、参数移动情况、类型统一和函数重命名,并列出了完整的破坏性变更清单和测试计划。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link
Copy Markdown
Contributor

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 refactors the public API for FlowConfig and BlockConfig by removing deprecated and unused parameters, and consolidating the searchPaths configuration into RunConfig for consistency.

Changes:

  • Removed deprecated inputValues, toNode, and unused address parameters from FlowConfig
  • Moved searchPaths from FlowConfig and BlockConfig to RunConfig with unified type string[]
  • Renamed buildArgs to buildRunConfigArgs for better clarity

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@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

🤖 Fix all issues with AI agents
In `@packages/oocana/src/oocana.ts`:
- Around line 182-184: The code calls searchPaths.join(...) which crashes when
searchPaths is a string; update the normalization where searchPaths is used (the
searchPaths variable and the args.push("--search-paths", ...) call) to accept
both string and string[]: detect Array.isArray(searchPaths) and join when it is
an array, otherwise coerce a string input (or ignore empty/undefined) before
pushing to args, so callers can gradually migrate to string[] without runtime
errors.

Comment on lines +182 to +184
if (searchPaths) {
args.push("--search-paths", searchPaths.join(","));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

修复 searchPaths 兼容性导致的运行时崩溃。
CI 已报 TypeError: searchPaths.join is not a function,说明仍有调用方传入旧的 string。建议在这里做归一化/兜底,同时逐步把调用方升级为 string[],避免直接崩溃。

✅ 建议修复
-  if (searchPaths) {
-    args.push("--search-paths", searchPaths.join(","));
-  }
+  if (searchPaths) {
+    const normalized = Array.isArray(searchPaths)
+      ? searchPaths
+      : [String(searchPaths)];
+    args.push("--search-paths", normalized.join(","));
+  }
📝 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
if (searchPaths) {
args.push("--search-paths", searchPaths.join(","));
}
if (searchPaths) {
const normalized = Array.isArray(searchPaths)
? searchPaths
: [String(searchPaths)];
args.push("--search-paths", normalized.join(","));
}
🧰 Tools
🪛 GitHub Actions: pr

[error] 183-183: TypeError: searchPaths.join is not a function. Occurred while building run config arguments during Flow tests (buildRunConfigArgs in Oocana.runFlow).

🤖 Prompt for AI Agents
In `@packages/oocana/src/oocana.ts` around lines 182 - 184, The code calls
searchPaths.join(...) which crashes when searchPaths is a string; update the
normalization where searchPaths is used (the searchPaths variable and the
args.push("--search-paths", ...) call) to accept both string and string[]:
detect Array.isArray(searchPaths) and join when it is an array, otherwise coerce
a string input (or ignore empty/undefined) before pushing to args, so callers
can gradually migrate to string[] without runtime errors.

- Add tsconfig.json extending base config
- Add typecheck script to catch type errors at compile time
- Fix another searchPaths string[] type error in flow.test.ts
@leavesster leavesster merged commit 93719d6 into main Jan 30, 2026
10 checks passed
@leavesster leavesster deleted the refactor/cleanup-oocana-public-api branch January 30, 2026 08:39
@oomol-bot oomol-bot mentioned this pull request Jan 30, 2026
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