You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add is_section_start support to Phrase class
Resolves Issue #47
Add support for the is_section_start attribute to enable phrase-based
section tracking, replacing the fragile index-based sectionStartsGrid
system. This architectural improvement ensures section markers move with
their phrases during insertions/deletions, eliminating section index
drift bugs.
## Changes:
### Phrase Class (phrase.py):
- Add 'is_section_start' to allowed parameters
- Initialize is_section_start attribute (optional boolean: True/False/None)
- Add type validation (must be boolean if provided)
- Include is_section_start in serialization (to_json)
### Piece Class (piece.py):
- Add migration logic to convert old sectionStartsGrid to phrase properties
- When loading old data, automatically sets is_section_start on phrases
- Maintains full backward compatibility with existing code
## Testing:
- 9 comprehensive test cases covering:
- Phrase initialization (True/False/None)
- Type validation
- Serialization round-trip
- Migration from old sectionStartsGrid format
- Multi-track pieces
- All 365 existing tests continue to pass
## Benefits:
- Section status is intrinsic to phrases, not external indices
- Eliminates section drift when phrases are added/removed
- Backward compatible with existing sectionStartsGrid data
- Matches TypeScript implementation in main IDTAP project
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments