Skip to content

Commit 4434342

Browse files
authored
docs: v0.4.0 release — CHANGELOG, README, Hugo docs, EventSLAMet fix (#37)
* docs: update CHANGELOG for v0.4.0 release * docs: update README architecture for v0.4.0 * docs: update architecture overview for sequential SFN and EventBridge Scheduler * docs: update AWS architecture for sequential SFN and EventBridge Scheduler SLA * docs: update SLA docs for EventBridge Scheduler and add execution granularity * docs: rewrite ASL guide for sequential state machine with EventBridge Scheduler * docs: fix event type names and add SLA_MET in alerting reference * docs: fix review findings — stale parallel-branch refs, contradictory state counts, missing INFRA_FAILURE * fix: rename EventSLAResolved to EventSLAMet to match published event string; fix remaining stale parallel-branch refs in docs
1 parent b6d8233 commit 4434342

12 files changed

Lines changed: 242 additions & 167 deletions

File tree

CHANGELOG.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,47 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased] — Architecture Rewrite
8+
## [0.4.0] - 2026-03-03
9+
10+
### Added
11+
12+
- **SLA monitoring via EventBridge Scheduler**: one-time Scheduler entries fire `SLA_WARNING` and `SLA_BREACH` events at exact timestamps, replacing the previous parallel-branch polling approach. Schedules auto-delete after firing. On job completion, unfired schedules are cancelled and `SLA_MET` is published.
13+
- **Sub-daily execution granularity**: pipelines can run at hourly or daily cadence depending on sensor data. When sensors include both `date` and `hour` fields, the framework uses a composite execution date (`2026-03-03T10`). Glue triggers receive `--par_day` and `--par_hour` arguments automatically.
14+
- **Infrastructure trigger retry**: trigger execution failures (e.g., Glue `ConcurrentRunsExceededException`) retry 4 times with exponential backoff (30s, 60s, 120s, 240s) via Step Functions native Retry. Each failure is logged to the joblog table for audit. This retry budget is separate from `maxRetries` for job failures.
15+
- **StatusChecker fallback in check-job**: when no terminal joblog entry exists, the orchestrator polls the trigger API directly to determine job status.
916

1017
### Changed
1118

1219
- **Declarative validation rules** replace the archetype/trait/evaluator system. Pipeline configs define validation as YAML rules (`exists`, `equals`, `gt`, `gte`, `lt`, `lte`, `age_lt`, `age_gt`) — no custom evaluator code needed.
1320
- **3 DynamoDB tables** (control, joblog, rerun) replace the single-table design for clearer access patterns and independent scaling.
1421
- **4 Lambda functions** (stream-router, orchestrator, sla-monitor, watchdog) replace the previous 7+ handlers. The orchestrator is a multi-mode handler covering evaluate, trigger, check-job, and post-run.
15-
- **~12-state Step Functions workflow** with parallel SLA monitoring branch replaces the 47-state machine.
22+
- **18-state sequential Step Functions workflow** replaces the 47-state machine. SLA monitoring uses EventBridge Scheduler instead of a parallel branch.
1623
- **EventBridge events** replace SNS for all alerting and lifecycle notifications.
1724
- **Reusable Terraform module** — consumers deploy infrastructure without framework code in their repo.
1825
- **Framework reads DynamoDB only** — external processes push sensor data into the control table.
26+
- **sla-monitor Lambda** supports 5 modes: `schedule`, `cancel`, `fire-alert`, `calculate`, `reconcile`.
27+
- **Trigger state** retries infrastructure failures independently of job failure retries (`maxRetries`). Exhausted trigger retries route to SLA cleanup and graceful termination instead of crashing.
1928

2029
### Removed
2130

22-
- Redis and Postgres storage providers (AWS-only going forward)
31+
- Redis and Postgres storage providers (AWS-first; GCP and Azure planned after AWS stabilizes)
2332
- CLI binary (`cmd/interlock`) and HTTP server
2433
- Archetype, trait, and evaluator subprocess system
2534
- Local mode (Docker Compose + Redis)
2635
- Cascade notifications, post-completion drift monitoring, replay support
2736
- SNS alert sinks, S3 alert sinks
2837
- cobra, chi, pgx, go-redis, color dependencies
2938

