Skip to content

refactor(dashboard): use getEnabledAppIds on metrics page#1394

Merged
mantrakp04 merged 1 commit intodevfrom
refactor/metrics-enabled-app-ids-helper
Apr 28, 2026
Merged

refactor(dashboard): use getEnabledAppIds on metrics page#1394
mantrakp04 merged 1 commit intodevfrom
refactor/metrics-enabled-app-ids-helper

Conversation

@mantrakp04
Copy link
Copy Markdown
Collaborator

@mantrakp04 mantrakp04 commented Apr 28, 2026

Summary

Uses the shared getEnabledAppIds helper from @/lib/apps-utils instead of manually filtering installed apps with typedEntries on the project metrics page.

Why

Keeps enabled-app logic consistent with other dashboard code paths and slightly reduces duplication.

Test plan

  • Smoke: open project metrics / overview and confirm installed app-dependent UI (e.g. analytics) still behaves as before.

Made with Cursor

Summary by CodeRabbit

  • Refactor
    • Improved code maintainability by consolidating component logic to utilize shared utilities.

Replace typedEntries + filter with shared getEnabledAppIds from apps-utils for consistency with other call sites.

Made-with: Cursor
Copilot AI review requested due to automatic review settings April 28, 2026 19:39
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-auth-hosted-components Ready Ready Preview, Comment Apr 28, 2026 7:45pm
stack-backend Ready Ready Preview, Comment Apr 28, 2026 7:45pm
stack-dashboard Ready Ready Preview, Comment Apr 28, 2026 7:45pm
stack-demo Ready Ready Preview, Comment Apr 28, 2026 7:45pm
stack-docs Ready Ready Preview, Comment Apr 28, 2026 7:45pm
stack-preview-backend Ready Ready Preview, Comment Apr 28, 2026 7:45pm
stack-preview-dashboard Ready Ready Preview, Comment Apr 28, 2026 7:45pm

@mantrakp04 mantrakp04 self-assigned this Apr 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 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: 6c47abc4-1fc5-484a-8730-999e8e88caac

📥 Commits

Reviewing files that changed from the base of the PR and between b3d0ab6 and c89da69.

📒 Files selected for processing (1)
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx

📝 Walkthrough

Walkthrough

This change refactors the installedApps list derivation in the metrics page component to use a shared helper function (getEnabledAppIds) instead of locally filtering and casting. The functional behavior remains unchanged, with only import statements and the derivation method modified.

Changes

Cohort / File(s) Summary
Helper Import Consolidation
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx
Replaced inline filtering logic using typedEntries with a call to the shared getEnabledAppIds helper function. Updated imports accordingly while maintaining identical downstream behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A helper comes to town so grand,
With shared logic now hand-in-hand,
No casting, no filtering to do,
Just clean and simple through and through! ✨

🚥 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 clearly and specifically describes the main change: refactoring to use a shared helper function on the metrics page.
Description check ✅ Passed The description provides summary, rationale, and test plan; it clearly explains the change, its motivation, and verification approach.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/metrics-enabled-app-ids-helper

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.

@mantrakp04 mantrakp04 requested a review from BilalG1 April 28, 2026 19:40
@mantrakp04 mantrakp04 enabled auto-merge (squash) April 28, 2026 19:40
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 28, 2026

Greptile Summary

This PR replaces a manual typedEntries / filter / map chain in the metrics page with the shared getEnabledAppIds helper, reducing duplication and aligning with other dashboard code paths. The change is largely equivalent for typical apps but does carry two subtle behavioral shifts: sub-apps whose parent is enabled are now included, and alpha apps in production are silently excluded even when marked enabled — see the inline comment for details.

Confidence Score: 4/5

Safe to merge; the refactor is consistent with the rest of the codebase, with only minor behavioral edge cases around sub-apps and alpha apps worth verifying.

Only P2 findings present — subtle behavioral differences between the old inline logic and the new helper, but no definitive bugs in the changed code path.

apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx — verify sub-app and alpha-app behavior is intentional for the metrics page context.

Important Files Changed

Filename Overview
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx Replaces inline typedEntries + filter + map with getEnabledAppIds helper; functionally equivalent for normal apps but changes behavior for sub-apps and alpha apps in production.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[config.apps.installed] --> B{getEnabledAppIds}
    B --> C[getAllAvailableAppIds\nObject.keys ALL_APPS\n⚠ filters alpha in prod]
    C --> D{isAppEnabled per appId}
    D -->|sub-app| E[check parent enabled\nin installedApps]
    D -->|regular app| F[check appId.enabled\nin installedApps]
    E --> G[installedApps array]
    F --> G
    G --> H[analyticsEnabled check\ninstalledApps.includes 'analytics']
Loading

Fix All in Claude Code Fix All in Cursor Fix All in Codex

Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx
Line: 999-1001

Comment:
**Subtle behavioral change vs. original**

The old code iterated over `typedEntries(config.apps.installed)` — only the app IDs actually present in the installed map. `getEnabledAppIds` instead iterates over `getAllAvailableAppIds()` (i.e. all keys of `ALL_APPS`), which introduces two differences:

1. **Sub-apps are now included**: if a sub-app's parent is enabled, the sub-app ID will appear in `installedApps` even though sub-apps have no direct entry in `config.apps.installed`. Depending on how the metrics page consumes this list this may or may not matter.
2. **Alpha apps in production are silently excluded**: `getAllAvailableAppIds` filters out apps with `stage === "alpha"` in non-dev envs. Previously an alpha app that was explicitly marked `enabled: true` in the installed config would have been returned; now it won't be.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "refactor(dashboard): use getEnabledAppId..." | Re-trigger Greptile

@mantrakp04 mantrakp04 merged commit a82097d into dev Apr 28, 2026
40 checks passed
@mantrakp04 mantrakp04 deleted the refactor/metrics-enabled-app-ids-helper branch April 28, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants