aglinxinyuan opened a new pull request, #9252:
URL: https://github.com/apache/texera/pull/9252
### What changes were proposed in this PR?
Deduplicates result formatting logic between
`agent-service/src/agent/tools/result-formatting.ts` and
`workflow-execution-tools.ts`:
- Exports `formatInputOutputMetadata` and `jsonToTableFormat` from
`result-formatting.ts`.
- Replaces duplicate private implementations `formatInputOutput` and
`jsonToTableFormat` in `workflow-execution-tools.ts` with direct imports from
`./result-formatting`.
- Adds direct unit tests in `result-formatting.spec.ts` covering
`formatInputOutputMetadata` (shape formatting, upstream link resolution, port
sorting) and `jsonToTableFormat` (empty cases, TSV formatting with index
column).
### Any related issues, documentation, discussions?
Closes #9250
### How was this PR tested?
- Target test suites:
```bash
bun test src/agent/tools/workflow-execution-tools.spec.ts
src/agent/tools/result-formatting.spec.ts
```
Output: 54 pass, 0 fail (119 expect() calls, 203ms).
- Full `agent-service` test suite:
```bash
bun test
```
Output: 317 pass, 0 fail (772 expect() calls, 2.14s).
- Type checking:
```bash
bun run typecheck
```
Output: `tsc --noEmit` clean.
- Code style formatting:
```bash
bun run format:check
```
Output: All matched files use Prettier code style.
- Mutation test:
Mutated `formatInputOutputMetadata` shape output in
`result-formatting.ts`; verified 5 tests in `workflow-execution-tools.spec.ts`
failed as expected, then restored clean.
--
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]