Skip to content

fix: update analytical model to include total repositories and adjust…#94

Merged
rahul-vyas-dev merged 1 commit into
AOSSIE-Org:mainfrom
rahul-vyas-dev:fix/repo-count
Jul 2, 2026
Merged

fix: update analytical model to include total repositories and adjust…#94
rahul-vyas-dev merged 1 commit into
AOSSIE-Org:mainfrom
rahul-vyas-dev:fix/repo-count

Conversation

@rahul-vyas-dev

@rahul-vyas-dev rahul-vyas-dev commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Screenshots/Recordings:

Before: -
image
image

After: -
image
image

Additional Notes:

Make changes to include all the repo for an organization and show states for all the organizations, instead of top repo.

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • New Features

    • Overview and repository pages now show repository metrics and listings from the full repository set, improving accuracy across stars, forks, activity, and language breakdowns.
    • Repository insights now include per-repo health, activity, and bus factor values in the underlying analytics.
  • Bug Fixes

    • Fixed repository counts and table results so they reflect the complete data set instead of a partial view.

@github-actions github-actions Bot added no-issue-linked PR has no linked issue frontend Frontend changes javascript JavaScript/TypeScript changes size/S 11-50 lines changed external-contributor External contributor labels Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

buildAnalyticalModel now accepts a totalReposPerOrg parameter and returns a new totalRepos collection with per-repo healthScore, activityClassification, and busFactor. allRepos is simplified. AppContext, OverviewPage, and RepositoriesPage are updated to build/consume this new data.

Changes

Total repos analytics flow

Layer / File(s) Summary
buildAnalyticalModel contract update
src/services/analytics.js
Adds totalReposPerOrg parameter, computes healthScore, activityClassification, and busFactor into a new totalRepos array, simplifies allRepos to only include orgLogin, and returns totalRepos in the result.
AppContext wiring
src/context/AppContext.jsx
Builds totalReposPerOrg from reposPerOrg via Object.fromEntries and passes it as the fourth argument to buildAnalyticalModel.
Consumer pages switch to totalRepos
src/pages/OverviewPage.jsx, src/pages/RepositoriesPage.jsx
Derived stats (stars, forks, active repos, languages, top repos) and the repository listing source now use model.totalRepos instead of model.allRepos.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • AOSSIE-Org/OrgExplorer#63: Directly touches buildAnalyticalModel in src/services/analytics.js, the same function modified here.
  • AOSSIE-Org/OrgExplorer#76: Overlaps on RepositoriesPage/OverviewPage model-data access patterns including the allRepos fallback logic.

Suggested labels: Typescript Lang

Suggested reviewers: Zahnentferner, bhavik-mangla

Poem

A rabbit hopped through repo trees,
Counting health scores with such ease,
totalRepos now leads the way,
allRepos trimmed and put away,
Hop, hop, hooray for cleaner code! 🐇✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: updating the analytical model to include total repositories and related UI adjustments.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added size/S 11-50 lines changed and removed size/S 11-50 lines changed labels Jul 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/services/analytics.js`:
- Around line 40-56: The `buildAnalyticalModel` flow is computing `healthScore`
and `busFactor` for `totalRepos` using incomplete `contribsPerRepo` data from
`AppContext.jsx`’s `explore()` subset, so repos outside that subset get treated
as having zero contributors. Fix this by either ensuring contributor data is
available for every repo in `totalRepos` (or fetching it where needed) or by
changing `computeHealthScore`/`computeBusFactor` handling in `analytics.js` so
missing contributor data is distinguished from truly empty data and does not
silently default to zero. Keep the logic aligned with `buildAnalyticalModel`,
`computeHealthScore`, and `computeBusFactor` so downstream `OverviewPage` and
`RepositoriesPage` sorting reflects actual data availability.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b0c628d3-5d15-4c21-bea9-e46564ca5465

📥 Commits

Reviewing files that changed from the base of the PR and between 5688e69 and 079eab6.

📒 Files selected for processing (4)
  • src/context/AppContext.jsx
  • src/pages/OverviewPage.jsx
  • src/pages/RepositoriesPage.jsx
  • src/services/analytics.js

Comment thread src/services/analytics.js
Comment on lines +40 to +56
export function buildAnalyticalModel(orgs, reposPerOrg, contribsPerRepo, totalReposPerOrg) {
const allRepos = []
const contributorMap = {}
const totalRepos = [];

orgs.forEach(org => {
const repos = reposPerOrg[org.login] || []
const total = totalReposPerOrg[org.login] || [];

total.forEach(repo => {
const key = `${org.login}/${repo.name}`
const contribs = contribsPerRepo[key] || []
const health = computeHealthScore(repo, contribs.length)
const activityClassification = computeActivityClassification(repo)
const bf = computeBusFactor(contribs)
totalRepos.push({ ...repo, orgLogin: org.login, contributors: contribs, healthScore: health, activityClassification: activityClassification, busFactor: bf })
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Health score/bus factor are computed with incomplete contributor data for most of totalRepos.

total (from totalReposPerOrg) contains all repos per org, but contribsPerRepo is only ever populated for the reduced "top" list built in AppContext.jsx's explore() (getTopRepositories(...,10) for non-PAT users, or the full list only when a PAT is present). For every repo in total that isn't in that top subset, contribs resolves to [], so:

  • computeHealthScore's contributor-diversity term (30% weight) is always 0, capping the score near ~70 regardless of actual contributor activity.
  • computeBusFactor([]) always returns { factor: 0, risk: 'unknown' }.

This directly affects OverviewPage's health-sorted topRepos and RepositoriesPage's default health-sorted table (both driven by model.totalRepos), which is exactly the “all repositories” feature this PR is meant to introduce.

💡 Possible directions
  • Fetch contributor counts for all repos (may be rate-limit prohibitive without a PAT — note the 60 req/hr GitHub default shown in the product).
  • Or reweight computeHealthScore to redistribute the diversity weight when contributor data is unavailable, rather than silently defaulting to 0.
  • At minimum, mark repos lacking contributor data so downstream UI can distinguish "no data" from "poor diversity".
🤖 Prompt for 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.

In `@src/services/analytics.js` around lines 40 - 56, The `buildAnalyticalModel`
flow is computing `healthScore` and `busFactor` for `totalRepos` using
incomplete `contribsPerRepo` data from `AppContext.jsx`’s `explore()` subset, so
repos outside that subset get treated as having zero contributors. Fix this by
either ensuring contributor data is available for every repo in `totalRepos` (or
fetching it where needed) or by changing `computeHealthScore`/`computeBusFactor`
handling in `analytics.js` so missing contributor data is distinguished from
truly empty data and does not silently default to zero. Keep the logic aligned
with `buildAnalyticalModel`, `computeHealthScore`, and `computeBusFactor` so
downstream `OverviewPage` and `RepositoriesPage` sorting reflects actual data
availability.

@rahul-vyas-dev rahul-vyas-dev merged commit ff17681 into AOSSIE-Org:main Jul 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor External contributor frontend Frontend changes javascript JavaScript/TypeScript changes no-issue-linked PR has no linked issue size/S 11-50 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant