Scenario Evaluation Configuration
Component Detail
Description
Environment-driven configuration that defines scenario thresholds, cooldown windows, cron schedule, supported scenario types, and feature flags per organisation. Loaded at Edge Function startup so values can be tuned without code deployment.
scenario-evaluation-config
Summaries
The Scenario Evaluation Configuration component gives the organisation direct control over how aggressively or conservatively the platform reaches out to peer mentors — without requiring software releases. Business stakeholders can tune inactivity thresholds, cooldown periods between notifications, and milestone boundaries on a per-organisation basis, adapting the programme to different client contracts or regional requirements. This configurability reduces risk: if a threshold is set too aggressively and generates complaints, it can be corrected immediately via environment variables rather than waiting for a deployment cycle. It also enables A/B-style tuning across organisations to identify optimal engagement cadences, supporting data-driven programme improvement and stronger client retention outcomes.
This is a low-complexity component with no upstream dependencies, making it a strong candidate for early delivery in the sprint plan. Its primary value to the project is that it decouples scenario behaviour from code deployments — a significant risk-mitigation for QA and production tuning. The main delivery consideration is agreeing on the full set of configurable parameters with product and client stakeholders before implementation, as adding new parameters later requires coordination with the trigger engine and scheduler. Documentation of all supported environment variables and their valid ranges is a required deliverable.
No dedicated testing infrastructure is needed beyond unit tests verifying default fallback values and per-org override logic.
Loaded at Edge Function startup, this configuration module reads environment variables and optional database overrides to expose typed accessors for all scenario evaluation parameters. `getInactivityThreshold(scenarioType)` and `getCooldownDays(scenarioType)` return numeric values keyed by scenario type enum, with hardcoded defaults as fallbacks. `getMilestoneThresholds()` returns a structured object mapping metric types to boundary arrays. `isScenarioEnabledForOrg(scenarioType, orgId)` performs a lookup against a per-org feature flag table or env-driven JSON blob, supporting gradual rollout.
`getCertificationLeadTimeDays()` returns a single numeric value. All methods must be synchronous after startup to avoid latency in the hot evaluation path. Keep this module pure and side-effect-free — no DB calls at read time, only at initialisation.
Responsibilities
- Provide inactivity threshold in days per scenario type
- Expose cooldown durations to prevent notification fatigue
- Supply milestone boundary values per metric type
- Allow per-organisation scenario enable/disable flags
Interfaces
getInactivityThreshold(scenarioType)
getCooldownDays(scenarioType)
getMilestoneThresholds()
isScenarioEnabledForOrg(scenarioType, orgId)
getCertificationLeadTimeDays()