Skip to content

feat: improve maintainers detection [CM-1033]#3908

Draft
mbani01 wants to merge 9 commits intomainfrom
feat/improve_maintainer_file_detection
Draft

feat: improve maintainers detection [CM-1033]#3908
mbani01 wants to merge 9 commits intomainfrom
feat/improve_maintainer_file_detection

Conversation

@mbani01
Copy link
Contributor

@mbani01 mbani01 commented Mar 10, 2026

This pull request significantly improves the maintainer file detection and analysis logic for the git integration service. The main enhancements include a more robust and flexible approach to identifying maintainer-related files using both static lists and dynamic content-based search (via ripgrep), as well as improved handling and reporting of candidate files and AI-suggested files. Additionally, the changes introduce better error handling and metadata tracking throughout the maintainer extraction process.

Maintainer file detection and analysis improvements:

  • Added dynamic maintainer file discovery using ripgrep to search for maintainer-related keywords across the repository, with fallback to os.walk if ripgrep fails. This enables more accurate and comprehensive detection of potential maintainer files.
  • Expanded and refined the static list of possible maintainer file names and valid file extensions, and introduced content validation keywords and exclusion rules to improve candidate file filtering.
  • Implemented a new extraction flow that prioritizes previously saved maintainer files, then tries static and dynamic candidates, and finally falls back to AI-based file detection as a last resort. The process now tracks and returns candidate files and AI-suggested files as metadata. [1] [2]

Metadata and reporting enhancements:

  • Updated the MaintainerResult model to include candidate_files and ai_suggested_file fields, allowing downstream consumers to see which files were considered and which file was suggested by AI.
  • Extended the maintainer processing pipeline to record and report candidate files and AI-suggested files in service execution logs and results. [1] [2] [3]

Dependency and utility updates:

  • Added the ripgrep tool to the Docker image to support fast and efficient content-based file search.
  • Updated imports and utility usage to support the new shell command execution and error handling required by the ripgrep-based search. [1] [2]

These changes collectively make maintainer detection more reliable, transparent, and extensible, while also improving observability for debugging and future enhancements.


Note

Medium Risk
Modifies the maintainer detection/analysis flow and introduces repo-wide rg searches plus new fallback paths, which could affect accuracy, performance, and execution behavior across many repos.

Overview
Improves maintainer extraction by prioritizing the previously saved maintainer file, then scanning the repo for likely governance files (expanded static filename list + ripgrep keyword search with filtering/scoring), and only falling back to AI filename selection as a last resort.

Adds observability by returning/storing candidate_files and ai_suggested_file on MaintainerResult and persisting them in ServiceExecution.metrics, and updates the git-integration Docker runner image to include ripgrep.

Written by Cursor Bugbot for commit cc717d8. This will update automatically on new commits. Configure here.

@mbani01 mbani01 self-assigned this Mar 10, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 15:41
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

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 improves maintainer file detection in the git integration service by adding a multi-step discovery and analysis flow that combines static filename matching, dynamic ripgrep-based content search, and an AI fallback, while also surfacing more metadata about what was tried.

Changes:

  • Added ripgrep-based repo scanning (rg --files and keyword search) with fallback to os.walk, plus scoring/filtering of dynamic candidates.
  • Refactored maintainer extraction to prioritize a previously saved maintainer file, then analyze top candidates, then use AI file suggestion as a last resort.
  • Extended MaintainerResult and service execution metrics to include candidate_files and ai_suggested_file; added ripgrep to the Docker image.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
services/apps/git_integration/src/crowdgit/services/maintainer/maintainer_service.py New candidate discovery + fallback extraction flow; logs and metrics now include candidate/AI-suggested file metadata.
services/apps/git_integration/src/crowdgit/models/maintainer_info.py Adds new result metadata fields (candidate_files, ai_suggested_file).
scripts/services/docker/Dockerfile.git_integration Installs ripgrep in the runner image to support dynamic search.

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

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@mbani01 mbani01 requested a review from joanagmaia March 10, 2026 16:42
@mbani01 mbani01 marked this pull request as draft March 10, 2026 17:54
mbani01 added 9 commits March 11, 2026 14:05
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
… detection

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
…rd in content

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
@mbani01 mbani01 force-pushed the feat/improve_maintainer_file_detection branch from bc8e3df to b4dd488 Compare March 11, 2026 14:05
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.

3 participants