# `PgFlow.Worker.Bootstrap`
[🔗](https://github.com/agoodway/pgflow/blob/v0.4.0/lib/pgflow/worker/bootstrap.ex#L1)

Compiles and verifies flow definitions before an Elixir worker registers.

Worker startup always calls upstream `pgflow.ensure_flow_compiled/2`, preserves
Elixir-specific metadata such as `flow_type`, and only then registers the worker
function with `pgflow.track_worker_function/2` using the `process` start mode.

# `prepare`

```elixir
@spec prepare(Ecto.Repo.t(), PgFlow.Flow.Definition.t()) ::
  {:ok, %{queue_name: String.t(), compilation_status: String.t()}}
  | {:error, term()}
```

Ensures the database definition matches the compiled Elixir definition and
registers the worker function for monitoring.

Returns `{:ok, %{queue_name: queue_name, compilation_status: status}}` when
compilation, verification, or local recompilation succeeds. Shape mismatches
in production return `{:error, {:flow_shape_mismatch, differences}}`. Missing
or incompatible schema objects return `{:error, {:schema_incompatible, key}}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
