Skip to content

test(agent-service): add unit test coverage for the metadata formatters#6355

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
mengw15:chore/6335-metadata-formatters-test
Jul 12, 2026
Merged

test(agent-service): add unit test coverage for the metadata formatters#6355
aglinxinyuan merged 2 commits into
apache:mainfrom
mengw15:chore/6335-metadata-formatters-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add unit test coverage for the two pure string formatters in agent-service/src/agent/util/workflow-system-metadata.tsformatValidationErrors and formatCompactSchemaForError. A bun test .spec.ts sits next to the source. No production-code changes.

fetchOperatorMetadata in the same file hits the backend and is out of scope for this unit issue.

Any related issues, documentation, discussions?

Closes #6335.

How was this PR tested?

bun test src/agent/util/workflow-system-metadata.spec.ts

4 pass. bun run typecheck and bun run format:check are clean. The spec is pure — it calls the formatters with in-process literals and covers: a valid result → ""; invalid messages joined as key: msg with "; "; a compact schema rendering its required keys plus the JSON-stringified present required properties; and the empty required/properties case.

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

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

formatValidationErrors and formatCompactSchemaForError (workflow-system-
metadata.ts) are pure string formatters. Cover the valid/invalid message
joining and the compact-schema rendering (required keys + JSON-stringified
present required properties) with a bun test .spec.ts next to the source.
fetchOperatorMetadata hits the backend and is out of scope.

Closes apache#6335.
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

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

  • No candidates found from git blame history.

@codecov-commenter

codecov-commenter commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.62%. Comparing base (00480e8) to head (7c16866).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6355      +/-   ##
============================================
+ Coverage     63.58%   63.62%   +0.03%     
- Complexity     3377     3380       +3     
============================================
  Files          1142     1142              
  Lines         45020    45020              
  Branches       4948     4948              
============================================
+ Hits          28625    28642      +17     
+ Misses        14818    14802      -16     
+ Partials       1577     1576       -1     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from dfabf7b
agent-service 44.90% <ø> (+0.30%) ⬆️
amber 66.56% <ø> (+0.02%) ⬆️ Carriedforward from dfabf7b
computing-unit-managing-service 9.97% <ø> (ø) Carriedforward from dfabf7b
config-service 52.30% <ø> (ø) Carriedforward from dfabf7b
file-service 63.97% <ø> (ø) Carriedforward from dfabf7b
frontend 59.05% <ø> (ø) Carriedforward from dfabf7b
notebook-migration-service 78.94% <ø> (ø) Carriedforward from dfabf7b
pyamber 91.18% <ø> (+0.04%) ⬆️ Carriedforward from dfabf7b
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from dfabf7b

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Bun unit tests in the agent-service to cover two pure string-formatting helpers in workflow-system-metadata.ts, aligning with Issue #6335’s requested behaviors and keeping production code unchanged.

Changes:

  • Adds a new .spec.ts file colocated with workflow-system-metadata.ts to test formatValidationErrors.
  • Adds unit tests for formatCompactSchemaForError, including required/properties filtering and the empty case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mengw15 mengw15 marked this pull request as draft July 12, 2026 01:36
@mengw15 mengw15 requested a review from aglinxinyuan July 12, 2026 01:39
@mengw15 mengw15 marked this pull request as ready for review July 12, 2026 01:39

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aglinxinyuan aglinxinyuan added this pull request to the merge queue Jul 12, 2026
Merged via the queue into apache:main with commit e462f22 Jul 12, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit test coverage for agent-service formatValidationErrors / formatCompactSchemaForError

4 participants