Skip to content

fix: prevent @defer list-item projector crash in streaming resolution#1413

Open
svesligaj wants to merge 1 commit intoabsinthe-graphql:mainfrom
fcm-digital:fix/defer-list-item-projector-crash
Open

fix: prevent @defer list-item projector crash in streaming resolution#1413
svesligaj wants to merge 1 commit intoabsinthe-graphql:mainfrom
fcm-digital:fix/defer-list-item-projector-crash

Conversation

@svesligaj
Copy link

What happens

When running incremental execution with @defer inside list items, deferred selection filtering can leave nil entries in selection lists and deferred task execution can resolve with an invalid parent shape/path; this can surface as a projector
crash (case clause mismatch) or malformed deferred payloads.

Why it happens

StreamingResolution marks deferred selections and uses blueprint traversal that replaces nodes but does not remove list entries automatically, so nils may remain in nested selections; additionally, deferred task execution may run against list containers without normalizing parent data/path for item-level resolution.

Proposed fix

  • In StreamingResolution, remove nil entries from selection lists after deferred filtering.
  • Normalize deferred parent data/path when the deferred target is under list selections.
  • Ensure deferred sub-blueprints reset execution result/cache fields and preserve correct operation schema node/current operation context.
  • Handle the {:insert, blueprint, phases} execution flow from Resolution.run/2 by running inserted
    phases.
  • Add a defensive nil clause in Resolution.Projector.do_collect/6.
  • Add a regression test covering inline @defer under list items.

Validation

  • Added regression coverage in incremental defer tests.
  • Verified deferred execution completes without projector crash and returns a valid incremental payload.

@svesligaj svesligaj marked this pull request as ready for review March 2, 2026 14:47
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.

2 participants