Skip to content

Fbe.unmask_repos yields the same repository twice when an exact-name mask overlaps a wildcard mask #616

Description

@morphqdd

Fbe.unmask_repos (lib/fbe/unmask_repos.rb:71-104) builds the repos array by iterating every non-exclusion mask independently and appending matches, with no deduplication anywhere in the pipeline (not after the inclusion loop, not after the exclusion loop, not before the final repos.each/return).

What happens: when options.repositories contains an exact repo name and a wildcard mask that also matches that same repo — e.g. "yegor256/factbase,Yegor256/*" — the repo is appended once by the exact-name branch (repos << mask; next) and again by the wildcard branch (re.match? loop over organization_repositories), and both copies survive to the end.

Reproduced directly:

opts = Judges::Options.new({'testing' => true, 'repositories' => 'yegor256/factbase,Yegor256/*'})
list = Fbe.unmask_repos(options: opts, global: {}, loog: Loog::NULL)
# => ["yegor256/judges", "yegor256/factbase", "yegor256/factbase"]
list.size      # => 3
list.uniq.size # => 2

yegor256/factbase appears twice. Since the method's block form does repos.each { |repo| ...; yield(repo) }, a caller using overlapping masks gets the same repository yielded (and processed — extra API calls, extra judge-fact writes, etc.) twice per run for no legitimate reason.

What should happen: repos should contain each matching repository exactly once regardless of how many masks (exact or wildcard) happen to match it — e.g. repos.uniq! before the emptiness check / return.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions