04 · The Core
Status & Ownership Engine
The heart of the application. Not a screen — the shared machinery every module writes through, so status tracking and ownership are uniform across the entire lifecycle.
Validate transitions
A state machine rejects illegal jumps.
Hand off ownership
Pass the baton between teams.
Record history
Immutable status + activity log.
Run SLA clock
Per-stage timer feeds escalation.
1 · State machine
Each status defines its allowed next statuses. A request outside that set is rejected — a stage cannot be skipped or set to an impossible value.
CONNECTED → OPPORTUNITY → QUOTE_REQUESTED → QUOTE_SHELL → PRICING_ADDED → QUOTE_SENT
QUOTE_SENT → SAMPLE_REQUESTED → IN_PRODUCTION → IN_QA → DISPATCHED → FEEDBACK_AWAITED
FEEDBACK_AWAITED → SAMPLE_APPROVED | SAMPLE_REJECTED
SAMPLE_APPROVED → DOCS_REQUESTED → DOCS_PROVIDED → CLIENT_APPROVED → CONTRACT_DRAFT → CONTRACT_CONFIRMED
CONTRACT_CONFIRMED → IN_PRODUCTION → PACKAGED → SHIPPED → PAYMENT → COMPLETED
Transition contract
assert isAllowed(entity.status, toStatus) # else reject
fromStatus = entity.status; fromOwner = entity.current_owner_id
entity.status = toStatus
if newOwner: reassign(entity, newOwner)
StatusHistory.append(entity, fromStatus, toStatus, actor)
ActivityLog.append(entity, "STATUS_CHANGE", actor, fromOwner, entity.current_owner_id)
startSlaTimer(entity, toStatus); notifyRelevantParties(entity)
2 · Ownership hand-off (the baton)
At any moment an entity has exactly one owner and team. Transitions pass the baton along the export chain:
Reassigning the owner updates current_owner_id + owner_team, drops the item into
the receiving team's work queue, and logs from_owner → to_owner.
3 · History & audit
StatusHistory
One append-only row per transition — from, to, by, when.
ActivityLog
One append-only row per meaningful action, including ownership changes.
Neither is ever updated or deleted. Together they reconstruct the full life of any deal.
4 · SLA / TAT timers
Each stage has a target turnaround (e.g. a quote in 24h). On entering a status a timer starts; if it elapses without the exit transition, the escalation chain fires. The same measurements power the TAT metrics on the KPI dashboard.