Skip to content

filtered pull and test plan#344

Merged
sker65 merged 5 commits intomainfrom
filtered-pull-&-test-plan
Jan 23, 2026
Merged

filtered pull and test plan#344
sker65 merged 5 commits intomainfrom
filtered-pull-&-test-plan

Conversation

@sker65
Copy link
Contributor

@sker65 sker65 commented Jan 21, 2026

Summary by CodeRabbit

New Features

  • Added optional --test-plan-id parameter to the pull command to filter test cases by a specific test plan
  • Introduced test plan data retrieval functionality with type-safe API responses
  • Extended test target operations to support optional filtering by test plan ID
  • Added comprehensive test coverage for test plan operations

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Warning

Rate limit exceeded

@sker65 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 33 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.

📝 Walkthrough

Walkthrough

The PR introduces test plan filtering functionality. It adds a new test-plans module for fetching test plans by ID, exports it from the tools index, adds a CLI option to specify test plan ID, and extends pullTestTarget to optionally accept and pass testPlanId as a query parameter when fetching test targets.

Changes

Cohort / File(s) Summary
CLI Enhancement
src/cli.ts
Added optional -p, --test-plan-id [id] parameter to the pull command for filtering test cases by test plan ID.
Test Plans Module
src/tools/test-plans.ts, src/tools/index.ts
Introduced new test-plans module exporting TestPlanResponse, GetTestPlanParams types and getTestPlan(options) function. Function invokes API via client.GET, handles errors, validates data presence, and returns retrieved test plan. Re-exported from tools index.
Test Targets Extension
src/tools/test-targets.ts
Extended pullTestTarget() signature to accept optional testPlanId?: string parameter; conditionally includes testPlanId in query string when provided.
Test Coverage
tests/tools/test-plans.spec.ts
Added new test suite covering successful test plan retrieval and error handling scenarios with mocked HTTP client and error handler.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Test plans now filter with grace,
A new module finds its place,
CLI options guide the way,
Query params for the day,
Code reviews hop through with ease!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'filtered pull and test plan' is vague and generic, using non-descriptive terms that don't clearly convey what the changeset accomplishes without additional context. Consider a more specific title like 'Add test plan filtering to pull command' that clearly describes the main feature being added.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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

Copy link

@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: 3

🤖 Fix all issues with AI agents
In `@src/tools/test-plans.ts`:
- Around line 4-6: The build is failing because the path
"/apiKey/beta/test-plans/{id}" referenced by GetTestPlanParams in
src/tools/test-plans.ts doesn't exist in the generated API types; either
regenerate the API types from the OpenAPI spec so paths includes the test-plan
endpoints or change GetTestPlanParams to the actual existing path name in the
generated `paths` type (inspect the `paths` union in ../api to find the correct
test-plan path), and update any related types (TestPlanResponse and any usages)
to reference the correct schema names from `components["schemas"]`; after
updating, re-run type-check to ensure lines 6, 11, and 25 no longer error.

In `@tests/tools/test-plans.spec.ts`:
- Around line 17-29: The mockTestPlan object in tests/tools/test-plans.spec.ts
does not match the real ExternalTestPlanSchema (it lacks fields like app, tags,
environments, etc.); update the mockTestPlan to mirror ExternalTestPlanSchema by
adding the missing properties (e.g., app, tags, environments and any required
nested shapes) and ensure types/field names and value shapes match those defined
by ExternalTestPlanSchema so tests use realistic data; reference the
mockTestPlan constant in this file when making the changes.
- Around line 50-63: The current test for getTestPlan mixes the API-error path
and the missing-data path by returning both error and data: undefined; split
this into two tests: (1) simulate an API error by mocking
vi.mocked(client.GET).mockResolvedValue({ data: undefined, error: { message:
"Not found" }, response: mock() }) and assert handleError was called with that
error (do not expect a throw since handleError should handle exit), and (2)
simulate missing data by mocking vi.mocked(client.GET).mockResolvedValue({ data:
undefined, error: undefined, response: mock() }) and assert getTestPlan({ id })
rejects with `No test plan with id ${id} found`; update test names accordingly
and keep references to getTestPlan and handleError to locate the code to change.

adapt removing when partial pull
@sker65 sker65 merged commit 39205a8 into main Jan 23, 2026
4 checks passed
@sker65 sker65 deleted the filtered-pull-&-test-plan branch January 23, 2026 08:06
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