# `Minga.Extension.Instance`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/extension/instance.ex#L1)

Stable per-extension lifecycle authority.

Public requests, runtime exits, drain events, and finalizer acknowledgements
share this one mailbox. Handler modules compute transitions, while this sole
GenServer owns message ordering and lifecycle authority.

# `result`

```elixir
@type result() :: {:ok, pid()} | {:error, term()}
```

# `server`

```elixir
@type server() :: GenServer.server()
```

# `child_spec`

```elixir
@spec child_spec(keyword()) :: Supervisor.child_spec()
```

Builds the permanent authority child spec.

# `declare`

```elixir
@spec declare(server(), Minga.Extension.Entry.t(), GenServer.server(), keyword()) ::
  :ok | {:error, term()}
```

Updates the declaration snapshot used by later transitions.

# `fail_start`

```elixir
@spec fail_start(server(), term()) :: {:error, term()}
```

Projects a bulk prerequisite failure through the lifecycle authority.

# `load_policy`

```elixir
@spec load_policy(server()) :: {:ok, Minga.Extension.load_policy()} | {:error, term()}
```

Prepares and captures the declaration artifact and returns its load policy.

# `phase`

```elixir
@spec phase(server()) :: Minga.Extension.Instance.State.phase()
```

Returns the tagged authority phase for diagnostics and focused tests.

# `start`

```elixir
@spec start(server()) :: result()
```

Starts or joins the extension's current start transition.

# `start_deferred`

```elixir
@spec start_deferred(server(), Minga.Extension.Entry.t()) :: result()
```

Starts only when the captured deferred declaration is still current.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts one named lifecycle authority.

# `stop`

```elixir
@spec stop(
  server(),
  keyword()
) :: :ok | {:error, term()}
```

Stops or joins the extension's current stop transition.

# `stub`

```elixir
@spec stub(server()) :: :ok | {:error, term()}
```

Registers a lazy stub through this authority.

---

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