You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Yicong-Huang (via GitHub)" <gi...@apache.org> on 2026/05/02 22:47:26 UTC

[PR] test(agent-service): add unit tests for result-formatting [texera]

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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(agent-service): add unit tests for result-formatting [texera]

Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang merged PR #4695:
URL: https://github.com/apache/texera/pull/4695


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(agent-service): add unit tests for result-formatting [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4695:
URL: https://github.com/apache/texera/pull/4695#issuecomment-4364890296

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/4695?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 31.69%. Comparing base ([`b98c863`](https://app.codecov.io/gh/apache/texera/commit/b98c863127669dbb8c4a78ce0960c78e3742db5a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`f05a01e`](https://app.codecov.io/gh/apache/texera/commit/f05a01efadf44ee92b36cbb5043b715f5ab37a5f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   > :exclamation:  There is a different number of reports uploaded between BASE (b98c863) and HEAD (f05a01e). Click for more details.
   > 
   > <details><summary>HEAD has 2 uploads less than BASE</summary>
   >
   >| Flag | BASE (b98c863) | HEAD (f05a01e) |
   >|------|------|------|
   >|python|1|0|
   >|frontend|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##             main    #4695       +/-   ##
   ===========================================
   - Coverage   52.46%   31.69%   -20.77%     
   ===========================================
     Files         353       20      -333     
     Lines       21338     3306    -18032     
     Branches     1791        0     -1791     
   ===========================================
   - Hits        11195     1048    -10147     
   + Misses      10026     2258     -7768     
   + Partials      117        0      -117     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/4695/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/4695/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `31.69% <ø> (+2.96%)` | :arrow_up: |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/4695/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [python](https://app.codecov.io/gh/apache/texera/pull/4695/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/texera/pull/4695?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org