Skip to content

DEV-230024 fix(get_assessment): reject limit outside 1-50 - #165

Open
Avivhdr wants to merge 1 commit into
mainfrom
dev-230024-get-assessment-limit
Open

Avivhdr wants to merge 1 commit into
mainfrom
dev-230024-get-assessment-limit

Conversation

@Avivhdr

@Avivhdr Avivhdr commented Nov 13, 2026 •

Copy link
Copy Markdown

Description of your changes

DEV-230024

What was wrong. get_assessment stored limit as a plain int with omitempty, so limit: 0 looked the same as "not set" and the API default of 10 applied. The tool returned 10 assessments where the REST API returns a 400. A limit above 50 reached the API and came back as a generic "Failed to retrieve assessment" error.

What changed.

  • Input.Limit and ListAssessmentsParams.Limit are now *int, the same way the classification clients handle limit, so an explicit 0 is no longer treated as "not set".
  • The handler rejects 0, negatives and anything above 50 with limit must be between 1 and 50; got N before any API call. Leaving limit out keeps the API default.
  • edit_assessment passes its fixed limit of 50 as a pointer.

One side effect: a direct lookup (assessmentId or assessmentReviewId) sent together with limit: 0 now gets the existing "cannot be combined with filters" error. Before, the 0 was silently dropped.

How it was tested. New unit tests in pkg/tools/get_assessment/tool_test.go against a stub server:

  • 0, -1 and 51 return the validation error, and the API is never called
  • 1 and 50 are sent to the API and return results
  • no limit sends no limit query parameter
  • {"limit": 0} decoded from JSON arguments is rejected

go test -race ./... passes (790 tests, 61 packages), including the schema tests in pkg/chip (TestRegisteredToolParamsHaveNoNullableUnions, TestNoToolDeclaresABooleanSubschema). The pointer field still produces a plain integer in the input schema. go vet and golangci-lint v2.15.0 report nothing.


Impact Analysis

The change is limited to the get_assessment input and the assessments list client. edit_assessment is the only other caller of ListAssessmentsParams and sends the same request as before. Other tools (find_dq_rules, list_asset_types) still treat limit 0 as "use the default". This ticket doesn't cover them.


Checklist

  • I have performed a self-review of my code
  • My code follows the contribution guidelines of this project
  • My changes generate no new warnings

🤖 Generated with Claude Code

DEV-230024

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Avivhdr
Avivhdr requested a review from a team as a code owner November 13, 2026 20:48
@Avivhdr Avivhdr added the DO NOT REVIEW Work in progress, not ready for review label Nov 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT REVIEW Work in progress, not ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant