D8LooPFocus modeCODE WORKSPACE
Implement an incremental transform runner that processes only new records, skips stale or duplicate inputs, and returns the next processing state.
Separate cursor filtering, transform logic, and state advancement so replay behavior is easy to reason about.
Sample input
records and state
Only records newer than the cursor should be processed.
{
"state": {
"last_successful_cursor": "2026-03-22T00:00:00Z"
},
"records": [
{
"record_id": "r-88",
"updated_at": "2026-03-21T23:58:00Z",
"account_id": "a-099",
"amount": 300
},
{
"record_id": "r-90",
"updated_at": "2026-03-22T01:05:00Z",
"account_id": "a-100",
"amount": 1200
},
{
"record_id": "r-91",
"updated_at": "2026-03-23T02:10:00Z",
"account_id": "a-102",
"amount": 640
}
]
}Expected output
expected run result
{
"processed": [
{
"account_id": "a-100",
"metric_day": "2026-03-22",
"daily_revenue": 1200
},
{
"account_id": "a-102",
"metric_day": "2026-03-23",
"daily_revenue": 640
}
],
"skipped": [
{
"record_id": "r-88",
"reason": "not newer than cursor"
}
],
"state": {
"last_successful_cursor": "2026-03-23T02:10:00Z"
}
}Constraints
Respect the last successful cursor, keep natural-key idempotency visible, and advance state only from successfully processed records.
Expected skills
State handling, cursor boundaries, idempotent transforms, and pipeline-safe return shapes.
Run the transform to inspect normalized rows and error summaries.