Verified Commit 7b013863 authored by Juhee Lee's avatar Juhee Lee Committed by GitLab
Browse files

feat: gate duo agent platform UI V2 behind experiment/beta settings

parent 164d37cf
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -717,12 +717,12 @@
        },
        {
          "command": "gl.duoAgentPlatform.enableNewUi",
          "when": "view == gl.webview.agentic-tabs && gitlab:duoAgentPlatformNewUIConfigured",
          "when": "view == gl.webview.agentic-tabs && gitlab:duoAgentPlatformNewUIConfigured && gitlab:experimentFeaturesEnabled",
          "group": "navigation"
        },
        {
          "command": "gl.duoAgentPlatform.disableNewUi",
          "when": "view == gl.webview.root.duoAgentPlatform && gitlab:duoAgentPlatformNewUIConfigured",
          "when": "view == gl.webview.root.duoAgentPlatform && gitlab:duoAgentPlatformNewUIConfigured && gitlab:experimentFeaturesEnabled",
          "group": "navigation"
        }
      ],
@@ -968,13 +968,13 @@
          "type": "webview",
          "id": "gl.webview.agentic-tabs",
          "name": "",
          "when": "config.gitlab.duoAgentPlatform.enabled && !gitlab.featureFlags.duoAgentPlatformNext && (gitlab.featureFlags.duo_agentic_chat || gitlab.featureFlags.duo_workflow)"
          "when": "config.gitlab.duoAgentPlatform.enabled && (!gitlab.featureFlags.duoAgentPlatformNext || !gitlab:experimentFeaturesEnabled) && (gitlab.featureFlags.duo_agentic_chat || gitlab.featureFlags.duo_workflow)"
        },
        {
          "type": "webview",
          "id": "gl.webview.root.duoAgentPlatform",
          "name": "",
          "when": "config.gitlab.duoAgentPlatform.enabled && gitlab.featureFlags.duoAgentPlatformNext && (gitlab.featureFlags.duo_agentic_chat || gitlab.featureFlags.duo_workflow)"
          "when": "config.gitlab.duoAgentPlatform.enabled && gitlab.featureFlags.duoAgentPlatformNext && (gitlab.featureFlags.duo_agentic_chat || gitlab.featureFlags.duo_workflow) && gitlab:experimentFeaturesEnabled"
        }
      ]
    },
@@ -1122,7 +1122,7 @@
          "gitlab.featureFlags.duoAgentPlatformNext": {
            "type": ["boolean", "null"],
            "default": null,
            "markdownDescription": "Show the new GitLab Duo Agent Platform UI in the Agent Platform view. When set to `true` the new UI is shown, when `false` the old UI is shown with a toggle to switch between them, and when unset (`null`) the old UI is shown without a toggle.\n\n_This feature is experimental._",
            "markdownDescription": "Enable the GitLab Duo Agent Platform UI V2 feature\n\n_This feature is experimental._",
            "tags": ["experimental"]
          }
        }
+32 −0
Original line number Diff line number Diff line
@@ -612,6 +612,38 @@ describe('LanguageClientWrapper', () => {
      });
    });

    describe('Experiment features notification', () => {
      const notificationHandlers: Map<
        NotificationType<unknown> | string,
        GenericNotificationHandler
      > = new Map();

      beforeEach(async () => {
        jest.mocked(client.onNotification).mockImplementation((type, handler) => {
          notificationHandlers.set(type, handler);
          return {
            dispose: () => {},
          };
        });

        wrapper = createWrapper();
        await wrapper.initAndStart();
      });

      it.each([true, false])(
        'sets the gitlab:experimentFeaturesEnabled context key when receiving %s',
        async enabled => {
          await notificationHandlers.get('$/gitlab/experimentFeaturesState')?.({ enabled });

          expect(vscode.commands.executeCommand).toHaveBeenCalledWith(
            'setContext',
            'gitlab:experimentFeaturesEnabled',
            enabled,
          );
        },
      );
    });

    describe('Repository Client Setup', () => {
      it('should set up repository client with generic request function', async () => {
        wrapper = createWrapper();
+14 −0
Original line number Diff line number Diff line
@@ -212,6 +212,20 @@ export class LanguageClientWrapperImpl implements LanguageClientWrapper {
      await vscode.window.showInformationMessage('Copied to clipboard');
    });

    this.#client.onNotification(
      '$/gitlab/experimentFeaturesState',
      async ({ enabled }: { enabled: boolean }) => {
        log.info(
          `[experiment-features] Experiment and beta features ${enabled ? 'enabled' : 'disabled'}`,
        );
        await vscode.commands.executeCommand(
          'setContext',
          'gitlab:experimentFeaturesEnabled',
          enabled,
        );
      },
    );

    this.#client.onRequest(AiContextEditorRequests.GIT_DIFF, (params: GitDiffRequest) => {
      log.debug(`Received git diff request: ${JSON.stringify(params)}`);
      return this.#handleGitDiffRequest(params);