Skip to content

Conversation

@andyatmiami
Copy link
Contributor

ℹ️ : NO GH ISSUE

chore: improve validation and error response handling

This commit delivers improvements to validation and error handling across the backend API.

Key changes:

Error Response Improvements:

  • Enhanced error response structure with origin tracking (INTERNAL vs KUBERNETES)
  • Added support for extracting StatusCauses from both Invalid and Conflict Kubernetes errors via StatusCausesFromAPIStatus helper
  • Improved conflict error handling to always include origin field in API responses, ensuring pause action conflicts show KUBERNETES origin
  • Added comprehensive test coverage for error response functions

Validation Enhancements:

  • Refactored workspace model types (types_create.go -> types_write.go) for better code organization
  • Enhanced validation helper functions with improved error extraction
  • Added IsEOFError handling for better empty request body detection
  • Improved webhook validation for WorkspaceKind resources

Handler Updates:

  • Updated PauseActionWorkspaceHandler to properly handle Invalid errors from Kubernetes patch operations, ensuring conflict_causes[] includes KUBERNETES origin
  • Enhanced CreateWorkspaceHandler and other handlers to utilize improved error extraction and response formatting
  • Updated workspace and workspacekind handlers to use new validation and error response patterns

Testing:

  • Added comprehensive test suite for response_errors.go
  • Added extensive validation helper tests
  • Updated existing handler tests to match new error response format

Signed-off-by: Mathew Wicks <[email protected]>

Signed-off-by: Andy Stoneberg <[email protected]>
@github-project-automation github-project-automation bot moved this to Needs Triage in Kubeflow Notebooks Nov 7, 2025
@google-oss-prow google-oss-prow bot added the area/backend area - related to backend components label Nov 7, 2025
@google-oss-prow google-oss-prow bot added area/controller area - related to controller components area/v2 area - version - kubeflow notebooks v2 size/XXL labels Nov 7, 2025
@andyatmiami andyatmiami changed the title Chore/validation improvements chore: improved validation and error responses Nov 7, 2025
@andyatmiami
Copy link
Contributor Author

/ok-to-test

@andyatmiami andyatmiami force-pushed the chore/validation-improvements branch 3 times, most recently from c857c42 to ae7023c Compare November 20, 2025 20:58
- Updated StatusCausesFromAPIStatus to also return causes from StatusReasonConflict
- Enhanced PauseActionWorkspaceHandler and CreateWorkspaceHandler to utilize IsEOFError for better error responses.
- Enhanced PauseActionWorkspaceHandler to ensure conflict_causes[] is present when Patch operation returns Invalid
- Introduced new test files for response error handling and validation helper functions.

Signed-off-by: Andy Stoneberg <[email protected]>
@andyatmiami andyatmiami force-pushed the chore/validation-improvements branch from ae7023c to 8972547 Compare November 20, 2025 21:03
@thesuperzapper
Copy link
Member

/lgtm
/approve

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: thesuperzapper

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit b817284 into kubeflow:notebooks-v2 Nov 20, 2025
15 of 16 checks passed
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in Kubeflow Notebooks Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved area/backend area - related to backend components area/controller area - related to controller components area/v2 area - version - kubeflow notebooks v2 lgtm ok-to-test size/XXL

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants