Fix bug with trap() around lists/connections - #3128
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 3101d99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
benjie
force-pushed
the
fix-trap-list-interaction
branch
2 times, most recently
from
August 7, 2026 13:00
9556296 to
71aa5ad
Compare
…pable list steps from resolving correctly (often replacing them with `null`).
benjie
force-pushed
the
fix-trap-list-interaction
branch
from
August 7, 2026 13:03
71aa5ad to
3be0b58
Compare
benjie
enabled auto-merge
August 7, 2026 13:19
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.
Consider a plan that wants to skip unnecessary work, such as:
$records, being aPgSelectStep, is a.items()capable step. It actually represents at runtime an object, with the items list inside of it. But now we're returningtrap()(which is a__FlagStep), which did not support.items()- so when the dependency is not inhibited, we just return the PgSelectStep value verbatim... and that's not a list, so we returnnull!trap()breaks our list!The fix is straightforward: have
__FlagStepimplement the$step.items()pattern, re-wrapping the resulting access to the underlying step with the same flag.Connections
For connections things are much more complex. Connections need to not just represent an empty list but potentially deal with aggregates and other complexities. We can't know which values to use for aggregates (string_agg over an empty list may be
"", array_agg maybe[],count()may be0, etc) so we can't sensibly create a default. Having the usertrap(..., valueForInhibit: "EMPTY_LIST")doesn't make sense for a connection because it expects an object with more details: cursors, etc. Basically... I timed out figuring out a good way to make this work. In the end I decided to forbidtrap()with connections; instead we should teach the underlying steps how to avoid doing work if it's unnecessary without leaning into the inhibit system. If you use inhibit in a field that returns a connection, you may well end up with that field returningnullrather than an empty connection. Recommendation: don't inhibit with connections for now.