Skip to content

Add support for double star and glob patterns#145

Merged
rustatian merged 1 commit intoroadrunner-server:masterfrom
Nyholm:glob
Mar 12, 2026
Merged

Add support for double star and glob patterns#145
rustatian merged 1 commit intoroadrunner-server:masterfrom
Nyholm:glob

Conversation

@Nyholm
Copy link
Copy Markdown
Contributor

@Nyholm Nyholm commented Mar 12, 2026

Reason for This PR

This PR will fix roadrunner-server/roadrunner#2220. It extends the functionality added in #90.

Description of Changes

This allows us to use glob pattern to specify the path to the proto files. Valid examples are:

proto:
    - "src/Support/Contracts/**/*.proto"
    - "src/Support/Contracts/{*suffix.proto,*another.proto}"

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.

PR Checklist

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md: Add documentation for glob pattern docs#74
  • All added/changed functionality is tested.

Summary by CodeRabbit

  • New Features

    • Enhanced glob pattern matching to support brace expansion (e.g., {file1,file2}) and recursive directory patterns in configuration.
  • Tests

    • Added test coverage for complex glob pattern scenarios including nested paths and grouped pattern syntax.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

This PR enables advanced glob pattern support for proto file path configuration by replacing the standard filepath.Glob with doublestar.FilepathGlob. This allows recursive globstar (**) and brace expansion ({...}) patterns in proto path specifications. The changes include a new external dependency, updated pattern matching logic, and expanded test coverage.

Changes

