Skip to content

Commit a7abad1

Browse files
feat(triage signals): Auto Trigger default settings change [feature flagged] (#103992)
## PR Details + When `triage-signals-v0` feature flag is enabled, the "Auto-Trigger Fixes" toggle defaults to checked for new projects (undefined value). Setting persists on user interaction with the form. + Existing projects with automation explicitly disabled (`'off'`) will see the toggle unchecked, moving them over will be handled in the onboarding billing logic.
1 parent 3277abc commit a7abad1

File tree

2 files changed

+54
-23
lines changed

2 files changed

+54
-23
lines changed

static/app/views/settings/projectSeer/index.spec.tsx

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ describe('ProjectSeer', () => {
547547
it('hides Scan Issues toggle when triage-signals-v0 feature flag is enabled', async () => {
548548
const projectWithFeatureFlag = ProjectFixture({
549549
features: ['triage-signals-v0'],
550+
autofixAutomationTuning: 'medium', // Already enabled, so no auto-enable PUT
550551
});
551552

552553
render(<ProjectSeer />, {
@@ -583,7 +584,7 @@ describe('ProjectSeer', () => {
583584
const projectWithFlag = ProjectFixture({
584585
features: ['triage-signals-v0'],
585586
seerScannerAutomation: true,
586-
autofixAutomationTuning: 'off',
587+
autofixAutomationTuning: 'medium', // Already enabled, so no auto-enable PUT
587588
});
588589

589590
const {unmount} = render(<ProjectSeer />, {
@@ -620,30 +621,16 @@ describe('ProjectSeer', () => {
620621
).not.toBeInTheDocument();
621622
});
622623

623-
it('maps values correctly: off=unchecked, others=checked', async () => {
624-
const {unmount} = render(<ProjectSeer />, {
625-
organization,
626-
outletContext: {
627-
project: ProjectFixture({
628-
features: ['triage-signals-v0'],
629-
seerScannerAutomation: true,
630-
autofixAutomationTuning: 'off',
631-
}),
632-
},
633-
});
634-
635-
expect(
636-
await screen.findByRole('checkbox', {name: /Auto-Trigger Fixes/i})
637-
).not.toBeChecked();
638-
unmount();
639-
624+
it('toggle is always checked when triage-signals-v0 flag is enabled', async () => {
625+
// When flag is on, the toggle is always checked regardless of stored value
626+
// because we default to ON for triage signals users
640627
render(<ProjectSeer />, {
641628
organization,
642629
outletContext: {
643630
project: ProjectFixture({
644631
features: ['triage-signals-v0'],
645632
seerScannerAutomation: true,
646-
autofixAutomationTuning: 'high',
633+
autofixAutomationTuning: 'medium',
647634
}),
648635
},
649636
});
@@ -666,30 +653,70 @@ describe('ProjectSeer', () => {
666653
project: ProjectFixture({
667654
features: ['triage-signals-v0'],
668655
seerScannerAutomation: true,
669-
autofixAutomationTuning: 'off',
656+
autofixAutomationTuning: 'medium', // Start with enabled so no auto-enable
670657
}),
671658
},
672659
});
673660

674661
const toggle = await screen.findByRole('checkbox', {name: /Auto-Trigger Fixes/i});
662+
expect(toggle).toBeChecked();
663+
664+
// Toggle OFF
675665
await userEvent.click(toggle);
676666

677667
await waitFor(() => {
678668
expect(projectPutRequest).toHaveBeenCalledWith(
679669
expect.any(String),
680-
expect.objectContaining({data: {autofixAutomationTuning: 'medium'}})
670+
expect.objectContaining({data: {autofixAutomationTuning: 'off'}})
681671
);
682672
});
683673

674+
// Toggle back ON
684675
await userEvent.click(toggle);
685676

686677
await waitFor(() => {
687678
expect(projectPutRequest).toHaveBeenCalledWith(
688679
expect.any(String),
689-
expect.objectContaining({data: {autofixAutomationTuning: 'off'}})
680+
expect.objectContaining({data: {autofixAutomationTuning: 'medium'}})
690681
);
691682
});
692683
});
684+
685+
it('respects existing off setting for orgs with flag enabled', async () => {
686+
render(<ProjectSeer />, {
687+
organization,
688+
outletContext: {
689+
project: ProjectFixture({
690+
features: ['triage-signals-v0'],
691+
seerScannerAutomation: true,
692+
autofixAutomationTuning: 'off', // Existing org with it disabled
693+
}),
694+
},
695+
});
696+
697+
// Toggle should be unchecked, respecting the existing 'off' setting
698+
expect(
699+
await screen.findByRole('checkbox', {name: /Auto-Trigger Fixes/i})
700+
).not.toBeChecked();
701+
});
702+
703+
it('defaults to ON for new orgs (undefined value)', async () => {
704+
render(<ProjectSeer />, {
705+
organization,
706+
outletContext: {
707+
project: ProjectFixture({
708+
features: ['triage-signals-v0'],
709+
seerScannerAutomation: true,
710+
autofixAutomationTuning: undefined, // New org
711+
}),
712+
},
713+
});
714+
715+
// Toggle should be checked for new orgs
716+
expect(
717+
await screen.findByRole('checkbox', {name: /Auto-Trigger Fixes/i})
718+
).toBeChecked();
719+
});
693720
});
694721

695722
describe('Auto Create PR Setting', () => {

static/app/views/settings/projectSeer/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,11 @@ function ProjectSeerGeneralForm({project}: {project: Project}) {
327327
},
328328
];
329329

330+
// When triage signals flag is on, toggle defaults to checked unless explicitly 'off'
331+
// - New orgs (undefined): shows checked, persists on form interaction
332+
// - Existing orgs with 'off': shows unchecked, preserves their choice
330333
const automationTuning = isTriageSignalsFeatureOn
331-
? (project.autofixAutomationTuning ?? 'off') !== 'off'
334+
? project.autofixAutomationTuning !== 'off'
332335
: (project.autofixAutomationTuning ?? 'off');
333336

334337
return (
@@ -346,6 +349,7 @@ function ProjectSeerGeneralForm({project}: {project: Project}) {
346349
initialData={{
347350
seerScannerAutomation: project.seerScannerAutomation ?? false,
348351
// Same DB field, different UI: toggle (boolean) vs dropdown (string)
352+
// When triage signals flag is on, default to true (ON)
349353
autofixAutomationTuning: automationTuning,
350354
automated_run_stopping_point: preference?.automation_handoff
351355
? 'cursor_handoff'

0 commit comments

Comments
 (0)