1.9 KiB
1.9 KiB
Capability Spec Delta: api-tenant-provider-memory (foundation-fix-gap-2-tenant-chain)
Package: @suaveplan/api-tenant-provider-memory
Status: PROPOSED
MODIFIED Requirements
Requirement: Boundary validation through tenantRecordSchema
Every record entering the backing store SHALL be parsed through
tenantRecordSchema from
@suaveplan/api-tenant-provider/tenant-record. As of the
foundation-fix-gap-2-tenant-chain change, tenantRecordSchema
requires a non-empty slug and accepts an optional metadata bag
— callers MUST supply slug on every record entering the store.
Schema failures (including missing/empty slug) raise
TENANT_PROVIDER_MEMORY.INVALID_RECORD.
Scenario: seed with malformed record is rejected
- WHEN
createMemoryTenantProvider({ tenants: [{ id: "", slug: "x", status: "active", ... }] })is called - THEN the call throws
TenantProviderMemoryErrorwith codeTENANT_PROVIDER_MEMORY.INVALID_RECORD
Scenario: seed with missing slug is rejected
- WHEN
createMemoryTenantProvider({ tenants: [{ id: "t1", status: "active", createdAt }] })(no slug) is called - THEN the call throws
TenantProviderMemoryErrorwith codeTENANT_PROVIDER_MEMORY.INVALID_RECORD
Scenario: add() validates input
- WHEN
add({ id: "", slug: "x", ... })is called with an empty id - THEN the call throws
TenantProviderMemoryErrorwith codeTENANT_PROVIDER_MEMORY.INVALID_RECORD
Scenario: invalid options shape rejected
- WHEN
createMemoryTenantProvider({ tenants: "not-an-array" })is called - THEN the call throws
TenantProviderMemoryErrorwith codeTENANT_PROVIDER_MEMORY.INVALID_RECORD
Verified by: src/provider/provider.test.ts::"rejects malformed seed record (INVALID_RECORD)" AND src/provider/provider.test.ts::"add rejects malformed record (INVALID_RECORD)" AND src/provider/provider.test.ts::"rejects invalid options shape".