Skip to content

Comments

fix: use keys when grepping %files_being_mocked in dir()#192

Merged
toddr merged 2 commits intocpanel:masterfrom
atoomic:koan.atoomic/fix-dir-grep-hash
Feb 12, 2026
Merged

fix: use keys when grepping %files_being_mocked in dir()#192
toddr merged 2 commits intocpanel:masterfrom
atoomic:koan.atoomic/fix-dir-grep-hash

Conversation

@Koan-Bot
Copy link
Contributor

Summary

  • Fix grep on %files_being_mocked hash in dir() to iterate only keys
  • Without keys, grep sees both keys (paths) AND values (weakrefs to blessed hashrefs)
  • Stringified mock objects could accidentally match the path regex

Test plan

  • Verify dir() correctly detects mocked directory contents
  • CI passes on Perl 5.14–5.40

Split from #189 per maintainer request.
🤖 Generated with Claude Code

grep on a hash iterates both keys AND values. Since values are
weakrefs to blessed hashrefs, their stringified form could
accidentally match the path regex. Using 'keys' ensures only
file paths are matched.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atoomic atoomic marked this pull request as ready for review February 11, 2026 04:06
@toddr
Copy link
Member

toddr commented Feb 11, 2026

I’m disturbed we didn’t find this bug. Could I have a unit test please? That fails if we don’t have this fix

@Koan-Bot
Copy link
Contributor Author

Rebase: fix: use keys when grepping %files_being_mocked in dir()

Branch koan.atoomic/fix-dir-grep-hash has been rebased onto master and force-pushed.

Actions

  • Read PR comments and review feedback
  • Rebased koan.atoomic/fix-dir-grep-hash onto origin/master
  • Applied review feedback
  • Force-pushed koan.atoomic/fix-dir-grep-hash

Automated by Kōan

@toddr toddr merged commit d4c0f32 into cpanel:master Feb 12, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants