ref(seer): Rewrite AutofixRepositories using the new /seer/repos/ endpoints#117740
Conversation
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>
094b0fe to
f0050e8
Compare
📊 Type Coverage Diff
🔍 1 new type safety issue introducedNon-null assertions (
This is informational only and does not block the PR. |
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-ddxxl5tqy.sentry.dev |
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.
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/
b857bbe to
212cdc2
Compare
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
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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)), |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 5e6d47d. Configure here.
There was a problem hiding this comment.
disagree. I can see that autosave works.
…m to fix nested form Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
| useEffect(() => { | ||
| setShowMaxLimitAlert(selectedExternalIds.length >= MAX_REPOS_LIMIT); | ||
| }, [selectedExternalIds.length]); |
There was a problem hiding this comment.
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>
…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>


This meant adding a
includeInstructionsprop to the new version, which revealed that the inputs needed to be debounced. apparently saving a default-branch name before was problematicWith instructions added

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.