Skip to content

[Bug]: ChainService.cancelExecution - Missing or incorrect status when already cancelled #4

@SSJane

Description

@SSJane

Bug Description

🧩 Test case

src/lib/__tests__/chain-service.test.ts > ChainService - Edge Cases & Errors > should ignore cancelExecution when already cancelled


📍 Suspected Root Cause

  • cancelExecution() does not persist the status update back to the database.
  • getExecution() might return undefined because the execution was never stored.
  • The test setup might not create and save the execution object before invoking cancelExecution().

Steps to Reproduce

  1. Create a mock execution with status: "cancelled".
  2. Call cancelExecution(execution.id) again.
  3. Call getExecution(execution.id) afterward.
  4. Observe that result?.status is undefined instead of "cancelled".

Expected Behavior

When calling cancelExecution() on an execution with status = "cancelled", the service should:

  1. Not throw any errors.
  2. Keep the status as "cancelled".
  3. Return a valid execution object when getExecution() is called.

Actual Behavior

expected undefined to be 'cancelled'

Environment

Vitest/ui v4.0.5
Vitest/coverage-v8 v4.0.4

Node.js v22.2.0

OS: Windows 11

File: src/lib/chain-service.ts

Test file: chain-service.test.ts

Screenshots

Image

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions