Skip to content

Implement health scorecard and risk advisor services with governance page - #157

Open
Devnil434 wants to merge 4 commits into
AOSSIE-Org:mainfrom
Devnil434:feature/org-health-scorecard
Open

Implement health scorecard and risk advisor services with governance page#157
Devnil434 wants to merge 4 commits into
AOSSIE-Org:mainfrom
Devnil434:feature/org-health-scorecard

Conversation

@Devnil434

@Devnil434 Devnil434 commented Aug 9, 2026

Copy link
Copy Markdown

Summary

Implemented the Automated Health Scorecard & Risk Advisor for OrgExplorer.

Key Changes

  • Added healthScorecard.js

    • Organization Health Score (0–100)
    • Grade calculation (A+ to F)
    • Activity, Maintainer Diversity, Compliance, and Issue/PR Health dimensions
    • Handles missing audit data as Insufficient Data
  • Added riskAdvisor.js

    • Signal-based repository risk classification
    • Critical Bus Factor = 1 detection
    • Hibernating, stale issue/PR, and missing-license warnings
    • Prioritized remediation recommendations
  • Added HealthScorecard.jsx

    • Organization health overview
    • Dimension breakdown
    • Risk Advisor
    • Risk-focused repository table
  • Updated GovernancePage.jsx

    • Added Health Scorecard & Risk Advisor tab
    • Preserved existing Structural Audit Details
  • Added Vitest coverage for health-score and risk-advisor logic.

Addressed Issues:

Fixes #152

Screenshots/Recordings:

Screen.Recording.2026-08-09.220646.mp4

Verification

✓ 5 test files passed
✓ 49 tests passed
✓ Production build successful
✓ 998 modules transformed

Additional Notes

  • Existing analytics.js remains unchanged.
  • Health and risk logic is separated into dedicated services.
  • Risk classification is signal-based, with critical risks taking precedence over numerical scores.

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 will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

AI tools were used responsibly during development. The implementation was reviewed, tested, and verified with the project's test suite and production build.

Summary by CodeRabbit

  • New Features

    • Added a Health Scorecard view with organization grades, scores, health dimensions, and risk counters.
    • Added repository risk classifications, filtering, GitHub links, and prioritized recommendations.
    • Added navigation between Health Scorecard and Structural Audit Details views.
    • Added audit controls and support for activity, licensing, compliance, and issue health metrics.
  • Bug Fixes

    • Added clear empty states when repository data is unavailable.
    • Improved handling of incomplete or unavailable audit data.

@github-actions github-actions Bot added enhancement New feature or request frontend Frontend changes javascript JavaScript/TypeScript changes tests Test changes size/XL 500+ lines changed first-time-contributor First time contributor labels Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Devnil434, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2f9c652f-a829-4ca6-b432-65a16468e5fc

📥 Commits

Reviewing files that changed from the base of the PR and between 96284c3 and 1325f35.

📒 Files selected for processing (2)
  • src/services/healthScorecard.js
  • src/services/healthScorecard.test.js

Walkthrough

The PR adds health scoring services, repository risk classification, risk recommendations, a HealthScorecard component, and GovernancePage navigation between the scorecard and structural audit details.

Changes

Health Scorecard

Layer / File(s) Summary
Health metric scoring
src/services/healthScorecard.js, src/services/healthScorecard.test.js
Adds dimension scoring, weighted organization summaries, letter grades, bounded scores, empty-model defaults, and tests.
Repository risk analysis
src/services/riskAdvisor.js, src/services/healthScorecard.test.js
Classifies repositories by bus factor, activity, licensing, and stale issues. Generates severity-ordered recommendations and tests.
Scorecard presentation
src/components/HealthScorecard.jsx
Renders organization health, dimensions, audit status, recommendations, risk counters, filters, repository risks, and GitHub links.
Governance view integration
src/pages/GovernancePage.jsx
Adds navigation between the Health Scorecard and Structural Audit Details views.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GovernancePage
  participant HealthScorecard
  participant HealthScorecardService
  participant RiskAdvisor
  GovernancePage->>HealthScorecard: Pass governance model and audit state
  HealthScorecard->>HealthScorecardService: Compute dimensions and organization summary
  HealthScorecard->>RiskAdvisor: Classify repositories and generate recommendations
  RiskAdvisor-->>HealthScorecard: Return risks and recommendations
  HealthScorecard-->>GovernancePage: Render selected scorecard view
Loading

Possibly related issues

  • Issue 100 — The PR addresses repository health analytics, contributor diversity, activity, issue health, and organization-level scoring.

Suggested labels: Typescript Lang

Poem

A rabbit checks each score with care,
Grades and risk flags fill the air.
Critical, warning, healthy rows
Help maintainers choose next goals.
Filters guide the audit trail,
Governance scores now set the scale.

