generated from coulomb/repo-seed
Phase 0 contracts (event envelope, ActivityDefinition, idempotency doc, naming conventions) and Phase 1 Temporal cluster setup (docker-compose.dev.yml, Temporal dynamic config) are complete. Includes Pydantic models, JSON schemas, wiki architecture docs, and ADR-001 workplan files for both workstreams. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
213 lines
6.4 KiB
JSON
213 lines
6.4 KiB
JSON
{
|
|
"$defs": {
|
|
"ContextSource": {
|
|
"description": "Describes one external data source that the workflow queries to build\nthe context snapshot passed to evaluate_templates.",
|
|
"properties": {
|
|
"name": {
|
|
"description": "Logical name; referenced as 'context.<name>' in task templates.",
|
|
"title": "Name",
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"description": "Source adapter type: 'db_query' | 'http_get' | 'static'.",
|
|
"title": "Type",
|
|
"type": "string"
|
|
},
|
|
"config": {
|
|
"additionalProperties": true,
|
|
"description": "Source-specific configuration (SQL, URL, static value, etc.).",
|
|
"title": "Config",
|
|
"type": "object"
|
|
}
|
|
},
|
|
"required": [
|
|
"name",
|
|
"type"
|
|
],
|
|
"title": "ContextSource",
|
|
"type": "object"
|
|
},
|
|
"CronTriggerConfig": {
|
|
"properties": {
|
|
"trigger_type": {
|
|
"const": "cron",
|
|
"default": "cron",
|
|
"title": "Trigger Type",
|
|
"type": "string"
|
|
},
|
|
"cron_expression": {
|
|
"description": "Standard 5-field cron expression, e.g. '0 9 * * 1-5'.",
|
|
"title": "Cron Expression",
|
|
"type": "string"
|
|
},
|
|
"timezone": {
|
|
"default": "UTC",
|
|
"description": "IANA timezone name, e.g. 'Europe/Berlin'.",
|
|
"title": "Timezone",
|
|
"type": "string"
|
|
},
|
|
"jitter_seconds": {
|
|
"default": 0,
|
|
"description": "Maximum random delay (seconds) added to each trigger to spread load.",
|
|
"minimum": 0,
|
|
"title": "Jitter Seconds",
|
|
"type": "integer"
|
|
},
|
|
"misfire_policy": {
|
|
"default": "skip",
|
|
"description": "skip: ignore any missed runs. catchup: replay missed runs up to a bounded limit. compress: run once covering the full missed window.",
|
|
"enum": [
|
|
"skip",
|
|
"catchup",
|
|
"compress"
|
|
],
|
|
"title": "Misfire Policy",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"cron_expression"
|
|
],
|
|
"title": "CronTriggerConfig",
|
|
"type": "object"
|
|
},
|
|
"EventTriggerConfig": {
|
|
"properties": {
|
|
"trigger_type": {
|
|
"const": "event",
|
|
"default": "event",
|
|
"title": "Trigger Type",
|
|
"type": "string"
|
|
},
|
|
"event_type": {
|
|
"description": "Matches EventEnvelope.type. The router fires this activity when an event with this type is received.",
|
|
"title": "Event Type",
|
|
"type": "string"
|
|
},
|
|
"filters": {
|
|
"additionalProperties": true,
|
|
"description": "Optional predicate filters applied to EventEnvelope.payload before routing. All filters must match for the activity to fire.",
|
|
"title": "Filters",
|
|
"type": "object"
|
|
}
|
|
},
|
|
"required": [
|
|
"event_type"
|
|
],
|
|
"title": "EventTriggerConfig",
|
|
"type": "object"
|
|
},
|
|
"TaskTemplate": {
|
|
"description": "Template for one task instance produced by RunActivityWorkflow.\n\nevaluate_templates() expands each template against the context snapshot\nto produce a concrete TaskInstance.",
|
|
"properties": {
|
|
"task_type": {
|
|
"description": "Maps to a registered TaskExecutorWorkflow type, e.g. 'send_email'.",
|
|
"title": "Task Type",
|
|
"type": "string"
|
|
},
|
|
"condition": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"default": null,
|
|
"description": "Optional Python expression evaluated against the context snapshot. Task is skipped if the expression is falsy. Example: \"context['user']['is_active'] == True\"",
|
|
"title": "Condition"
|
|
},
|
|
"params_template": {
|
|
"additionalProperties": true,
|
|
"description": "Parameter template. String values starting with '{context.' are interpolated from the context snapshot at evaluation time.",
|
|
"title": "Params Template",
|
|
"type": "object"
|
|
}
|
|
},
|
|
"required": [
|
|
"task_type"
|
|
],
|
|
"title": "TaskTemplate",
|
|
"type": "object"
|
|
}
|
|
},
|
|
"description": "Versioned definition of a single activity: its trigger, context resolution\nstrategy, and the task templates it can spawn.",
|
|
"properties": {
|
|
"id": {
|
|
"description": "Stable UUID. Used as the Temporal Schedule ID prefix (f'activity-schedule-{id}') and as the workflow ID component.",
|
|
"format": "uuid",
|
|
"title": "Id",
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"description": "Human-readable name.",
|
|
"title": "Name",
|
|
"type": "string"
|
|
},
|
|
"enabled": {
|
|
"default": true,
|
|
"description": "When False the corresponding Temporal Schedule is paused and event routing is suppressed.",
|
|
"title": "Enabled",
|
|
"type": "boolean"
|
|
},
|
|
"trigger_config": {
|
|
"description": "Cron or event trigger configuration.",
|
|
"discriminator": {
|
|
"mapping": {
|
|
"cron": "#/$defs/CronTriggerConfig",
|
|
"event": "#/$defs/EventTriggerConfig"
|
|
},
|
|
"propertyName": "trigger_type"
|
|
},
|
|
"oneOf": [
|
|
{
|
|
"$ref": "#/$defs/CronTriggerConfig"
|
|
},
|
|
{
|
|
"$ref": "#/$defs/EventTriggerConfig"
|
|
}
|
|
],
|
|
"title": "Trigger Config"
|
|
},
|
|
"context_sources": {
|
|
"items": {
|
|
"$ref": "#/$defs/ContextSource"
|
|
},
|
|
"title": "Context Sources",
|
|
"type": "array"
|
|
},
|
|
"task_templates": {
|
|
"items": {
|
|
"$ref": "#/$defs/TaskTemplate"
|
|
},
|
|
"title": "Task Templates",
|
|
"type": "array"
|
|
},
|
|
"dedupe_key_strategy": {
|
|
"default": "skip",
|
|
"description": "How to handle duplicate or missed trigger events. Should match CronTriggerConfig.misfire_policy for cron activities.",
|
|
"enum": [
|
|
"skip",
|
|
"catchup",
|
|
"compress"
|
|
],
|
|
"title": "Dedupe Key Strategy",
|
|
"type": "string"
|
|
},
|
|
"version": {
|
|
"default": 1,
|
|
"description": "Incremented on breaking schema changes. Stored in activity_runs for audit purposes.",
|
|
"minimum": 1,
|
|
"title": "Version",
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"name",
|
|
"trigger_config"
|
|
],
|
|
"title": "ActivityDefinition",
|
|
"type": "object"
|
|
} |