Yicong-Huang opened a new pull request, #4695:
URL: https://github.com/apache/texera/pull/4695

   ### What changes were proposed in this PR?
   
   Adds a `result-formatting.test.ts` covering the public 
`formatOperatorResult` entry point in 
`agent-service/src/agent/tools/result-formatting.ts` and, through it, the 
private `formatInputOutputMetadata` and `jsonToTableFormat` helpers.
   
   The new suite exercises:
   
   - early-return paths (error string, missing/non-array `result`, empty array)
   - output-shape line: `outputTuples` vs. `totalRowCount` precedence, internal 
`__is_visualization__` column being filtered from the column count
   - input-port metadata: missing/empty `inputPortShapes`, fallback `inputN` 
placeholder when no link matches, upstream operator id when a link matches, 
multi-port sort order
   - visualization-row stripping of `html-content` / `json-content`
   - cell coercion: `null`, `undefined`, `"NULL"` sentinel, numbers, booleans, 
tab/newline escaping, object/array `JSON.stringify`
   - `__row_index__` gap-marker behavior, including the consecutive and 
non-zero-start cases
   
   ### Any related issues, documentation, discussions?
   
   Closes #4694.
   
   Potential bug noted while reading the module (not pinned by these tests): 
`formatOperatorResult` filters both `__row_index__` and `__is_visualization__` 
from headers, but the inner `jsonToTableFormat` only filters `__row_index__` 
(line 106). For non-visualization rows that still carry `__is_visualization__`, 
the column would leak into the table body while being excluded from the 
metadata column count. Same single-filter pattern exists in 
`workflow-execution-tools.ts:400` and `server.ts:449`. Flagging for follow-up 
rather than locking the inconsistency in.
   
   ### How was this PR tested?
   
   ```
   cd agent-service
   bun install --frozen-lockfile
   bun test src/agent/tools/result-formatting.test.ts   # 24 pass / 0 fail
   bun test                                             # 58 pass / 0 fail
   bun run typecheck
   bun run format:check
   ```
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (claude-opus-4-7)


-- 
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]

Reply via email to