Skip to content

refactor(coderd/x/gitsync): remove unused Worker.RefreshChat - #30944

Draft
ibetitsmike wants to merge 3 commits into
mainfrom
mike/gitsync-remove-refresh-chat
Draft

ibetitsmike wants to merge 3 commits into
mainfrom
mike/gitsync-remove-refresh-chat

Conversation

@ibetitsmike

Copy link
Copy Markdown
Collaborator

Removes Worker.RefreshChat and the four TestRefreshChat_* tests that only exercised it. RefreshChat has had no production caller since #23901 stopped resolving diff statuses inline on GetChat. The worker's periodic tick is the only refresh path.

TestWorker_RefreshDoesNotReorderPrimary used RefreshChat to refresh one of two refs. It now keeps the newer ref fresh (StaleAt one hour ahead) and runs one worker tick, so it checks the same ordering rule through the production path.

Why removal is safe: git grep '\.RefreshChat(' finds no caller. Each removed assertion either checked RefreshChat itself or is still caught by a remaining test. I mutated the production line behind each shared assertion with go test -overlay:

Removed test and assertion Mutant Remaining tests that fail
TestRefreshChat_Success: the upsert uses the chat's ID Refresher.refreshOne upserts a random chat ID TestRefresher_WithPRURL, TestWorker, TestWorker_UpsertError_ContinuesNextRow, TestWorker_RefreshDoesNotReorderPrimary
TestRefreshChat_NoPR: a branch without a PR is not an error refreshOne returns an error when there is no PR TestRefresher_BranchNoPRYet and the three TestWorker_NoPR_* tests
TestRefreshChat_RefreshError: the "no provider" error Refresher.Refresh changes the "no provider" message TestRefresher_NoProviderForOrigin

The other assertions (the returned row, the upsert chat diff status error wrap, and the publish call inside RefreshChat) checked only the deleted method. For the rewritten test, a mutant that sets updated_at in UpsertChatDiffStatus fails both the old and the new version. A mutant that sets updated_at in AcquireStaleChatDiffStatuses fails only the new version, because the old version never ran a tick.

Review focus: the fixture change in TestWorker_RefreshDoesNotReorderPrimary. #29997 changes one line in TestRefreshChat_RefreshError, so whichever PR lands second drops that test.

Validation:

  • go test ./coderd/x/gitsync/ -count=1 passes, and -race -count=5 passes.
  • golangci-lint run ./coderd/x/gitsync/... reports 0 issues, and the pre-commit hook passed.

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

Worker.RefreshChat has had no production caller since diff statuses
stopped resolving inline on GetChat. Remove it and the four
TestRefreshChat_* tests that existed only to exercise it.

TestWorker_RefreshDoesNotReorderPrimary used RefreshChat to refresh one
of two stale refs. It now leaves the newer ref fresh and runs one worker
tick, so the test covers the production refresh path.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T17:07:54.645196Z 25c75ac Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: deafc51438

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, requested this review for @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 25c75ac6fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant