Skip to content
Tracon

WorkflowCheckpointStoreContract

Namespace Tracon.Testing.Contracts.Storage · Assembly Tracon.Testing.Contracts.Xunit.dll

Behavior tests for the IWorkflowCheckpointStore contract.

public abstract class WorkflowCheckpointStoreContract : TenantIsolationContract<IWorkflowCheckpointStore>, IAsyncLifetime, IAsyncDisposable
Inheritance
object ← StoreCancellationContract<IWorkflowCheckpointStore> ← TenantIsolationContract<IWorkflowCheckpointStore> ← WorkflowCheckpointStoreContract
Implements
IAsyncLifetime, IAsyncDisposable
Inherited Members
TenantIsolationContract<IWorkflowCheckpointStore>.TenantA, TenantIsolationContract<IWorkflowCheckpointStore>.TenantB, TenantIsolationContract<IWorkflowCheckpointStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<IWorkflowCheckpointStore>.SeedAsync(string, string, CancellationToken), TenantIsolationContract<IWorkflowCheckpointStore>.ExistsAsync(string, object), TenantIsolationContract<IWorkflowCheckpointStore>.CountAsync(string, CancellationToken), TenantIsolationContract<IWorkflowCheckpointStore>.TryDeleteAsync(string, object), TenantIsolationContract<IWorkflowCheckpointStore>.TryOverwriteAsync(string, string), TenantIsolationContract<IWorkflowCheckpointStore>.CancellableReadAsync(CancellationToken), TenantIsolationContract<IWorkflowCheckpointStore>.CancellableWriteAsync(CancellationToken), TenantIsolationContract<IWorkflowCheckpointStore>.WroteAnythingAsync(), TenantIsolationContract<IWorkflowCheckpointStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<IWorkflowCheckpointStore>.Tenant_reads_its_own_record(), TenantIsolationContract<IWorkflowCheckpointStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<IWorkflowCheckpointStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<IWorkflowCheckpointStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<IWorkflowCheckpointStore>.AmbientTenant, StoreCancellationContract<IWorkflowCheckpointStore>.CreateStoreAsync(), StoreCancellationContract<IWorkflowCheckpointStore>.InitializeAsync(), StoreCancellationContract<IWorkflowCheckpointStore>.DisposeAsync(), StoreCancellationContract<IWorkflowCheckpointStore>.OnDisposeAsync(), StoreCancellationContract<IWorkflowCheckpointStore>.CancellableReadAsync(CancellationToken), StoreCancellationContract<IWorkflowCheckpointStore>.CancellableWriteAsync(CancellationToken), StoreCancellationContract<IWorkflowCheckpointStore>.WroteAnythingAsync(), StoreCancellationContract<IWorkflowCheckpointStore>.Canceled_token_throws_on_read(), StoreCancellationContract<IWorkflowCheckpointStore>.The_write_this_contract_checks_can_be_read_back(), StoreCancellationContract<IWorkflowCheckpointStore>.Canceled_token_throws_on_write_and_leaves_no_trace(), StoreCancellationContract<IWorkflowCheckpointStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The most critical scenario is reading back a polymorphic payload without corruption: the Microsoft Agent Framework checkpoint JSON carries a $type discriminator that must be the first property of the object it appears in. A store that reorders object keys on write can silently take the discriminator out of first place, so a compliant implementation must preserve key order.

protected WorkflowCheckpointStoreContract()

A_checkpoint_written_without_version_stamps_lists_back_null()

Section titled “ A_checkpoint_written_without_version_stamps_lists_back_null()”
[Fact]
public Task A_checkpoint_written_without_version_stamps_lists_back_null()

Task

Another_tenants_checkpoint_is_NOT_FOUND()

Section titled “ Another_tenants_checkpoint_is_NOT_FOUND()”
[Fact]
public Task Another_tenants_checkpoint_is_NOT_FOUND()

Task

Reports how many records the given tenant sees through the listing endpoint.

protected override ValueTask<int> CountAsync(string tenantId, CancellationToken cancellationToken)

tenantId string

The reading tenant.

cancellationToken CancellationToken

The token every store call inside the hook must be handed; see TenantIsolationContract.SeedAsync.

ValueTask<int>

The number of records seen.

[Fact]
public Task Delete_clears_the_entire_session()

Task

Reports whether the record is visible from the given tenant’s viewpoint.

protected override ValueTask<bool> ExistsAsync(string tenantId, object key)

tenantId string

The reading tenant.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool>

true if the record is visible.

[Fact]
public Task Listing_by_run_filters_correctly()

Task

Listing_does_NOT_CARRY_the_state_payload()

Section titled “ Listing_does_NOT_CARRY_the_state_payload()”
[Fact]
public Task Listing_does_NOT_CARRY_the_state_payload()

Task

[Fact]
public Task Listing_preserves_creation_order()

Task

[Fact]
public Task Nonexistent_checkpoint_returns_null()

Task

Polymorphic_payload_is_read_back_with_KEY_ORDER_PRESERVED()

Section titled “ Polymorphic_payload_is_read_back_with_KEY_ORDER_PRESERVED()”
[Fact]
public Task Polymorphic_payload_is_read_back_with_KEY_ORDER_PRESERVED()

Task

SeedAsync(string, string, CancellationToken)

Section titled “ SeedAsync(string, string, CancellationToken)”

Writes a sample record for the given tenant.

protected override ValueTask<object> SeedAsync(string tenantId, string name, CancellationToken cancellationToken)

tenantId string

The tenant that owns the record.

name string

The name distinguishing the record. The same name may be used by two tenants.

cancellationToken CancellationToken

The token every store call inside the hook must be handed. The cancellation contract calls this hook with a token that is already cancelled, so a hook that drops the token reports a store as sound when it is not.

ValueTask<object>

The key to use for reading the record back.

StateSchemaVersion_and_StateMafVersion_round_trip_through_listing_metadata()

Section titled “ StateSchemaVersion_and_StateMafVersion_round_trip_through_listing_metadata()”
[Fact]
public Task StateSchemaVersion_and_StateMafVersion_round_trip_through_listing_metadata()

Task

Attempts to delete the record on behalf of the given tenant.

protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)

tenantId string

The tenant attempting the delete.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool?>

true if the delete succeeded, false if the record was not found; null if the store does not offer deletion.

[Fact]
public Task Written_checkpoint_is_read_back()

Task

Reports whether StoreCancellationContract.CancellableWriteAsync left anything behind.

protected override ValueTask<bool> WroteAnythingAsync()

ValueTask<bool>

true if the store holds any record the write would have created.