Skip to content

Give workflow persistence a dedicated repository - #33

Open
boudra wants to merge 1 commit into
mainfrom
improve-one-thing
Open

Give workflow persistence a dedicated repository#33
boudra wants to merge 1 commit into
mainfrom
improve-one-thing

Conversation

@boudra

@boudra boudra commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PostgreSQL workflow persistence now has a dedicated repository, so workflow changes no longer require navigating the broad PgDatabase implementation. The existing Database contract and runtime behavior remain unchanged.

Goals

  • Give durable workflow SQL, transaction recovery, row mapping, and activity reads one explicit owner.
  • Preserve the existing public database interface and transaction semantics.
  • Keep shared agent-execution insertion, metering, and non-workflow transitions behind narrow injected operations.
  • Remove workflow row types and workflow persistence helpers from PgDatabase.

Non-goals

  • No workflow product or behavior changes.
  • No database schema or migration changes.
  • No refactor of the in-memory database implementation.
  • No changes to daemon lifecycle behavior.

Why

src/db/pg.ts had grown to nearly 5,000 lines, with durable workflow persistence occupying its largest coherent responsibility cluster. Existing connection and provider-event repositories already establish a repository boundary for PostgreSQL domains; this applies the same ownership model to workflows while leaving the stable Database interface intact.

Verification

  • npm test — 643 passed, 14 skipped
  • npm run typecheck
  • npm run lint:node
  • npm run format:check
  • npm run db:check

Risk surface

The meaningful risk is transaction behavior at the workflow/agent-execution boundary: atomic execution creation and usage reservation, deadline recovery, terminal notification leasing, and idle-deadline synchronization. The PostgreSQL workflow integration suite and full test suite cover these paths. There are no schema or externally observable changes.

Follow-up candidates

  • Decompose the large Hub E2E helper by test-domain ownership.
  • Separate daemon lifecycle persistence and orchestration responsibilities.

Keep durable workflow SQL, row mapping, and transaction recovery behind one repository while preserving the existing Database contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant