Powered by AppSignal & Oban Pro

Lesson 03 Livebook: Faction Power

livebooks/03_faction_power.livemd

Lesson 03 Livebook: Faction Power

This notebook keeps chapter 3 focused on the first actor-aware GTA rule:

> the same manifest should not look equally real to every faction

Mix.install([
  {:galactic_trade_authority, path: "../03_faction_power"}
])

Compare Faction Views

state = GalacticTradeAuthority.bootstrap_registry!()

%{
  standard_tax: state.guild_manifest.tax_due,
  authority:
    Enum.map(GalacticTradeAuthority.visible_manifests!(state.authority_actor), & &1.manifest_number),
  guild:
    Enum.map(GalacticTradeAuthority.visible_manifests!(state.guild_actor), & &1.manifest_number),
  syndicate:
    Enum.map(GalacticTradeAuthority.visible_manifests!(state.syndicate_actor), & &1.manifest_number)
}

Inspect A Suspended Actor Failure

try do
  GalacticTradeAuthority.visible_manifests!(state.suspended_actor)
rescue
  error in Ash.Error.Forbidden ->
    Exception.message(error)
end

The ledger now has one more political property: visibility depends on who is asking.