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

TASK 2.1: Add background provisioning job and enqueue it from credential create and update

Summary

Add a TickerQ-based background provisioning job and enqueue it after credential create and update so warehouse provisioning no longer blocks HTTP requests.

This task introduces the async orchestration path but keeps the actual bootstrap semantics aligned with the current backend-owned reconciliation model.

Dependencies

  • TASK 1.1 - Define split admin flow and credential-trigger boundaries
  • TASK 1.2 - Persist and expose async provisioning state for the admin UI

Files to Modify

Expected implementation touch points:

  • new job file under backend/Kds.Ai.ApiService/Jobs/
  • backend/Kds.Ai.ApiService/Services/CustomerManagementService.cs
  • backend/Kds.Ai.ApiService/Program.cs or DI wiring as needed
  • related tests under backend/tests/Kds.Ai.ApiService.Tests/

Required Behavior

  • Add a one-shot TickerQ job for customer warehouse provisioning reconciliation.
  • Enqueue that job after credential create.
  • Enqueue that job after credential update.
  • Do not enqueue that job after credential delete.
  • The job must read current database state at execution time.
  • The job must update provisioning state through pending, running, success, and failure transitions.
  • The job must be idempotent and safe to rerun for the same customer.

Recommended reconciliation flow:

  1. Load customer.
  2. Load current credentials.
  3. Resolve enabled source services.
  4. If no enabled warehouse-backed source exists, stop without bootstrap.
  5. Ensure tenant mapping exists.
  6. Bootstrap or re-bootstrap the tenant warehouse.
  7. Persist final success or failure state.

Acceptance Criteria

  • [ ] A TickerQ provisioning job exists
  • [ ] Credential create enqueues the job
  • [ ] Credential update enqueues the job
  • [ ] Credential delete does not enqueue the job
  • [ ] The job reads current state from the database
  • [ ] The job updates persisted provisioning state

Notes

  • Reuse the existing TickerQ pattern already used by document and manual ETL jobs.
  • Event payloads should stay minimal; the job should reconcile against fresh stored state.