-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alex/cos 3309 set new orgs as prospect leads by default #7296
Alex/cos 3309 set new orgs as prospect leads by default #7296
Conversation
WalkthroughThe changes across the codebase primarily involve renaming and reordering enums in the Changes
Tip New Features and ImprovementsReview SettingsIntroduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments. AST-based InstructionsCodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation. Community-driven AST-based RulesWe are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information. New Static Analysis ToolsWe are continually expanding our support for static analysis tools. We have added support for Tone SettingsUsers can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:
Revamped Settings PageWe have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to Miscellaneous
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (13)
- packages/server/customer-os-api-sdk/graph/generated/generated.go (2 hunks)
- packages/server/customer-os-api-sdk/graph/model/models_gen.go (5 hunks)
- packages/server/customer-os-api/graph/generated/generated.go (2 hunks)
- packages/server/customer-os-api/graph/model/models_gen.go (5 hunks)
- packages/server/customer-os-api/graph/resolver/organization.resolvers.go (1 hunks)
- packages/server/customer-os-api/graph/resolver/view.resolvers.go (3 hunks)
- packages/server/customer-os-api/graph/resolver/view_helper.go (3 hunks)
- packages/server/customer-os-api/graph/schemas/organization.graphqls (1 hunks)
- packages/server/customer-os-api/graph/schemas/view.graphqls (1 hunks)
- packages/server/customer-os-api/mapper/enum/organization_relationship_mapper.go (1 hunks)
- packages/server/customer-os-api/mapper/enum/organization_stage_mapper.go (1 hunks)
- packages/server/customer-os-neo4j-repository/enum/organization_relationship.go (3 hunks)
- packages/server/customer-os-neo4j-repository/enum/organization_stage.go (2 hunks)
Additional comments not posted (15)
packages/server/customer-os-neo4j-repository/enum/organization_relationship.go (3)
9-9
: AddedNotAFit
toOrganizationRelationship
enum.This change aligns with the PR's objective to adjust organization relationship statuses.
33-33
: Validated the inclusion ofNotAFit
in theIsValid
method.This ensures that
NotAFit
is recognized as a valid organization relationship.
22-23
: EnsureNotAFit.String()
correctly returns the string representation.packages/server/customer-os-api/mapper/enum/organization_relationship_mapper.go (1)
12-12
: Updated mapping forOrganizationRelationshipNotAFit
.Correctly maps the new enum value from the model to the Neo4j repository.
packages/server/customer-os-api/mapper/enum/organization_stage_mapper.go (1)
10-19
: Updated mapping for newOrganizationStage
enums.The mappings are correctly updated to reflect the new stages introduced in the enums.
packages/server/customer-os-neo4j-repository/enum/organization_stage.go (3)
6-15
: Added newOrganizationStage
enums.These additions are consistent with the PR's objectives to redefine organization stages.
51-51
: Validated the inclusion of new stages in theIsValid
method.This ensures that all new stages are recognized as valid organization stages.
32-43
: Ensure correct string representations for newOrganizationStage
values.packages/server/customer-os-api/graph/schemas/view.graphqls (1)
43-43
: The addition of theCHURN
enum value aligns with the PR's objectives to handle organization stages related to churn.packages/server/customer-os-api/graph/resolver/view.resolvers.go (1)
Line range hint
168-237
: The updated logic to check for the presence of various table view definitions, includingchurn
, and to create them if they are not found, enhances the robustness of the system.packages/server/customer-os-api/graph/schemas/organization.graphqls (1)
377-391
: The updates to theOrganizationRelationship
andOrganizationStage
enums align with the PR's objectives to handle new stages and relationships of organizations.packages/server/customer-os-api/graph/resolver/view_helper.go (1)
419-447
: The addition of theDefaultTableViewDefinitionChurn
function supports the handling of the newchurn
stage and is consistent with changes in other files.packages/server/customer-os-api/graph/resolver/organization.resolvers.go (1)
116-131
: Ensure correct default values forRelationship
andStage
.Verification successful
The extracted implementation of the
OrganizationCreate
function provides a comprehensive view of how default values forRelationship
andStage
are set. The logic appears to be correctly implemented, ensuring that default values are assigned based on specific conditions.Key Points:
- Relationship Default Value: If
input.Relationship
is not provided andinput.IsCustomer
is true, it defaults toOrganizationRelationshipCustomer
. If neither is provided, it defaults toOrganizationRelationshipProspect
.- Stage Default Value: If
input.Stage
is not provided, theStage
is set based on theRelationship
value:
OrganizationRelationshipCustomer
->OrganizationStageOnboarding
OrganizationRelationshipProspect
->OrganizationStageLead
OrganizationRelationshipNotAFit
->OrganizationStageUnqualified
OrganizationRelationshipFormerCustomer
->OrganizationStageTarget
Conclusion:
The logic for setting default values for
Relationship
andStage
in theOrganizationCreate
function is correctly implemented and aligns with the intended behavior.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the logic for setting default values in `OrganizationCreate` function. # Test: Search for the function usage and ensure the default values are correctly applied. rg --type go $'OrganizationCreate'Length of output: 10908
Script:
#!/bin/bash # Description: Extract the implementation of the OrganizationCreate function from organization.resolvers.go for detailed review. # Search for the OrganizationCreate function implementation in organization.resolvers.go ast-grep --lang go --pattern $'func (r *mutationResolver) OrganizationCreate(ctx context.Context, input model.OrganizationInput) (*model.Organization, error) { $$$ }' packages/server/customer-os-api/graph/resolver/organization.resolvers.goLength of output: 25501
packages/server/customer-os-api-sdk/graph/model/models_gen.go (2)
4864-4864
: Update toOrganizationRelationship
enum to reflect new business logic.The removal of
STRANGER
and addition ofNOT_A_FIT
aligns with the new business strategy to categorize organizations more effectively.Also applies to: 4871-4871
4907-4916
: Update toOrganizationStage
enum to accommodate new stages in organization lifecycle.The addition of stages such as
READY_TO_BUY
,ONBOARDING
,INITIAL_VALUE
,RECURRING_VALUE
,MAX_VALUE
, andPENDING_CHURN
provides a more granular and realistic tracking of organization progression and lifecycle.
OrganizationRelationshipNotAFit OrganizationRelationship = "NOT_A_FIT" | ||
OrganizationRelationshipFormerCustomer OrganizationRelationship = "FORMER_CUSTOMER" | ||
) | ||
|
||
var AllOrganizationRelationship = []OrganizationRelationship{ | ||
OrganizationRelationshipCustomer, | ||
OrganizationRelationshipProspect, | ||
OrganizationRelationshipStranger, | ||
OrganizationRelationshipNotAFit, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The old enum value OrganizationRelationshipStranger
is still present in packages/server/user-admin-api/model/cos_input.go
and is not referenced elsewhere in the codebase. Please remove this outdated enum value to ensure consistency with the updated business logic.
packages/server/user-admin-api/model/cos_input.go
Analysis chain
The enum OrganizationRelationship
has been updated to reflect new business logic. The removal of STRANGER
and addition of NOT_A_FIT
and FORMER_CUSTOMER
should be cross-checked to ensure they align with the business requirements and that all references in the codebase have been updated accordingly.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that all references to the old `STRANGER` enum value have been updated or removed.
# Test: Search for the old enum value. Expect: No occurrences.
rg --type go 'STRANGER'
Length of output: 151
Script:
#!/bin/bash
# Description: Verify if `OrganizationRelationshipStranger` is still being used in the codebase.
# Test: Search for references to `OrganizationRelationshipStranger`. Expect: No occurrences.
rg --type go 'OrganizationRelationshipStranger'
Length of output: 175
OrganizationStageLead OrganizationStage = "LEAD" | ||
OrganizationStageTarget OrganizationStage = "TARGET" | ||
OrganizationStageEngaged OrganizationStage = "ENGAGED" | ||
OrganizationStageUnqualified OrganizationStage = "UNQUALIFIED" | ||
OrganizationStageReadyToBuy OrganizationStage = "READY_TO_BUY" | ||
OrganizationStageOnboarding OrganizationStage = "ONBOARDING" | ||
OrganizationStageInitialValue OrganizationStage = "INITIAL_VALUE" | ||
OrganizationStageRecurringValue OrganizationStage = "RECURRING_VALUE" | ||
OrganizationStageMaxValue OrganizationStage = "MAX_VALUE" | ||
OrganizationStagePendingChurn OrganizationStage = "PENDING_CHURN" | ||
) | ||
|
||
var AllOrganizationStage = []OrganizationStage{ | ||
OrganizationStageLead, | ||
OrganizationStageTarget, | ||
OrganizationStageInterested, | ||
OrganizationStageEngaged, | ||
OrganizationStageClosedWon, | ||
OrganizationStageClosedLost, | ||
OrganizationStageUnqualified, | ||
OrganizationStageNurture, | ||
OrganizationStageReadyToBuy, | ||
OrganizationStageOnboarding, | ||
OrganizationStageInitialValue, | ||
OrganizationStageRecurringValue, | ||
OrganizationStageMaxValue, | ||
OrganizationStagePendingChurn, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The absence of output from the verification scripts indicates that the new stages (READY_TO_BUY
, INITIAL_VALUE
, RECURRING_VALUE
, MAX_VALUE
, PENDING_CHURN
) are not explicitly handled in the business logic (organization.resolvers.go
) and are not covered in the tests (organization.resolvers_it_test.go
).
Action Required
-
Update Business Logic:
- Ensure that all new stages are explicitly handled in
organization.resolvers.go
.
- Ensure that all new stages are explicitly handled in
-
Add Tests:
- Add tests to cover the new stages in
organization.resolvers_it_test.go
.
- Add tests to cover the new stages in
Locations Needing Attention
packages/server/customer-os-api/graph/resolver/organization.resolvers.go
packages/server/customer-os-api/graph/resolver/organization.resolvers_it_test.go
Please update the business logic and tests to handle the new stages appropriately.
Analysis chain
The enum OrganizationStage
has been significantly updated with new stages such as READY_TO_BUY
, ONBOARDING
, INITIAL_VALUE
, RECURRING_VALUE
, MAX_VALUE
, and PENDING_CHURN
. This change likely impacts various business processes. Ensure that all parts of the application that depend on this enum are updated to handle these new stages.
The rg
command output indicates that the OrganizationStage
enum is used in various files across the codebase. To ensure that the new stages are handled correctly, we need to verify the following:
- Enum Definition and Mapping: Ensure that the new stages are defined and mapped correctly in the relevant files.
- Business Logic: Verify that the business logic handling
OrganizationStage
includes the new stages. - Tests: Check if there are tests covering the new stages.
Enum Definition and Mapping
The enum definition and mapping appear in several files, such as:
packages/server/customer-os-api/graph/model/models_gen.go
packages/server/customer-os-api/mapper/enum/organization_stage_mapper.go
packages/server/customer-os-neo4j-repository/enum/organization_stage.go
Business Logic
The business logic handling OrganizationStage
is found in:
packages/server/customer-os-api/graph/resolver/organization.resolvers.go
packages/server/events-processing-platform-subscribers/subscriptions/graph/organization_event_handlers.go
packages/server/customer-os-neo4j-repository/mapper/node_to_entity_mapper.go
Tests
Tests related to OrganizationStage
are found in:
packages/server/customer-os-api/graph/resolver/organization.resolvers_it_test.go
To ensure comprehensive verification, we need to check the handling of the new stages in these files. Let's start by examining the enum definition and mapping files to confirm the inclusion of the new stages.
Once we confirm the inclusion of the new stages in the enum definition and mapping, we can proceed to verify the business logic and tests.
The rg
command output indicates that the OrganizationStage
enum is used in various files across the codebase. To ensure that the new stages are handled correctly, we need to verify the following:
- Enum Definition and Mapping: Ensure that the new stages are defined and mapped correctly in the relevant files.
- Business Logic: Verify that the business logic handling
OrganizationStage
includes the new stages. - Tests: Check if there are tests covering the new stages.
Enum Definition and Mapping
The enum definition and mapping appear in several files, such as:
packages/server/customer-os-api/graph/model/models_gen.go
packages/server/customer-os-api/mapper/enum/organization_stage_mapper.go
packages/server/customer-os-neo4j-repository/enum/organization_stage.go
Business Logic
The business logic handling OrganizationStage
is found in:
packages/server/customer-os-api/graph/resolver/organization.resolvers.go
packages/server/events-processing-platform-subscribers/subscriptions/graph/organization_event_handlers.go
packages/server/customer-os-neo4j-repository/mapper/node_to_entity_mapper.go
Tests
Tests related to OrganizationStage
are found in:
packages/server/customer-os-api/graph/resolver/organization.resolvers_it_test.go
To ensure comprehensive verification, we need to check the handling of the new stages in these files. Let's start by examining the enum definition and mapping files to confirm the inclusion of the new stages.
Once we confirm the inclusion of the new stages in the enum definition and mapping, we can proceed to verify the business logic and tests.
The output confirms that the new stages (READY_TO_BUY
, ONBOARDING
, INITIAL_VALUE
, RECURRING_VALUE
, MAX_VALUE
, PENDING_CHURN
) have been correctly defined and mapped in the relevant files:
packages/server/customer-os-api/graph/model/models_gen.go
packages/server/customer-os-api/mapper/enum/organization_stage_mapper.go
packages/server/customer-os-neo4j-repository/enum/organization_stage.go
Next, we need to verify that the business logic and tests handling OrganizationStage
include these new stages. This involves checking the following files:
-
Business Logic:
packages/server/customer-os-api/graph/resolver/organization.resolvers.go
packages/server/events-processing-platform-subscribers/subscriptions/graph/organization_event_handlers.go
packages/server/customer-os-neo4j-repository/mapper/node_to_entity_mapper.go
-
Tests:
packages/server/customer-os-api/graph/resolver/organization.resolvers_it_test.go
Let's proceed by examining these files to ensure the new stages are handled appropriately.
The output confirms that the new stages are included in the enum definition and mapping files. However, the business logic and tests do not seem to fully account for the new stages. Specifically:
-
Business Logic:
packages/server/customer-os-api/graph/resolver/organization.resolvers.go
only shows handling forOrganizationStageOnboarding
,OrganizationStageLead
,OrganizationStageUnqualified
, andOrganizationStageTarget
. The new stagesREADY_TO_BUY
,INITIAL_VALUE
,RECURRING_VALUE
,MAX_VALUE
, andPENDING_CHURN
are not explicitly handled.packages/server/events-processing-platform-subscribers/subscriptions/graph/organization_event_handlers.go
andpackages/server/customer-os-neo4j-repository/mapper/node_to_entity_mapper.go
use a generic decoding function, which might handle all stages, but this needs to be confirmed.
-
Tests:
packages/server/customer-os-api/graph/resolver/organization.resolvers_it_test.go
only tests forOrganizationStageLead
. There are no tests for the new stages.
Actionable Follow-Up
To ensure comprehensive handling of the new stages, the following steps should be taken:
-
Update Business Logic:
- Ensure that all new stages (
READY_TO_BUY
,INITIAL_VALUE
,RECURRING_VALUE
,MAX_VALUE
,PENDING_CHURN
) are explicitly handled in the business logic files.
- Ensure that all new stages (
-
Add Tests:
- Add tests to cover the new stages in
organization.resolvers_it_test.go
.
- Add tests to cover the new stages in
Verification Scripts
To verify the updates, we need to check for explicit handling of the new stages in the business logic and ensure that tests for these stages are added.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that all parts of the application handling `OrganizationStage` have been updated to accommodate new stages.
# Test: Search for the usage of the enum. Expect: Updated logic to handle new stages.
rg --type go 'OrganizationStage'
Length of output: 18177
Script:
#!/bin/bash
# Verify the inclusion of new stages in the enum definition and mapping files
# Check the enum definition in models_gen.go
echo "Checking enum definition in models_gen.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-api/graph/model/models_gen.go
# Check the enum mapping in organization_stage_mapper.go
echo "Checking enum mapping in organization_stage_mapper.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-api/mapper/enum/organization_stage_mapper.go
# Check the enum definition in organization_stage.go
echo "Checking enum definition in organization_stage.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-neo4j-repository/enum/organization_stage.go
Length of output: 4008
Script:
#!/bin/bash
# Verify the inclusion of new stages in the enum definition and mapping files
# Check the enum definition in models_gen.go
echo "Checking enum definition in models_gen.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-api/graph/model/models_gen.go
# Check the enum mapping in organization_stage_mapper.go
echo "Checking enum mapping in organization_stage_mapper.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-api/mapper/enum/organization_stage_mapper.go
# Check the enum definition in organization_stage.go
echo "Checking enum definition in organization_stage.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-neo4j-repository/enum/organization_stage.go
Length of output: 4008
Script:
#!/bin/bash
# Verify the handling of new stages in business logic and tests
# Check business logic in organization.resolvers.go
echo "Checking business logic in organization.resolvers.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-api/graph/resolver/organization.resolvers.go
# Check business logic in organization_event_handlers.go
echo "Checking business logic in organization_event_handlers.go..."
rg --type go 'OrganizationStage' packages/server/events-processing-platform-subscribers/subscriptions/graph/organization_event_handlers.go
# Check business logic in node_to_entity_mapper.go
echo "Checking business logic in node_to_entity_mapper.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-neo4j-repository/mapper/node_to_entity_mapper.go
# Check tests in organization.resolvers_it_test.go
echo "Checking tests in organization.resolvers_it_test.go..."
rg --type go 'OrganizationStage' packages/server/customer-os-api/graph/resolver/organization.resolvers_it_test.go
Length of output: 1727
Script:
#!/bin/bash
# Verify explicit handling of new stages in business logic and ensure tests are added
# Check for explicit handling of new stages in organization.resolvers.go
echo "Checking for explicit handling of new stages in organization.resolvers.go..."
rg --type go 'OrganizationStage(ReadyToBuy|InitialValue|RecurringValue|MaxValue|PendingChurn)' packages/server/customer-os-api/graph/resolver/organization.resolvers.go
# Check for tests covering new stages in organization.resolvers_it_test.go
echo "Checking for tests covering new stages in organization.resolvers_it_test.go..."
rg --type go 'OrganizationStage(ReadyToBuy|InitialValue|RecurringValue|MaxValue|PendingChurn)' packages/server/customer-os-api/graph/resolver/organization.resolvers_it_test.go
Length of output: 677
24507b2
to
1ef9dcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/server/customer-os-api/graph/resolver/organization.resolvers.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/server/customer-os-api/graph/resolver/organization.resolvers.go
Proposed changes
Changes
What types of changes does your code introduce? Put an
x
in the boxes that applyAdditional context
Summary by CodeRabbit
New Features
READY_TO_BUY
,ONBOARDING
,INITIAL_VALUE
,RECURRING_VALUE
,MAX_VALUE
,PENDING_CHURN
.CHURN
as a new table ID type.Updates
STRANGER
toNOT_A_FIT
.INTERESTED
,CLOSED_WON
,CLOSED_LOST
,NURTURE
.Enhancements