Skip to content

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

Open
Sypher845 wants to merge 1 commit intogoharbor:mainfrom
Sypher845:fix/reject-negative-page-size
Open

fix: reject negative page-size values in list commands#631
Sypher845 wants to merge 1 commit intogoharbor:mainfrom
Sypher845:fix/reject-negative-page-size

Conversation

@Sypher845
Copy link
Contributor

@Sypher845 Sypher845 commented Jan 22, 2026

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
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 0% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 7.15%. Comparing base (60ad0bd) to head (908492f).
⚠️ Report is 83 commits behind head on main.

Files with missing lines Patch % Lines
cmd/harbor/root/logs.go 0.00% 6 Missing and 1 partial ⚠️
cmd/harbor/root/instance/list.go 0.00% 6 Missing ⚠️
cmd/harbor/root/robot/list.go 0.00% 6 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.15%   -3.85%     
=========================================
  Files         173     260      +87     
  Lines        8671   12895    +4224     
=========================================
- Hits          953     922      -31     
- Misses       7612   11865    +4253     
- 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
Copy link
Collaborator

@qcserestipy qcserestipy left a comment

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.)

Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
@Sypher845 Sypher845 force-pushed the fix/reject-negative-page-size branch from 81d9ad4 to 908492f Compare February 7, 2026 07:05
@Sypher845
Copy link
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
Copy link
Collaborator

@qcserestipy qcserestipy left a comment

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!

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