test(agent-service): raise unit-test coverage of core modules#5274
Open
bobbai00 wants to merge 1 commit into
Open
test(agent-service): raise unit-test coverage of core modules#5274bobbai00 wants to merge 1 commit into
bobbai00 wants to merge 1 commit into
Conversation
Adds unit tests for the agent service's previously under-tested modules: API clients (workflow/compile/backend/auth, via mocked fetch), the system prompt builder, context assembly, workflow utilities, the workflow CRUD and execution tools, and the in-memory surface of TexeraAgent. Introduces a shared operator-metadata fixture so tests need no live backend. Line coverage rises from ~52% to ~89% and function coverage from ~54% to ~90% (bun test --coverage). Closes apache#5266
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5274 +/- ##
============================================
+ Coverage 49.01% 52.05% +3.03%
Complexity 2378 2378
============================================
Files 1050 1051 +1
Lines 40336 40173 -163
Branches 4277 4277
============================================
+ Hits 19772 20911 +1139
+ Misses 19407 18105 -1302
Partials 1157 1157
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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?
The agent service had low automated test coverage (~52% line / ~54% function), concentrated in its core logic. This PR adds unit tests for the previously under-tested modules:
fetch, positive + non-ok + malformed)api/workflow-api.test.ts,api/compile-api.test.ts,api/backend-api.test.tsapi/auth-api.test.tsagent/prompts.test.tsagent/util/context-utils.test.tsagent/util/workflow-utils.test.tsagent/tools/workflow-crud-tools.test.tsagent/tools/workflow-execution-tools.test.tsTexeraAgentin-memory surface (state, settings, tools, lifecycle)agent/texera-agent.test.tsA shared operator-metadata fixture (
agent/util/metadata-fixture.ts) lets tests run without a live backend. No production code was changed.Coverage (
bun test --coverage): line 51.6% → 88.5%, function 54.2% → 90.0%.Any related issues, documentation, discussions?
Closes #5266
How was this PR tested?
Both positive and negative paths are covered (invalid input, missing config, non-ok HTTP responses, malformed responses).
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.8 (1M context)