Skip to content

refactor: clean up accessor internals#27

Closed
Koan-Bot wants to merge 1 commit into
masterfrom
koan.atoomic/refactor-accessor-internals
Closed

refactor: clean up accessor internals#27
Koan-Bot wants to merge 1 commit into
masterfrom
koan.atoomic/refactor-accessor-internals

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented Apr 5, 2026

Copy link
Copy Markdown
Collaborator

What

Refactors three internal patterns in the accessor implementation — no behavior change.

Why

Addresses three open issues flagged during the last audit:

How

The hook dispatch loop now resolves the coderef first ($self->can → role chain fallback), then calls it once. This eliminates the duplicated rollback block and slightly simplifies the control flow. Same approach applied to the lazy builder resolution.

Testing

All 311 existing tests pass. No new tests needed — this is a pure refactor with identical behavior.

Closes #22, closes #25, closes #26.

🤖 Generated with Claude Code


Quality Report

Changes: 1 file changed, 23 insertions(+), 23 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

@atoomic atoomic marked this pull request as ready for review April 11, 2026 13:19
@atoomic

atoomic commented Apr 11, 2026

Copy link
Copy Markdown
Owner

@Koan-Bot rebase

… dispatch)

Three focused improvements to the accessor implementation:

1. Move `require mro` to module level — was called inside _all_attributes()
   on every new() invocation (closes #22)

2. Replace string eval with block eval for role require — the module name
   is already validated by regex, so eval { require $file } is safer and
   avoids potential edge cases with string eval (closes #25)

3. Unify hook resolution in setter and builder closures — the rollback
   logic for _after_* hooks was copy-pasted in two branches (class method
   vs role chain). Now resolves the hook coderef first, then calls it
   once with a single rollback path (closes #26)

No behavior change. All 311 existing tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Koan-Bot

Copy link
Copy Markdown
Collaborator Author

Rebase: refactor: clean up accessor internals

Branch koan.atoomic/refactor-accessor-internals rebased onto master and force-pushed.

Diff: 1 file changed, 23 insertions(+), 23 deletions(-)

Review feedback was analyzed and applied.

Actions

  • Already-solved check: negative (confidence=high, reasoning=None of the recent master commits address the three refactoring goals of this PR: hoisting `require )
  • Warning: pending (unsubmitted) review comments detected
  • Rebased koan.atoomic/refactor-accessor-internals onto origin/master
  • Pre-push CI check: previous run passed
  • Force-pushed koan.atoomic/refactor-accessor-internals to origin
  • CI check enqueued in ## CI (async)

CI

CI will be checked asynchronously.


Automated by Kōan

@Koan-Bot Koan-Bot force-pushed the koan.atoomic/refactor-accessor-internals branch from a80e837 to 615768f Compare April 11, 2026 15:07
@Koan-Bot

Koan-Bot commented May 2, 2026

Copy link
Copy Markdown
Collaborator Author

This PR now has merge conflicts after recent master changes (hook cache, hashref constructor, etc.). The refactoring scope has also been partially superseded by those incremental improvements. Happy to rebase if you still want this, or close it — your call.

@Koan-Bot

Koan-Bot commented May 3, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: superseded by PR #34 (covers #22 + #25 with tests) and master commit 6b8f5d7 (hook cache already solved #26 — rollback dedup). This PR also has merge conflicts. The cleaner path is merging #34 for the remaining items.

@Koan-Bot Koan-Bot closed this May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants