Skip to content

ref(seer): Rewrite AutofixRepositories using the new /seer/repos/ endpoints#117740

Merged
ryan953 merged 19 commits into
masterfrom
ryan953/ref-autofix-repos
Jun 16, 2026
Merged

ref(seer): Rewrite AutofixRepositories using the new /seer/repos/ endpoints#117740
ryan953 merged 19 commits into
masterfrom
ryan953/ref-autofix-repos

Conversation

@ryan953

@ryan953 ryan953 commented Jun 15, 2026

Copy link
Copy Markdown
Member

This meant adding a includeInstructions prop to the new version, which revealed that the inputs needed to be debounced. apparently saving a default-branch name before was problematic

With instructions added
SCR-20260614-lqlb

Note: these were originally stacked into #117618 and #117630 but i messed that up somehow to update things on master. So now they're together and ready to go. No changes made since before.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 15, 2026
ryan953 and others added 3 commits June 15, 2026 13:45
This meant adding a `includeInstructions` prop to the new version, which revealed that the inputs needed to be debounced. apparently saving a default-branch name before was problematic
… component

Adapt test assertions after the AutofixRepositories refactor:
- Add preference.repositories to mock data (component now uses
  preference instead of code_mapping_repos for the repo list)
- Update button labels: 'Add Repos' -> 'Add Repositories to Project',
  'Remove Repository' -> 'Disconnect Repository'
- Remove explicit Save button click in update test (component now
  auto-saves via debounce)
- Use objectContaining matchers for flexible POST payload assertions

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.70% 93.70% ±0%
Typed 133,020 132,935 🔴 -85
Untyped 8,942 8,941 🟢 -1
🔍 1 new type safety issue introduced

Non-null assertions (!) (1 new)

File Line Detail
static/app/components/seer/legacy/addAutofixRepoModal.tsx 166 filteredRepositories[virtualItem.index]!

This is informational only and does not block the PR.

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Story previews

Preview the stories changed in this PR on the Vercel deployment:

Preview deployment: https://sentry-ddxxl5tqy.sentry.dev

@ryan953 ryan953 marked this pull request as ready for review June 15, 2026 21:09
@ryan953 ryan953 requested review from a team as code owners June 15, 2026 21:09
Comment thread static/gsApp/views/seerAutomation/onboarding/onboardingLegacy.tsx Outdated
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx Outdated
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx Outdated
Comment thread static/app/utils/seer/seerProjectRepos.ts Outdated
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx Outdated
@ryan953 ryan953 enabled auto-merge (squash) June 15, 2026 21:15
Comment thread static/app/utils/seer/seerProjectRepos.ts
Comment thread static/app/utils/seer/seerProjectRepos.ts Outdated
ryan953 added 3 commits June 15, 2026 14:35
The onSettled callback was passing an array of query keys (from .map())
as the queryKey option, creating a nested array that TanStack Query
could never match. Loop and invalidate each repo's key individually.
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx
The AutofixRepositoriesList component now fetches repos from
GET /seer/repos/ and mutates via POST/PUT/DELETE on the same
endpoint, instead of going through POST /seer/preferences/.

- Add GET /seer/repos/ mock in beforeEach and all clearMockResponses() tests
- Update 'can add' test to assert POST /seer/repos/
- Update 'can update' test to assert PUT /seer/repos/:id/
- Update 'can remove' test to assert DELETE /seer/repos/:id/
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx
The frontend used split('/') without a limit, which breaks GitLab
subgroup repos (e.g. "Org / Subgroup / Repo") by only capturing the
second segment as the name. Use indexOf + slice to match the backend's
split("/", 1) behavior in _serialize_project_repo().

See: src/sentry/seer/endpoints/project_seer_repos.py

@cursor cursor Bot left a comment

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.

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 5e6d47d. Configure here.

onChangeDebounceMs: 1000,
onChange: ({formApi}) => formApi.handleSubmit(),
},
onSubmit: ({value}) => handleUpdateRepo(repoSchema.parse(value)),

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.

Incomplete overrides block autosave

Medium Severity

Debounced autosave validates the whole branchOverrides array before submit. A partially filled override row fails overrideItemSchema, so handleSubmit never runs and completed overrides or edits to other rows are not persisted until every draft row is valid or removed.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5e6d47d. Configure here.

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.

disagree. I can see that autosave works.

Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx
…m to fix nested form

Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Comment thread static/app/components/seer/legacy/addAutofixRepoModal.tsx Outdated
Comment on lines +103 to +105
useEffect(() => {
setShowMaxLimitAlert(selectedExternalIds.length >= MAX_REPOS_LIMIT);
}, [selectedExternalIds.length]);

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 repository limit alert does not account for existing repositories, causing silent UI blocking when the total limit is reached.
Severity: MEDIUM

Suggested Fix

Update the useEffect hook that sets the showMaxLimitAlert. The condition should be changed to selectedExternalIds.length + hiddenExternalIds.length >= MAX_REPOS_LIMIT to be consistent with the selection-blocking logic in handleToggleRepository.

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/components/seer/legacy/addAutofixRepoModal.tsx#L103-L105

Potential issue: The logic to display a repository limit alert is inconsistent with the
logic that enforces the limit. The alert is triggered when `selectedExternalIds.length
>= MAX_REPOS_LIMIT`, only considering newly selected repositories. However, the
selection is blocked based on `hiddenExternalIds.length + prev.length >=
MAX_REPOS_LIMIT`, which includes already-connected repositories. This causes a situation
where a user can be blocked from selecting more repositories without any alert or
feedback, creating a confusing user experience where clicks have no effect.

…submit

Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
@ryan953 ryan953 merged commit 166db99 into master Jun 16, 2026
75 checks passed
@ryan953 ryan953 deleted the ryan953/ref-autofix-repos branch June 16, 2026 15:59
sehr-m pushed a commit that referenced this pull request Jun 23, 2026
…points (#117740)

This meant adding a `includeInstructions` prop to the new version, which
revealed that the inputs needed to be debounced. apparently saving a
default-branch name before was problematic

With instructions added
<img width="819" height="547" alt="SCR-20260614-lqlb"
src="https://github.com/user-attachments/assets/325af416-9b42-4de1-b190-f8bc874ecd79"
/>


Note: these were originally stacked into
#117618 and
#117630 but i messed that up
somehow to update things on master. So now they're together and ready to
go. No changes made since before.

---------

Co-authored-by: Claude Opus 4 <noreply@anthropic.com>
Co-authored-by: Ryan Albrecht <ryan953@MLHJDQR9VJ.local>
Co-authored-by: billy <billy@sentry.io>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.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