Commit dd546fc
Fix three bugs: pop() return type, fill() cursor reset, and comment errors
This commit addresses three bugs found in the circular buffer implementation:
1. Type Safety Bug - pop() return type (HIGH severity)
- Changed pop() return type from 'T | undefined' to 'T'
- The method never returns undefined; it either returns T or throws RangeError
- Previous type signature was misleading and could cause incorrect null checks
- Affects: src/ts/circular_buffer.ts:708
2. Consistency Bug - fill() missing cursor reset (MEDIUM severity)
- Added 'this._cursor = 0' to fill() method
- Now consistent with similar buffer-reorganizing methods (reverse, every, some)
- Previously left internal rotation state unnormalized after filling
- Affects: src/ts/circular_buffer.ts:501
3. Documentation Bug - copy-paste comment errors (LOW severity)
- Fixed comment in some() that incorrectly said "every can mutate"
- Fixed typo "_this.offset" → "this._offset"
- Comments were copied from every() method and not updated
- Affects: src/ts/circular_buffer.ts:611, 616
All tests pass (84/84) with 100% coverage maintained.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent d246f7f commit dd546fc
2 files changed
Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
| |||
607 | 608 | | |
608 | 609 | | |
609 | 610 | | |
610 | | - | |
| 611 | + | |
611 | 612 | | |
612 | 613 | | |
613 | 614 | | |
614 | 615 | | |
615 | | - | |
| 616 | + | |
616 | 617 | | |
617 | 618 | | |
618 | 619 | | |
| |||
705 | 706 | | |
706 | 707 | | |
707 | 708 | | |
708 | | - | |
| 709 | + | |
709 | 710 | | |
710 | 711 | | |
711 | 712 | | |
| |||
0 commit comments