8000 Fix bookmark event handling in watch operations by sambhav · Pull Request #116 · cloudcoil/cloudcoil · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix bookmark event handling in watch operations #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2025
Merged

Conversation

sambhav
Copy link
Contributor
@sambhav sambhav commented May 31, 2025

Summary

Fix handling of Kubernetes BOOKMARK events in watch operations to prevent validation errors when watching resources.

Problem

BOOKMARK events in Kubernetes watch streams contain minimal object data - only metadata.resourceVersion field is included. When cloudcoil tried to validate these minimal objects against the full resource schema, it would fail for resources with non-nullable fields, causing watch operations to crash.

Solution

  • Separate event types: Split BookmarkEvent from WatchEvent to handle them differently
  • Use Unstructured for bookmarks: Handle BOOKMARK events with Unstructured objects to avoid validation errors
  • Skip in wait_for: BOOKMARK events don't represent actual resource changes, so they're filtered out in wait_for operations
  • Update return types: Both sync and async watch methods now properly return union types including bookmark events

Changes

  • Add BookmarkEvent type separate from WatchEvent
  • Import and use Unstructured and BookmarkEvent types in API client
  • Handle BOOKMARK events specially in both sync and async watch methods
  • Skip BOOKMARK events in wait_for operations with proper type assertions
  • Update method signatures to reflect new return types

Testing

This fix resolves the validation crashes reported in issue #115 when bookmark events are received during watch operations.

Fixes #115

…OOKMARK events separately from regular watch events to prevent validation errors - Add BookmarkEvent type and use Unstructured objects for bookmarks - Skip BOOKMARK events in wait_for operations - Fixes #115

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
@sambhav sambhav enabled auto-merge (squash) May 31, 2025 21:29
Copy link
codecov bot commented May 31, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 12 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cloudcoil/client/_api_client.py 58.33% 10 Missing ⚠️
cloudcoil/resources.py 66.66% 2 Missing ⚠️
Files with missing lines Coverage Δ
cloudcoil/resources.py 50.81% <66.66%> (+0.13%) ⬆️
cloudcoil/client/_api_client.py 62.37% <58.33%> (-0.85%) ⬇️

@sambhav sambhav merged commit 4d3375e into main May 31, 2025
14 of 15 checks passed
@sambhav sambhav deleted the fix-bookmarks branch May 31, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bookmark events are broken
1 participant
0