Skip to content

fix: reject negative page-size values in list commands#631

Merged
bupd merged 1 commit into
goharbor:mainfrom
Sypher845:fix/reject-negative-page-size
Feb 17, 2026
Merged

fix: reject negative page-size values in list commands#631
bupd merged 1 commit into
goharbor:mainfrom
Sypher845:fix/reject-negative-page-size

Conversation

@Sypher845

@Sypher845 Sypher845 commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #627
Previously, negative page-size values (e.g., --page-size -1) were accepted without validation. This fix adds validation to reject negative values.

Affected commands:

  • project list
  • user list
  • repository list
  • schedule list
  • registry list
  • quota list
  • replication policies list
  • replication executions list
  • artifact list
  • labels list
  • instance list
  • project member list
  • robot list
  • project robot list
  • logs (not a list command, but it also has the page-size flag.)

@codecov

codecov Bot commented Jan 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 7.13%. Comparing base (60ad0bd) to head (79fcf39).
⚠️ Report is 94 commits behind head on main.

Files with missing lines Patch % Lines
cmd/harbor/root/instance/list.go 0.00% 6 Missing ⚠️
cmd/harbor/root/robot/list.go 0.00% 6 Missing ⚠️
cmd/harbor/root/logs.go 0.00% 4 Missing ⚠️
cmd/harbor/root/project/logs.go 0.00% 4 Missing ⚠️
cmd/harbor/root/project/member/list.go 0.00% 4 Missing ⚠️
cmd/harbor/root/project/robot/list.go 0.00% 4 Missing ⚠️
cmd/harbor/root/quota/list.go 0.00% 3 Missing ⚠️
cmd/harbor/root/artifact/list.go 0.00% 2 Missing ⚠️
cmd/harbor/root/labels/list.go 0.00% 2 Missing ⚠️
cmd/harbor/root/project/list.go 0.00% 2 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #631      +/-   ##
=========================================
- Coverage   10.99%   7.13%   -3.86%     
=========================================
  Files         173     260      +87     
  Lines        8671   12923    +4252     
=========================================
- Hits          953     922      -31     
- Misses       7612   11893    +4281     
- Partials      106     108       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bupd bupd self-requested a review January 22, 2026 18:05
@bupd bupd added bug Something isn't working go Pull requests that update go code labels Jan 22, 2026
@qcserestipy qcserestipy self-requested a review February 6, 2026 18:55

@qcserestipy qcserestipy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for your contribution. The over all implementation already looks good. To make this PR complete please also take care of missing list commands such as:

  • instance list
  • project member list
  • robot list
  • project robot list
  • logs (not a list command, but it also has the page-size flag.)

@Sypher845 Sypher845 force-pushed the fix/reject-negative-page-size branch from 81d9ad4 to 908492f Compare February 7, 2026 07:05
@Sypher845

Copy link
Copy Markdown
Contributor Author

@qcserestipy added the check to the remaining commands. Please take a look.

@Sypher845 Sypher845 requested a review from qcserestipy February 7, 2026 07:10

@qcserestipy qcserestipy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Sypher845 Looks nice, thank you!

@bupd bupd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Sypher845 heads up merge conflicts - please fix Thanks

Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
@Sypher845 Sypher845 force-pushed the fix/reject-negative-page-size branch from 908492f to 79fcf39 Compare February 10, 2026 20:11
@Sypher845

Copy link
Copy Markdown
Contributor Author

@bupd PTAL :)

@bupd bupd self-requested a review February 14, 2026 11:00

@bupd bupd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@bupd bupd merged commit 0c5c320 into goharbor:main Feb 17, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: list commands accept negative page-size values

3 participants