feat: implement basic commit classification system and tracking tab#266
feat: implement basic commit classification system and tracking tab#266ABHImaybeJEET wants to merge 2 commits into
Conversation
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe 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. ChangesCommit Tracking Feature
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 }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
🎉 Thank you @ABHImaybeJEET for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
src/hooks/useGitHubData.tssrc/pages/Tracker/Tracker.tsxsrc/utils/commitClassifier.ts
ABHImaybeJEET
left a comment
There was a problem hiding this comment.
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
useGitHubDatato 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
commitClassifieraccurately 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
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
commitClassifierutility to:GitHub API Integration
Updated
useGitHubDatato:UI Improvements
Added a new Commits tab in the Tracker dashboard featuring:
Future Scope
This rules-based implementation can later be extended with:
Testing
Type of Change
Summary by CodeRabbit
New Features
Bug Fixes