Skip to content

eFEC Invariants

Source boundary: schema vs. events

  • Schema creates trust roots. pg-governed-events/sql/schema.sql may bootstrap the system/corporate registries, actors, and the bootstrap workflow needed to accept signed workflow-deployment events.
  • Events deploy workflows. Business, demo, customer, screening, case, and product workflows must be deployed through signed process_event events. They must not be embedded directly in schema bootstrap JSON.
  • Seed scripts use the engine. Seed scripts must call process_event for every non-genesis mutation, including workflow deployment and customer/demo process creation.
  • No raw workflow/process mutation in seeds. Seed scripts must not directly UPDATE processes, INSERT INTO processes, jsonb_set registry workflows, or mutate data.workflows outside the engine chokepoint.

Verification

Run the source-only invariant guard before schema or seed changes merge:

bash cd test && npm run verify:invariants

This command does not connect to Postgres, does not reset data, and does not execute seed/runtime code. It scans source files for boundary violations and fails with actionable path:line :: invariant :: pattern output.