PhoenixReplay.Recording.Code (PhoenixReplay v0.6.2)

Copy Markdown View Source

Which code a recording was made with, as its code, so the player can say what changed since.

Replay renders today's code with the assigns recorded then. A recording keeps:

  • release — the name of the deploy, from the :release config, such as a commit, or the version of the view's application. For people and the recording list's filter; nothing is decided by it.
  • modules — the MD5 of each module that rendered the session, its view and its LiveComponents, as module_info(:md5) gives it, which changes whenever the module's code does.
  • migration — the newest PhoenixReplay.Migration the app had, whose newer ones replay applies, or nil without any.
  • deps — the versions of the dependencies that render: Phoenix, LiveView, phoenix_html, phoenix_template, and any direct dependency of the view's application built on LiveView, such as a component library. One that comes in through another dependency is not covered.

Modules and dependencies are kept by name, as strings, not as atoms: stored recordings decode only atoms the node knows, so a module deleted since would otherwise make every recording naming it unreadable. One the node no longer has counts as changed.

Reading them costs a few function calls when a session starts; the dependency versions are read once per application.

Summary

Types

What changed since a recording, as changes/1 tells, by name.

t()

Functions

What changed since the recording was made, by name: its modules whose code is different now, or that are gone, and its rendering dependencies at another version now, as {dep, then, now}. A recording made before code was recorded has no changes to tell.

The code view runs now: the release named release, or its application's version, the view's MD5, the rendering dependencies, and migration, the newest migration version the app has.

Adds the MD5 of modules, such as the LiveComponents a session rendered.

Types

changes()

@type changes() :: %{
  modules: [String.t()],
  deps: [{String.t(), String.t(), String.t() | nil}]
}

What changed since a recording, as changes/1 tells, by name.

t()

@type t() :: %{
  release: String.t() | nil,
  modules: %{required(String.t()) => String.t()},
  migration: pos_integer() | nil,
  deps: %{required(String.t()) => String.t()}
}

Functions

changes(arg1)

@spec changes(t() | nil) :: changes()

What changed since the recording was made, by name: its modules whose code is different now, or that are gone, and its rendering dependencies at another version now, as {dep, then, now}. A recording made before code was recorded has no changes to tell.

of(view, release, migration \\ nil)

@spec of(module(), String.t() | nil, pos_integer() | nil) :: t()

The code view runs now: the release named release, or its application's version, the view's MD5, the rendering dependencies, and migration, the newest migration version the app has.

with_modules(code, modules)

@spec with_modules(t() | nil, [module()]) :: t() | nil

Adds the MD5 of modules, such as the LiveComponents a session rendered.