Skip to content

feat(seer): Add the stopping-point field to project-specific seer settings#112232

Open
ryan953 wants to merge 2 commits intomasterfrom
ryan953/seer-projects-stopping-point
Open

feat(seer): Add the stopping-point field to project-specific seer settings#112232
ryan953 wants to merge 2 commits intomasterfrom
ryan953/seer-projects-stopping-point

Conversation

@ryan953
Copy link
Copy Markdown
Member

@ryan953 ryan953 commented Apr 3, 2026

This brings in the stopping-point dropdown to the project-specific seer settings page

Follows: #112211

There's still more to cleanup in here, but we're well on the way.

SCR-20260403-msjw

@ryan953 ryan953 requested review from a team as code owners April 3, 2026 21:19
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 3, 2026
Comment on lines -129 to -131
getApiUrl(`/organizations/$organizationIdOrSlug/autofix/automation-settings/`, {
path: {organizationIdOrSlug: organization.slug},
}),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This wasn't staying up to date with the actual queryKey in use. We're fetching infinite data, so things would've never matched here.

Requiring the proper ApiQueryKey type for invalidateQueries is something i want to followup on across the whole codebase, that should encourage more use of apiOptions and similar

organization,
});
queryClient.invalidateQueries({
queryKey: [`/organizations/${organization.slug}/autofix/automation-settings/`],
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

again, wrong query key. People ideally shouldn't be doing string-interpolation for api urls anymore.

Comment on lines +35 to +44
export function getProjectStoppingPointValue(
project: Project,
preference: ProjectSeerPreferences
): SelectValue {
if ([null, undefined, 'off'].includes(project.autofixAutomationTuning)) {
return 'off';
}
return preference.automated_run_stopping_point === 'root_cause' ? 'root_cause' : 'code';
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

same logic as getDefaultStoppingPointValue above, just with different field names

having the names align is a goal as we update the endpoints, but not for this PR :(

Comment on lines +192 to +198
setApiQueryData<SeerPreferencesResponse>(queryClient, seerPrefsQueryKey, {
preference: {
repositories: [],
...previous.preference,
...preferencePayload,
},
code_mapping_repos: previous.code_mapping_repos,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The optimistic cache update for Seer preferences spreads the entire SeerPreferencesResponse into the preference field, creating a malformed cache object with a nested structure.
Severity: MEDIUM

Suggested Fix

In the optimistic update logic, instead of spreading the entire preferencePayload, spread the inner preferencePayload.preference object to match the expected ProjectSeerPreferences type for the preference key.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: static/app/views/settings/seer/overview/utils/seerStoppingPoint.ts#L192-L198

Potential issue: The optimistic cache update for Seer preferences incorrectly spreads
the entire `preferencePayload` object, which is of type `SeerPreferencesResponse`, into
the `preference` field. This field is expected to be of type `ProjectSeerPreferences`.
This data structure mismatch creates a malformed cache object with a nested `preference`
key and misplaced `code_mapping_repos`. This will cause the UI to render with incorrect
data until the cache is invalidated and refetched, potentially leading to transient
display errors or type errors when accessing preference fields.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b840624. Configure here.

...preferencePayload,
},
code_mapping_repos: previous.code_mapping_repos,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cache update spreads wrong object into preference field

High Severity

In the onSuccess handler for getProjectStoppingPointMutationOptions, preferencePayload (a SeerPreferencesResponse) is spread directly into the preference object when updating the query cache. This corrupts the cache by incorrectly injecting code_mapping_repos and a nested preference object into the preference field.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b840624. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant