SnakeBridge.Lock.Verifier (SnakeBridge v0.15.0)

Copy Markdown View Source

Verifies hardware and environment compatibility between the lock file and current system.

The verifier compares the hardware identity in the lock file against the current system's capabilities to detect potential compatibility issues before runtime.

Verification Levels

  • :ok - Full compatibility, no issues detected
  • {:warning, warnings} - Minor differences that may work but could cause issues
  • {:error, errors} - Incompatible environment that will likely fail

Examples

# Verify lock file compatibility
lock = SnakeBridge.Lock.load()
case SnakeBridge.Lock.Verifier.verify(lock) do
  :ok ->
    IO.puts("Environment compatible")
  {:warning, warnings} ->
    Enum.each(warnings, &IO.warn/1)
  {:error, errors} ->
    raise SnakeBridge.EnvironmentError, message: Enum.join(errors, "; ")
end

Summary

Functions

Verifies the lock file against the current hardware environment.

Verifies the lock file and raises on error.

Types

verification_result()

@type verification_result() :: :ok | {:warning, [String.t()]} | {:error, [String.t()]}

Functions

verify(lock)

@spec verify(map() | nil) :: verification_result()

Verifies the lock file against the current hardware environment.

Returns :ok if compatible, {:warning, warnings} for minor issues, or {:error, errors} for critical incompatibilities.

verify!(lock)

@spec verify!(map() | nil) :: :ok

Verifies the lock file and raises on error.

Returns :ok on success or raises SnakeBridge.EnvironmentError. Warnings are logged but do not raise.