Skip to content

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

Merged
ryan953 merged 6 commits intomasterfrom
ryan953/seer-projects-stopping-point
Apr 7, 2026
Merged

feat(seer): Add the stopping-point field to project-specific seer settings#112232
ryan953 merged 6 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if we switch to queryOptions this should be implicitly lint-able with:

https://tanstack.com/query/v5/docs/eslint/prefer-query-options

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 :(

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.

@ryan953 ryan953 requested a review from a team April 6, 2026 18:46
…eference field

The onSuccess handler was spreading the entire SeerPreferencesResponse object
(which contains code_mapping_repos and preference) directly into the preference
field. The preference field expects ProjectSeerPreferences (repositories,
automated_run_stopping_point, automation_handoff), so this created a malformed
cache entry with a nested preference key and a misplaced code_mapping_repos field.

Fix by spreading preferencePayload.preference instead of preferencePayload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
setApiQueryData<SeerPreferencesResponse>(queryClient, seerPrefsQueryKey, {
...previous,
preference: {
repositories: [],
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 in onSuccess spreads preferencePayload.preference without guarding against null or undefined, leading to an incomplete cache update and stale UI data.
Severity: MEDIUM

Suggested Fix

Guard against null or undefined values before spreading preferencePayload.preference. For example, use the nullish coalescing operator: ...(preferencePayload.preference ?? {}).

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

Potential issue: In the `onSuccess` handler for a mutation, the code updates the cache
optimistically by spreading `preferencePayload.preference`. However, the type for this
property allows it to be `null` or `undefined`. When a `null` or `undefined` value is
received from the API, spreading it is a no-op in JavaScript. This causes the new
`automated_run_stopping_point` value to be omitted from the cache update, resulting in a
silent data corruption. The UI will then display stale data until a forced refetch
occurs, which can cause a visual flicker.

@ryan953 ryan953 merged commit 1ac5e9a into master Apr 7, 2026
67 of 68 checks passed
@ryan953 ryan953 deleted the ryan953/seer-projects-stopping-point branch April 7, 2026 15:23
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…tings (#112232)

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.

<img width="960" height="383" alt="SCR-20260403-msjw"
src="https://github.com/user-attachments/assets/09b86dd8-6a0e-4bf5-89d9-9cd9d9649f6d"
/>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants