bobbai00 opened a new issue, #5563:
URL: https://github.com/apache/texera/issues/5563
### Task Summary
The `agent-service/` (Bun/TS) codebase has accumulated structural
inconsistencies that hurt readability and risk silent wire-contract bugs.
**Code structure**
| Problem | Detail |
| --- | --- |
| Definitions scattered | ~25 interfaces/types live in
client/tool/util/server files instead of `types/` |
| Duplicate definitions | `LogicalPlan` / `PortSchema` / `InputPortInfo`
defined twice; `AgentSettingsApi` is field-for-field identical to
`UpdateAgentSettingsRequest` |
| Impure "clients" | `api/` mixes HTTP clients with types, endpoint config,
and JWT helpers; the execution HTTP client lives in `agent/tools/`, while
`api/execution-api.ts` holds only types |
| Misleading naming | `AgentDelegateConfig` is a runtime binding (not
config) and is re-declared inline 3× with conflicting shapes; `*Config` is used
for non-config objects |
| Duplicate logic | `jsonToTableFormat` and the input/output-shape formatter
are duplicated across two files |
**Inconsistency with the frontend wire contract**
The agent reads/writes the same workflow and compile payloads as the Angular
frontend, but several `types/` definitions have drifted from
`frontend/src/app/.../*.interface.ts`:
| Type | agent-service (current) | frontend (source of truth) |
| --- | --- | --- |
| `CommentBox` | `{commentBoxID, comments: string, x, y, width, height}` |
`{commentBoxID, comments: Comment[], commentBoxPosition: Point}` |
| `WorkflowSettings` | missing `executionMode` | `{dataTransferBatchSize,
executionMode}` |
| `WorkflowFatalError` | `{type: string, message, operatorId?}` | `{message,
details, operatorId, workerId, type: {name}, timestamp}` |
These avoid runtime breakage today only because the code reads a subset of
the fields and passes the rest through opaquely — they are latent bugs, not
correct shapes.
### Task Type
- [x] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [ ] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]