Skip to content

Commit 2166998

Browse files
committed
fix(ci): destructure timeline API records in stream_active_logs/2
Same bug as render_timeline_diff/2 (fixed in 0be521c): the Azure DevOps timeline API returns {"records": [...]}, not a bare list. Without the %{"records" => records} pattern, the Enum.filter/2 on line 193 would iterate over a map's key/value pairs as tuples {"records", [...]} instead of the actual record maps, and the reduction in stream_active_logs/2 would never find matching records (because r["state"] and r["log"] would be nil on the tuple {"records", [...]}). This is the second and final call site of fetch_timeline/3 (the first was fixed earlier).
1 parent 2a35f32 commit 2166998

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/ado_cli/ci/watcher.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ defmodule AdoCli.CI.Watcher do
188188
# progress and have a log, and streams new log content for each.
189189
defp stream_active_logs(state, print) do
190190
case fetch_timeline(state.build_id, state.project, state.org) do
191-
{:ok, records} ->
191+
{:ok, %{"records" => records}} ->
192192
records
193193
|> Enum.filter(fn r -> r["state"] == "inProgress" and r["log"] end)
194194
|> Enum.reduce(state, fn rec, state ->

0 commit comments

Comments
 (0)