Skip to content

feat: close storage adapter parity gaps (Dynamo sort direction, Cosmos Search query, empty provider/schema name) #201

@Lutherwaves

Description

@Lutherwaves

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

The storage adapters have drifted apart in behavior, so swapping StorageAdapterType changes results in ways callers don't expect. Three concrete parity gaps:

1. DynamoDB List ignores sort direction (storage/dynamodb.go:250-269).
It applies ORDER BY %s from sortKey but never reads/applies a sort-direction param, so results are always ascending. CosmosDB, by contrast, extracts and applies it (storage/cosmosdb.go uses extractSortDirection).

2. CosmosDB Search ignores its query argument (storage/cosmosdb.go:485).

// Use executePaginatedQuery with empty filter (the query parameter is ignored for CosmosDB)
return s.executePaginatedQuery(ctx, dest, sortKey, sortDirection, limit, cursor, map[string]any{}, params...)

Search silently degrades to an unfiltered List. The method signature promises search but does not deliver it.

3. DynamoDB GetProvider() / GetSchemaName() return empty strings (storage/dynamodb.go:99-105).

func (s *DynamoDBAdapter) GetProvider() StorageProviders { return "" }
func (s *DynamoDBAdapter) GetSchemaName() string         { return "" }

Other adapters return a real provider; the empty string degrades anything keying off provider (e.g. telemetry/metric labels in observability/storage_metrics.go).

Desired Solution you'd like

  • DynamoDB List: extract and apply sort direction the same way Cosmos/SQL do.
  • CosmosDB Search: either implement query filtering, or return an explicit "search not supported" error rather than silently behaving like List.
  • DynamoDB: return a real StorageProviders value (e.g. a DYNAMODB provider constant) so telemetry labels are correct.

Define and document the cross-adapter contract for List/Search/GetProvider so future adapters conform.

Additional Context

Found during a general audit of the library. Labeled help wanted since closing all three cleanly touches the adapter interface contract, not just one method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgoPull requests that update go codehelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions