Skip to content

test: Increase test coverage for agent-core and composeApp#116

Merged
yacosta738 merged 2 commits intomainfrom
test/increase-coverage-10574148230699322893
Mar 1, 2026
Merged

test: Increase test coverage for agent-core and composeApp#116
yacosta738 merged 2 commits intomainfrom
test/increase-coverage-10574148230699322893

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

@yacosta738 yacosta738 commented Mar 1, 2026

This PR increases the test coverage for the agent-core-kmp and composeApp modules by adding several unit tests for previously untested or under-tested components.

Key changes:

  • Added GreetingTest.kt to test platform-specific greetings in composeApp.
  • Added ChatComponentsTest.kt to test URL normalization and assistant reply formatting.
  • Added ChatWorkspaceDefaultsTest.kt to verify default UI state values.
  • Updated RustCliBridgeTest.kt in agent-core-kmp to cover:
    • Invalid timeout (<= 0)
    • Working directory configuration
    • Blank error output handling

All changes follow the project's TDD approach and have been verified locally using ./gradlew check and ./gradlew :composeApp:jvmTest.


PR created automatically by Jules for task 10574148230699322893 started by @yacosta738

Summary by CodeRabbit

Release Notes

  • Tests
    • Added comprehensive test coverage for greeting functionality with platform detection
    • Added test suite for chat component utilities including endpoint normalization and assistant reply handling
    • Added test suite for chat workspace configuration and default settings
    • Added tests for CLI bridge execution covering timeout validation, working directory handling, and error scenarios

- Add unit tests for Greeting and ChatComponents utility functions in composeApp.
- Add unit tests for ChatWorkspaceDefaults state initialization.
- Enhance RustCliBridgeTest in agent-core-kmp with edge cases: invalid timeout, working directory support, and blank failure output.
- Verified all new and existing tests pass using Gradle.

Co-authored-by: yacosta738 <33158051+yacosta738@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 1, 2026

Deploying corvus with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54a8d30
Status: ✅  Deploy successful!
Preview URL: https://c8bbde86.corvus-42x.pages.dev
Branch Preview URL: https://test-increase-coverage-10574.corvus-42x.pages.dev

View logs

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 1, 2026

📝 Walkthrough

Walkthrough

This PR introduces new test files for Greeting, ChatComponents, and ChatWorkspaceDefaults functionality, and extends RustCliBridgeTest with three additional test methods and an updated existing test case.

Changes

Cohort / File(s) Summary
Chat UI Tests
clients/composeApp/src/commonTest/.../ui/chat/ChatComponentsTest.kt, clients/composeApp/src/commonTest/.../ui/chat/ChatWorkspaceDefaultsTest.kt
New tests for endpoint URL normalization, local assistant reply building with gateway info, and ChatWorkspaceDefaults configuration including model name, input placeholder, and welcome message validation.
Common Tests
clients/composeApp/src/commonTest/.../GreetingTest.kt
New test verifying that Greeting().greet() returns a string containing "Hello" and the current platform name.
Agent Core Tests
modules/agent-core-kmp/src/jvmTest/.../RustCliBridgeTest.kt
Three new test methods for invalid timeout validation, working directory honor, and default details on blank output failure; existing test updated to use explicit shell invocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely describes the main change: adding test coverage to agent-core and composeApp modules.
Description check ✅ Passed The description covers the summary, key changes, and tested information sections, though the template's Breaking Changes section is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/increase-coverage-10574148230699322893

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 1, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 88% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 9 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3047 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 380 >= 0
Merger Diversity Unique maintainers who merged PRs 2 >= 0
Repo History Merge Rate Merge rate in this repo 91% >= 0%
Repo History Min PRs Previous PRs in this repo 87 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-03-01 to 2026-03-01

@yacosta738 yacosta738 changed the title Increase test coverage for agent-core and composeApp test: Increase test coverage for agent-core and composeApp Mar 1, 2026
@yacosta738 yacosta738 marked this pull request as ready for review March 1, 2026 20:34
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 1, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
modules/agent-core-kmp/src/jvmTest/kotlin/com/profiletailors/agent/core/RustCliBridgeTest.kt (1)

35-35: Avoid hardcoded /usr/bin/env in test commands.

Using an absolute env path adds unnecessary environment coupling; the shell is already invoked, so direct exits are enough.

Proposed fix
-            arguments = listOf("-c", "echo bridge-error >&2; /usr/bin/env sh -c 'exit 7'", "bridge"),
+            arguments = listOf("-c", "echo bridge-error >&2; exit 7", "bridge"),
...
-            arguments = listOf("-c", "/usr/bin/env sh -c 'exit 9'", "bridge"),
+            arguments = listOf("-c", "exit 9", "bridge"),

Also applies to: 115-115

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@modules/agent-core-kmp/src/jvmTest/kotlin/com/profiletailors/agent/core/RustCliBridgeTest.kt`
at line 35, Test commands in RustCliBridgeTest use a hardcoded "/usr/bin/env"
path; update the arguments list in the test(s) so they do not reference an
absolute env path. Replace occurrences of "/usr/bin/env sh -c 'exit 7'" in the
RustCliBridgeTest arguments with a portable form such as "sh -c 'exit 7'" (or
simply "exit 7" if the invoked shell handles it) in both places where arguments
= listOf(...) appears so the tests no longer depend on a hardcoded env path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@clients/composeApp/src/commonTest/kotlin/com/profiletailors/corvus/GreetingTest.kt`:
- Line 12: The assertion in GreetingTest.kt uses greeting.contains("Hello") but
its message says "Greeting should start with Hello"; update the test to make
intent and message consistent by using greeting.startsWith("Hello") in the
assertTrue (or alternatively adjust the message to say "should contain Hello" if
you intend to allow contains) so that the assertion and message match for the
assertion in the test function where greeting is validated.

