Repository navigation
Conversation
arieleven
reviewed
Dec 5, 2026
arieleven
left a comment
There was a problem hiding this comment.
Looks right to me. members is list[Allele | iriReference], so on main an already-inlined member hits object_store[str(allele)] and raises KeyError; resolving only GA4GH identifiers and passing the rest through fixes it, and the round-trip test covers both forms.
Two notes:
- This pairs with #699, which fixes the enref side of the same list branch. They touch neighbouring lines in
enderef.pyand both append to the end oftests/test_vrs.py, so they'll conflict trivially. Whichever lands second could add a mixed case: a block with one inlinedAlleleand one existingga4gh:VA...reference, enref'd then deref'd. - A pre-existing behaviour this extends to lists:
_derefworks in place on the objects it takes fromobject_store. Afterga4gh_deref, the store's member alleles are themselves dereffed and are the same objects as the returnedmembers, so mutating the result mutates the store. Probably fine for the in-memory dict use, butpydantic_copyon the looked-up object (or a note in the docstring) would avoid surprises. While there,_deref's docstring says it returns the id, but it returns the object.
This branch has not been deployed
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.
vrs_dereffails on any object whose referable attribute is a list, so aCisPhasedBlockcan't be round-tripped throughvrs_enref/vrs_deref:ga4gh_derefcopies the object first, which turns the member ids intoiriReferencemodels. The list branch then looks each one up withobject_store[str(curie)], andstr()of a pydanticRootModelis"root='ga4gh:VA...'", not the id. The single-value branch already unwraps withget_pydantic_root. The list branch also assumed every item was a reference, so a list of members that were already inlined raisedKeyErrortoo.The list branch now handles each item like the single-value branch does. A GA4GH identifier is unwrapped with
get_pydantic_rootand looked up in the store, and an inlined object is passed through as-is.CisPhasedBlock.members,Adjacency.adjoinedSequencesandDerivativeMolecule.componentsall go through this path.Tests
test_enref_deref_list_attributeintests/test_vrs.pyround-trips the existingcpb_431012block and checks that already-inlined members pass through. It fails onmainwith theKeyErrorabove and passes with this change.ruff checkandruff format --check(v0.9.4) are clean. The rest of the suite passes locally, except tests that need a local SeqRepo at/usr/local/share/seqrepo(test_dataproxy,test_vrs_normalize), which I don't have; this change doesn't touch them.