Spensara Spensara Knowledge Base & Documentation Repository

Repository Docs & Knowledge Base

Consolidated Spensara documentation repository (722 Markdown & architecture documents in ../repository)
Built Word Documents (.docx): Spensara Overview (.docx) Capability Assessment (.docx) Brink POS Ingestion Analysis (.docx) The Borg Ingestion Architecture (.docx)

Implementation Specs (157)

Detailed engineering and feature implementation specifications.
implementation-specs/specs/SingleStoreRedshiftRuntimeReadPath/TASK1.2.md 3,038 bytes · Updated Oct 23, 2026 10:44 AM EDT
Raw File

TASK 1.2: Wire Runtime Services to Tenant Warehouse Foundation

Summary

Wire runtime read consumers to the tenant warehouse foundation introduced in Redshift Foundation.

This task connects the runtime tenant resolver with the existing tenant warehouse resolver and connection factory.

It does not yet replace the query tool implementation or migrate API endpoints.

Dependencies

  • TASK 1.1 (runtime tenant resolver and configuration)
  • Redshift Foundation tenant warehouse resolver and connection factory

Files to Modify

1. Runtime DI modules

Update dependency injection in the runtime modules so they can consume:

  • runtime tenant resolver,
  • tenant warehouse resolver,
  • tenant warehouse connection factory,
  • warehouse runtime options.

Likely files:

  • backend/Kds.Ai.AnomalyDetector/DependencyInjectionExtensions.cs
  • backend/Kds.Ai.ApiService/Program.cs
  • backend/Kds.Ai.Cli/Program.cs
  • backend/Kds.Ai.AppHost/AppHost.cs

2. Configuration/AppHost

Add configuration shape for local/dev runtime Redshift reads.

The AppHost/configuration should continue to support legacy PostgreSQL connections where unmigrated flows still need them.

Required Behavior

Runtime services must be able to:

  1. resolve a runtime tenant_id,
  2. resolve tenant_id -> tenant_database from kdsaidb,
  3. reject missing mappings,
  4. reject inactive mappings,
  5. open a Redshift connection to the resolved tenant database.

This task may expose a small reusable runtime connection accessor if useful.

Status

Completed.

Implemented in:

  • backend/Kds.Ai.Warehouse/Abstractions/IRuntimeWarehouseResolver.cs
  • backend/Kds.Ai.Warehouse/Services/RuntimeWarehouseResolver.cs
  • backend/Kds.Ai.Warehouse/DependencyInjectionExtensions.cs
  • backend/Kds.Ai.AppHost/AppHost.cs

Notes:

  • Runtime missing/inactive tenant failures are centralized in RuntimeWarehouseResolver.
  • Legacy PostgreSQL warehouse connections remain available in the solution for unmigrated simulator and other legacy flows, but the migrated runtime path no longer uses them.
  • Local/dev Redshift runtime access should use ConnectionStrings__redshiftwarehousedb as the base connection string and override only the resolved tenant database at runtime.

Acceptance Criteria

  • [x] Runtime DI can resolve runtime tenant resolver
  • [x] Runtime DI can resolve tenant warehouse resolver
  • [x] Runtime DI can resolve tenant warehouse connection factory
  • [x] Runtime path can reject missing tenant mapping
  • [x] Runtime path can reject inactive tenant mapping
  • [x] Runtime path can open a resolved tenant Redshift database
  • [x] Legacy PostgreSQL connections remain available only for unmigrated flows
  • [x] Anomaly detector query behavior is not changed yet
  • [x] API endpoint behavior is not changed yet
  • [x] Solution builds without errors

Notes

  • This task is wiring and readiness, not the full runtime migration.
  • Do not construct Redshift database names in runtime modules.
  • Do not pass tenant database names through prompts.