Skip to content

Conversation

@eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Jan 23, 2026

What does this PR do?

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings
  • My PR is too large (>500 lines or >10 files) and should be split into smaller PRs

Summary by cubic

Replaced legacy feature flag access with DI-based repositories across the codebase to standardize global, team, and user checks and reduce Prisma coupling. Updated onboarding path helpers, TRPC routes, calendar subscription flows, and tests to align with the new interfaces.

  • Refactors

    • Switched to getFeatureRepository, getTeamFeatureRepository, and getUserFeatureRepository.
    • Updated checks to repository interfaces: global, team, and user feature flags.
    • Removed legacy FeaturesRepository, docs, and tests; TRPC map/list now uses findAll.
    • OnboardingPathService no longer requires a prisma argument; updated all call sites.
    • PBAC, bot detection, bookings, organizations, teams, emails, and calendar utilities now use the team/global/user feature repositories.
    • Introduced Nest wrappers for PrismaFeatureRepository, PrismaTeamFeatureRepository, and PrismaUserFeatureRepository.
    • Updated DI modules/tokens to use cached feature repositories where applicable.
    • Simplified Zod DTO schemas (FeatureDto, TeamFeaturesDto, UserFeaturesDto).
    • Updated tests and mocks to use the new containers.
  • Migration

    • Replace direct FeaturesRepository and getFeaturesRepository usage with DI containers.
    • For flag maps, use featureRepository.findAll() and reduce to AppFlags.
    • Update OnboardingPathService methods to the new no-arg signatures.
    • Pass featureRepository, teamFeatureRepository, and userFeatureRepository to CalendarSubscriptionService; use getTeamFeatureRepository in permission-related services and factories.

Written for commit 3943f48. Summary will update on new commits.

@eunjae-lee
Copy link
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Jan 23, 2026

@cubic-dev-ai review this PR

@eunjae-lee I have started the AI code review. It will take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 117 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

@eunjae-lee eunjae-lee force-pushed the chore/replace-feature-repository-usages branch from fcd9b24 to 0f825f1 Compare January 26, 2026 14:10
Base automatically changed from devin/1769178292-cleanup-features-repository to devin/1769164663-split-flag-repositories January 26, 2026 14:12
replace more checkIfFeatureIsEnabledGlobally

use checkIfTeamHasFeature from getTeamFeatureRepository()

replace checkIfUserHasFeatureNonHierarchical

replace more methods

replace more usages

replace more usages
@eunjae-lee eunjae-lee force-pushed the chore/replace-feature-repository-usages branch from 0f825f1 to 3943f48 Compare January 26, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants