Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Python client’s delete_relationship() implementation to align with the current JupiterOne GraphQL API requirements by supplying fromEntityId and toEntityId in addition to relationshipId, and propagates the new call signature through docs, examples, and tests.
Changes:
- Update the
DeleteRelationshipGraphQL mutation anddelete_relationship()client method to requirefrom_entity_idandto_entity_id, with optionaltimestamp. - Refresh README + example call sites to use the new
delete_relationship()signature. - Bump package version and adjust the existing delete-relationship test invocation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
jupiterone/constants.py |
Updates the DELETE_RELATIONSHIP mutation to include fromEntityId and toEntityId. |
jupiterone/client.py |
Updates delete_relationship() signature, adds validation, and passes new variables. |
tests/test_delete_relationship.py |
Updates the test call to include new required parameters. |
README.md |
Updates documentation examples for deleting relationships with new required args. |
examples/examples.py |
Updates delete_relationship() usage to provide entity IDs. |
examples/03_relationship_management.py |
Updates relationship deletion examples to pass required entity IDs. |
examples/06_advanced_operations.py |
Tracks relationship endpoints so bulk update/delete can pass required IDs. |
examples/test_list_parameter_items.py |
Adds a new example script for list-type account parameter testing. |
examples/snyk_findings_resolved_within_15_days.py |
Adds a new example script for J1QL + Python-side time filtering/reporting. |
setup.py |
Bumps package version to 2.2.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #!/usr/bin/env python3 | ||
| """ | ||
| Test script: Create an account parameter of the list type with N items. |
There was a problem hiding this comment.
Because this is under examples/ but the filename starts with test_, running pytest from the repo root may try to collect it as a test module (depending on config). Consider renaming the script to avoid the test_ prefix (or adjusting pytest discovery config) so example scripts don’t get unintentionally picked up in CI/dev test runs.
| #!/usr/bin/env python3 | ||
| """ | ||
| Find critical Snyk findings linked to resolved issues where the issue |
There was a problem hiding this comment.
PR description lists updates to existing delete-relationship docs/examples/tests, but this PR also adds new example scripts (examples/test_list_parameter_items.py and examples/snyk_findings_resolved_within_15_days.py). Consider updating the PR description’s “Files changed” list (or removing these additions if they’re unintended) to keep the description aligned with the actual change set.
jupiterone/client.py
Outdated
| self._validate_entity_id(to_entity_id, "to_entity_id") | ||
|
|
||
| if timestamp is not None: | ||
| if not isinstance(timestamp, int) or timestamp <= 0: |
There was a problem hiding this comment.
timestamp validation uses isinstance(timestamp, int), which will also accept booleans (True/False) because bool is a subclass of int. Consider explicitly rejecting booleans (e.g., isinstance(timestamp, bool)) so accidental timestamp=True doesn’t get treated as 1 and sent to the API.
| if not isinstance(timestamp, int) or timestamp <= 0: | |
| if isinstance(timestamp, bool) or not isinstance(timestamp, int) or timestamp <= 0: |
There was a problem hiding this comment.
To confirm, this example is a side addition not related to relationship deletion, correct?
README.md
Outdated
| to_entity_id='<id-of-destination-entity>' | ||
| ) | ||
|
|
||
| # Delete with timestamp |
There was a problem hiding this comment.
I'm unfamiliar with the purpose of the timestamp argument.
Consider including details on what the timestamp does and why a user would want to include it.
VDubber
left a comment
There was a problem hiding this comment.
Left a few comments. Looks good to me!
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Update
delete_relationship()to match current GraphQL APISummary
deleteRelationshipGraphQL mutation now requiresfromEntityIdandtoEntityIdin addition torelationshipId. Updated the mutation inconstants.pyand thedelete_relationship()method inclient.pyto pass all three required fields.Files changed
jupiterone/constants.py$fromEntityIdand$toEntityIdto theDeleteRelationshipmutationjupiterone/client.pydelete_relationship()signature and validationtests/test_delete_relationship.pyREADME.mdexamples/03_relationship_management.pydelete_relationship()call sites with new required paramsexamples/06_advanced_operations.pyfrom/toentity IDsexamples/examples.pydelete_relationship()usagesetup.pyNote on backwards compatibility
This is technically a breaking change to the
delete_relationship()signature, but the previous implementation was already non-functional — the GraphQL API had been updated to requirefromEntityIdandtoEntityId, so any existing call with onlyrelationshipIdwas returning a server-side error. This release fixes the method to work against the current API.