Skip to content

Conversation

retr0-kernel
Copy link

Description

  • Improved error handling and validation in API handlers (application.go, audit.go)
  • Updated Swagger comments to document all error responses (422, 500, etc.)

Related Issue

Closes #4094

Motivation and Context

These changes improve API robustness, make error responses more predictable, and help new contributors understand and follow best practices.

Screenshots (if appropriate)

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Signed-off-by: Krish Srivastava <[email protected]>
@retr0-kernel retr0-kernel force-pushed the feat/handler-error-handling-and-docs branch from e028400 to a8f7bd8 Compare May 24, 2025 08:04
Copy link

codecov bot commented May 24, 2025

Codecov Report

Attention: Patch coverage is 14.28571% with 36 lines in your changes missing coverage. Please review.

Project coverage is 33.17%. Comparing base (e23bd66) to head (a8f7bd8).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
manager/handlers/application.go 9.67% 22 Missing and 6 partials ⚠️
manager/handlers/audit.go 27.27% 6 Missing and 2 partials ⚠️

❌ Your project check has failed because the head coverage (33.17%) is below the target coverage (34.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4095      +/-   ##
==========================================
- Coverage   34.36%   33.17%   -1.19%     
==========================================
  Files         346      346              
  Lines       40489    40625     +136     
==========================================
- Hits        13913    13478     -435     
- Misses      25660    26248     +588     
+ Partials      916      899      -17     
Flag Coverage Δ
unittests 33.17% <14.28%> (-1.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
manager/handlers/audit.go 54.16% <27.27%> (-17.27%) ⬇️
manager/handlers/application.go 53.26% <9.67%> (-16.44%) ⬇️

... and 27 files with indirect coverage changes

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

@retr0-kernel
Copy link
Author

@gaius-qi I guess we need to re-run the jobs not sure what are the errors for the second job (which is a required one)

return
}

// Validate pagination parameters
Copy link
Member

Choose a reason for hiding this comment

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

The parameter verification has been completed in the annotation, refer to https://github.com/dragonflyoss/dragonfly/blob/main/manager/types/audit.go#L40.

}

// Validate pagination parameters
if query.Page < 0 {
Copy link
Member

Choose a reason for hiding this comment

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

The parameter verification has been completed in the annotation, refer to https://github.com/dragonflyoss/dragonfly/blob/main/manager/types/audit.go#L40.

@gaius-qi gaius-qi added the enhancement New feature or request label May 26, 2025
@gaius-qi gaius-qi added this to the v2.3.0 milestone May 26, 2025
@gaius-qi gaius-qi added the wip label May 27, 2025
@gaius-qi gaius-qi modified the milestones: v2.3.0, v2.4.0 Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wip
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve handler error handling and Swagger docs
4 participants