Commit 7e12451
Fix py/id resolution bug in SLP skeleton decoder (#257)
* Add failing test for SLP edge type py/id resolution bug
Add test_slp_decoder_edge_type_pyid_resolution to catch a bug where
py/id references in edge types are treated as direct edge type values
instead of references to previously defined edge types.
The bug causes edges and symmetries to be swapped when a symmetry edge
(EdgeType=2) is defined before a regular edge (EdgeType=1) in the
metadata.
Test uses exact metadata from a real .slp file and currently fails as
expected. The fix will be applied to SkeletonSLPDecoder.decode() in
sleap_io/io/skeleton.py.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix py/id resolution bug in SLP skeleton decoder
Fix bug in SkeletonSLPDecoder where py/id references in edge types were
treated as direct edge type values instead of references to previously
defined edge types.
The bug caused edges and symmetries to be swapped when a symmetry edge
(EdgeType=2) was defined before a regular edge (EdgeType=1), because:
- First py/reduce creates EdgeType(2) and gets py/id=1
- Second py/reduce creates EdgeType(1) and gets py/id=2
- Old code: py/id=1 was treated as EdgeType(1) (wrong!)
- Fixed code: py/id=1 correctly resolves to EdgeType(2)
Implementation uses single-pass processing that builds the py/id mapping
as links are processed, then looks up references. Falls back to treating
py/id as direct edge type value for files without py/reduce definitions
(maintains backward compatibility).
Fixes test_slp_decoder_edge_type_pyid_resolution and resolves issues
with real .slp files that have non-standard edge type ordering.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Apply ruff formatting
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove unreachable edge case
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6ba4849 commit 7e12451
2 files changed
Lines changed: 125 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
603 | 609 | | |
| 610 | + | |
604 | 611 | | |
605 | 612 | | |
| 613 | + | |
606 | 614 | | |
607 | | - | |
608 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
609 | 623 | | |
610 | 624 | | |
611 | 625 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1558 | 1558 | | |
1559 | 1559 | | |
1560 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
0 commit comments