Skip to content

Commit Workspace mutations and journal results atomically #365

Description

@taras

Story

As a workflow host implementor, I want every Workspace-local effect to publish its mutation and journal result atomically, so interruption cannot expose a filesystem state the durable Effection tree does not record.

Contract

The Deno workflow adapter owns one authoritative DOFS connection for each WorkflowRun SQLite database and serializes Workspace-local effects on it. One expansion produces one effect and one top-level SQLite transaction:

BEGIN IMMEDIATE
  apply the Workspace mutation
  publish the resulting logical Workspace root
  append the already-filtered journal result
COMMIT

Known effect failure may roll back an effect-local savepoint and append one failed result before committing. Host interruption leaves the transaction uncommitted, so SQLite recovery publishes neither mutation nor result.

Shared production code uses contextual storage and transaction APIs. It contains no Deno, SQLite, DOFS, or Cloudflare runtime detection.

Acceptance

  • One host-owned DOFS connection is authoritative for a workflow database.
  • Workspace-local effects are serialized on that connection.
  • The transaction coordinator admits a caller-owned DOFS mutation and an already-filtered journal append to the same transaction.
  • A successful file write and its result become visible together.
  • Known failure retains one failed result while publishing no mutation.
  • A real host crash after mutation but before result publication leaves neither mutation nor result after restart.
  • Nested DOFS operations use savepoints without creating another top-level effect transaction.
  • A second long-lived connection cannot retain stale negative path-cache state across commits.
  • Tests prove commit, rollback, cancellation, crash recovery, and stale-request fencing.

Intentionally excluded

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions