Skip to content

feat: implement basic commit classification system and tracking tab#266

Open
ABHImaybeJEET wants to merge 2 commits into
GitMetricsLab:mainfrom
ABHImaybeJEET:main
Open

feat: implement basic commit classification system and tracking tab#266
ABHImaybeJEET wants to merge 2 commits into
GitMetricsLab:mainfrom
ABHImaybeJEET:main

Conversation

@ABHImaybeJEET
Copy link
Copy Markdown

@ABHImaybeJEET ABHImaybeJEET commented May 15, 2026

Related Issue

Closes #<264>

Issue was raised by me .

Description

This PR introduces an initial Commit Classification System to reduce noise in the tracker and better highlight meaningful contributions over minor updates such as typo fixes or dependency bumps.

Key Changes

Commit Classification Utility

Added a commitClassifier utility to:

  • Categorize commits (Feature, Bug Fix, Docs, Refactor, etc.)
  • Assign importance levels (High, Medium, Low)
  • Classify commits using keywords and basic impact heuristics

GitHub API Integration

Updated useGitHubData to:

  • Fetch commit history from the GitHub API
  • Process and classify commits before rendering

UI Improvements

Added a new Commits tab in the Tracker dashboard featuring:

  • Color-coded importance badges
  • Commit category labels
  • Filtering by importance level

Future Scope

This rules-based implementation can later be extended with:

  • AI-based intent recognition
  • Semantic commit analysis
  • Diff-aware impact scoring

Testing

  • Verified commit fetching across multiple GitHub accounts
  • Confirmed accurate commit categorization and importance scoring
  • Tested filtering for High, Medium, and Low importance commits
  • Ensured existing Issues and PRs tabs remain unaffected

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Breaking change
  • Code style update
Screenshot 2026-05-15 234740 Screenshot 2026-05-15 234837 Screenshot 2026-05-15 234740

Summary by CodeRabbit

  • New Features

    • Commits added to the tracker with a dedicated Commits tab.
    • Commits are auto-classified by importance (High/Medium/Low/Unknown) and category (Feature, Bugfix, Refactor, Chore, Docs, Test) with visible importance badges.
    • Table shows "Title / Message" and "Status / Importance"; commit messages used as link text and a commit icon marks commit rows.
    • Search and filter support extended to commit messages and importance.
  • Bug Fixes

    • Dates now display "N/A" for missing or invalid values.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit f5e292a
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a0845cb170f670008c333fa
😎 Deploy Preview https://deploy-preview-266--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d587c5bf-6f15-4641-a144-8e9ffa3360b0

📥 Commits

Reviewing files that changed from the base of the PR and between 0c81fda and f5e292a.

📒 Files selected for processing (3)
  • src/hooks/useGitHubData.ts
  • src/pages/Tracker/Tracker.tsx
  • src/utils/commitClassifier.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/utils/commitClassifier.ts
  • src/hooks/useGitHubData.ts
  • src/pages/Tracker/Tracker.tsx

📝 Walkthrough

Walkthrough

The PR adds commit tracking: a commit classifier, hook enhancements to fetch and classify commits, and Tracker UI updates to display commits in a new tab with importance-based filtering and updated table rendering.

Changes

Commit Tracking Feature

Layer / File(s) Summary
Commit Classification Utility
src/utils/commitClassifier.ts
New module exports CommitImportance, CommitCategory, and ClassifiedCommit types, plus classifyCommit() that detects category via keyword regex, computes a score from metrics and modifiers, and returns importance/category/score.
Hook Enhancement for Commits
src/hooks/useGitHubData.ts
Imports classifyCommit, adds commits and totalCommits state, implements fetchCommitsPaginated calling /search/commits (preview header), enriches each commit with classifiedInfo, and updates fetchData to fetch commits concurrently with issues/PRs.
Tracker Data Model and Filtering
src/pages/Tracker/Tracker.tsx
Extends GitHubItem with optional commit, repository.html_url, and classifiedInfo; adds commitFilter; expands filterData to search commit.message, filter by classifiedInfo.importance, match repository.html_url fallback, and return "N/A" for invalid/missing dates.
Tracker Tabbed Interface and Rendering
src/pages/Tracker/Tracker.tsx
Adds a Commits tab, routes the Select handler per active tab, shows importance options for commits, updates headers to Title / Message and Status / Importance, uses commit message first line as link text, optionally displays classifiedInfo.category pill, derives repo name from URL, and renders an importance badge for commits.

Sequence Diagram(s)

sequenceDiagram
  participant useGitHubData
  participant PromiseAll
  participant fetchIssues
  participant fetchPRs
  participant fetchCommits
  participant classifyCommit
  useGitHubData->>PromiseAll: call fetchData()
  PromiseAll->>fetchIssues: fetch issues
  PromiseAll->>fetchPRs: fetch PRs
  PromiseAll->>fetchCommits: fetch commits (/search/commits)
  fetchCommits->>classifyCommit: classify each commit
  classifyCommit-->>fetchCommits: ClassifiedCommit
  fetchCommits-->>PromiseAll: commits with classifiedInfo
  PromiseAll-->>useGitHubData: { issues, prs, commits, totals }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

gssoc25, level2

Poem

A rabbit reads commits by moonlight’s gleam,
Classifying messages like a dream,
Badges glint for changes big and small,
The tracker now lists them one and all,
Hooray — the logs sing, hop, and beam! 🐇✨

