Skip to content

test: add tests for subvalues by timestamp#53

Merged
kdmelon merged 2 commits into
mainfrom
test/add-subvalues-tests
Mar 25, 2026
Merged

test: add tests for subvalues by timestamp#53
kdmelon merged 2 commits into
mainfrom
test/add-subvalues-tests

Conversation

@kdmelon

@kdmelon kdmelon commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Tests
    • Added integration tests for --ground-truth-subvalues CLI parameter covering create operations, update operations with multiple subvalues, and invalid input error handling

@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@kdmelon has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 96d112d5-19cb-4c0d-96ae-cac55729f14d

📥 Commits

Reviewing files that changed from the base of the PR and between 5d3f722 and e0832bf.

📒 Files selected for processing (1)
  • tests/cli_tests.rs
📝 Walkthrough

Walkthrough

Added three new CLI integration tests for review-annotations command to validate --ground-truth-subvalues parameter handling, covering successful create/update operations with the parameter and error handling for invalid JSON input.

Changes

Cohort / File(s) Summary
CLI Integration Tests
tests/cli_tests.rs
Added three integration tests: one verifies create requests with ground_truth_subvalues_by_timestamp succeed and return the created annotation id, another validates update requests with multiple string-typed subvalue entries containing role fields succeed, and a third confirms invalid JSON input to --ground-truth-subvalues causes command failure without making API requests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 ✨ Three tests hop into the night,
CLI parameters checked left and right,
JSON validated with careful care,
Ground-truth subvalues everywhere!
Review-annotations passes the test,
Our code quality gets the best! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding tests for subvalues by timestamp functionality in the CLI integration tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/add-subvalues-tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/cli_tests.rs`:
- Around line 828-847: Update the test function
test_review_annotations_create_with_invalid_subvalues_json to assert the
specific JSON parse error instead of only .failure(): after building the command
(coval()...arg("--ground-truth-subvalues").arg("not valid json")), replace or
augment the final .assert().failure() with an assertion that checks stderr
contains the expected JSON-parse error message (e.g., something mentioning
"invalid JSON" or "failed to parse" for the --ground-truth-subvalues input) so
the test verifies the correct failure path rather than any generic failure.
- Around line 723-826: The mocks for POST in
test_review_annotations_create_with_subvalues and PATCH in
test_review_annotations_update_with_subvalues only assert method/path/header;
add a request-body assertion to each Mock::given chain to verify the client is
sending ground_truth_subvalues_by_timestamp. Concretely, augment the POST mock
for path "/v1/review-annotations" and the PATCH mock for path
"/v1/review-annotations/ann123" with an additional .and(body_json(json!(...)))
(or an equivalent body matcher) that asserts the JSON contains the expected
ground_truth_subvalues_by_timestamp array entries (matching the same objects
used in the test coval() --ground-truth-subvalues payloads) so the test fails if
the flag is ignored.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ac208050-c19e-46ba-9a02-b1dc2e85ce0f

📥 Commits

Reviewing files that changed from the base of the PR and between 2b7f47b and 5d3f722.

📒 Files selected for processing (1)
  • tests/cli_tests.rs

Comment thread tests/cli_tests.rs
Comment thread tests/cli_tests.rs
@kdmelon kdmelon merged commit 28edf71 into main Mar 25, 2026
7 checks passed
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.

2 participants