refactor(bitbucket): centralize Data Center pagination guard - #1105
Open
dpol1 wants to merge 2 commits into
Open
refactor(bitbucket): centralize Data Center pagination guard#1105dpol1 wants to merge 2 commits into
dpol1 wants to merge 2 commits into
Conversation
Data Center repeated the same nextPageStart guard in six paginators, while regression coverage was uneven: removing the repository- restrictions copy still left the suite green. Hoist the guard into _next_page_start(), mirroring cloud.py's single-helper pattern. Add focused unit coverage for the helper's stop conditions and a parameterized regression test that drives all six paginators against a non-advancing response.
CodeQL flagged two parametrize entries that wrapped a callable in a lambda without binding any extra arguments. Pass the functions directly; the remaining lambdas bind extra arguments and stay.
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.
Summary
datacenter.pyrepeated the same non-advancing-pagination guard(
next_start <= startplus theisLastPage/ non-int checks) in sixpaginators, and coverage was uneven: the issue demonstrated that deleting
the
get_repository_restrictionscopy left the whole suite green._next_page_start()helper, mirroring the_validated_next_url()single-helper patterncloud.pyalready uses.Behaviour is unchanged — the helper preserves the three stop conditions
exactly as they were.
(last page, missing / non-int / repeated / backwards / advancing
nextPageStart), and a parameterized regression test that drives all sixpaginators against a non-advancing server response — so removing the guard
wiring from any one of them now fails the suite.
Type of change
tools/*/withpyproject.toml)Test plan
existing behaviour), and the helper unit tests go red → green across
the refactor.
ruff check,mypy, and the prekworkspace hooks (ruff / mypy / pytest) all green.
apache/magpie#1047 and
apache/magpie#766 are
untouched and still pass.
RFC-AI-0004 compliance
No new network reach, credentials, or mutations; URL construction,
authentication, and response handling are unchanged.
Linked issues
Closes apache/magpie#1052
Notes for reviewers
boolpasses theisinstance(next_start, int)check is deliberately preserved — this PR changes structure, not
behaviour.
existing discussion-paginator pin in
apache/magpie#766, which this
change keeps green). Happy to defer or split credit if a PR of theirs is
in flight — none was visible after 17 days, so this picks the issue up.