Workflow layer: gates, decisions, lineage audits, workflow test

This commit is contained in:
2026-05-06 18:54:55 +02:00
parent 3b5f96e159
commit f4f77b2eeb
11 changed files with 1037 additions and 25 deletions

View File

@@ -66,6 +66,8 @@ and SQLite repositories are adapters behind those ports.
- Transformation run and derived lineage persistence for traceable derived
artifact creation.
- Workflow template and workflow run persistence for durable job execution.
- Workflow review tasks and exception queue items are embedded in workflow run
payloads for reconstructable local-first state.
- In-memory repository for deterministic tests.
- SQLite repository for local-first durable asset registry state.
- SQLite foreign-key enforcement for representation and metadata asset

View File

@@ -56,6 +56,9 @@ rather than by bypassing existing asset governance.
available.
- `DerivedArtifactLineage` persistence and lookup by output asset, source
asset, or transformation run.
- `derived_artifact.lineage.linked` audit events connect output assets to
transformation runs, source assets, source versions, and output
representations.
- Audit events for queued, started, completed, failed, denied, and canceled
transformation runs.

View File

@@ -2,7 +2,7 @@
Date: 2026-05-06
Status: active implementation note for `KONT-WP-0008`.
Status: completed foundation implementation note for `KONT-WP-0008`.
## Purpose
@@ -36,7 +36,8 @@ governance, transformation run records, derived lineage, or audit.
- `WorkflowInputDefinition` supports asset, collection, query, source event,
and payload inputs.
- `WorkflowStepDefinition` captures step kind, operation ID, dependencies,
input/output bindings, preconditions, failure behavior, and metadata.
input/output bindings, preconditions, review gates, failure behavior, and
metadata.
- Template registration validates duplicate step IDs, missing dependencies,
dependency cycles, and unsupported failure behavior.
- `WorkflowRun` and `WorkflowStepRun` persist queued, running, waiting,
@@ -49,8 +50,17 @@ governance, transformation run records, derived lineage, or audit.
- Retry and repeated invocation avoid silent overwrite by choosing a fresh
output asset ID when a fixed template output ID already exists.
- Workflow template and run persistence are implemented for memory and SQLite.
- Review-required outputs pause the step and workflow run with embedded
`WorkflowReviewTask` and `WorkflowExceptionRecord` state.
- Review decisions can continue, reject, correct, retry, or escalate workflow
runs.
- Exception queue listing exposes review-required, failed, blocked,
low-confidence, and policy-conflicted items.
- Audit events are emitted for template registration, run queue/start/final
states, step start/final states, retry, and cancellation.
states, step start/final states, retry, cancellation, review requests,
review decisions, and exception opening.
- `WorkflowService.reconstruct_run` returns run state, template, audit events,
transformation runs, derived lineage, review tasks, and exceptions.
## Current Boundaries
@@ -60,8 +70,8 @@ adapter or job worker handles them.
Workflow inputs preserve collection, query, source event, and payload bindings,
but the MVP runner only interprets asset bindings for transformation execution.
Query expansion, source-event ingestion, human tasks, and exception queues stay
in later WP-0008 tasks.
Query expansion, source-event ingestion, and external queue-worker adapters stay
in later implementation work.
Markdown-specific transformations remain adapter-backed through markitect-tool.
Workflow orchestration may invoke those operations once the adapter boundary is
@@ -80,15 +90,10 @@ ID, queued timestamp, and updated timestamp.
## Not Yet Implemented
- Human review gates and approval tasks.
- Exception queues for blocked, failed, low-confidence, or policy-conflicted
items.
- Queue-worker adapters beyond embedded execution.
- Rich retry policies by operation type.
- Query/input expansion into dynamic asset sets.
- Full workflow reconstruction views across all audit and lineage records.
These remain in open tasks `KONT-WP-0008-T006` and `KONT-WP-0008-T007`.
- Product/API views for review queues and reconstruction records.
## Test Coverage
@@ -100,5 +105,9 @@ These remain in open tasks `KONT-WP-0008-T006` and `KONT-WP-0008-T007`.
- queue, cancel, resume denial, and retry without direct storage edits,
- partial completion when a continue-on-failure step fails and another step
succeeds,
- SQLite reload of workflow templates, workflow runs, step state, and derived
output representation state.
- review gate pause, continue, reject, correct, retry, and escalation decisions,
- failed step exception queue items,
- reconstruction across workflow audit, transformation runs, and derived
lineage,
- SQLite reload of workflow templates, workflow runs, step state, review state,
exception state, and derived output representation state.