Skip to content

Add provider validation test for orphan activities (instance deleted without cancellation) #37

@affandar

Description

@affandar

Context

When implementing the queue-row cancel flag proposal (see proposals/activity-cancellation-queue-flag.md), we identified a gap in test coverage:

Scenario: An instance is deleted while activities are still in the worker queue, without first processing a CancelInstance.

What happens

  1. The cancel_requested flag is never set (no runtime turn processed cancellation)
  2. Worker fetches the activity, sees cancel_requested=false, and executes it
  3. Worker completes and enqueues ActivityCompleted to orchestrator queue
  4. The completion sits in the orchestrator queue forever (no instance to process it)

Why this is acceptable

  • The completion is harmless - it will either be filtered or ignored
  • Direct instance deletion is a management/admin operation, not normal runtime flow
  • The runtime already handles orphan completions gracefully

Test needed

Add a provider validation test that:

  1. Creates an instance and schedules an activity
  2. Deletes/archives the instance (bypassing normal cancellation flow)
  3. Fetches the activity work item
  4. Verifies the expected behavior (activity executes, completion is orphaned)

Blocker

This test cannot be implemented until the Provider trait supports instance deletion or archival. Currently there is no delete_instance or archive_instance method.

Related

  • proposals/activity-cancellation-queue-flag.md - Queue-row cancel flag proposal
  • src/provider_validation/cancellation.rs - Existing cancellation tests (to be replaced)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions