Encode SCV logs for Cloud Logging

6b889c6f8637 · AtlantisPleb · · parent a0a2dff2e163

Encode SCV logs for Cloud Logging

Deploy story

What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.

Not deployed through the forge lane

No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.

Changed files

  • modified lib/openagents/scv/worker.ex
  • modified test/openagents/scv/run_test.exs

Diff

2 files changed, +12 -1

lib/openagents/scv/worker.ex modified +6 -1

@@ -258,5 +258,10 @@ defmodule OpenAgents.SCV.Worker do

258 258
  defp error_code({reason, _detail}) when is_atom(reason), do: Atom.to_string(reason)
259 259
  defp error_code(_reason), do: "worker_failed"
260 260
261
  defp write_json(value), do: IO.puts(Jason.encode!(value))
261
  @doc false
262
  @spec encode_event(map()) :: String.t()
263
  def encode_event(value) when is_map(value),
264
    do: Jason.encode!(value, escape: :unicode_safe)
265
266
  defp write_json(value), do: IO.puts(encode_event(value))
262 267
end
test/openagents/scv/run_test.exs modified +6

@@ -154,6 +154,12 @@ defmodule OpenAgents.SCV.RunTest do

154 154
    assert Enum.all?(chunks, &(&1.report_digest == digest))
155 155
    assert Enum.all?(chunks, &(byte_size(Jason.encode!(&1)) < 4_096))
156 156
    assert chunks |> Enum.map(& &1.text) |> Enum.join() == text
157
158
    encoded = chunks |> hd() |> Worker.encode_event()
159
    assert encoded =~ "\\uD83D\\uDE80"
160
    refute encoded =~ "🚀"
161
    assert {:ok, %{"text" => decoded}} = Jason.decode(encoded)
162
    assert decoded == hd(chunks).text
157 163
  end
158 164
159 165
  defp fake_executable do

This page updates live while a promote is in flight · changelog