From bc458c816f2d7bc5fc328fea54f3b9033383f596 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Tue, 23 Jun 2026 23:46:12 -0700 Subject: [PATCH] Test dropping visit timestamps for removed runtime repos Verify that removing an unhydrated runtime repository successfully drops its associated worktree entries from the persisted visit history. --- src/renderer/src/store/slices/repos.test.ts | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/renderer/src/store/slices/repos.test.ts b/src/renderer/src/store/slices/repos.test.ts index 0db2f3e9576..38087dc087e 100644 --- a/src/renderer/src/store/slices/repos.test.ts +++ b/src/renderer/src/store/slices/repos.test.ts @@ -688,6 +688,39 @@ describe('repo slice runtime routing', () => { expect(reposRemove).toHaveBeenCalledWith({ repoId: sshRepo.id }) }) + it('drops persisted visit timestamps for removed unhydrated runtime repos', async () => { + runtimeEnvironmentCall.mockResolvedValue({ + id: 'rpc-remove-runtime-unhydrated', + ok: true, + result: { removed: true }, + _meta: { runtimeId: 'runtime-remote' } + }) + const store = createTestStore() + const remoteWorktreeId = `${remoteRepo.id}::/srv/orca/wt` + const localWorktreeId = `${localRepo.id}::/local/wt` + store.setState({ + settings: { activeRuntimeEnvironmentId: 'env-1' } as never, + repos: [remoteRepo, localRepo], + activeRepoId: remoteRepo.id, + lastVisitedAtByWorktreeId: { + [remoteWorktreeId]: 100, + [localWorktreeId]: 200 + } + }) + + await store.getState().removeProject(remoteRepo.id) + + expect(store.getState().repos).toEqual([localRepo]) + expect(store.getState().lastVisitedAtByWorktreeId).toEqual({ [localWorktreeId]: 200 }) + expect(runtimeEnvironmentCall).toHaveBeenCalledWith({ + selector: 'env-1', + method: 'repo.rm', + params: { repo: remoteRepo.id }, + timeoutMs: 15_000 + }) + expect(reposRemove).not.toHaveBeenCalled() + }) + it('evicts GitHub caches for removed repos using repo id and legacy path keys', async () => { const store = createTestStore() store.setState({