refactor(oocana)!: clean up FlowConfig and BlockConfig public API#420
refactor(oocana)!: clean up FlowConfig and BlockConfig public API#420leavesster merged 6 commits intomainfrom
Conversation
…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
Summary by CodeRabbit发布说明
✏️ Tip: You can customize this high-level summary in your review settings. Walkthrough将运行时路径配置统一为 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
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 unusedaddressparameters fromFlowConfig - Moved
searchPathsfromFlowConfigandBlockConfigtoRunConfigwith unified typestring[] - Renamed
buildArgstobuildRunConfigArgsfor better clarity
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
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.
| if (searchPaths) { | ||
| args.push("--search-paths", searchPaths.join(",")); | ||
| } |
There was a problem hiding this comment.
修复 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.
| 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
Summary
inputValuesandtoNodeparameters fromFlowConfig(usenodesInputsandnodesinstead)addressparameter fromFlowConfigsearchPathsfromFlowConfigandBlockConfigintoRunConfig, unify type tostring[]buildArgstobuildRunConfigArgsfor clarityBREAKING CHANGE
FlowConfig.inputValuesremoved — usenodesInputsFlowConfig.toNoderemoved — usenodesFlowConfig.addressremoved (was unused; broker address comes fromconnect())FlowConfig.searchPathstype changed fromstringtostring[], moved toRunConfigBlockConfig.searchPathsmoved toRunConfigTest plan
pnpm -F @oomol/oocana buildpassespnpm -F @oomol/oocana test— 12 tests pass