Cover relationships(type, source) on entities - #54
Open
makegov-mark[bot] wants to merge 1 commit into
Open
Conversation
Tango API 4.20.0 adds two keys to each entry in the entity `relationships` expand — `type` (the stable relationship-type code) and `source` (where the tie came from) — and both are shape-selectable. The SDK's vendored contract predated them, so the shape overlay described the expand as `display_name` / `relation` / `uei` only. Re-vendored the contract and regenerated `tango/shapes/generated_overlay.py`. The only schema delta is the two new leaves on `RELATIONSHIPS_SCHEMA`; the generator produced no other changes across the other 30 containers. Also records the upstream `relation` vocabulary change in the changelog. That needs no SDK code change — `relation` was and remains a `str` — but application code branching on the string `affiliate` should move to `type`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Covers the two new keys on the entity
relationshipsexpand introduced in Tango API 4.20.0:type(the stable relationship-type code) andsource(where the tie came from). Both are shape-selectable, soshape="uei,relationships(type,source,uei)"now resolves against the SDK's schema.Why
The SDK's vendored contract predated the API change, so
RELATIONSHIPS_SCHEMAdescribed the expand asdisplay_name/relation/ueionly. Left alone, this is exactly the drift the reverse shape-coverage gate exists to catch — the API returns fields the SDK's typed shape API doesn't know about.Changes
Two generated artifacts and a changelog entry. No hand-written code.
contracts/filter_shape_contract.json— re-vendored viascripts/refresh_contract.py. The diff is 5 lines:relationships.sourceandrelationships.typein the entities shape tree and flat-path list, plus ameta.api_versionkey (4.20.0) that the upstream contract now stamps and the vendored copy didn't previously carry.tango/shapes/generated_overlay.py— regenerated viascripts/generate_shape_overlay.py. The only delta is the two new leaves onRELATIONSHIPS_SCHEMA; the generator produced no other changes across the other 30 containers, which is the signal that the contract refresh was scoped to this one change.CHANGELOG.md— Added for the two keys; Changed for the upstreamrelationvocabulary shift.The
relationchange needs no SDK code change, but read thisUpstream,
relationstopped collapsing toaffiliatefor subcontracting and corporate-succession ties. It now names the partner's role:subcontractor/prime,predecessor/successor, anddescendant(rather thanchild) on the far side of an ultimate-parent tie.affiliatesurvives only as a fallback for a type the API doesn't recognize. This affects the large majority of relationship entries.Nothing breaks at the SDK's type layer —
relationwas and remains astr. But application code branching on the literalaffiliateshould move totype, which is stable. The full vocabulary table is in the entities data dictionary.Testing
scripts/check_shape_coverage.pyscripts/check_filter_shape_conformance.pyruff format --check tango/ruff check tango/mypy tango/pytestThe one failure is a live-API 504, not a regression.
tests/production/test_production_smoke.py::TestProductionSmoke::test_search_filtersfails withAPI request failed with status 504. It's marked@pytest.mark.production/@pytest.mark.liveand hits the production API directly. Verified it fails identically on cleanorigin/mainwith these changes stashed, and it reproduces consistently rather than intermittently — so it's a live-API condition worth looking at separately, unrelated to this diff (which touches a vendored JSON and a generated schema, neither of which is on the path of an HTTP search request).Note on
observed_shape_types.jsonNot refreshed, deliberately. That file is derived by sampling the live API (
scripts/probe_shape_types.py, maintainer-run, needs an API key), and the API change isn't deployed yet — probing now would re-record the old shape. The overlay generator therefore had no observation for the two new fields and defaulted both tostr, which is correct for a type code and a source label. A maintainer probe after the deploy will confirm rather than change them.