Skip to content

feat: define the workspace state after a refused delete #5707

Open

Description

@elezar

User Story

As an operator who deletes workspaces, I want to know what state a workspace is in after workspace delete is refused, so I can predict whether its users can still create resources in it.

Problem Statement

DeleteWorkspace marks the workspace Terminating (sets deletion_time and the phase) before it checks for blocking resources. If any exist, it returns failed_precondition ("still contains resources"). The workspace stays Terminating and rejects new resources until the blocking ones are removed and the delete is retried. See crates/openshell-server/src/grpc/workspace.rs.

Nothing public says this. The DeleteWorkspace RPC comment is "Delete a workspace by name", WorkspacePhase has no comments, and the docs show only the workspace delete command. The conformance tests added in #4607 assert the behavior, which conformance should do only for public contracts.

Impact / Why This Matters

A refused delete changes the workspace's state and blocks new creates, which a user wouldn't expect from an error. It differs from a Kubernetes namespace delete, which cascades instead of refusing. The marking does close a real race: without it, a create could slip in between the resource scan and the final delete.

Proposed Design

Decide one of:

  1. Keep the behavior and make it a contract. Document it in the DeleteWorkspace and WorkspacePhase proto comments and in the workspace docs. The conformance assertions then stay as they are.
  2. Refuse without a state change. Scan for blocking resources first and return the error with the workspace still Active. If the scan is empty, mark Terminating and scan again to close the race. Update the conformance tests to match.

Acceptance Criteria

  • The state after a refused delete is documented in the proto comments and the workspace docs, or the behavior is changed as in option 2.
  • The workspace_terminating_rejects_creates and workspace_full_crud_lifecycle conformance tests assert only documented behavior.

Alternatives Considered

Cascade-delete the blocking resources, as Kubernetes does for a namespace. This removes user data on one command, so it needs a separate decision.

Context

Raised while reviewing #4607. The tests there preserve what the legacy workspace_lifecycle e2e test already asserted.

Activity

  1. added
    area:platformSDKs, CLIs, APIs, gateway infrastructure, persistence, configuration, and session management.
    topic:apiPublic APIs, gRPC/protobuf, SDK interfaces, versioning, compatibility, and API design standards.
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:platformSDKs, CLIs, APIs, gateway infrastructure, persistence, configuration, and session management.topic:apiPublic APIs, gRPC/protobuf, SDK interfaces, versioning, compatibility, and API design standards.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions