Implement health scorecard and risk advisor services with governance page - #157
Implement health scorecard and risk advisor services with governance page#157Devnil434 wants to merge 4 commits into
Conversation
…iated governance page and component
|
Warning Review limit reached
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe PR adds health scoring services, repository risk classification, risk recommendations, a ChangesHealth Scorecard
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
Possibly related issues
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
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
📒 Files selected for processing (5)
src/components/HealthScorecard.jsxsrc/pages/GovernancePage.jsxsrc/services/healthScorecard.jssrc/services/healthScorecard.test.jssrc/services/riskAdvisor.js
Link your account with GitcordThanks for opening this PR, @Devnil434! To receive Discord notifications and contributor tracking for this organization:
Once linked, Gitcord can notify you about reviews, merges, and more. — Posted by Gitcord |
… repository health assessment
…zation metrics and risk classification
There was a problem hiding this comment.
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 winInclude all required governance files in
complianceScore.
computeDimensionScoresandcomputeOrgHealthSummarycurrently compute compliance fromlicenseonly, so repositories with a license but missingCONTRIBUTING.mdorCODE_OF_CONDUCTcan still receive a full compliance score. Add the missingCODE_OF_CONDUCT.mdaudit 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
📒 Files selected for processing (3)
src/components/HealthScorecard.jsxsrc/services/healthScorecard.jssrc/services/healthScorecard.test.js
Summary
Implemented the Automated Health Scorecard & Risk Advisor for OrgExplorer.
Key Changes
Added
healthScorecard.jsAdded
riskAdvisor.jsAdded
HealthScorecard.jsxUpdated
GovernancePage.jsxAdded Vitest coverage for health-score and risk-advisor logic.
Addressed Issues:
Fixes #152
Screenshots/Recordings:
Screen.Recording.2026-08-09.220646.mp4
Verification
Additional Notes
analytics.jsremains unchanged.Checklist
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
Bug Fixes