Skip to content

fix: remove_child stale handle, value() falsy setter, otraverse POD#6

Merged
toddr merged 1 commit intomainfrom
koan.toddr.bot/fix-remove-child-and-value-setter
Mar 22, 2026
Merged

fix: remove_child stale handle, value() falsy setter, otraverse POD#6
toddr merged 1 commit intomainfrom
koan.toddr.bot/fix-remove-child-and-value-setter

Conversation

@toddr-bot
Copy link
Collaborator

@toddr-bot toddr-bot commented Mar 22, 2026

What

Fixes three bugs in Tree::MultiNode: stale handle state after remove_child, inability to set value() to falsy values, and wrong POD heading for otraverse.

Why

  • remove_child() left curr_pos/curr_child pointing at stale or out-of-bounds data, causing unpredictable behavior on subsequent handle operations
  • Node::value() used defined $value while key() used @_ > 1 — asymmetric and prevented setting value to undef
  • otraverse POD was hidden under a duplicate traverse heading, making it undiscoverable

How

  • remove_child: reset curr_pos and curr_child to undef after splice (same pattern as up() and top())
  • value(): switched from defined $value to @_ > 1 argument detection, matching key()
  • Rewrote otraverse POD heading and description

Testing

  • Added t/03-bugfixes.t with 8 subtests covering all three fixes
  • Full suite passes: 131 tests + POD coverage

🤖 Generated with Claude Code


Quality Report

Changes: 4 files changed, 150 insertions(+), 15 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

… POD

Three bugs fixed:

1. Handle::remove_child() left curr_pos and curr_child pointing at stale
   data after removing a child node. Now resets both to undef.

2. Node::value() used `defined $value` which prevented setting a value
   to undef. Changed to `@_ > 1` to match key()'s pattern — any value
   including undef, 0, and "" can now be set.

3. The otraverse() method's POD heading incorrectly said "traverse"
   (duplicate of the real traverse heading). Fixed to "otraverse" with
   accurate documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@toddr toddr marked this pull request as ready for review March 22, 2026 17:12
@toddr toddr merged commit ca6b6f4 into main Mar 22, 2026
24 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.

2 participants