Skip to content

fix(python): match server contract for relationship create and decode - #491

Open
rudycelekli wants to merge 1 commit into
raphaelmansuy:edgequake-mainfrom
rudycelekli:fix/python-relationship-create-contract-20261015
Open

rudycelekli wants to merge 1 commit into
raphaelmansuy:edgequake-mainfrom
rudycelekli:fix/python-relationship-create-contract-20261015

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Python relationship create does not match the server. CreateRelationshipRequest requires src_id, tgt_id, keywords, description, source_id (optional weight, metadata) and answers {status, message, relationship: {...}} with items using src_id, tgt_id, relation_type (relationships_types.rs). The SDK sent source/target/relationship_type, could omit description/source_id, and could not validate the wrapped response.

Evidence

New tests/test_relationship_create_contract.py (3 tests): before 3 failed (pydantic missing validation errors), after 3 passed. Suite: 628 passed, 33 skipped (main: 625 passed).

Change

RelationshipCreate keeps the SDK names but serializes with server aliases (defaults description="", source_id="manual_entry", properties -> metadata); Relationship also accepts src_id/tgt_id/relation_type; sync and async create unwrap the relationship envelope.

Verified / not verified

  • Verified: mocked request body and response decoding. I merged this branch with the four sibling SDK PR branches (query params, graph limit, entity merge, Ruby) with no conflicts; combined Python suite 636 passed, 33 skipped.
  • Not verified: against a live server. Behaviour change: RelationshipCreate.description is now a required-by-server string defaulting to "" instead of None.

Type of change

  • Bug fix

Checklist

The author checklist items from the template are left for the human submitter to tick.

CI note

Security Audit fails on edgequake-main itself (CI run 38326709329 at da1831c), and the Layer 1 — Static checksum guard job failed on the recently merged #446. Neither touches SDK code; I did not investigate them here.

POST /graph/relationships (CreateRelationshipRequest) requires `src_id`,
`tgt_id`, `keywords`, `description` and `source_id`, and answers with
`{status, message, relationship: {...}}` whose item uses `src_id`, `tgt_id` and
`relation_type`. The Python SDK sent `source`/`target`/`relationship_type`,
could omit `description` and `source_id`, and failed to validate the wrapped
response.

RelationshipCreate now serializes with server aliases (defaults: description "",
source_id "manual_entry"), Relationship accepts the server field names, and the
sync and async create unwrap the `relationship` envelope.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@rudycelekli
rudycelekli force-pushed the fix/python-relationship-create-contract-20261015 branch from 522e685 to dca9234 Compare October 15, 2026 06:37

This branch has not been deployed

No deployments
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.

1 participant