Skip to content

Commit 6353dde

Browse files
wolfibDevtools-frontend LUCI CQ
authored andcommitted
[Patch agent] Remove first-run-disclaimer
The disclaimer was only needed for connecting workspaces from within the patch agent UI. Since the patch agent now only uses workspaces if they have already been set up before via the Sources panel, the patch agent's first-run-disclaimer can be removed. Fixed: 406686142 Change-Id: I18b28475ac9904fd65a8041f96d36986804169c1 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6405319 Commit-Queue: Ergün Erdoğmuş <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]> Auto-Submit: Wolfgang Beyer <[email protected]> Commit-Queue: Wolfgang Beyer <[email protected]>
1 parent ea6ee69 commit 6353dde

File tree

5 files changed

+0
-157
lines changed

5 files changed

+0
-157
lines changed

front_end/panels/ai_assistance/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ devtools_module("ai_assistance") {
3636
"../../models/workspace:bundle",
3737
"../../models/workspace_diff:bundle",
3838
"../../panels/changes:bundle",
39-
"../../panels/common:bundle",
4039
"../../panels/elements:bundle",
4140
"../../panels/network:bundle",
4241
"../../panels/sources:bundle",

front_end/panels/ai_assistance/PatchWidget.test.ts

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import * as Common from '../../core/common/common.js';
65
import * as Platform from '../../core/platform/platform.js';
76
import * as Root from '../../core/root/root.js';
87
import * as AiAssistanceModel from '../../models/ai_assistance/ai_assistance.js';
98
import * as Workspace from '../../models/workspace/workspace.js';
10-
import * as PanelCommon from '../../panels/common/common.js';
119
import {
1210
cleanup,
1311
createPatchWidget,
@@ -24,11 +22,7 @@ import {createContentProviderUISourceCode, createFileSystemUISourceCode} from '.
2422
import * as AiAssistance from './ai_assistance.js';
2523

2624
describeWithMockConnection('PatchWidget', () => {
27-
let showFreDialogStub: sinon.SinonStub<Parameters<typeof PanelCommon.FreDialog.show>, Promise<boolean>>;
2825
beforeEach(() => {
29-
Common.Settings.moduleSetting('ai-assistance-patching-fre-completed').set(true);
30-
showFreDialogStub = sinon.stub(PanelCommon.FreDialog, 'show');
31-
3226
initializePersistenceImplForTests();
3327
});
3428

@@ -54,51 +48,8 @@ describeWithMockConnection('PatchWidget', () => {
5448
});
5549

5650
describe('enterprise text cases', () => {
57-
it('should FRE text include no logging case when the enterprise policy value is ALLOW_WITHOUT_LOGGING',
58-
async () => {
59-
Common.Settings.moduleSetting('ai-assistance-patching-fre-completed').set(false);
60-
updateHostConfig({
61-
devToolsFreestyler: {
62-
enabled: true,
63-
patching: true,
64-
},
65-
aidaAvailability: {enterprisePolicyValue: Root.Runtime.GenAiEnterprisePolicyValue.ALLOW_WITHOUT_LOGGING}
66-
});
67-
const {view, widget} = await createPatchWidget();
68-
widget.changeSummary = 'body { background-color: red; }';
69-
70-
view.input.onApplyToPageTree();
71-
72-
assert.isTrue(showFreDialogStub.called, 'Expected FreDialog to be shown but it\'s not shown');
73-
assert.exists(showFreDialogStub.lastCall.args[0].reminderItems.find(
74-
reminderItem => reminderItem.content.toString().includes(
75-
'This data will not be used to improve Google’s AI models.')));
76-
});
77-
78-
it('should FRE text not include no logging case when the enterprise policy value is ALLOW_WITHOUT_LOGGING',
79-
async () => {
80-
Common.Settings.moduleSetting('ai-assistance-patching-fre-completed').set(false);
81-
updateHostConfig({
82-
devToolsFreestyler: {
83-
enabled: true,
84-
patching: true,
85-
},
86-
aidaAvailability: {enterprisePolicyValue: Root.Runtime.GenAiEnterprisePolicyValue.ALLOW}
87-
});
88-
const {view, widget} = await createPatchWidget();
89-
widget.changeSummary = 'body { background-color: red; }';
90-
91-
view.input.onApplyToPageTree();
92-
93-
assert.isTrue(showFreDialogStub.called, 'Expected FreDialog to be shown but it\'s not shown');
94-
assert.notExists(showFreDialogStub.lastCall.args[0].reminderItems.find(
95-
reminderItem => reminderItem.content.toString().includes(
96-
'This data will not be used to improve Google’s AI models.')));
97-
});
98-
9951
it('should tooltip text include no logging case when the enterprise policy value is ALLOW_WITHOUT_LOGGING',
10052
async () => {
101-
Common.Settings.moduleSetting('ai-assistance-patching-fre-completed').set(false);
10253
updateHostConfig({
10354
devToolsFreestyler: {
10455
enabled: true,
@@ -113,7 +64,6 @@ describeWithMockConnection('PatchWidget', () => {
11364
});
11465

11566
it('should tooltip text not include no logging case when the enterprise policy value is ALLOW', async () => {
116-
Common.Settings.moduleSetting('ai-assistance-patching-fre-completed').set(false);
11767
updateHostConfig({
11868
devToolsFreestyler: {
11969
enabled: true,
@@ -128,26 +78,6 @@ describeWithMockConnection('PatchWidget', () => {
12878
});
12979
});
13080

131-
it('should show FRE dialog on applyToPageTree click if the setting is false', async () => {
132-
Common.Settings.moduleSetting('ai-assistance-patching-fre-completed').set(false);
133-
const {view, widget} = await createPatchWidget();
134-
widget.changeSummary = 'body { background-color: red; }';
135-
136-
view.input.onApplyToPageTree();
137-
138-
assert.isTrue(showFreDialogStub.called, 'Expected FreDialog to be shown but it\'s not shown');
139-
});
140-
141-
it('should not show FRE dialog on applyToPageTree click if the setting is true', async () => {
142-
Common.Settings.moduleSetting('ai-assistance-patching-fre-completed').set(true);
143-
const {view, widget} = await createPatchWidget();
144-
widget.changeSummary = 'body { background-color: red; }';
145-
146-
view.input.onApplyToPageTree();
147-
148-
assert.isFalse(showFreDialogStub.called, 'Expected FreDialog to be not shown but it\'s shown');
149-
});
150-
15181
it('should show files uploaded', async () => {
15282
const {view, widget} = await createPatchWidget({
15383
aidaClient: mockAidaClient([

front_end/panels/ai_assistance/PatchWidget.ts

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import '../../ui/components/spinners/spinners.js';
77
import '../../ui/components/tooltips/tooltips.js';
88
import '../../ui/legacy/legacy.js';
99

10-
import * as Common from '../../core/common/common.js';
1110
import * as Host from '../../core/host/host.js';
1211
import * as i18n from '../../core/i18n/i18n.js';
1312
import type * as Platform from '../../core/platform/platform.js';
@@ -20,7 +19,6 @@ import * as UI from '../../ui/legacy/legacy.js';
2019
import {Directives, html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
2120
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
2221
import * as ChangesPanel from '../changes/changes.js';
23-
import * as PanelCommon from '../common/common.js';
2422

2523
const {classMap} = Directives;
2624

@@ -74,27 +72,6 @@ const UIStringsNotTranslate = {
7472
*@description Tooltip link for the navigating to "AI innovations" page in settings.
7573
*/
7674
learnMore: 'Learn more',
77-
/**
78-
*@description Header text for the AI-powered code suggestions disclaimer dialog.
79-
*/
80-
freDisclaimerHeader: 'Get AI-powered code suggestions for your workspace',
81-
/**
82-
*@description First disclaimer item text for the fre dialog.
83-
*/
84-
freDisclaimerTextAiWontAlwaysGetItRight: 'This feature uses AI and won’t always get it right',
85-
/**
86-
*@description Second disclaimer item text for the fre dialog.
87-
*/
88-
freDisclaimerTextPrivacy: 'Source code from the selected folder is sent to Google to generate code suggestions',
89-
/**
90-
*@description Second disclaimer item text for the fre dialog when enterprise logging is off.
91-
*/
92-
freDisclaimerTextPrivacyNoLogging:
93-
'Source code from the selected folder is sent to Google to generate code suggestions. This data will not be used to improve Google’s AI models.',
94-
/**
95-
*@description Third disclaimer item text for the fre dialog.
96-
*/
97-
freDisclaimerTextUseWithCaution: 'Use generated code snippets with caution',
9875
/**
9976
* @description Title of the link opening data that was used to
10077
* produce a code suggestion.
@@ -112,8 +89,6 @@ const UIStringsNotTranslate = {
11289

11390
const lockedString = i18n.i18n.lockedString;
11491

115-
const CODE_SNIPPET_WARNING_URL = 'https://support.google.com/legal/answer/13505487';
116-
11792
export enum PatchSuggestionState {
11893
/**
11994
* The user did not attempt patching yet
@@ -156,9 +131,6 @@ type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
156131
export class PatchWidget extends UI.Widget.Widget {
157132
changeSummary = '';
158133
changeManager: AiAssistanceModel.ChangeManager|undefined;
159-
// Whether the user completed first run experience dialog or not.
160-
#aiPatchingFreCompletedSetting =
161-
Common.Settings.Settings.instance().createSetting('ai-assistance-patching-fre-completed', false);
162134
#view: View;
163135
#viewOutput: ViewOutput = {};
164136
#aidaClient: Host.AidaClient.AidaClient;
@@ -397,64 +369,10 @@ export class PatchWidget extends UI.Widget.Widget {
397369
}
398370
}
399371

400-
async #showFreDisclaimerIfNeeded(): Promise<boolean> {
401-
const isAiPatchingFreCompleted = this.#aiPatchingFreCompletedSetting.get();
402-
if (isAiPatchingFreCompleted) {
403-
return true;
404-
}
405-
406-
const result = await PanelCommon.FreDialog.show({
407-
header: {iconName: 'smart-assistant', text: lockedString(UIStringsNotTranslate.freDisclaimerHeader)},
408-
reminderItems: [
409-
{
410-
iconName: 'psychiatry',
411-
content: lockedString(UIStringsNotTranslate.freDisclaimerTextAiWontAlwaysGetItRight),
412-
},
413-
{
414-
iconName: 'google',
415-
content: this.#noLogging ? lockedString(UIStringsNotTranslate.freDisclaimerTextPrivacyNoLogging) :
416-
lockedString(UIStringsNotTranslate.freDisclaimerTextPrivacy),
417-
},
418-
{
419-
iconName: 'warning',
420-
// clang-format off
421-
content: html`<x-link
422-
href=${CODE_SNIPPET_WARNING_URL}
423-
class="link"
424-
jslog=${VisualLogging.link('code-snippets-explainer.patch-widget').track({
425-
click: true
426-
})}
427-
>${lockedString(UIStringsNotTranslate.freDisclaimerTextUseWithCaution)}</x-link>`,
428-
// clang-format on
429-
}
430-
],
431-
onLearnMoreClick: () => {
432-
void UI.ViewManager.ViewManager.instance().showView('chrome-ai');
433-
}
434-
});
435-
436-
if (result) {
437-
this.#aiPatchingFreCompletedSetting.set(true);
438-
}
439-
return result;
440-
}
441-
442372
async #onApplyToPageTree(): Promise<void> {
443373
if (!isAiAssistancePatchingEnabled()) {
444374
return;
445375
}
446-
447-
// Show the FRE dialog if needed and only continue when
448-
// the user accepted the disclaimer.
449-
const freDisclaimerCompleted = await this.#showFreDisclaimerIfNeeded();
450-
if (!freDisclaimerCompleted) {
451-
return;
452-
}
453-
454-
await this.#applyPatchAndUpdateUI();
455-
}
456-
457-
async #applyPatchAndUpdateUI(): Promise<void> {
458376
const changeSummary = this.changeSummary;
459377
if (!changeSummary) {
460378
throw new Error('Change summary does not exist');

front_end/testing/EnvironmentHelpers.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,6 @@ export async function initializeGlobalVars({reset = true} = {}) {
293293
Common.Settings.SettingCategory.AI, 'ai-annotations-enabled', false, Common.Settings.SettingType.BOOLEAN),
294294
createSettingValue(
295295
Common.Settings.SettingCategory.AI, 'ai-assistance-history-entries', [], Common.Settings.SettingType.ARRAY),
296-
createSettingValue(
297-
Common.Settings.SettingCategory.AI, 'ai-assistance-patching-fre-completed', false,
298-
Common.Settings.SettingType.BOOLEAN),
299296
createSettingValue(
300297
Common.Settings.SettingCategory.MOBILE, 'emulation.show-device-outline', false,
301298
Common.Settings.SettingType.BOOLEAN),

front_end/ui/visual_logging/KnownContextValues.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ export const knownContextValues = new Set([
334334
'ai-assistance-enabled',
335335
'ai-assistance-history-entries',
336336
'ai-assistance-history-images',
337-
'ai-assistance-patching-fre-completed',
338337
'ai-assistance-patching-selected-project-id',
339338
'ai_assistance',
340339
'align-content',

0 commit comments

Comments
 (0)