39+
### Fixed
40+
41+
- Pipeline config included in Step Functions execution input, eliminating redundant DynamoDB reads during orchestrator modes (#30)
42+
- YAML configs converted to JSON before DynamoDB storage (#27)
43+
- Missing trigger enable variables added to Terraform module (`enable_emr_serverless_trigger`, `enable_sfn_trigger`) (#26)
44+
- Sensor data `data` map unwrapped in stream-router before trigger condition evaluation (#28)
45+
- Orchestrator output uses `status` string instead of `passed` boolean (#29)
46+
- SLA monitor handles relative `:MM` deadline format for hourly pipelines (#35)
47+
- `check-job` skips non-terminal joblog events (e.g., `infra-trigger-failure`) to prevent infinite polling loops (#36)
48+
3049
## [0.3.1] - 2026-02-28
3150

3251
### Fixed
@@ -169,6 +188,7 @@ Initial release of the Interlock STAMP-based safety framework for data pipeline
169188

170189
Released under the [Elastic License 2.0](LICENSE).
171190

191+
[0.4.0]: https://github.com/dwsmith1983/interlock/releases/tag/v0.4.0
172192
[0.3.1]: https://github.com/dwsmith1983/interlock/releases/tag/v0.3.1
173193
[0.3.0]: https://github.com/dwsmith1983/interlock/releases/tag/v0.3.0
174194
[0.2.1]: https://github.com/dwsmith1983/interlock/releases/tag/v0.2.1

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,17 @@ Supported checks: `exists`, `equals`, `gt`, `gte`, `lt`, `lte`, `age_lt`, `age_g
5757
└───────────────────┘ │
5858
┌───────────▼──────────────┐
5959
│ Step Functions │
60-
~12 states, 2 branches: │
61-
│ ┌─────────┐ ┌────────┐ │
62-
│ │ Eval + │ │ SLA │ │
63-
│ │ Trigger │ │Monitor │ │
64-
│ └─────────┘ └────────┘ │
60+
│ 18 sequential states: │
61+
│ Evaluate → Trigger → │
62+
│ Poll → SLA → Done │
6563
└──────────┬───────────────┘
6664
6765
┌────────────────┼────────────────┐
6866
▼ ▼ ▼
6967
orchestrator sla-monitor watchdog
70-
(evaluate, (calculate, (stale runs,
71-
trigger, fire-alert) missed cron)
72-
check-job,
68+
(evaluate, (schedule SLA (stale runs,
69+
trigger, via EventBridge missed cron)
70+
check-job, Scheduler)
7371
post-run)
7472
```
7573
@@ -79,7 +77,7 @@ Supported checks: `exists`, `equals`, `gt`, `gte`, `lt`, `lte`, `age_lt`, `age_g
7977
|----------|---------|
8078
| `stream-router` | Routes DynamoDB Stream events, starts Step Function executions |
8179
| `orchestrator` | Multi-mode handler: evaluate rules, trigger jobs, check status, post-run validation |
82-
| `sla-monitor` | Calculates warning/breach times, fires SLA events to EventBridge |
80+
| `sla-monitor` | Schedules SLA alerts via EventBridge Scheduler; cancels on job completion |
8381
| `watchdog` | Detects stale trigger executions and missed cron schedules |
8482
8583
### DynamoDB Tables

docs/content/docs/architecture/aws.md

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@ External processes ──→ DynamoDB control table (SENSOR# writes)
1616
1717
stream-router Lambda ──→ Step Functions execution
1818
19-
┌──────────┴──────────┐
20-
↓ ↓
21-
Evaluation SLA Monitoring
22-
Branch Branch
23-
│ │
24-
orchestrator sla-monitor
25-
(Lambda) (Lambda)
26-
27-
┌───────────┼──────────┐
28-
↓ ↓ ↓
29-
Evaluate Trigger CheckJob
30-
(rules) (job) (poll status)
19+
Sequential flow:
20+
Evaluate → Trigger
21+
22+
SLA Scheduling
23+
(EventBridge Scheduler)
24+
25+
Poll job status
26+
27+
SLA Cleanup → Done
3128
3229
EventBridge schedule ──→ watchdog Lambda ──→ DynamoDB (scan for stale/missed)
3330
──→ EventBridge (publish alerts)
@@ -101,14 +98,14 @@ Supported trigger types: `http`, `command`, `airflow`, `glue`, `emr`, `emr-serve
10198

10299
### sla-monitor
103100

104-
Lightweight SLA deadline calculator and alert publisher, invoked by the SLA monitoring branch of the Step Functions state machine. Two modes:
101+
Manages SLA deadlines using EventBridge Scheduler. Creates one-time schedule entries that fire alerts at exact warning and breach timestamps. Invoked by the Step Functions state machine at two points:
105102

106-
| Mode | Purpose |
103+
| When | Action |
107104
|---|---|
108-
| `calculate` | Compute warning and breach timestamps from deadline, expected duration, and timezone |
109-
| `fire-alert` | Publish `SLA_WARNING` or `SLA_BREACH` event to EventBridge |
105+
| After trigger (or validation exhaustion) | Creates two one-time EventBridge Scheduler entries — one for warning, one for breach. Entries auto-delete after firing. |
106+
| On job completion (or all retries exhausted) | Cancels unfired Scheduler entries. Publishes `SLA_MET` if the job completed before the warning deadline. |
110107

111-
The SLA monitor does not read from DynamoDB -- it receives all necessary data as input from the Step Function.
108+
When a Scheduler entry fires, it invokes this Lambda to publish the corresponding `SLA_WARNING` or `SLA_BREACH` event to EventBridge.
112109

113110
### watchdog
114111

@@ -121,34 +118,58 @@ See [Watchdog](../watchdog) for the full algorithm.
121118

122119
## Step Functions State Machine
123120

124-
The state machine orchestrates the pipeline lifecycle using two parallel branches:
121+
The state machine orchestrates the pipeline lifecycle as a sequential flow of 18 states. SLA monitoring is handled by EventBridge Scheduler rather than a parallel branch.
125122

126-
### Evaluation Branch (7 states)
123+
### State Flow
124+
125+
```
126+
InitEvalLoop → Evaluate → IsReady
127+
→ (passed) Trigger → CheckSLAConfig → ScheduleSLAAlerts → HasTriggerResult
128+
→ WaitForJob → CheckJob → IsJobDone
129+
→ (terminal) CheckCancelSLA → CancelSLASchedules → Done
130+
→ (running) WaitForJob (loop)
131+
→ (not ready) WaitInterval → IncrementElapsed → CheckWindowExhausted
132+
→ (window remaining) Evaluate (loop)
133+
→ (window exhausted) ValidationExhausted → CheckSLAConfig → ... → Done
134+
```
127135

128-
1. **InitEvalLoop** -- initialize elapsed-seconds counter
129-
2. **Evaluate** -- invoke orchestrator with `mode=evaluate`, returns `passed` or `not_ready`
130-
3. **IsReady** -- route on evaluation result: passed goes to Trigger, otherwise WaitInterval
131-
4. **WaitInterval** -- wait `evaluationIntervalSeconds` before retrying
132-
5. **IncrementElapsed** -- track total elapsed time using `States.MathAdd`
133-
6. **CheckWindowExhausted** -- if elapsed >= window, go to ValidationExhausted
134-
7. **Trigger** -- invoke orchestrator with `mode=trigger`, then poll via WaitForJob/CheckJob/IsJobDone loop
136+
### Evaluation Loop (7 states)
135137

136-
### SLA Monitoring Branch (5 states)
138+
1. **InitEvalLoop** — initialize elapsed-seconds counter
139+
2. **Evaluate** — invoke orchestrator with `mode=evaluate`
140+
3. **IsReady** — if `passed`, go to Trigger; otherwise WaitInterval
141+
4. **WaitInterval** — configurable delay between evaluation attempts
142+
5. **IncrementElapsed** — track total elapsed time via `States.MathAdd`
143+
6. **CheckWindowExhausted** — if elapsed >= window, go to ValidationExhausted
144+
7. **ValidationExhausted** — publish `VALIDATION_EXHAUSTED` event
137145

138-
1. **CheckSLAConfig** -- skip branch if no SLA configured
139-
2. **CalcDeadlines** -- invoke sla-monitor with `mode=calculate`
140-
3. **WaitForWarning** -- wait until warning timestamp
141-
4. **FireSLAWarning** -- invoke sla-monitor with `mode=fire-alert, alertType=SLA_WARNING`
142-
5. **WaitForBreach/FireSLABreach** -- same pattern for breach deadline
146+
### Trigger and Job Polling (7 states)
147+
148+
1. **Trigger** — invoke orchestrator with `mode=trigger`. Infrastructure failures retry 4 times with exponential backoff (30s, 60s, 120s, 240s)
149+
2. **CheckSLAConfig** — if SLA configured, schedule alerts; otherwise skip
150+
3. **ScheduleSLAAlerts** — invoke sla-monitor to create one-time EventBridge Scheduler entries
151+
4. **HasTriggerResult** — if a job was triggered, poll for completion; otherwise finish
152+
5. **WaitForJob** — configurable delay between job status checks
153+
6. **CheckJob** — invoke orchestrator with `mode=check-job`
154+
7. **IsJobDone** — route on terminal events (success/fail/timeout) or keep polling
155+
156+
### SLA Cleanup (2 states)
157+
158+
1. **CheckCancelSLA** — if SLA was scheduled, cancel unfired entries
159+
2. **CancelSLASchedules** — invoke sla-monitor to delete Scheduler entries and record final SLA outcome
160+
161+
### Terminal States (2 states)
162+
163+
1. **InfraFailure** — Fail state for unrecoverable infrastructure errors
164+
2. **Done** — Succeed state
143165

144166
### Error Handling
145167

146168
Every Task state includes Retry and Catch blocks:
147169

148-
- **Retry**: `IntervalSeconds: 2`, `MaxAttempts: 3`, `BackoffRate: 2` for Lambda service errors
149-
- **Catch**: `States.ALL` routes to a branch-level Fail state (`EvalBranchFailed` or `SLABranchFailed`)
150-
151-
The top-level Parallel state catches any branch failure and routes to `InfraFailure`.
170+
- **Default Retry**: `IntervalSeconds: 2`, `MaxAttempts: 3`, `BackoffRate: 2` for Lambda service errors
171+
- **Trigger Retry**: `IntervalSeconds: 30`, `MaxAttempts: 4`, `BackoffRate: 2` — infrastructure failures (e.g., Glue concurrency limits) get a longer retry budget
172+
- **Catch**: unrecoverable errors route to `InfraFailure` (Fail state). Trigger exhaustion routes to `CheckCancelSLA` for graceful SLA cleanup before termination.
152173

153174
### ARN Substitution
154175

docs/content/docs/architecture/overview.md

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -106,56 +106,45 @@ Each pipeline execution follows this lifecycle, orchestrated by Step Functions:
106106
```
107107
Sensor data arrives
108108
109-
109+
110110
stream-router starts SFN
111111
112+
113+
Evaluation Loop
114+
(Evaluate → Wait → Re-evaluate)
115+
112116
┌────┴────┐
113-
↓ ↓
114-
Evaluation SLA Monitor
115-
Loop (parallel)
116-
│ │
117-
│ CalcDeadlines
118-
│ │
119-
│ WaitForWarning
120-
│ │
121-
│ FireSLAWarning
122-
│ │
123-
│ WaitForBreach
124-
│ │
125-
│ FireSLABreach
117+
▼ ▼
118+
Passed Window Exhausted
119+
│ │
120+
▼ ▼
121+
Trigger VALIDATION_EXHAUSTED
122+
│ │
123+
├─────────┘
124+
125+
CheckSLA → ScheduleSLAAlerts (EventBridge Scheduler)
126+
127+
128+
WaitForJob → CheckJob → IsJobDone
126129
127-
├─→ Evaluate (validation rules)
128-
│ │
129-
│ ┌───┴───┐
130-
│ ↓ ↓
131-
│ Ready Not Ready
132-
│ │ │
133-
│ │ Wait → re-evaluate
134-
│ │ │
135-
│ │ Window exhausted?
136-
│ │ │
137-
│ │ VALIDATION_EXHAUSTED
138-
│ │
139-
│ ↓
140-
│ Trigger job
141-
│ │
142-
│ Wait → CheckJob
143-
│ │
144-
│ success / fail / timeout
130+
131+
CheckCancelSLA → CancelSLASchedules
145132
146-
147-
Reconcile (merge branch results)
133+
134+
Done
148135
```
149136

150137
### State Summary
151138

152-
The Step Functions state machine uses two parallel branches:
139+
The Step Functions state machine uses 18 sequential states:
140+
141+
1. **Evaluation loop** — evaluates validation rules at a configurable interval. When all rules pass, triggers the job. If the evaluation window expires, publishes `VALIDATION_EXHAUSTED`.
153142

154-
1. **Evaluation branch** -- loops on Evaluate, checking validation rules at a configurable interval. When all rules pass, triggers the job and polls for completion. Exits on success, failure, timeout, or window exhaustion.
143+
2. **SLA scheduling** — after trigger (or validation exhaustion), creates one-time EventBridge Scheduler entries for SLA warning and breach deadlines. The Scheduler fires alerts independently at exact timestamps.
155144

156-
2. **SLA monitoring branch** -- calculates warning and breach timestamps from the SLA config, waits until each deadline, and publishes alerts to EventBridge. Skipped entirely if no SLA is configured.
145+
3. **Job polling** — polls the triggered job for completion via `check-job` mode. Terminal events (success, fail, timeout) proceed to SLA cleanup.
157146

158-
Both branches run concurrently. The evaluation branch handles the actual pipeline lifecycle; the SLA branch is purely observational and never stops execution.
147+
4. **SLA cleanup** — cancels unfired SLA Scheduler entries and publishes `SLA_MET` if the job completed before the warning deadline.
159148

160149
## Event System
161150

@@ -170,6 +159,7 @@ All lifecycle events are published to a custom EventBridge event bus. This repla
170159
| `JOB_FAILED` | Triggered job failed |
171160
| `SLA_WARNING` | SLA warning deadline reached |
172161
| `SLA_BREACH` | SLA breach deadline reached |
162+
| `SLA_MET` | Job completed before SLA warning deadline |
173163
| `RETRY_EXHAUSTED` | All retry attempts consumed |
174164
| `SFN_TIMEOUT` | Step Function execution timed out (watchdog) |
175165
| `SCHEDULE_MISSED` | Cron schedule passed without a trigger (watchdog) |
@@ -205,6 +195,10 @@ When a triggered job fails or times out, the stream-router processes the `JOB#`
205195

206196
Re-run executions use a unique name (`{pipeline}-{schedule}-{date}-rerun-{attempt}`) to avoid Step Function dedup collisions.
207197

198+
### Infrastructure Trigger Retry
199+
200+
When the trigger execution itself fails (e.g., Glue `ConcurrentRunsExceededException`), the orchestrator logs the failure to the joblog table and returns a Lambda error. Step Functions retries the trigger 4 times with exponential backoff (30s, 60s, 120s, 240s). This retry budget is separate from `maxRetries`. If all attempts fail, the execution routes to SLA cleanup and terminates gracefully.
201+
208202
## Post-Run Validation
209203

210204
Pipelines can define optional post-run validation rules that are evaluated after the triggered job completes. These use the same declarative rule syntax as pre-trigger validation:

0 commit comments

Comments
 (0)