Skip to content

FIX: stop the findings export when a page offset repeats - #4008

Merged
Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
ManoharPaturi:fix/finding-export-loop-guard
Nov 8, 2026
Merged

Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
ManoharPaturi:fix/finding-export-loop-guard

Conversation

@ManoharPaturi

@ManoharPaturi Manohar Paturi (ManoharPaturi) commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #4007

The export dialog loads every finding through a while loop over next_offset. When the server answers has_more: true with an offset that does not advance, the loop fetches the same page forever: the dialog stays on loading findings with no error and no way out except closing it. The codebase's own pagination helper documents this exact hazard and guards it with a seen cursor set and a page cap; the export loop had neither.

The loop now remembers every offset it has fetched and stops with an error naming the non advancing offset the moment a page repeats it. The guard throws a plain Error, and the existing error path already turns that into its message through toApiError, so the dialog shows it next to Retry.

Tests and Documentation

Added a regression whose list endpoint always returns the same offset: the dialog now shows the did not advance error after exactly one fetch instead of looping; it fails on main, where the loop never terminates. The full export suite passes at 25 tests and tsc is clean.

No documentation change needed, so I did not run JupyText.

A server answer whose next offset does not advance left the export loop fetching the same page forever with the dialog stuck loading. The loop now remembers seen offsets and stops with an error naming the problem, and the error path surfaces the message when the API error carries no detail.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 12:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@romanlutz Roman Lutz (romanlutz) self-assigned this Nov 7, 2026
@romanlutz

Copy link
Copy Markdown
Contributor

The visible change is in the repeated-offset error path, not the normal dialog layout.

These screenshots show the actual export dialog with synthetic findings and a controlled page response of has_more: true, next_offset: 0.

Before: the dialog stays on "Loading findings..." and continues requesting the same page.

Before: the export dialog stays on Loading findings with Download disabled when the page offset repeats

After: it shows "Could not load findings: The findings page offset did not advance." with Retry after one request.

After: the export dialog shows the repeated-offset error and a Retry button, with Download still disabled

toApiError already returns the message of a plain Error, or a fixed message when it is empty, and its detail is never undefined, so the fallback could not run. The repeated offset error reaches the dialog through toApiError on its own.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 8, 2026
Merged via the queue into microsoft:main with commit b6f4b13 Nov 8, 2026
55 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.

Export findings loops forever when the server repeats the same page offset

3 participants