Skip to content

Make governed workflow persistence atomic and auditable #113

@justinrayshort

Description

@justinrayshort

Summary

Make governed workflow persistence atomic and auditable by introducing workflow-scoped units of work in the shared SurrealDB access layer and durable workflow execution lifecycle records in the orchestrator runtime.

Primary Architectural Plane

shared / platform / services / workflows

Owning Subsystem

shared/surrealdb-access, platform/runtime/orchestrator, platform/runtime/enforcement, services/knowledge-service, workflows/knowledge_publication

Architectural References

  • ARCHITECTURE.md
  • docs/architecture/layer-boundaries.md
  • docs/architecture/runtime-composition.md
  • docs/adr/0010-durable-workflow-execution-plane.md

Integration Boundaries

Allowed touchpoints: shared repository abstractions, orchestrator runtime types, enforcement context, knowledge service, and knowledge publication workflow.
Explicit non-goals: broad service decomposition outside touched governed mutation paths.

Scope In

  • Add transaction or unit-of-work APIs in the shared SurrealDB access layer
  • Refactor knowledge ingestion, capsule publication, and analysis generation so related domain, evidence, and event writes commit atomically
  • Extend workflow execution records with explicit lifecycle states and durable auditability
  • Remove hard-coded environment literals from touched workflow construction in favor of typed runtime context
  • Add failure-injection and integration tests for partial-write prevention

Scope Out

  • Wasmtime sandbox policy changes
  • Placeholder service promotion outside touched knowledge paths

Acceptance Criteria

  • Touched mutation paths do not leave partial persisted state when a later write fails
  • Workflow execution records represent lifecycle state transitions explicitly
  • Touched workflow callers receive typed runtime context rather than hard-coded environment strings
  • Full repository validation remains green

Validation Requirements

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-targets
  • cargo xtask architecture audit-boundaries

Rollback Considerations

Revert the unit-of-work and lifecycle changes together so callers and repositories return to the prior persistence contract coherently.

Parent Issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions