Skip to content

Preserve edge and migration metadata when trimming - #3511

Merged
jeromekelleher merged 1 commit into
tskit-dev:mainfrom
rpinho:fix-trim-preserve-metadata
Nov 21, 2026
Merged

jeromekelleher merged 1 commit into
tskit-dev:mainfrom
rpinho:fix-trim-preserve-metadata

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

ltrim and trim discard metadata attached to edges and migrations. Add metadata to a tree sequence with recorded migrations, keep a region away from position zero and trim the result to reproduce the loss. Pass the metadata and offsets through the table updates that shift the coordinates. The test checks positions, metadata and offsets after both operations.

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 data-loss bug: ltrim/trim rebuild the edges and migrations tables with an explicit list of columns that was never updated when those tables gained metadata in 0.3.0, so all edge and migration metadata is silently dropped. I've confirmed the new test fails on main and passes with this change.

As with #3512 and #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 force-pushed the fix-trim-preserve-metadata branch from bd5be6c to 57f87e1 Compare November 19, 2026 13:21
@rpinho

rpinho commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I changed those.

@rpinho
rpinho force-pushed the fix-trim-preserve-metadata branch from 57f87e1 to c65a9f8 Compare November 20, 2026 17:53
@codecov

codecov Bot commented Nov 20, 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 (c65a9f8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3511   +/-   ##
=======================================
  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
Merged via the queue into tskit-dev:main with commit b44392a Nov 21, 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