refactor(agent-service): reorganize types and clients code with more test cases#5564
refactor(agent-service): reorganize types and clients code with more test cases#5564bobbai00 wants to merge 4 commits into
Conversation
- Move all type/interface definitions under types/ (new types/metadata.ts, types/api.ts); drop duplicate LogicalPlan/PortSchema/InputPortInfo and the identical AgentSettingsApi/UpdateAgentSettingsRequest. - Make api/ pure HTTP clients: extract the execution client (api/execution-client.ts), move JWT helpers to auth/jwt.ts and endpoint config to config/endpoints.ts, rename *-api.ts -> *-client.ts (backend-api -> operator-metadata-client). - Rename misleading *Config types: AgentDelegateConfig -> AgentDelegation (+ AgentDelegationDto), TexeraAgentConfig -> TexeraAgentOptions, ExecutionConfig -> ExecutionRequestParams, getBackendConfig -> getServiceEndpoints. - De-duplicate the table/IO-shape formatters into tools-utility.ts. - Align CommentBox, WorkflowSettings.executionMode, and WorkflowFatalError with the frontend wire contract. Refs apache#5563
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5564 +/- ##
============================================
+ Coverage 52.16% 55.38% +3.21%
Complexity 2482 2482
============================================
Files 1067 1070 +3
Lines 41273 40970 -303
Branches 4437 4437
============================================
+ Hits 21532 22693 +1161
+ Misses 18479 17015 -1464
Partials 1262 1262
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add unit tests (mocking fetch) for the client layer flagged by Codecov on apache#5564, plus the auth and agent-lifecycle paths: - execution-client, operator-metadata-client, workflow-client and compile-client (now ~100% line coverage) - auth/jwt token decoding and validation - TexeraAgent delegation, settings, and history accessors Refs apache#5563
Extend coverage for the integration lines Codecov flagged on apache#5564: - executeOperatorAndFormat: success, validation-error (no backend call), and backend-failure paths - TexeraAgent.sendMessage: workflow refresh, post-step auto-execution via an addOperator tool call, and debounced auto-persist, driven by a stub LanguageModelV2 with mocked fetch - server: delegated-agent creation (token masking) and graceful handling of a failed workflow load Refs apache#5563
Export and exercise printStartupMessage, covering the three getServiceEndpoints() log lines that were the last patch-coverage gap on apache#5564. Refs apache#5563
|
cc @xuang7 I would like to include this in the release v1.2. |
|
Given that this is a broad refactor and does not change runtime behavior, I‘m leaning toward deferring it until after the v1.2 release to reduce release risk. |
|
@bobbai00 I tried to review this PR but it is still too large of the changes. Could you please do one refactoring at a time? you are mixing 5-6 topics in one PR and it's hard for me to track and understand them. |
|
Superseded by #5747 (Refactor agent-service), which splits this bundled work into single-topic sub-tasks. Closing. |
What changes were proposed in this PR?
A refactor of
agent-service/for clarity and consistency, with no runtime behavior change:types/(newtypes/metadata.ts,types/api.ts) and removed duplicates —LogicalPlan/PortSchema/InputPortInfo, and the identicalAgentSettingsApi/UpdateAgentSettingsRequest.api/pure HTTP clients: extracted the execution client toapi/execution-client.ts, moved JWT helpers toauth/jwt.tsand endpoint config toconfig/endpoints.ts, and renamed*-api.ts→*-client.ts(backend-api→operator-metadata-client).*Confignames:AgentDelegateConfig→AgentDelegation(+AgentDelegationDto),TexeraAgentConfig→TexeraAgentOptions,ExecutionConfig→ExecutionRequestParams,getBackendConfig→getServiceEndpoints.tools-utility.ts.types/with the frontend wire contract: fixedCommentBox, addedWorkflowSettings.executionMode, and correctedWorkflowFatalError.Any related issues, documentation, discussions?
Closes #5563
How was this PR tested?
Refactor with no behavior change, plus new unit tests. From
agent-service/:bun install && bun test(132 pass, 0 fail),bun run typecheck(clean),bun run format:check(clean).Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.8 (1M context)