Skip to content

Commit 5fbf327

Browse files
committed
use same language in usercheck middleware docs as swagger
1 parent ae442c9 commit 5fbf327

File tree

3 files changed

+33
-38
lines changed

3 files changed

+33
-38
lines changed

backend/packages/Upgrade/src/api/controllers/ExperimentClientController.v6.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ export class ExperimentClientController {
679679
* **Ephemeral Mode** (Session-only groups):
680680
* - Set `includeStoredUserGroups` to `false` and provide `groupsForSession`
681681
* - Uses only the groups provided in the session, ignoring any stored user groups.
682+
* - Does not require the user to be initialized (it will bypass stored user lookup)
682683
* - Useful when complete group information is always provided at runtime.
683684
*
684685
* **Merged Mode** (Stored + Session groups):

backend/packages/Upgrade/src/api/middlewares/UserCheckMiddleware.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,23 @@ export class UserCheckMiddleware {
5757
*
5858
* Note: provided session groups are never persisted
5959
*
60-
* **Scenario 1: Session-only groups (Ephemeral group user request)**
61-
* - `groupsForSession`: provided
62-
* - `includeStoredUserGroups`: explicitly `false`
63-
* - Behavior: Uses ONLY the provided session groups, ignoring any stored user groups
64-
* - Use case: Contexts where complete group information is preferred to be provided at runtime,
65-
* rather reading from stored user groups.
60+
* **Stored-user Mode** (Standard stored user lookup):
61+
* - Omit both `groupsForSession` and `includeStoredUserGroups` parameters
62+
* - Uses only stored user groups from the database
63+
* - User must already have been initialized, will 404 if user does not exist
6664
*
67-
* **Scenario 2: Merged groups (Merged stored/ephemeral groups request mode)**
68-
* - `groupsForSession`: provided
69-
* - `includeStoredUserGroups`: `true`
70-
* - Behavior: Merges session groups with stored user groups, if they don't already exist
71-
* - Use case: Adding temporary context while preserving existing user groups
72-
* - Note: This will 404 if user does not exist, as use cases would only exist for application
73-
* contexts that are 'dependent' on another context to set complete user data.
65+
* **Ephemeral Mode** (Session-only groups):
66+
* - Set `includeStoredUserGroups` to `false` and provide `groupsForSession`
67+
* - Uses only the groups provided in the session, ignoring any stored user groups.
68+
* - Does not require the user to be initialized (it will bypass stored user lookup)
69+
* - Useful when complete group information is always provided at runtime.
7470
*
75-
* **Scenario 3: Default behavior (Standard mode)**
76-
* - `groupsForSession`: not provided or undefined
77-
* - `includeStoredUserGroups`: not provided or undefined
78-
* - Behavior: Uses standard user lookup with stored groups only
79-
* - Use case: Normal feature flag evaluation without session context
71+
* **Merged Mode** (Stored + Session groups):
72+
* - Set `includeStoredUserGroups` to `true` and provide `groupsForSession`
73+
* - User must already have been initialized, will 404 if user does not exist.
74+
* - Session groups are merged with stored groups if they don't already exist for stored user.
75+
* - Session groups are never persisted.
76+
* - Useful for adding context-specific ephemeral groups to an existing user.
8077
*
8178
* @param req - The application request containing session group parameters
8279
* @param user_id - The user identifier for group lookup

clientlibs/js/src/UpGradeClient/UpgradeClient.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,23 @@ export default class UpgradeClient {
9191
* const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context, options);
9292
* ```
9393
*
94-
* **Scenario 1: Session-only groups (Ephemeral user request)**
95-
* - `groupsForSession`: provided
96-
* - `includeStoredUserGroups`: explicitly `false`
97-
* - Behavior: Uses ONLY the provided session groups, ignoring any stored user groups
98-
* - Use case: Contexts where complete group information is preferred to be provided at runtime,
99-
* rather reading from stored user groups.
100-
*
101-
* **Scenario 2: Merged groups (Merged stored/ephemeral groups request mode)**
102-
* - `groupsForSession`: provided
103-
* - `includeStoredUserGroups`: `true`
104-
* - Behavior: Merges session groups with stored user groups, if they don't already exist
105-
* - Use case: Adding temporary context while preserving existing user groups
106-
* - Note: This will 404 if user does not exist, as use cases would only exist for application
107-
* contexts that are 'dependent' on another context to set complete user data.
108-
*
109-
* **Scenario 3: Default behavior (Standard mode)**
110-
* - `groupsForSession`: not provided or undefined
111-
* - `includeStoredUserGroups`: not provided or undefined
112-
* - Behavior: Uses standard user lookup with stored groups only
113-
* - Use case: Normal feature flag evaluation without session context
94+
* **Stored-user Mode** (Standard stored user lookup):
95+
* - Omit both `groupsForSession` and `includeStoredUserGroups` parameters
96+
* - Uses only stored user groups from the database
97+
* - User must already have been initialized, will 404 if user does not exist
98+
*
99+
* **Ephemeral Mode** (Session-only groups):
100+
* - Set `includeStoredUserGroups` to `false` and provide `groupsForSession`
101+
* - Uses only the groups provided in the session, ignoring any stored user groups.
102+
* - Does not require the user to be initialized (it will bypass stored user lookup)
103+
* - Useful when complete group information is always provided at runtime.
104+
*
105+
* **Merged Mode** (Stored + Session groups):
106+
* - Set `includeStoredUserGroups` to `true` and provide `groupsForSession`
107+
* - User must already have been initialized, will 404 if user does not exist.
108+
* - Session groups are merged with stored groups if they don't already exist for stored user.
109+
* - Session groups are never persisted.
110+
* - Useful for adding context-specific ephemeral groups to an existing user.
114111
*/
115112

116113
constructor(userId: string, hostUrl: string, context: string, options?: UpGradeClientInterfaces.IConfigOptions) {

0 commit comments

Comments
 (0)