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

Serialized VM-generation authority for extension module provenance.

Claims remain pending through code loading and are identified by an
unforgeable attempt token. Equivalent callers wait for commit or receive the
next ownership token after abort; no caller can release another attempt's
claim. Committed provenance is persisted by `ArtifactGenerationState`, so an
admission-service restart never reopens an empty generation under loaded code.

# `claim`

```elixir
@type claim() :: %{
  source: Minga.Extension.ContributionCleanup.contribution_source(),
  fingerprint: fingerprint(),
  source_fingerprint: fingerprint(),
  modules: [module()],
  load_modules: [module()],
  adopted_modules: [module()],
  acquired?: boolean(),
  attempt_token: reference() | nil
}
```

# `collision`

```elixir
@type collision() ::
  {:source_artifact_changed,
   Minga.Extension.ContributionCleanup.contribution_source()}
  | {:generation_failed, term()}
  | {:generation_sealed,
     Minga.Extension.ContributionCleanup.contribution_source()}
  | {:module_owned_by_source, module(),
     Minga.Extension.ContributionCleanup.contribution_source(),
     Minga.Extension.ContributionCleanup.contribution_source()}
  | {:module_conflicts_with_host, module()}
  | {:invalid_module_set, term()}
  | {:invalid_trusted_application, term()}
  | {:module_not_in_trusted_application, module(), atom()}
```

# `fingerprint`

```elixir
@type fingerprint() :: binary()
```

# `abort_attempt`

```elixir
@spec abort_attempt(
  claim(),
  keyword()
) :: :ok | {:error, term()}
```

Aborts only the exact pending attempt and transfers ownership to a waiting caller.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `claim_inventory`

```elixir
@spec claim_inventory(
  Minga.Extension.ContributionCleanup.contribution_source(),
  Minga.Extension.ArtifactInventory.t(),
  keyword()
) :: {:ok, claim()} | {:error, collision() | term()}
```

Atomically begins admission for every module in one validated inventory.

# `claim_source_modules`

```elixir
@spec claim_source_modules(
  Minga.Extension.ContributionCleanup.contribution_source(),
  [module()],
  fingerprint(),
  keyword()
) :: {:ok, claim()} | {:error, collision() | term()}
```

Atomically begins a deterministic generated or application module-set attempt.

# `commit_attempt`

```elixir
@spec commit_attempt(
  claim(),
  keyword()
) :: :ok | {:error, term()}
```

Commits the exact pending attempt after all modules load successfully.

# `mark_loading`

```elixir
@spec mark_loading(
  claim(),
  keyword()
) :: :ok | {:error, term()}
```

Marks the exact pending attempt as able to have loaded code.

# `seal`

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

Seals this VM generation against first-time source admission.

# `source_fingerprint`

```elixir
@spec source_fingerprint(
  Minga.Extension.ContributionCleanup.contribution_source(),
  keyword()
) :: {:ok, fingerprint()} | :error
```

Returns the immutable source snapshot fingerprint admitted for a source.

# `source_modules`

```elixir
@spec source_modules(
  Minga.Extension.ContributionCleanup.contribution_source(),
  keyword()
) :: {:ok, [module()]} | :error
```

Returns the exact committed module set admitted for a source.

# `start_link`

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

Starts the VM-generation artifact admission authority.

---

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