Skip to content

Add typed workflow template contracts#72

Open
andrei-hasna wants to merge 8 commits into
mainfrom
openloops/open-loops/a658283f-25a6-480d-80c6-4253edc879b1-e5451e23
Open

Add typed workflow template contracts#72
andrei-hasna wants to merge 8 commits into
mainfrom
openloops/open-loops/a658283f-25a6-480d-80c6-4253edc879b1-e5451e23

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • Add versioned workflow template contracts with input/output schemas, task bindings, required evidence, and policy requirements for built-in and custom templates.
  • Surface template contracts through templates list/show plus todos-task and generic event route dry-run/preflight output and WorkflowInvocation.outputPolicy.
  • Document the event-triggered contract surface and add regression coverage for contract invariants, custom typed defaults, and deduped route contract exposure.

Validation

  • bun test src/lib/templates.test.ts --update-snapshots
  • bun test src/lib/route/route-event.test.ts src/lib/route/drain.test.ts src/lib/workflow-spec.test.ts
  • bun test src/cli/index.test.ts
  • bun run typecheck
  • bun run test:boundary
  • bun run build
  • bun test (671 pass, 15 skip, 0 fail)

Review

  • Independent adversarial reviewer found P2/P3 issues around PR requiredFields, custom typed defaults, and deduped route contract output. All were fixed and covered by tests before commit.
  • Staged secrets scan passed before commit.

… claim

Vendor the @hasna/contracts 0.4.0 storage kit into src/generated/storage-kit
(pool/query/tls/mode/migrations/health) and build the Postgres run-claim
correctness core on top of it:

- PgPoolExecutor adapts the vendored pg.Pool client to PostgresQueryExecutor
  so PostgresStorage.migrate() runs against live cloud Postgres.
- claimNextRun/heartbeatRunLease use SELECT ... FOR UPDATE SKIP LOCKED so
  concurrent loops-runner processes never double-claim a queued run.
- Two-connection concurrency test (skips unless LOOPS_TEST_DATABASE_URL set)
  verifies exactly-once claiming across two pooled connections.
- Promote pg to a direct dependency; add @types/pg dev dependency.
- docs/CUTOVER-RUNBOOK.md documents remaining store wiring + enable steps.

PURE REMOTE (Amendment A1): kit builds a pool only in cloud mode; no
hybrid/sync path. Daemon stays on local sqlite until the full
LoopStorageContract impl + async consumer wiring land (tracked in runbook).
…health+/ready+/version, OpenAPI-generated SDK

- loops-serve bin: RDS-direct (A1) Postgres storage + @hasna/contracts verifyApiKey auth
- api: public /health,/ready,/version ({status,version,mode}) + /openapi.json; /v1 gated
- SDK: typed LoopsClient generated from openapi/loops.json (@hasna/loops/sdk/http)
…tract.json, migrations mirror

- Dockerfile bakes Amazon RDS global CA + NODE_EXTRA_CA_CERTS for verify-full TLS
- hasna.contract.json service manifest (validated against @hasna/contracts v1 schema)
- migrations/*.sql generated mirror of postgres-schema.ts; runner = loops-serve migrate
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