A build cannot succeed with a missing or unreadable partition table
(gen_esp32part consumes it first), so the is_file check and the OSError
arm also defended dead paths; the reachable contract keeps its named
handling (None from the caller, no qualifying row) and everything else
is the backstop's business.
A malformed table cannot reach a successful build: IDF's own parser
rejects blank/junk/zero size cells and validates the layout before rc
is 0, so the blank-cell raise, the row-context re-raise, the broken-
table warning arm, and the size-0 backstop defended dead paths. Only
the read race (OSError) stays named; anything else is the backstop's
business. Their tests go with them; a decimal size cell keeps the
plain-int parse covered.
UnicodeDecodeError is a ValueError, so a non-UTF-8 esp_idf_size.json
read as an internal regression via the backstop; the size report is the
one input nothing upstream validates.
Structural corruption at any level (containers or non-numeric leaves)
warns as malformed; a well-shaped report simply lacking DRAM/DIRAM is a
variant difference and stays at debug, so healthy builds on other
targets cannot train users to ignore the warning channel. The backstop
warning carries exc_info so a field report is actionable without -v,
and the image_size warning names its file. Tests pin each message
distinctly.
A structurally corrupt memory_types warns as malformed instead of
posing as a variant without the region; csv.Error joins the
broken-table warning arm; the blanket's visible record carries the
exception type. The malformed-cell test parametrizes over blank and
non-blank junk, the missing-report test pins its warning, and the
quiet path asserts its debug record exists with no warning records.
_flash_line validates image_size and returns the formatted line, so
nothing after a print can raise and the line buffer, the image_size
double-lookup, and the blanket's one known trigger all dissolve; the
blanket keeps its charter (a test now drives it with a patched raise).
_find_app_partition_size returns None for legitimate absence and
reserves raises for a present-but-broken table, dissolving the
_MalformedPartitionRow subclass and the except-ordering it relied on;
run_compile passes the table path unconditionally so the module owns
the whole policy. The is_file pre-check folds into the OSError arm,
the dead or-{} is gone, and the tests share _dram_size_data and
_write_partitions instead of repeating payload literals.
Skips caused by the build's own outputs (missing/unparsable/misshapen
size report, absent RAM region, broken-but-present partition table via
a typed _MalformedPartitionRow) log at warning; only the legitimately
quiet cases (no table given, no qualifying partition) stay at debug.
The report is buffered so a late failure prints nothing instead of half
a report. The blank-cell test now asserts the logged row and path, so
reverting the ValueError fails it (mutation-checked), and the nested-
shape tests assert the named guard fired rather than the blanket.
The blanket backstop and the zero-partition skip log at warning naming
their input, so a regression or broken table is visible where the
missing line is observed, with the traceback at debug. The blank-cell
ValueError carries the partition and csv path, and the blanket test
asserts no half-formed bar prints instead of a vacuous Traceback check.