Skip to content

Conversation

@brandon-wada
Copy link
Collaborator

  • Implement delete_detector() method in client.py that accepts both Detector objects and ID strings
  • Add comprehensive integration test covering deletion by object, by ID, and error handling
  • Follow existing SDK patterns for parameter handling and error conversion
  • Include proper documentation with usage examples and warnings about irreversible deletion

🤖 Generated with Claude Code

Brandon and others added 3 commits June 9, 2025 20:34
- Implement delete_detector() method in client.py that accepts both Detector objects and ID strings
- Add comprehensive integration test covering deletion by object, by ID, and error handling
- Follow existing SDK patterns for parameter handling and error conversion
- Include proper documentation with usage examples and warnings about irreversible deletion

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
"""
# Create a detector to delete
name = f"Test delete detector {datetime.utcnow()}"
query = "Is there a dog to delete?"
Copy link
Member

Choose a reason for hiding this comment

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

this name is so sad

Copy link
Member

Choose a reason for hiding this comment

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

bad claude

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was going to change it originally, but then I thought about the silly test strings I've used and figured I'd let Claude have its fun

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm going to assume that Claude was being funny here, and not just confused.


# Verify the detector exists
retrieved_detector = gl.get_detector(detector.id)
assert retrieved_detector.id == detector.id
Copy link
Member

Choose a reason for hiding this comment

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

this assert is not meaningful? remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure. Interestingly, this line is added because it's an exact pattern match of the structure of the get_detector methods.

assert retrieved_detector.id == detector.id

detector_id = str(detector)

try:
self.detectors_api.delete_detector(id=detector_id, _request_timeout=DEFAULT_REQUEST_TIMEOUT)
Copy link
Member

Choose a reason for hiding this comment

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

I have no idea if this line is correct. I assume you've already verified that it is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is correct. It's a pretty strict pattern match from the create_detector method

@paulina-positronix
Copy link
Contributor

Do we want to add a test that an IQ and label submitted to detector is also deleted? Or is that tested elsewhere?

@brandon-wada brandon-wada merged commit 0ae9fed into main Jun 11, 2025
8 checks passed
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.

5 participants