Let an empty rows= iterable leave no LAVA table - #235
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add_row()registers an artifact's LAVA table at the first row, so a streaming module that finds nothing leaves nothing behind. Therows=form had no such guarantee:__bool__returnedTruefor 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.pystays 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