Cohort / File(s) Summary
Core Glob Pattern Implementation
config.go
Replaces filepath.Glob with doublestar.FilepathGlob to support brace expansion and recursive patterns; adds pattern detection for braces ({) to determine which globber to use.
Dependencies
go.mod
Adds indirect dependency github.com/bmatcuk/doublestar/v4 v4.10.0 to enable advanced glob pattern matching.
Test Coverage
config_test.go, parser/test_nested/sub/deep.proto
Extends TestInitDefaults with test cases for recursive patterns (**/*.proto), brace expansion ({message,pong}.proto), and grouped patterns; adds nested test proto file for validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 With braces wide and stars that double,
Proto paths skip nested rubble!
A globstar hops through depths so deep,
While brace-bound patterns leap and leap!
Doublestar brings patterns true and bright! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: adding support for double-star (recursive) and glob patterns including brace expansion.
Linked Issues check ✅ Passed The code changes implement both requested features from issue #2220: recursive globstar patterns via doublestar.FilepathGlob and brace alternation support through pattern detection.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing glob pattern support. The addition of test cases, dependency, and test proto file are all necessary and in-scope for this feature.
Description check ✅ Passed The PR description follows the template structure with issue reference, clear description of changes with YAML examples, license acceptance, and completed checklist items.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
go.mod (1)

30-30: Promote doublestar/v4 to a direct requirement.

config.go imports this module directly, so keeping it marked // indirect will be rewritten by the next go mod tidy.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` at line 30, The go.mod entry for github.com/bmatcuk/doublestar/v4 is
marked "// indirect" but config.go imports it directly; update go.mod to make
doublestar a direct requirement by removing the "// indirect" marker (or run `go
get github.com/bmatcuk/doublestar/v4@v4.10.0`) so the module remains listed as a
direct dependency; check config.go to confirm the import usage after the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@parser/test_nested/sub/deep.proto`:
- Line 2: The proto package declaration "package deep;" in the file containing
the fixture under parser/test_nested/sub causes a PACKAGE_DIRECTORY_MATCH lint
failure; fix it by either updating the package declaration to match the
directory (e.g., change the package name from "deep" to the correct package for
parser.test_nested.sub) or move this proto file into a deep/ subdirectory so the
package "deep" and the file path align; locate the package line ("package
deep;") and apply the chosen fix consistently across imports and references.

---

Nitpick comments:
In `@go.mod`:
- Line 30: The go.mod entry for github.com/bmatcuk/doublestar/v4 is marked "//
indirect" but config.go imports it directly; update go.mod to make doublestar a
direct requirement by removing the "// indirect" marker (or run `go get
github.com/bmatcuk/doublestar/v4@v4.10.0`) so the module remains listed as a
direct dependency; check config.go to confirm the import usage after the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4aa000e7-7996-4ebd-a153-977588ead902

📥 Commits

Reviewing files that changed from the base of the PR and between ed78f96 and e5f1b58.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • config.go
  • config_test.go
  • go.mod
  • parser/test_nested/sub/deep.proto

Nyholm added a commit to Nyholm/roadrunner-server-docs that referenced this pull request Mar 12, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.31%. Comparing base (ed78f96) to head (e5f1b58).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
config.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #145   +/-   ##
=======================================
  Coverage   68.31%   68.31%           
=======================================
  Files           7        7           
  Lines         464      464           
=======================================
  Hits          317      317           
  Misses        113      113           
  Partials       34       34           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rustatian
Copy link
Copy Markdown
Member

lgtm, thank you @Nyholm 👍🏻

@rustatian rustatian merged commit 28dac0d into roadrunner-server:master Mar 12, 2026
10 of 11 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the grpc.proto configuration handling to support more expressive globbing—specifically recursive ** patterns and brace expansion—so users can specify proto file sets via glob patterns (fixing roadrunner-server/roadrunner#2220 and building on PR #90).

Changes:

  • Switch proto path expansion from filepath.Glob to doublestar.FilepathGlob to support ** and {...} patterns.
  • Add unit tests covering recursive ** and brace-expansion cases.
  • Add nested proto fixtures to validate recursive matching.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
config.go Uses doublestar.FilepathGlob and treats { as a glob indicator when expanding Config.Proto.
config_test.go Adds test coverage for **/*.proto recursion and {a,b} / {pattern1,pattern2} brace expansion.
parser/test_nested/sub/deep.proto Adds a deeper nested proto fixture for recursive glob tests.
go.mod Adds github.com/bmatcuk/doublestar/v4 (currently placed in the indirect section).
go.sum Adds checksums for github.com/bmatcuk/doublestar/v4.
go.work.sum Updates workspace checksums (likely from dependency resolution/build/test).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 29 to 31
github.com/beorn7/perks v1.0.1 // indirect
github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

github.com/bmatcuk/doublestar/v4 is imported from non-test code (config.go), so it should be a direct dependency in the main require block. Keeping it under the // indirect section can get reverted by go mod tidy and makes the dependency graph harder to reason about.

Copilot uses AI. Check for mistakes.
@Nyholm
Copy link
Copy Markdown
Contributor Author

Nyholm commented Mar 12, 2026

Lovely. Thank you for the merge.

Im not aware of the release schedule of this library. Can I ask for a release?

Should I make any changes to the PR for the docs? roadrunner-server/docs#74

@rustatian
Copy link
Copy Markdown
Member

Lovely. Thank you for the merge.

Im not aware of the release schedule of this library. Can I ask for a release?

Should I make any changes to the PR for the docs? roadrunner-server/docs#74

You're welcome 😃

Is this a feature that you're waiting for? Asking, because I'd prefer to release this in the upcoming (1-2 months) v3.0 (I'm returning to a semver). But if that feature is something that blocking you, I'd be happy to release it with 2025.1.9

Docs PR is good, thank you 👍🏻

@Nyholm
Copy link
Copy Markdown
Contributor Author

Nyholm commented Mar 12, 2026

Yes. This feature would help me a lot. I would love to have it as 2025.1.9.

<3

@rustatian
Copy link
Copy Markdown
Member

Sure, will be released this week then, thank you for the contribution 🙇🏻

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[💡 FEATURE REQUEST]: Recursive grpc.proto glob wildcards

3 participants