🚥 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 summarizes the health scorecard, risk advisor services, and Governance page integration.
Linked Issues check ✅ Passed The changes implement the scorecard, risk classification, recommendations, filtering, Governance integration, and tests requested in issue #152.
Out of Scope Changes check ✅ Passed All changed files directly support the health scorecard and risk advisor objectives in issue #152.
✨ 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/XL 500+ lines changed and removed size/XL 500+ lines changed labels Aug 9, 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: 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/components/HealthScorecard.jsx`:
- Around line 124-167: Replace the three interactive filter divs in the
HealthScorecard component with semantic button elements, each using
type="button" and aria-pressed={filter === ...} for its corresponding critical,
warning, or healthy state. Preserve the existing onClick handlers, styles,
labels, and counts while ensuring the controls remain keyboard accessible.
- Around line 18-23: Update the score assignment in the repository mapping to
use nullish fallback semantics instead of a falsy check, so a valid healthScore
of 0 is preserved while only null or undefined values default to 50.

In `@src/services/healthScorecard.js`:
- Around line 17-23: Update the no-organization-model return object in the
health scorecard logic so issueHealth is null rather than 0, preserving the
existing “Insufficient Data” semantics; update the corresponding empty-model
test expectation to assert null.
- Around line 42-45: Update the diversity calculation in the health scorecard
around the bus-factor logic so repositories with bus factor 1 are capped below
the maximum diversity score regardless of contributor count. Define and apply
the intended ceiling while preserving the existing scoring for bus factors at
least 2, and add a boundary test covering bus factor 1 with ten contributors.

In `@src/services/healthScorecard.test.js`:
- Around line 64-73: Update the test case around computeOrgHealthSummary to
assert the exact expected values for this repository-only input: summary.score
must be 100 and summary.grade must be “A”. Remove the tautological range
assertions while preserving the existing model and invocation.

In `@src/services/riskAdvisor.js`:
- Around line 26-30: The hibernation check in classifyRepositoryRisk must work
when activityClassification is absent from model.allRepos. Derive isHibernating
from repo.pushed_at using the existing 180-day threshold, or ensure that
classification is propagated before generateRiskRecommendations filters entries;
add a test covering a repo without activityClassification whose pushed_at is
older than 180 days.
🪄 Autofix

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 Plus

Run ID: dd9c650c-6a9d-46b7-8119-b9d7a7760b37

📥 Commits

Reviewing files that changed from the base of the PR and between 5a02b1a and e3afc49.

📒 Files selected for processing (5)
  • src/components/HealthScorecard.jsx
  • src/pages/GovernancePage.jsx
  • src/services/healthScorecard.js
  • src/services/healthScorecard.test.js
  • src/services/riskAdvisor.js

Comment thread src/components/HealthScorecard.jsx
Comment thread src/components/HealthScorecard.jsx Outdated
Comment thread src/services/healthScorecard.js
Comment thread src/services/healthScorecard.js
Comment thread src/services/healthScorecard.test.js Outdated
Comment thread src/services/riskAdvisor.js
@gitcordapp

gitcordapp Bot commented Aug 9, 2026

Copy link
Copy Markdown

Link your account with Gitcord

Thanks for opening this PR, @Devnil434!

To receive Discord notifications and contributor tracking for this organization:

  1. Join Discord: https://discord.gg/hjUhu33uAn
  2. In Discord, run /link Devnil434
  3. Paste the verification code into your GitHub bio (or a public gist)
  4. Click Verify in Discord (or run /verify-link Devnil434)

Once linked, Gitcord can notify you about reviews, merges, and more.

Posted by Gitcord

@github-actions github-actions Bot added size/XL 500+ lines changed and removed size/XL 500+ lines changed labels Aug 10, 2026
@github-actions github-actions Bot added size/XL 500+ lines changed and removed size/XL 500+ lines changed labels Aug 10, 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/healthScorecard.js (1)

52-58: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Include all required governance files in complianceScore.

computeDimensionScores and computeOrgHealthSummary currently compute compliance from license only, so repositories with a license but missing CONTRIBUTING.md or CODE_OF_CONDUCT can still receive a full compliance score. Add the missing CODE_OF_CONDUCT.md audit signal or base this calculation on an upstream structural-audit result that covers all required files.

🤖 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/healthScorecard.js` around lines 52 - 58, Update compliance
scoring in computeDimensionScores and computeOrgHealthSummary to account for all
required governance files, not just r.license. Include CODE_OF_CONDUCT.md and
CONTRIBUTING.md audit signals, or reuse the existing upstream structural-audit
result that validates them, while preserving the non-archived, non-fork
repository scope and 100 fallback for no valid repositories.
🤖 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/healthScorecard.test.js`:
- Around line 62-74: Extend the computeDimensionScores tests with hasAudit: true
cases covering closed issues, stale open issues, and an empty audited issue
array. Assert each case’s calculated issueHealth score and hasAudit value, using
the existing model and issue-health fixtures or symbols without changing the
scoring implementation.

---

Outside diff comments:
In `@src/services/healthScorecard.js`:
- Around line 52-58: Update compliance scoring in computeDimensionScores and
computeOrgHealthSummary to account for all required governance files, not just
r.license. Include CODE_OF_CONDUCT.md and CONTRIBUTING.md audit signals, or
reuse the existing upstream structural-audit result that validates them, while
preserving the non-archived, non-fork repository scope and 100 fallback for no
valid repositories.
🪄 Autofix

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 Plus

Run ID: ec0d6aeb-2961-4870-a5cc-a0350d5c024a

📥 Commits

Reviewing files that changed from the base of the PR and between d8cc8e2 and 96284c3.

📒 Files selected for processing (3)
  • src/components/HealthScorecard.jsx
  • src/services/healthScorecard.js
  • src/services/healthScorecard.test.js

Comment thread src/services/healthScorecard.test.js
@github-actions github-actions Bot added size/XL 500+ lines changed and removed size/XL 500+ lines changed labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request first-time-contributor First time contributor frontend Frontend changes javascript JavaScript/TypeScript changes size/XL 500+ lines changed tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Automated Health Scorecard & Risk Advisor Dashboard

1 participant