Skip to content

refactor(agent-service): isolate HTTP clients#5753

Draft
bobbai00 wants to merge 2 commits into
apache:mainfrom
bobbai00:refactor/agent-service-clients
Draft

refactor(agent-service): isolate HTTP clients#5753
bobbai00 wants to merge 2 commits into
apache:mainfrom
bobbai00:refactor/agent-service-clients

Conversation

@bobbai00

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Second slice of the agent-service reorganization (no runtime behavior change):

  • Rename the per-service HTTP clients to *-client.ts (compile-apicompile-client, workflow-apiworkflow-client), split operator-metadata fetching into operator-metadata-client.ts, and add a dedicated execution-client.ts; all clients now read base URLs via getServiceEndpoints().
  • Rewire api/index.ts; add unit tests for all four clients.
  • Add the additive types the clients/tests need: ExecutionRequestParams (types/agent.ts) and the ExecutionMode enum + optional WorkflowSettings.executionMode (types/workflow.ts). The follow-up server/state PR completes the workflow.ts reshaping and makes executionMode required.
  • Trim api/backend-api.ts to a transitional getBackendConfig; the remaining server/tools consumers switch to getServiceEndpoints() in the follow-up PR.

Consumer changes are import-path-only; no logic was modified.

Stacked on #5751. Until that merges, the "Files changed" tab here also includes its commit — review the isolate HTTP clients commit for this PR's changes. Please merge after #5751.

Any related issues, documentation, discussions?

Closes #5749
Part of #5747

How was this PR tested?

bunx tsc --noEmit, bun test (116 pass / 0 fail, including 4 new client test suites), and prettier --check all pass in agent-service.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.8 (1M context)

bobbai00 added 2 commits June 16, 2026 22:28
…module

Foundation slice of the agent-service reorganization (no runtime behavior
change):

- Add src/types/api.ts (wire DTOs) and src/types/metadata.ts (operator
  metadata types extracted out of api/backend-api.ts); export both from the
  types barrel.
- Add src/config/endpoints.ts exposing getServiceEndpoints().
- Move src/api/auth-api.ts -> src/auth/jwt.ts (content unchanged) and add
  src/auth/jwt.test.ts; update auth import paths.
- Keep api/backend-api.ts transitional: it now imports/re-exports the metadata
  types from ../types/metadata and retains getBackendConfig/fetchOperatorMetadata,
  which the follow-up clients PR relocates.

The types/agent.ts and types/workflow.ts reshaping is deferred to the PR that
also updates server.ts/workflow-state.ts, since those renames are coupled.
Second slice of the agent-service reorganization (no runtime behavior change):

- Rename the per-service HTTP clients to *-client.ts: compile-api -> compile-client,
  workflow-api -> workflow-client, and split operator-metadata fetching into
  operator-metadata-client.ts; add a dedicated execution-client.ts for workflow
  execution calls. All clients now read base URLs via getServiceEndpoints().
- Rewire api/index.ts to the new client modules.
- Add unit tests for all four clients.
- Add the additive ExecutionRequestParams type (types/agent.ts) and ExecutionMode
  enum + optional WorkflowSettings.executionMode (types/workflow.ts) needed by the
  new client and its test; the follow-up server/state PR completes the
  workflow.ts reshaping and makes executionMode required.
- Trim api/backend-api.ts to just getBackendConfig (transitional); the remaining
  server/tools consumers switch to getServiceEndpoints in the follow-up PR.

Consumer changes are import-path-only; no logic was modified.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.31%. Comparing base (07724d5) to head (cc17f01).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
agent-service/src/agent/texera-agent.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5753      +/-   ##
============================================
+ Coverage     53.04%   53.31%   +0.27%     
  Complexity     2654     2654              
============================================
  Files          1094     1098       +4     
  Lines         42295    42367      +72     
  Branches       4545     4545              
============================================
+ Hits          22434    22589     +155     
+ Misses        18545    18462      -83     
  Partials       1316     1316              
Flag Coverage Δ *Carryforward flag
access-control-service 70.44% <ø> (ø) Carriedforward from 676cc26
agent-service 38.22% <98.00%> (+3.85%) ⬆️
amber 53.34% <ø> (ø) Carriedforward from 676cc26
computing-unit-managing-service 1.65% <ø> (ø) Carriedforward from 676cc26
config-service 56.71% <ø> (ø) Carriedforward from 676cc26
file-service 57.06% <ø> (ø) Carriedforward from 676cc26
frontend 47.93% <ø> (ø) Carriedforward from 676cc26
pyamber 89.77% <ø> (ø) Carriedforward from 676cc26
python 90.73% <ø> (ø) Carriedforward from 676cc26
workflow-compiling-service 58.69% <ø> (ø) Carriedforward from 676cc26

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-service refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(agent-service): consolidate the WebSocket message-type framework

2 participants