Crosswake.Bridge.Registry (crosswake v0.2.3)

View Source

Manifest-backed Phase 3 bridge allowlist.

Summary

Functions

Resolves the wire command for a declared capability family (the reverse of command_capability/1). @capability_commands is a bijection today (every capability family has exactly one command), so this reverse lookup is well-defined. Returns nil when the family is not part of the bounded bridge command vocabulary at all — the caller (Crosswake.Bridge.push/3) treats that as an undeclared-capability preflight failure (D-04), not a new authorization path.

Returns the closed vocabulary of capability families capability_command/1 (and, by extension, Crosswake.Bridge.push/3) recognizes at all — the domain of the reverse lookup above. A family absent from this list can never be authorized by any route's declaration; it fails the vocabulary check (moment C, D-51), not the per-route declaration check (moment B, Crosswake.Bridge.UndeclaredCapabilityError).

Functions

allowed_commands()

@spec allowed_commands() :: [String.t()]

capability_command(capability_family)

@spec capability_command(String.t()) :: String.t() | nil

Resolves the wire command for a declared capability family (the reverse of command_capability/1). @capability_commands is a bijection today (every capability family has exactly one command), so this reverse lookup is well-defined. Returns nil when the family is not part of the bounded bridge command vocabulary at all — the caller (Crosswake.Bridge.push/3) treats that as an undeclared-capability preflight failure (D-04), not a new authorization path.

command_capability(command)

@spec command_capability(String.t()) :: String.t() | nil

command_supported?(command)

@spec command_supported?(String.t()) :: boolean()

known_capability_families()

@spec known_capability_families() :: [String.t()]

Returns the closed vocabulary of capability families capability_command/1 (and, by extension, Crosswake.Bridge.push/3) recognizes at all — the domain of the reverse lookup above. A family absent from this list can never be authorized by any route's declaration; it fails the vocabulary check (moment C, D-51), not the per-route declaration check (moment B, Crosswake.Bridge.UndeclaredCapabilityError).

lookup(manifest, route_id, command)

@spec lookup(Crosswake.Manifest.Types.Root.t(), String.t(), String.t()) ::
  {:ok, Crosswake.Bridge.Registry.Entry.t()}
  | {:error, :inactive_route | :unsupported_command | :undeclared_capability}

lookup(manifest, route_id, command, payload)

@spec lookup(Crosswake.Manifest.Types.Root.t(), String.t(), String.t(), map()) ::
  {:ok, Crosswake.Bridge.Registry.Entry.t()}
  | {:error, :inactive_route | :unsupported_command | :undeclared_capability}