Repository navigation
refactor(coderd/x/gitsync): remove unused Worker.RefreshChat - #30944
ibetitsmike wants to merge 3 commits into
Conversation
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.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Removes
Worker.RefreshChatand the fourTestRefreshChat_*tests that only exercised it.RefreshChathas had no production caller since #23901 stopped resolving diff statuses inline onGetChat. The worker's periodic tick is the only refresh path.TestWorker_RefreshDoesNotReorderPrimaryusedRefreshChatto refresh one of two refs. It now keeps the newer ref fresh (StaleAtone 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 checkedRefreshChatitself or is still caught by a remaining test. I mutated the production line behind each shared assertion withgo test -overlay:TestRefreshChat_Success: the upsert uses the chat's IDRefresher.refreshOneupserts a random chat IDTestRefresher_WithPRURL,TestWorker,TestWorker_UpsertError_ContinuesNextRow,TestWorker_RefreshDoesNotReorderPrimaryTestRefreshChat_NoPR: a branch without a PR is not an errorrefreshOnereturns an error when there is no PRTestRefresher_BranchNoPRYetand the threeTestWorker_NoPR_*testsTestRefreshChat_RefreshError: the "no provider" errorRefresher.Refreshchanges the "no provider" messageTestRefresher_NoProviderForOriginThe other assertions (the returned row, the
upsert chat diff statuserror wrap, and the publish call insideRefreshChat) checked only the deleted method. For the rewritten test, a mutant that setsupdated_atinUpsertChatDiffStatusfails both the old and the new version. A mutant that setsupdated_atinAcquireStaleChatDiffStatusesfails only the new version, because the old version never ran a tick.Review focus: the fixture change in
TestWorker_RefreshDoesNotReorderPrimary. #29997 changes one line inTestRefreshChat_RefreshError, so whichever PR lands second drops that test.Validation:
go test ./coderd/x/gitsync/ -count=1passes, and-race -count=5passes.golangci-lint run ./coderd/x/gitsync/...reports 0 issues, and the pre-commit hook passed.