Skip to content

Fix bugs from code review, add CI and __all__#4

Merged
royerloic merged 1 commit into
mainfrom
fix/code-review-bugs
Feb 22, 2026
Merged

Fix bugs from code review, add CI and __all__#4
royerloic merged 1 commit into
mainfrom
fix/code-review-bugs

Conversation

@royerloic

Copy link
Copy Markdown
Member

Summary

  • Fix end parameter double-application in aprint — e.g. aprint('hi', end='!!') produced hi!!!! instead of hi!!. Was masked for the default end='\n' because split('\n') consumed the trailing newline.
  • Fix KeyboardInterrupt/SystemExit leaking _depth — changed except Exception to except BaseException in asection so Ctrl-C no longer permanently corrupts the depth counter.
  • Fix silent drop of elapsed time >= 24 hours — added else clause to _print_elapsed formatting as days.
  • Fix section decorator losing function metadata — added @functools.wraps.
  • Fix flush parameter silently ignored in tree mode — plumbed through native_print.
  • Fix set_log_max_depth docstring — said "clamped to minimum of 1" but actually clamps to 0.
  • Fix Makefile publish grep prefix-matching2026.2.2 no longer falsely matches 2026.2.22.
  • Add __all__ to __init__.py for explicit public API.
  • Add CI test workflow (test.yml) — pytest across Python 3.9–3.13 + ruff lint/format check on push/PR.
  • Add test gate to publish.yml — build now requires tests to pass before publishing.

Test plan

  • All 42 existing tests pass
  • Ruff lint: all checks passed
  • Ruff format: 6 files already formatted
  • Demo runs correctly end-to-end
  • Edge case battery: KeyboardInterrupt, SystemExit, custom end/sep/flush, __all__, Makefile grep compatibility
  • CI workflows run on this PR (test.yml)

🤖 Generated with Claude Code

Bug fixes in arbol.py:
- Fix end parameter double-application in aprint (e.g. end='!!' produced '!!!!')
- Fix KeyboardInterrupt/SystemExit leaking _depth (except Exception -> BaseException)
- Fix elapsed time silent drop for durations >= 24 hours (added days case)
- Fix section decorator losing function metadata (added functools.wraps)
- Fix flush parameter silently ignored in tree mode (plumbed through native_print)
- Fix set_log_max_depth docstring inaccuracy ("clamped to minimum of 1")
- Fix Makefile publish grep prefix-matching edge case (anchor with $)

Additions:
- Add __all__ to __init__.py for explicit public API
- Add .github/workflows/test.yml (pytest across Python 3.9-3.13 + ruff lint)
- Add test gate in publish.yml (build now requires tests to pass)

Housekeeping:
- Fix stale test comments in test_arbol.py
- Update CLAUDE.md line count (285 -> 390)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@royerloic royerloic merged commit f6cd162 into main Feb 22, 2026
6 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.

1 participant