Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

additional_file_patterns no longer matches files outside empty root_dir

Open Beginner friendly
#406 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Shaisolaris is already working on this.

Since Oct 13, 2026.

  • #407 by @Shaisolaris — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rails, ruby
Domain
backend

Research direction

Start with related_files_list_builder.rb and inspect related_files_for_pattern and its owning_root_dir filter, which the issue identifies as dropping files outside configured packs. Reproduce with the given additional_file_patterns and root_dir configuration, then check that app/serializers/address.rb is annotated while existing behavior for files inside packs still works.

Written by the indexing model from the issue text.

Description

bug

Since 4.25.0, additional_file_patterns silently returns nothing when the target file isn't inside one of the configured root_dirs. 4.24.0 and earlier work.

Steps to reproduce the problem

In a Rails app using packwerk.

packs/core/app/models/address.rb defines Address. app/serializers/address.rb exists at the app root, outside any pack.

Cause: related_files_for_pattern in related_files_list_builder.rb now has:

.select { |f| owning_root_dir(f) == model_root_dir }

owning_root_dir rejects empty root_dir entries, so a file outside every pack returns nil. The model's owner is packs/core, and "packs/core" != nil, so the file is dropped. The glob itself finds the file. Only this filter removes it.

Expected behavior

app/serializers/address.rb is annotated, as in 4.24.0.

Actual behavior

app/serializers/address.rb is ignored.

Your .annotaterb.yml configuration

:additional_file_patterns:
  - app/serializers/%MODEL_NAME%.rb
:model_dir:
  - packs/core/app/models
:root_dir:
  - ""
  - packs/core
  - packs/pack1

Environment

  • AnnotateRb version: 4.25.0
  • Ruby version: 4.0.7
  • Ruby on Rails version: 8.1.4
  • Database adapter (e.g., sqlite3, pg, mysql2): pg
  • Database adapter version: 1.6.3
Dominant language
Ruby
Stars
624
Forks
95
Avg merge
1d 21h
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from drwl/annotaterb

All issues in drwl/annotaterb

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.