test(agent-service): add unit test coverage for the metadata formatters#6355
Merged
aglinxinyuan merged 2 commits intoJul 12, 2026
Merged
Conversation
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.
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
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.tsfile colocated withworkflow-system-metadata.tsto testformatValidationErrors. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ts—formatValidationErrorsandformatCompactSchemaForError. Abun test.spec.tssits next to the source. No production-code changes.fetchOperatorMetadatain 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?
4 pass.
bun run typecheckandbun run format:checkare clean. The spec is pure — it calls the formatters with in-process literals and covers: a valid result →""; invalid messages joined askey: msgwith"; "; 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])