Skip to content

refactor(agent-service): centralize backend DTOs, metadata, endpoint config, and auth#5928

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

refactor(agent-service): centralize backend DTOs, metadata, endpoint config, and auth#5928
bobbai00 wants to merge 2 commits into
apache:mainfrom
bobbai00:refactor/agent-service-dto

Conversation

@bobbai00

@bobbai00 bobbai00 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Centralizes the agent-service type/config layer (no runtime behavior change). Stacked on #5751 (the WS-types PR).

  • types/dto.ts — backend request/response DTOs (workflow persistence, compiling-service responses, WorkflowFatalError).
  • types/metadata.ts — operator-metadata types extracted from api/backend-api.
  • config/endpoints.tsgetServiceEndpoints() centralizing backend base URLs.
  • auth/jwt.ts — relocated from api/auth-api; import paths updated.
  • Replace any with precise types across src/types/*; type ReActStep tool/message fields.
  • Consume the centralized types at the call sites (clients, server, agent utils); expand test coverage (jwt, workflow-system-metadata, compile/workflow clients) and rename *.test.ts*.spec.ts.

types/execution.ts is intentionally untouched here — its redesign is #5927.

Any related issues, documentation, discussions?

Closes #5748
Part of #5747.

How was this PR tested?

bunx tsc --noEmit, bun test (126 pass / 0 fail), 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)

@github-actions github-actions Bot added refactor Refactor the code frontend Changes related to the frontend GUI agent-service labels Jun 24, 2026
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Ma77Ball, @Yicong-Huang, @yangzhang75
    You can notify them by mentioning @Ma77Ball, @Yicong-Huang, @yangzhang75 in a comment.

@codecov-commenter

codecov-commenter commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.35849% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.83%. Comparing base (1aae005) to head (8d73920).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...ervice/src/agent/tools/workflow-execution-tools.ts 10.00% 9 Missing ⚠️
agent-service/src/agent/texera-agent.ts 16.66% 5 Missing ⚠️
...d/src/app/workspace/service/agent/agent.service.ts 0.00% 4 Missing ⚠️
agent-service/src/config/endpoints.ts 75.00% 3 Missing ⚠️
agent-service/src/agent/util/context-utils.ts 0.00% 1 Missing ⚠️
...service/src/agent/util/workflow-system-metadata.ts 66.66% 1 Missing ⚠️
...ent/agent-panel/agent-chat/agent-chat.component.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5928      +/-   ##
============================================
+ Coverage     56.25%   56.83%   +0.58%     
  Complexity     2992     2992              
============================================
  Files          1120     1124       +4     
  Lines         43175    43042     -133     
  Branches       4658     4632      -26     
============================================
+ Hits          24286    24463     +177     
+ Misses        17469    17159     -310     
  Partials       1420     1420              
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from af73dff
agent-service 49.78% <81.18%> (+5.18%) ⬆️
amber 57.80% <ø> (ø) Carriedforward from af73dff
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from af73dff
config-service 51.56% <ø> (ø) Carriedforward from af73dff
file-service 59.02% <ø> (ø) Carriedforward from af73dff
frontend 49.72% <0.00%> (+0.42%) ⬆️
notebook-migration-service 78.57% <ø> (ø) Carriedforward from af73dff
pyamber 90.20% <ø> (ø) Carriedforward from af73dff
python 90.76% <ø> (ø) Carriedforward from af73dff
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from af73dff

*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.

bobbai00 added a commit to bobbai00/texera that referenced this pull request Jun 28, 2026
…#5930)

### What changes were proposed in this PR?

Removes the step-checkout feature from agent-service, which was wired
end-to-end but unreachable — nothing in the product ever invokes the
frontend `checkoutStep()`, so the backend `/agents/:id/checkout`
endpoint and its `headChange` WebSocket broadcast were never triggered.
Removing the dead vertical slice:

- `agent-service/src/server.ts` — drop the `POST /:id/checkout` route
and the `headChange` / `workflowContent` members of the outgoing
WebSocket-message type.
- `agent-service/src/agent/texera-agent.ts` — drop
`TexeraAgent.checkout()`.
- `frontend/.../agent/agent.service.ts` — drop the `case "headChange"`
WS handler and the unused `checkoutStep()` method.

HEAD *tracking* is retained: `init`/`step` messages still carry
`headId`, and the chat panel still walks the ancestor path from HEAD to
render the visible step chain. Only the backward HEAD move (checkout) is
removed.

This branches from `main` and is independent of the type-refactor stack
(apache#5751apache#5928/apache#5927). Note apache#5751 currently lists `headChange` as a
server message; whichever merges second will drop it from the union — a
trivial reconciliation.

### Any related issues, documentation, discussions?

Closes apache#5942
Part of apache#5747. Independent of the stack (branches from `main`).

### How was this PR tested?

agent-service: `tsc --noEmit` clean, 93/93 `bun test` pass, prettier
clean. Frontend: the removed `checkoutStep()` had zero callers and the
`headChange` handler is now unreachable; verified no remaining
`checkout`/`headChange` references and no orphaned imports.

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

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

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…config, and auth

Consolidate the agent-service type/config layer. Stacked on the WS PR (apache#5751);
types/execution.ts is left untouched (its redesign is a separate PR).

- types/dto.ts: backend request/response DTOs (workflow persistence, compiling-service responses, WorkflowFatalError).
- types/metadata.ts: operator-metadata types extracted from api/backend-api.
- config/endpoints.ts: getServiceEndpoints() centralizing backend base URLs.
- auth/jwt.ts: relocated from api/auth-api; update import paths.
- Replace `any` with precise types across src/types/*; type ReActStep tool/message fields precisely.
- Consume the centralized types at call sites (clients, server, agent utils).
- Expand test coverage (jwt, workflow-system-metadata, compile/workflow clients); rename *.test.ts -> *.spec.ts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q
@bobbai00 bobbai00 force-pushed the refactor/agent-service-dto branch from ee9205f to af73dff Compare June 28, 2026 22:23
@github-actions github-actions Bot removed the frontend Changes related to the frontend GUI label Jun 28, 2026
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-service frontend Changes related to the frontend GUI refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(agent-service): centralize backend DTOs, metadata, endpoint config, and auth

2 participants