Skip to content

fix: correct workflow summary pagination#7392

Merged
sfmskywalker merged 1 commit intoelsa-workflows:release/3.6.1from
RalfvandenBurg:fix/workflow-summary-pagination-release-3.6.1
Apr 15, 2026
Merged

fix: correct workflow summary pagination#7392
sfmskywalker merged 1 commit intoelsa-workflows:release/3.6.1from
RalfvandenBurg:fix/workflow-summary-pagination-release-3.6.1

Conversation

@RalfvandenBurg
Copy link
Copy Markdown
Contributor

Purpose

Fix pagination advancement for workflow instance summary enumeration on release/3.6.1. This corrects PageArgs.Next() so paged enumeration advances by a full page instead of getting stuck at Offset = 1.


Scope

  • Bug fix (behavior change)

Description

Problem

WorkflowInstanceStoreExtensions.EnumerateSummariesAsync advances pagination by calling pageArgs.Next(). On release/3.6.1, PageArgs.Next() sets Offset = Page + 1, which is incorrect for paged range-based iteration.

With a batch size greater than 1, pagination can become stuck at Offset = 1, causing the same page to be requested repeatedly and potentially preventing enumeration from completing.

Solution

This change fixes PageArgs.Next() at the root cause by advancing pagination using Offset + Limit.

It also adds regression tests to verify:

  1. PageArgs.Next() advances by a full page.
  2. WorkflowInstanceStoreExtensions.EnumerateSummariesAsync progresses across multiple pages without repeating offsets.

Verification

Steps:

  1. Run dotnet test test/unit/Elsa.Common.UnitTests/Elsa.Common.UnitTests.csproj --filter FullyQualifiedName~PageArgsTests
  2. Run dotnet test test/unit/Elsa.Workflows.Runtime.UnitTests/Elsa.Workflows.Runtime.UnitTests.csproj --filter FullyQualifiedName~WorkflowInstanceStoreExtensionsTests
  3. Confirm all targeted tests pass and that requested page offsets progress as expected.

Expected outcome:

  • PageArgs.Next() advances from (Offset=0, Limit=10) to (Offset=10, Limit=10) and then (Offset=20, Limit=10).
  • Workflow summary enumeration completes after the empty page instead of repeating Offset = 1.
  • Targeted regression tests pass.

Checklist

  • The PR is focused on a single concern
  • Commit messages follow the recommended convention
  • Tests added or updated
  • No unrelated cleanup included
  • All targeted tests pass

@RalfvandenBurg
Copy link
Copy Markdown
Contributor Author

RalfvandenBurg commented Apr 14, 2026

fixes #7391

@RalfvandenBurg RalfvandenBurg changed the title fix: correct workflow summary pagination on release 3.6.1 fix: correct workflow summary pagination Apr 14, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 14, 2026

Greptile Summary

This PR fixes a one-line pagination bug in PageArgs.Next() on the release/3.6.1 branch, where Offset = Page + 1 advanced by only 1 row instead of a full page, causing EnumerateSummariesAsync to repeat the same tiny window indefinitely. The fix correctly advances by Offset + Limit, and two focused regression tests are added to guard against regression.

Confidence Score: 5/5

  • This PR is safe to merge — the fix is minimal, clearly correct, and covered by well-designed regression tests.
  • Single-line root-cause fix with correct arithmetic, no risk of regressions in adjacent code paths, and two targeted tests that would catch recurrence. No P0/P1 findings.
  • No files require special attention.

Important Files Changed

Filename Overview
src/modules/Elsa.Common/Models/PageArgs.cs Fixes Next() to advance by Offset + Limit instead of the buggy Page + 1; the one-line change is correct and safe.
test/unit/Elsa.Common.UnitTests/Models/PageArgsTests.cs Adds targeted regression tests for Next() covering both the offset-advancing path and the null/unbounded PageArgs.All path; assertions are correct.
test/unit/Elsa.Workflows.Runtime.UnitTests/Extensions/WorkflowInstanceStoreExtensionsTests.cs Integration-style regression test that validates EnumerateSummariesAsync advances through pages 0→2→4 with batchSize=2 and terminates on the empty page; correctly fails against the old buggy Next() formula.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([Start]) --> B["pageArgs = FromPage(0, batchSize)\n(Offset=0, Limit=batchSize)"]
    B --> C{cancellationToken\ncancelled?}
    C -- Yes --> Z([End])
    C -- No --> D["page = SummarizeManyAsync(filter, pageArgs)"]
    D --> E{page.Items\n.Count == 0?}
    E -- Yes --> Z
    E -- No --> F["yield return each item"]
    F --> G["pageArgs = pageArgs.Next()\n✅ Offset = Offset + Limit\n❌ OLD: Offset = Page + 1"]
    G --> C
Loading

Reviews (1): Last reviewed commit: "fix: correct workflow summary pagination..." | Re-trigger Greptile

@sfmskywalker sfmskywalker merged commit 3a37668 into elsa-workflows:release/3.6.1 Apr 15, 2026
3 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.

3 participants