Skip to content

Let an empty rows= iterable leave no LAVA table - #235

Merged
abrignoni merged 1 commit into
mainfrom
feat/artifact-result-empty-iterable
Sep 20, 2026
Merged

abrignoni merged 1 commit into
mainfrom
feat/artifact-result-empty-iterable

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

add_row() registers an artifact's LAVA table at the first row, so a streaming module that finds nothing leaves nothing behind. The rows= form had no such guarantee: __bool__ returned True for any non-list iterable, so the core registered the table and its manifest entry before a row proved there was data. An artifact that found nothing came out as a table with no rows and a zero record count, which reads as "parsed, found nothing" rather than "did not run".

__bool__ now takes a one-item lookahead and __iter__ puts the item back, so both forms behave alike and consuming the result still yields every row.

Nothing in the tree uses rows= today, so this changes no current output; it closes the trap before the first artifact walks into it. leapp_functions/app/artifact_result.py stays byte-identical across all five cores.

Six tests: the empty iterable, the empty list, a non-empty iterable keeping every row after the lookahead, asking twice, and both shapes driven through artifact_processor. Two fail without the change, in every core.

🤖 Generated with Claude Code

add_row() registers the artifact's table at the first row, so a streaming module that
finds nothing leaves nothing. The rows= form had no such guarantee: __bool__ returned
True for any non-list iterable, so the core registered the table and a manifest entry
before a row proved there was data, and an artifact that found nothing came out as a
table with no rows and a zero record count. In a report that reads as "parsed, found
nothing" rather than "did not run".

__bool__ now takes a one-item lookahead and __iter__ puts the item back, so both forms
behave alike and consuming the result still yields every row. Nothing in the tree uses
rows= today; this closes the trap before anything does.

Tests cover the empty iterable, the empty list, a non-empty iterable keeping every row
after the lookahead, asking twice, and both shapes through artifact_processor. Two of
them fail without the change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@abrignoni
abrignoni merged commit 95f9e5d into main Sep 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant