Skip to content

Add helper function to use paging links#9306

Closed
Hugo-Inmanta wants to merge 39 commits intomasterfrom
issue/8801-add-helper-to-use-paging-links
Closed

Add helper function to use paging links#9306
Hugo-Inmanta wants to merge 39 commits intomasterfrom
issue/8801-add-helper-to-use-paging-links

Conversation

@Hugo-Inmanta
Copy link
Copy Markdown
Contributor

@Hugo-Inmanta Hugo-Inmanta commented Jul 2, 2025

Description

Add Result.all() helper method.

closes #8801

Follow-up ticket for api improvement here, I tried for a while to get the plumbing right, but I couldn't.

Self Check:

Strike through any lines that are not applicable (~~line~~) then check the box

  • Attached issue to pull request
  • Changelog entry
  • Type annotations are present
  • Code is clear and sufficiently documented
  • No (preventable) type errors (check using make mypy or make mypy-diff)
  • Sufficient test cases (reproduces the bug/tests the requested feature)
  • Correct, in line with design
  • End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
  • If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see test-fixes for more info)

@Hugo-Inmanta Hugo-Inmanta changed the title first rough draft Add helper function to use paging links Jul 2, 2025
@Hugo-Inmanta Hugo-Inmanta requested a review from wouterdb July 2, 2025 14:38

async def iter_result(result: "Result", env: str, client: "Client") -> AsyncIterator["Result"]:
yield result
async for next_link_url in result.all():
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.

this plumbing is a bit weird, we should do a call about it I think

Comment on lines +584 to +590
async def test_helper_method_using_paging_links(
client: protocol.Client,
fetch_all_data_coro: Coroutine[Any, Any, common.Result],
fetch_page_by_page_coro: Coroutine[Any, Any, common.Result],
page_size: int,
env: str,
) -> None:
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.

This helper makes it hard to understand what the testcase is testing.

Options I see to improve:

  1. I would pass in the expected number of pages as a parameter to this method
  2. I would name it assert_ not test_ (i.e. it is not a test, it is an assertion helper)

@Hugo-Inmanta Hugo-Inmanta requested a review from wouterdb July 9, 2025 05:45
description: Add helper method to use paging links
issue-nr: 8801
change-type: minor
destination-branches: [master, iso8]
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.

I would also include a changelog entry

@Hugo-Inmanta Hugo-Inmanta requested a review from wouterdb July 9, 2025 14:05
Hugo-Inmanta and others added 3 commits July 9, 2025 16:16
…ks.yml

Co-authored-by: Wouter De Borger <wouter.deborger@inmanta.com>
Co-authored-by: Wouter De Borger <wouter.deborger@inmanta.com>
@Hugo-Inmanta Hugo-Inmanta added the merge-tool-ready This ticket is ready to be merged in label Jul 10, 2025
@inmantaci
Copy link
Copy Markdown
Contributor

Processing this pull request

@inmantaci inmantaci removed the merge-tool-ready This ticket is ready to be merged in label Jul 10, 2025
@inmantaci
Copy link
Copy Markdown
Contributor

Failed to merge changes into iso8 due to merge conflict. Please open a pull request for these branches separately by cherry-picking the commit that was made on the branch master (git cherry-pick d6c7c13).

@inmantaci
Copy link
Copy Markdown
Contributor

Merged into branches master in d6c7c13

@inmantaci
Copy link
Copy Markdown
Contributor

Not closing this pull request due to previously commented issues for some of the destination branches. Please open a separate pull request for those branches by cherry-picking the relevant commit. You can safely close this pull request and delete the source branch.

inmantaci pushed a commit that referenced this pull request Jul 10, 2025
…urned by v2 Rest API endpoints that support paging. See [documentation](helper_method_for_paging) for more information.

 (Issue #8801, PR #9306)

# Description

Add `Result.all()` helper method.

closes #8801

Follow-up ticket for api improvement [here](#9320), I tried for a while to get the plumbing right, but I couldn't.
# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
- [ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)
@inmantaci
Copy link
Copy Markdown
Contributor

This branch was not deleted as it seems to still be in use.

Hugo-Inmanta added a commit that referenced this pull request Jul 10, 2025
…urned by v2 Rest API endpoints that support paging. See [documentation](helper_method_for_paging) for more information.

 (Issue #8801, PR #9306)

Add `Result.all()` helper method.

closes #8801

Follow-up ticket for api improvement [here](#9320), I tried for a while to get the plumbing right, but I couldn't.

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
- [ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)
inmantaci pushed a commit that referenced this pull request Jul 10, 2025
…urned by v2 Rest API endpoints that support paging. See [documentation](helper_method_for_paging) for more information.

 (Issue #8801, PR #9337)

follow up iso8 PR to #9306

Add `Result.all()` helper method.

closes #8801

Follow-up ticket for api improvement [here](#9320), I tried for a while to get the plumbing right, but I couldn't.

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
- [ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)

# Description

* Short description here *

closes *Add ticket reference here*

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
- [ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)
@Hugo-Inmanta Hugo-Inmanta mentioned this pull request Jul 10, 2025
9 tasks
inmantaci pushed a commit that referenced this pull request Jul 10, 2025
# Description

follow up fix to github.com//pull/9306

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
- [ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)
inmantaci pushed a commit that referenced this pull request Jul 10, 2025
# Description

follow up fix to github.com//pull/9306

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [ ] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
- [ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)
@Hugo-Inmanta Hugo-Inmanta deleted the issue/8801-add-helper-to-use-paging-links branch July 11, 2025 05:44
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.

Add helper to use paging links

4 participants