Skip to content
Tracon

AgentFileStoreContract

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

Tenant isolation contract for the persistent agent file memory.

public abstract class AgentFileStoreContract : TenantIsolationContract<AgentFileStore>, IAsyncLifetime, IAsyncDisposable

objectTenantIsolationContract<AgentFileStore>AgentFileStoreContract

IAsyncLifetime, IAsyncDisposable

TenantIsolationContract<AgentFileStore>.TenantA, TenantIsolationContract<AgentFileStore>.TenantB, TenantIsolationContract<AgentFileStore>.CreateStoreAsync(), TenantIsolationContract<AgentFileStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<AgentFileStore>.InitializeAsync(), TenantIsolationContract<AgentFileStore>.DisposeAsync(), TenantIsolationContract<AgentFileStore>.OnDisposeAsync(), TenantIsolationContract<AgentFileStore>.SeedAsync(string, string), TenantIsolationContract<AgentFileStore>.ExistsAsync(string, object), TenantIsolationContract<AgentFileStore>.CountAsync(string), TenantIsolationContract<AgentFileStore>.TryDeleteAsync(string, object), TenantIsolationContract<AgentFileStore>.TryOverwriteAsync(string, string), TenantIsolationContract<AgentFileStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<AgentFileStore>.Tenant_reads_its_own_record(), TenantIsolationContract<AgentFileStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<AgentFileStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<AgentFileStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<AgentFileStore>.AmbientTenant, TenantIsolationContract<AgentFileStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

File memory is not an IStore; it is the Microsoft Agent Framework AI.AgentFileStore type. The tenant is read from ITenantContext, and the agent name is read from an implementation-defined ambient scope that AgentFileStoreContract.EnterRunScope establishes – Tracon’s own stores read it from TraconRunContext (Tracon.Core), which this package deliberately does not reference (it depends on Tracon.Abstractions only).

The ambient scope is set up at the start of each test body, not in InitializeAsync: the xunit v3 (MTP) lifecycle hook can run the test body as a separately scheduled task, which breaks an AsyncLocal-based flow.

protected AgentFileStoreContract()

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

protected override ValueTask<int> CountAsync(string tenantId)

tenantId string

The reading tenant.

ValueTask<int>

The number of records seen.

Creating_a_directory_does_not_produce_a_record()

Section titled “ Creating_a_directory_does_not_produce_a_record()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 90)]
public Task Creating_a_directory_does_not_produce_a_record()

Task

Sets the active tenant and establishes the ambient run scope.

protected void Enter(string tenantId)

tenantId string

The tenant id.

Establishes whatever ambient run scope the store under test reads the agent name from. Tracon’s own SQL-backed implementations read TraconRunContext.Current (Tracon.Core); a derived contract in a project that already references Tracon.Core sets that up here.

protected abstract void EnterRunScope()

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.

Clears the ambient run scope AgentFileStoreContract.EnterRunScope established.

protected abstract void ExitRunScope()
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 120)]
public Task Glob_filter_narrows_by_file_name()

Task

Hook for a derived class to release its own resources.

protected override ValueTask OnDisposeAsync()

ValueTask

A completed task.

Recursive_false_skips_matches_in_subdirectories()

Section titled “ Recursive_false_skips_matches_in_subdirectories()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 103)]
public Task Recursive_false_skips_matches_in_subdirectories()

Task

Search_does_not_find_another_tenants_file()

Section titled “ Search_does_not_find_another_tenants_file()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 77)]
public Task Search_does_not_find_another_tenants_file()

Task

Search_in_a_large_store_returns_only_the_target_directory()

Section titled “ Search_in_a_large_store_returns_only_the_target_directory()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 139)]
public Task Search_in_a_large_store_returns_only_the_target_directory()

Task

Writes a sample record for the given tenant.

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

tenantId string

The tenant that owns the record.

name string

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

ValueTask<object>

The key to use for reading the record back.

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.