Skip to content

fix(tree): only increment size on insert, not update#100

Merged
tigerwill90 merged 1 commit into
masterfrom
fix/tree-update-size
May 3, 2026
Merged

fix(tree): only increment size on insert, not update#100
tigerwill90 merged 1 commit into
masterfrom
fix/tree-update-size

Conversation

@tigerwill90
Copy link
Copy Markdown
Collaborator

@tigerwill90 tigerwill90 commented May 2, 2026

An embarrassing bug...

The insert function in tree.go was incrementing t.size unconditionally after a successful write, so every Update call inflated Len() even though no new route was added (the methods map increment was correctly gated on modeInsert, but t.size++ was not). This fix moves t.size++ inside the modeInsert guard so Update no longer drifts the route count.

@tigerwill90 tigerwill90 requested a review from pawndev May 2, 2026 14:15
@tigerwill90 tigerwill90 self-assigned this May 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tigerwill90 tigerwill90 merged commit e5e0a48 into master May 3, 2026
4 checks passed
@tigerwill90 tigerwill90 deleted the fix/tree-update-size branch May 3, 2026 10:22
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.

2 participants