Skip to content

#474: anchor repository mask regex#483

Open
akmhatey-ai wants to merge 1 commit into
zerocracy:masterfrom
akmhatey-ai:codex/anchor-mask-regex-474
Open

#474: anchor repository mask regex#483
akmhatey-ai wants to merge 1 commit into
zerocracy:masterfrom
akmhatey-ai:codex/anchor-mask-regex-474

Conversation

@akmhatey-ai

Copy link
Copy Markdown
Contributor

Fixes #474.

What changed:

  • Anchor Fbe.mask_to_regex with \A and \z so masks must match the complete org/repo full name.
  • Add regression coverage for an exact mask not matching prefix-collision repositories.
  • Keep wildcard masks working for normal repository-name suffixes.

Validation:

  • Red before implementation: bundle exec ruby test\fbe\test_unmask_repos.rb -- --no-cov failed on the new prefix-collision assertions.
  • Green after implementation: bundle exec ruby test\fbe\test_unmask_repos.rb -- --no-cov passed: 7 tests, 18 assertions, 0 failures, 0 errors, 1 skipped.
  • bundle exec rubocop lib\fbe\unmask_repos.rb test\fbe\test_unmask_repos.rb passed with no offenses.
  • ruby -c lib\fbe\unmask_repos.rb and ruby -c test\fbe\test_unmask_repos.rb passed.
  • git diff --check passed.
  • git diff -- lib\fbe\unmask_repos.rb test\fbe\test_unmask_repos.rb | gitleaks stdin --no-banner --redact reported no leaks.

Limitation:

  • bundle exec rake test is locally blocked on this Windows setup before reaching this patch area because typhoeus/ethon cannot load libcurl while loading unrelated test_enter.rb. I did not change that path.

@GHX5T-SOL GHX5T-SOL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the mask anchoring change for #474. Anchoring Fbe.mask_to_regex with \A/\z fixes prefix-collision rejects while preserving wildcard suffix matching.

Validation:

  • env BUNDLE_PATH=/private/tmp/bundle-fbe-488 mise x ruby@3.3.11 -- bundle check -> dependencies satisfied
  • env BUNDLE_PATH=/private/tmp/bundle-fbe-488 mise x ruby@3.3.11 -- bundle exec ruby -Itest test/fbe/test_unmask_repos.rb -- --no-cov -> 7 tests, 18 assertions, 0 failures, 0 errors, 1 skip
  • env BUNDLE_PATH=/private/tmp/bundle-fbe-488 mise x ruby@3.3.11 -- bundle exec rake test -> 285 tests, 812 assertions, 0 failures, 0 errors, 9 skips
  • env BUNDLE_PATH=/private/tmp/bundle-fbe-488 mise x ruby@3.3.11 -- bundle exec rubocop lib/fbe/unmask_repos.rb test/fbe/test_unmask_repos.rb --format simple -> 2 files inspected, no offenses
  • ruby -c lib/fbe/unmask_repos.rb and ruby -c test/fbe/test_unmask_repos.rb -> Syntax OK
  • git diff --check origin/master...HEAD -> passed
  • git diff origin/master...HEAD | gitleaks stdin --no-banner --redact --exit-code 1 -> no leaks found

Live pre-review state: open, non-draft, mergeable/CLEAN, all GitHub checks green, no existing comments/reviews. Same-scope open PR search for #474 returned only this PR.

@0crat

0crat commented May 26, 2026

Copy link
Copy Markdown

@GHX5T-SOL Great work on the review! 🎉 You've earned +6 points (+18 base, -8 for missing comments, -4 for low code coverage with 19 hits). Your total score is now +162 - keep up the momentum and check your Zerocracy account for updates!

@yegor256

Copy link
Copy Markdown
Member

@akmhatey-ai merge conflicts here

@yegor256

Copy link
Copy Markdown
Member

Please fix the merge conflicts so this pull request can be merged.

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.

Fbe.mask_to_regex returns unanchored pattern, over-rejecting repositories on prefix collisions

4 participants