Skip to content

Use the converted site mask when validating VCF positions - #3512

Merged
jeromekelleher merged 1 commit into
tskit-dev:mainfrom
rpinho:fix-vcf-site-mask
Nov 22, 2026
Merged

jeromekelleher merged 1 commit into
tskit-dev:mainfrom
rpinho:fix-vcf-site-mask

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Passing a list as site_mask to write_vcf raises TypeError during the position check. An integer mask array can also allow a record at position zero through that check. Validate positions with the same Boolean mask used to write the records. The tests cover masks that omit position zero and an integer mask that leaves it in the output.

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

rpinho added a commit to rpinho/tskit that referenced this pull request Nov 18, 2026

@jeromekelleher-bot jeromekelleher-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rpinho, this is a real bug: site_mask is documented as accepting anything convertible to a boolean array, but since the zero-position check was added (0.6.0) it has used the unconverted argument. So any list mask raises a TypeError, and an integer mask gets interpreted as negative indexes, which can let a position-0 record through without the error. I've confirmed both on main, and the fix and tests look good.

As with #3514, a few small things before we merge:

  • Could you add :user:`rpinho` to the changelog entry?
  • Please squash the two commits into one.
  • Please remove the Co-Authored-By: Claude ... and Claude-Session: ... lines from the commit message.

Otherwise LGTM.

@rpinho

rpinho commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I changed those.

@jeromekelleher

Copy link
Copy Markdown
Member

Changelog needs conflict resolution

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (c91ca20) to head (7d3c58f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3512   +/-   ##
=======================================
  Coverage   91.72%   91.72%           
=======================================
  Files          37       37           
  Lines       30839    30839           
  Branches     4921     4921           
=======================================
  Hits        28286    28286           
  Misses       2223     2223           
  Partials      330      330           
Flag Coverage Δ
C 82.32% <ø> (ø)
c-python 77.05% <ø> (ø)
python-tests 96.44% <ø> (ø)
python-tests-no-jit 33.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Python API 98.73% <ø> (ø)
Python C interface 91.21% <ø> (ø)
C library 91.27% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeromekelleher
jeromekelleher added this pull request to the merge queue Nov 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 21, 2026
@jeromekelleher
jeromekelleher added this pull request to the merge queue Nov 22, 2026
Merged via the queue into tskit-dev:main with commit 9c21a80 Nov 22, 2026
17 checks passed
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.

3 participants