Skip to content

feat(git-integration): track re-onboarding counts and unreachable commits [CM-815]#3679

Merged
mbani01 merged 2 commits intomainfrom
feat/keep_track_of_git_repos_reonboarding_count
Dec 8, 2025
Merged

feat(git-integration): track re-onboarding counts and unreachable commits [CM-815]#3679
mbani01 merged 2 commits intomainfrom
feat/keep_track_of_git_repos_reonboarding_count

Conversation

@mbani01
Copy link
Copy Markdown
Contributor

@mbani01 mbani01 commented Dec 8, 2025

This pull request introduces a new mechanism to track how many times a git repository has been re-onboarded, which helps in identifying unreachable commits by associating activities with specific onboarding cycles. The changes span database schema, models, CRUD operations, commit processing logic, and worker routines to ensure this new field is consistently updated and utilized throughout the system.

Database and Model Updates:

  • Added a new reOnboardingCount column to the git.repositories table and updated related SQL queries and comments for tracking re-onboarding events.
  • Updated the Repository model and its mapping logic to include the new re_onboarding_count field, ensuring it is available in application code. [1] [2]

CRUD and Worker Logic:

  • Modified repository CRUD queries to select and return the new reOnboardingCount field, and added an increase_re_onboarding_count function to increment this value whenever a repository is re-onboarded. [1] [2] [3] [4] [5] [6]
  • Updated the repository worker to call the increment function during re-onboarding, ensuring the count is maintained accurately.

Commit Processing Enhancements:

  • Updated commit activity creation logic to accept and propagate re_onboarding_count, setting the activity.attributes.cycle field to onboarding-{reOnboardingCount} for re-onboarded commits. This helps in distinguishing activities from different onboarding cycles. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

@mbani01 mbani01 requested review from Copilot and themarolt December 8, 2025 10:56
@mbani01 mbani01 self-assigned this Dec 8, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 8, 2025

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@mbani01 mbani01 changed the title feat(git-integration): track re-onboarding counts and unreachable commits feat(git-integration): track re-onboarding counts and unreachable commits [CM-815] Dec 8, 2025
Copy link
Copy Markdown
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 introduces a re-onboarding counter mechanism to track how many times a repository has been re-onboarded, enabling the identification of unreachable commits through activity cycle tagging.

Key Changes

  • Added reOnboardingCount database column with default value of 0 to track re-onboarding events
  • Enhanced activity processing to tag commits from re-onboarding cycles with activity.attributes.cycle pattern
  • Implemented automatic counter increment when repositories require re-onboarding

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
backend/src/database/migrations/V1765185575__addReOnboardingCountToGitRepos.sql Adds reOnboardingCount INTEGER column with default 0 to git.repositories table
backend/src/database/migrations/U1765185575__addReOnboardingCountToGitRepos.sql Undo migration file for reverting the schema change (currently empty - needs implementation)
services/apps/git_integration/src/crowdgit/models/repository.py Adds re_onboarding_count field to Repository model and maps database field to Python field
services/apps/git_integration/src/crowdgit/database/crud.py Updates SELECT queries to include reOnboardingCount, adds increase_re_onboarding_count function
services/apps/git_integration/src/crowdgit/worker/repository_worker.py Calls increase_re_onboarding_count when re-onboarding is required
services/apps/git_integration/src/crowdgit/services/commit/commit_service.py Propagates re_onboarding_count through activity creation, sets cycle attribute when count > 0

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

description="Indicates if the stuck repository is resolved by a re-onboarding",
)
re_onboarding_count: int = Field(
...,
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The re_onboarding_count field is marked as required (...) but should have a default value of 0 to be consistent with the database schema. This will cause issues when creating Repository instances without providing this value. Change to:

re_onboarding_count: int = Field(
    default=0,
    description="Tracks the number of times this repository has been re-onboarded. Used to identify unreachable commits via activity.attributes.cycle matching pattern onboarding-{reOnboardingCount}",
)
Suggested change
...,
default=0,

Copilot uses AI. Check for mistakes.
return str(result)


async def increase_re_onboarding_count(repo_id: str):
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The increase_re_onboarding_count function is missing a docstring. Following the pattern of other functions in this file, it should include a docstring that describes its purpose. For example:

async def increase_re_onboarding_count(repo_id: str):
    """
    Increment the re-onboarding count for a repository.
    
    This is called when a repository requires re-onboarding, typically
    when commits become unreachable and need to be reprocessed.
    """
Suggested change
async def increase_re_onboarding_count(repo_id: str):
async def increase_re_onboarding_count(repo_id: str):
"""
Increment the re-onboarding count for a repository.
This is called when a repository requires re-onboarding, typically
when commits become unreachable and need to be reprocessed.
"""

Copilot uses AI. Check for mistakes.
@mbani01 mbani01 merged commit 05df663 into main Dec 8, 2025
21 checks passed
@mbani01 mbani01 deleted the feat/keep_track_of_git_repos_reonboarding_count branch December 8, 2025 12:55
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