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/TASK3.1.md 2,667 bytes · Updated Oct 23, 2026 10:44 AM EDT
Raw File

TASK 3.1: Create a Branch-Aligned Redshift Runtime Read Service

Summary

Create a small read service for API queries over tenant Redshift once a branch-aligned runtime contract is defined.

Status: deferred.

The earlier canonical order-read service was removed from the branch together with the canonical curated.orders / curated.order_items assumption.

Dependencies

  • TASK 1.2 (runtime services wired to tenant warehouse foundation)

Files to Create

1. Redshift runtime read service

Create a branch-aligned runtime read service abstraction and implementation.

The service should use the runtime tenant resolver and tenant warehouse connection factory.

2. Query/read models if needed

Create internal query models or DTOs as needed to keep endpoint handlers clean.

Required Behavior

The service should support the current /warehouse/orders endpoint data needs only after the branch defines a stable runtime contract for those endpoints:

  • count orders today,
  • orders per hour for last 24 hours,
  • average preparation time today,
  • orders by order type today,
  • orders by destination today,
  • active orders,
  • average items per order today,
  • top items today.

Do not assume canonical column names such as order_id, created_at, or preparation_time_seconds until that runtime contract exists.

The eventual service must:

  • use tenant-resolved Redshift connections,
  • preserve current endpoint semantics where practical,
  • keep local day/hour calculations consistent with current API behavior,
  • avoid inventing a second hardcoded curated contract inside the API layer.

Status

Deferred.

The earlier canonical service and related models were removed from the branch.

Acceptance Criteria

  • [ ] Order read service exists
  • [ ] Service uses runtime tenant resolver
  • [ ] Service opens tenant Redshift through the warehouse foundation
  • [ ] Service supports a branch-aligned Redshift runtime contract
  • [ ] Service supports order count today
  • [ ] Service supports orders per hour
  • [ ] Service supports average preparation time
  • [ ] Service supports orders by type
  • [ ] Service supports orders by destination
  • [ ] Service supports active orders
  • [ ] Service supports average items per order
  • [ ] Service supports top items
  • [ ] Service does not use KDSContext
  • [x] Solution builds without errors

Notes

  • Prefer raw SQL or a lightweight query service over creating a new EF model for Redshift.
  • Do not recreate the removed canonical order contract just to preserve an endpoint.
  • If an endpoint cannot be faithfully represented by the source-mirror branch contract, document that gap before migrating.