🚥 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 title directly and accurately describes the main changes: implementing a commit classification system and adding a tracking tab.
Description check ✅ Passed The description provides comprehensive details covering all key aspects: related issue, clear description of changes, testing methodology, type of change, and supporting screenshots.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@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: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/hooks/useGitHubData.ts`:
- Around line 44-47: The mapped GitHub items lack a normalized top-level date
for table rendering; inside the mapping that creates items (in useGitHubData.ts
where response.data.items is mapped and classifyCommit is called), extract a
stable date from item.commit.author.date or item.commit.committer.date,
normalize it (e.g., new Date(...).toISOString() or null-safe fallback) and
assign it to a consistent top-level field like date or committedDate before
returning the mapped object; ensure you handle missing/invalid dates with a
fallback (null or empty string) so downstream rendering never receives an
invalid value.
- Around line 66-70: The combined Promise.all call causes a failure in
fetchCommitsPaginated to reject the whole batch and prevent issue/pr results
from loading; change the code in useGitHubData to run fetchPaginated(octokit,
username, 'issue', ...) and fetchPaginated(..., 'pr', ...) with Promise.all or
await them, but handle fetchCommitsPaginated separately using Promise.allSettled
or a try/catch around fetchCommitsPaginated so commits errors are caught and
commitRes is set to an empty array (or a safe fallback) while still allowing
issueRes and prRes to be used; update any downstream logic that reads commitRes
to handle the fallback.

In `@src/pages/Tracker/Tracker.tsx`:
- Around line 141-146: The filter callback around selectedRepo can throw because
repoUrl may be undefined; change the repoUrl assignment in the filtered.filter
(where you use item.repository?.html_url || item.repository_url) to include the
same safe fallback used in the repository cell (e.g. item.repository?.html_url
|| item.repository?.url || item.repository_url || '') so repoUrl is always a
string before calling repoUrl.includes(selectedRepo), ensuring .includes never
runs on undefined.
- Around line 370-382: The importance badge currently treats any
non-'High'/'Medium' value (including undefined) as 'Low' by using a nested
ternary; update the logic used in the TableCell/Box rendering (referencing
item.classifiedInfo?.importance and the Box sx bgcolor) to explicitly check for
'Low' and use a neutral fallback (e.g., gray or 'neutral.light') when importance
is missing or unknown, ensuring the badge shows High -> error.light, Medium ->
warning.light, Low -> success.light, otherwise the neutral color and preferably
render a placeholder label like 'Unknown' instead of an empty green chip.
- Line 384: The Created column shows "Invalid Date" because commit items from
/search/commits put their timestamp at commit.author.date or
commit.committer.date rather than created_at; update the useGitHubData mapping
for commits (or if you prefer Tracker-side, change the Tracker render) so that
created_at is populated from item.commit.author?.date ??
item.commit.committer?.date; this ensures TableCell uses
formatDate(item.created_at) correctly and you can keep Tracker code using
formatDate unchanged.

In `@src/utils/commitClassifier.ts`:
- Around line 25-29: Reorder and broaden the docs check so commit messages like
"docs: update README" are classified as Docs: move the docs branch to run before
the Chore branch and change its regex to match common prefixes and variants (use
lowerMsg and category as in the diff), e.g. include patterns like
/(?:^|\\W)docs[:\\b]|doc\\b|readme\\b|comment\\b/ so "docs:", "docs/", "docs "
and "doc" are all caught; ensure the Chore branch
(/chore\\b|bump\\b|update\\b|depend\\b|config\\b|format\\b|style\\b/) remains
after the updated Docs check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d785c9ad-c305-46a1-b583-1d4de019c14e

📥 Commits

Reviewing files that changed from the base of the PR and between 7a15543 and 0c81fda.

📒 Files selected for processing (3)
  • src/hooks/useGitHubData.ts
  • src/pages/Tracker/Tracker.tsx
  • src/utils/commitClassifier.ts

Comment thread src/hooks/useGitHubData.ts
Comment thread src/hooks/useGitHubData.ts
Comment thread src/pages/Tracker/Tracker.tsx
Comment thread src/pages/Tracker/Tracker.tsx
Comment thread src/pages/Tracker/Tracker.tsx
Comment thread src/utils/commitClassifier.ts Outdated
Copy link
Copy Markdown
Author

@ABHImaybeJEET ABHImaybeJEET left a comment

Choose a reason for hiding this comment

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

Related Issue

  • Closes: #

Description

This PR introduces an initial Commit Classification System to reduce noise in the tracker and highlight meaningful contributions over minor typo or dependency fixes.

Key Additions:

  • commitClassifier: A utility that categorizes commits (e.g., Feature, Bugfix) and assigns an Importance score (High, Medium, Low) based on message keywords and impact.
  • API Integration: Updated useGitHubData to fetch and classify commits via the GitHub API.
  • UI Update: Added a "Commits" tab to the Tracker dashboard with color-coded importance badges and filtering.

Future potential: This v1 rules-based system lays the groundwork for adding AI intent recognition and deep diff analysis in the future.


How Has This Been Tested?

  • Verified commit fetching across multiple test GitHub accounts.
  • Confirmed commitClassifier accurately applies categories and importance scores.
  • Tested table filtering by High/Medium/Low importance.
  • Ensured existing Issues and PRs tabs remain fully functional.

Screenshots (if applicable)

(Add a screenshot showing the new Commits tab with the color-coded badges)


Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant