Skip to content

Update Serving API - from backend PR #6604 - #379

Merged
JosephSamirL merged 1 commit into
main-convertfrom
api-serving-update-6604
May 19, 2026
Merged

Update Serving API - from backend PR #6604#379
JosephSamirL merged 1 commit into
main-convertfrom
api-serving-update-6604

Conversation

@clllaur

@clllaur clllaur commented May 18, 2026

Copy link
Copy Markdown
Contributor

Updating TS Serving API after the latest changes from backend repo,
PR #6604

@clllaur
clllaur requested a review from a team May 18, 2026 19:16

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request migrates numerous TypeScript type and constant definitions to enums within packages/types/src/config/types.gen.ts and introduces new enums for PlanStatus and Products. The reviewer identified critical issues where the new PlanStatus and Products enums conflict with existing definitions, potentially causing compilation errors. Additionally, the use of intersection operators for KeyValueMatchRulesTypes and RulesTypes needs to be replaced with union operators to avoid never types, and there is a recommendation to improve non-descriptive enum names like type for better maintainability.

Comment thread packages/types/src/config/types.gen.ts Outdated
Comment on lines +37 to +43
export enum PlanStatus {
PAID = 'paid',
TRIAL = 'trial',
TRIAL_EXPIRED = 'trialExpired',
CANCELED = 'canceled',
PAUSED = 'paused'
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The addition of the PlanStatus enum here creates a duplicate identifier conflict with the existing type PlanStatus and const PlanStatus definitions located at lines 61 and 66 of this file. This will cause a compilation error in TypeScript. Please remove the redundant definitions further down in the file.

Comment thread packages/types/src/config/types.gen.ts Outdated
Comment on lines +52 to +56
export enum Products {
EXPERIENCES = 'experiences',
DEPLOY = 'deploy',
ADDONS = 'addons'
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

The addition of the Products enum here creates a duplicate identifier conflict with the existing type Products and const Products definitions at lines 81 and 90. This will result in a "Duplicate identifier" error. The old definitions should be removed to maintain consistency with the new enum-based approach.

JS_CONDITION = 'js_condition'
}

export type KeyValueMatchRulesTypes = GenericTextKeyValueMatchRulesTypes & GenericNumericKeyValueMatchRulesTypes & GenericBoolKeyValueMatchRulesTypes;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Using the intersection operator & with enums (which are now string-based) results in the never type, as a value cannot be a member of multiple distinct enums simultaneously. This should be a union type using the | operator to allow any of the key-value match rule types.

Suggested change
export type KeyValueMatchRulesTypes = GenericTextKeyValueMatchRulesTypes & GenericNumericKeyValueMatchRulesTypes & GenericBoolKeyValueMatchRulesTypes;
export type KeyValueMatchRulesTypes = GenericTextKeyValueMatchRulesTypes | GenericNumericKeyValueMatchRulesTypes | GenericBoolKeyValueMatchRulesTypes;

WEATHER_CONDITION = 'weather_condition'
}

export type RulesTypes = TextMatchRulesTypes & NumericMatchRulesTypes & BoolMatchRulesTypes & KeyValueMatchRulesTypes & VisitorDataExistsMatchRulesTypes & CookieMatchRulesTypes & CountryMatchRulesTypes & VisitorTypeMatchRulesTypes & LanguageMatchRulesTypes & GoalTriggeredMatchRulesTypes & SegmentBucketedMatchRulesTypes & DayOfWeekMatchRulesTypes & HourOfDayMatchRulesTypes & MinuteOfHourMatchRulesTypes & BrowserNameMatchRulesTypes & OsMatchRulesTypes & WeatherConditionMatchRulesTypes;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Similar to KeyValueMatchRulesTypes, the RulesTypes definition should use the union operator | instead of the intersection operator &. As currently written, this type evaluates to never, which will break any logic relying on a generic rule type.

Suggested change
export type RulesTypes = TextMatchRulesTypes & NumericMatchRulesTypes & BoolMatchRulesTypes & KeyValueMatchRulesTypes & VisitorDataExistsMatchRulesTypes & CookieMatchRulesTypes & CountryMatchRulesTypes & VisitorTypeMatchRulesTypes & LanguageMatchRulesTypes & GoalTriggeredMatchRulesTypes & SegmentBucketedMatchRulesTypes & DayOfWeekMatchRulesTypes & HourOfDayMatchRulesTypes & MinuteOfHourMatchRulesTypes & BrowserNameMatchRulesTypes & OsMatchRulesTypes & WeatherConditionMatchRulesTypes;
export type RulesTypes = TextMatchRulesTypes | NumericMatchRulesTypes | BoolMatchRulesTypes | KeyValueMatchRulesTypes | VisitorDataExistsMatchRulesTypes | CookieMatchRulesTypes | CountryMatchRulesTypes | VisitorTypeMatchRulesTypes | LanguageMatchRulesTypes | GoalTriggeredMatchRulesTypes | SegmentBucketedMatchRulesTypes | DayOfWeekMatchRulesTypes | HourOfDayMatchRulesTypes | MinuteOfHourMatchRulesTypes | BrowserNameMatchRulesTypes | OsMatchRulesTypes | WeatherConditionMatchRulesTypes;

Comment on lines +862 to +864
export enum type {
GA3 = 'ga3'
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The enum name type is non-descriptive and potentially confusing as it is also a TypeScript keyword. While this file is auto-generated, it is highly recommended to improve the naming in the source OpenAPI specification or generator configuration to something more specific, such as IntegrationTypeGA3.

@clllaur
clllaur force-pushed the api-serving-update-6604 branch from 652c47a to 9858341 Compare May 19, 2026 11:58
@clllaur
clllaur force-pushed the api-serving-update-6604 branch from 9858341 to c379e1d Compare May 19, 2026 12:56
@sonarqubecloud

Copy link
Copy Markdown

@JosephSamirL
JosephSamirL merged commit 3657ed4 into main-convert May 19, 2026
5 checks passed
@JosephSamirL
JosephSamirL deleted the api-serving-update-6604 branch May 19, 2026 13:45
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.

3 participants