Skip to content

IncrementalExecutionResult.transform() loses incremental-specific fields #4072

@AndreaRomani

Description

@AndreaRomani

Bug Description

When calling transform() on an IncrementalExecutionResultImpl, the method returns an IncrementalExecutionResult of the correct type, but loses the incremental-specific field values (incremental, hasNext, incrementalPublisher).

Expected Behavior

The transform() method should preserve both the incremental result type AND its specific field values.

Current Behavior

The transformed result is correctly typed as IncrementalExecutionResult but the incremental data fields are lost/null.

Reproduction

ExecutionResult incrementalResult = IncrementalExecutionResultImpl
    .newIncrementalExecutionResult()
    .incremental(List.of(DeferPayload.newDeferredItem().data("hello").build()))
    .build();

var transformedResult = incrementalResult.transform(builder -> builder.addExtension("key", "value"));

// transformedResult is correctly IncrementalExecutionResult, but incremental data is lost
assert transformedResult instanceof IncrementalExecutionResult; // PASSES
IncrementalExecutionResult incResult = (IncrementalExecutionResult) transformedResult;
assert incResult.getIncremental() != null; // FAILS - incremental data is lost

Impact

This breaks the contract that transform() should preserve all result data while allowing modifications. Users lose incremental payloads when transforming results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions