Skip to content

fix: treat a 0 bound as set in the Adjacency adjoinedSequences validator - #701

Open
syahra712 wants to merge 1 commit into
ga4gh:mainfrom
syahra712:fix/adjacency-zero-bound
Open

syahra712 wants to merge 1 commit into
ga4gh:mainfrom
syahra712:fix/adjacency-zero-bound

Conversation

@syahra712

Copy link
Copy Markdown
Contributor

Adjacency rejects an adjoined SequenceLocation that has both start and end, but the check uses truthiness, so a bound of 0 counts as missing:

from ga4gh.vrs import models

models.Adjacency(adjoinedSequences=[
    models.SequenceLocation(start=1),
    models.SequenceLocation(start=1, end=2),   # rejected, as intended
])
models.Adjacency(adjoinedSequences=[
    models.SequenceLocation(start=1),
    models.SequenceLocation(start=0, end=2),   # accepted
])

start=0 is a valid position (the minimum allowed by SequenceLocation), so a location starting at the beginning of a sequence, or ending at 0, gets past the validator. The check now uses is not None for both bounds. This is the same kind of 0-is-falsy problem as #688 in normalize.

Tests

test_adjacency in tests/validation/test_models.py now also checks (start, end) of (0, 2), (1, 0) and (0, 0). They fail on main (no ValueError raised) and pass with this change; the existing valid cases still pass. ruff check and ruff 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).

@syahra712
syahra712 requested review from a team as code owners November 12, 2026 17:02

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