In
`@modules/agent-core-kmp/src/jvmTest/kotlin/com/profiletailors/agent/core/RustCliBridgeTest.kt`:
- Around line 102-105: The test compares paths using expected =
File(tempDir).absolutePath.removeSuffix("/") and actual =
File(success.output.text).absolutePath.removeSuffix("/"), but
success.output.text may include a trailing newline; update the actual (and
optionally expected) construction to trim whitespace before converting to File
(e.g., call .trim() on success.output.text) so the comparison uses
File(success.output.text.trim()).absolutePath.removeSuffix("/"); locate these
variables in RustCliBridgeTest.kt (expected, actual, success.output.text) and
apply the trim to avoid flakiness.

---

Nitpick comments:
In
`@modules/agent-core-kmp/src/jvmTest/kotlin/com/profiletailors/agent/core/RustCliBridgeTest.kt`:
- Line 35: Test commands in RustCliBridgeTest use a hardcoded "/usr/bin/env"
path; update the arguments list in the test(s) so they do not reference an
absolute env path. Replace occurrences of "/usr/bin/env sh -c 'exit 7'" in the
RustCliBridgeTest arguments with a portable form such as "sh -c 'exit 7'" (or
simply "exit 7" if the invoked shell handles it) in both places where arguments
= listOf(...) appears so the tests no longer depend on a hardcoded env path.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fe371a7 and 54a8d30.

📒 Files selected for processing (4)
  • clients/composeApp/src/commonTest/kotlin/com/profiletailors/corvus/GreetingTest.kt
  • clients/composeApp/src/commonTest/kotlin/com/profiletailors/corvus/ui/chat/ChatComponentsTest.kt
  • clients/composeApp/src/commonTest/kotlin/com/profiletailors/corvus/ui/chat/ChatWorkspaceDefaultsTest.kt
  • modules/agent-core-kmp/src/jvmTest/kotlin/com/profiletailors/agent/core/RustCliBridgeTest.kt

val platform = getPlatform()
val greeting = Greeting().greet()

assertTrue(greeting.contains("Hello"), "Greeting should start with Hello")
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.

⚠️ Potential issue | 🟡 Minor

Assertion intent and message don’t match.

The check uses contains("Hello") while the message says the greeting should start with Hello, so this can pass for incorrect output.

Proposed fix
-    assertTrue(greeting.contains("Hello"), "Greeting should start with Hello")
+    assertTrue(greeting.startsWith("Hello"), "Greeting should start with Hello")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
assertTrue(greeting.contains("Hello"), "Greeting should start with Hello")
assertTrue(greeting.startsWith("Hello"), "Greeting should start with Hello")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@clients/composeApp/src/commonTest/kotlin/com/profiletailors/corvus/GreetingTest.kt`
at line 12, The assertion in GreetingTest.kt uses greeting.contains("Hello") but
its message says "Greeting should start with Hello"; update the test to make
intent and message consistent by using greeting.startsWith("Hello") in the
assertTrue (or alternatively adjust the message to say "should contain Hello" if
you intend to allow contains) so that the assertion and message match for the
assertion in the test function where greeting is validated.

Comment on lines +102 to +105
// Normalize paths for comparison
val expected = File(tempDir).absolutePath.removeSuffix("/")
val actual = File(success.output.text).absolutePath.removeSuffix("/")
assertEquals(expected, actual)
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.

⚠️ Potential issue | 🟡 Minor

Trim command output before path comparison.

pwd commonly emits a trailing newline; comparing the raw captured text can make this test flaky.

Proposed fix
-    val actual = File(success.output.text).absolutePath.removeSuffix("/")
+    val actual = File(success.output.text.trim()).absolutePath.removeSuffix("/")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Normalize paths for comparison
val expected = File(tempDir).absolutePath.removeSuffix("/")
val actual = File(success.output.text).absolutePath.removeSuffix("/")
assertEquals(expected, actual)
// Normalize paths for comparison
val expected = File(tempDir).absolutePath.removeSuffix("/")
val actual = File(success.output.text.trim()).absolutePath.removeSuffix("/")
assertEquals(expected, actual)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@modules/agent-core-kmp/src/jvmTest/kotlin/com/profiletailors/agent/core/RustCliBridgeTest.kt`
around lines 102 - 105, The test compares paths using expected =
File(tempDir).absolutePath.removeSuffix("/") and actual =
File(success.output.text).absolutePath.removeSuffix("/"), but
success.output.text may include a trailing newline; update the actual (and
optionally expected) construction to trim whitespace before converting to File
(e.g., call .trim() on success.output.text) so the comparison uses
File(success.output.text.trim()).absolutePath.removeSuffix("/"); locate these
variables in RustCliBridgeTest.kt (expected, actual, success.output.text) and
apply the trim to avoid flakiness.

@yacosta738 yacosta738 merged commit 260028c into main Mar 1, 2026
18 of 20 checks passed
@yacosta738 yacosta738 deleted the test/increase-coverage-10574148230699322893 branch March 1, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant