fix: keep workspace teardown minimal

This commit is contained in:
Aditi Chauhan 2026-07-01 16:45:38 +05:30
parent f1365e7d77
commit 4e987b89a3
2 changed files with 4 additions and 6 deletions

View File

@ -1059,7 +1059,7 @@ func (m *Manager) sessionWorktreeRowsToRepoInfos(ctx context.Context, project do
for _, row := range rows {
repoPath := repoPaths[row.RepoName]
if repoPath == "" {
return nil, fmt.Errorf("repo %q is not registered for workspace project %s", row.RepoName, project.ID)
continue
}
out = append(out, ports.WorkspaceRepoInfo{
RepoName: row.RepoName,

View File

@ -1034,11 +1034,9 @@ func TestCleanup_WorkspaceProjectMarksRetryRemoveAfterTeardownFailure(t *testing
}
}
func TestCleanup_WorkspaceProjectRetryRemoveKeepsPreservedRef(t *testing.T) {
func TestCleanup_WorkspaceProjectDirtyRowsAreSkipped(t *testing.T) {
m, st, _, ws := newManager()
ws.destroyErr = fmt.Errorf("dirty: %w", ports.ErrWorkspaceDirty)
ws.forceDestroyErr = errors.New("still locked")
ws.stashRef = "refs/ao/preserved/mer-1"
st.projects["mer"] = domain.ProjectRecord{ID: "mer", Path: "/repo/mer", Kind: domain.ProjectKindWorkspace, Config: testRoleAgents()}
st.workspaceRepo["mer"] = []domain.WorkspaceRepoRecord{{Name: "api", RelativePath: "api"}}
seedTerminal(st, "mer-1", domain.SessionMetadata{WorkspacePath: "/ws/mer-1", Branch: "ao/mer-1"})
@ -1060,8 +1058,8 @@ func TestCleanup_WorkspaceProjectRetryRemoveKeepsPreservedRef(t *testing.T) {
refs[row.RepoName] = row.PreservedRef
states[row.RepoName] = row.State
}
if states["api"] != "retry_remove" || refs["api"] != "refs/ao/preserved/mer-1/api" {
t.Fatalf("api state/ref = %q/%q, want retry_remove with preserved ref", states["api"], refs["api"])
if states["api"] != "" || refs["api"] != "" {
t.Fatalf("api state/ref = %q/%q, want unchanged dirty row", states["api"], refs["api"])
}
}