Bourse.RecordedResponseFixtures.ListBody (bourse v0.1.0)

Copy Markdown View Source

Evidence classification for list-returning private recorded fixtures.

Enum.all?([], _) is true, so a list-shape assert on an empty capture only proves "the parser returned a list." This module makes empty vs populated mechanical: fixtures declare body_populated, empty bodies emit an explicit shape-only marker, and a silent empty re-capture cannot downgrade a populated cell while staying green (task 469).

Summary

Functions

Sticky population annotation for a captured fixture.

True when a parsed struct bound at least one scalar from the raw wire row.

Whether a recorded response body carries at least one list-of-maps row.

Declared population for a fixture.

First map row from the primary list-of-maps under a body, or nil.

True when method is a list-returning private capture method.

List-returning private methods whose empty-body assert is vacuous without classification.

Longest list-of-maps length under a recorded body (0 when empty).

Explicit marker printed for empty-body list fixtures.

Functions

annotate(fixture, previous \\ nil)

@spec annotate(map(), map() | nil) :: map()

Sticky population annotation for a captured fixture.

Once a cell has been recorded as populated, an empty re-capture keeps body_populated: true so the oracle gate fails instead of silently downgrading to shape-only evidence.

binds_wire_row?(parsed, raw_row)

@spec binds_wire_row?(struct() | map(), map()) :: boolean()

True when a parsed struct bound at least one scalar from the raw wire row.

body_populated?(body)

@spec body_populated?(term()) :: boolean()

Whether a recorded response body carries at least one list-of-maps row.

Walks nested envelopes (data, result.list, result.orders, …) and counts the longest list that contains map rows. Scalar arrays (OHLCV bars, etc.) do not count as populated private-list evidence.

declared_populated?(fixture, recording \\ nil)

@spec declared_populated?(map(), map() | nil) :: boolean()

Declared population for a fixture.

A populated declaration in either the fixture or recording manifest is sticky. When neither carries a declaration, derive it from the body so pre-annotation fixtures still classify correctly.

first_wire_row(body)

@spec first_wire_row(term()) :: map() | nil

First map row from the primary list-of-maps under a body, or nil.

list_method?(method)

@spec list_method?(atom() | String.t()) :: boolean()

True when method is a list-returning private capture method.

list_methods()

@spec list_methods() :: [atom()]

List-returning private methods whose empty-body assert is vacuous without classification.

max_row_list_length(body)

@spec max_row_list_length(term()) :: non_neg_integer()

Longest list-of-maps length under a recorded body (0 when empty).

shape_only_marker()

@spec shape_only_marker() :: String.t()

Explicit marker printed for empty-body list fixtures.