Repository navigation
Closed
Labels
scope/infraDocker container images, DevContainers, and infrastructure toolingsource/agentFiled by an agenttype/bugType bug: the code does not do what it must
Description
Problem
Lines cited at 05e9388 (release/v0.2.29).
- Access listings read only the first page.
list_access_applications(cloudflare/client.py:627-637) reads only the first page ofaccounts/{id}/access/apps.get_access_policies(:660-670) does the same for.../policies.- Both endpoints are paginated; the official SDK types them as
V4PagePaginationArray. _ensure_access_application(:672-690) looks for the domain on that first page and creates the application when it is not there. An account with more applications than one page holds therefore gets a duplicate.
- Only the DNS listing paginates (
list_dns_records,:361-386, with_is_last_dns_page,:241-246). - Nothing is retried.
_request(:272-295) has no retry, so a 429 from Cloudflare's API rate limit or a transient 5xx fails a sync midway. - The official SDK (
cloudflare5.9.0) is not a fit. Itshttp_clientmust be anhttpx.Client:_base_client.py:916checks the type. This project's egress-checked clients are httpx2 clients (fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898, refactor(cli): Unify HTTP and DNS seams with shared fakes #1314).
Proposed remedy
- Pagination. One paginated GET helper over
result_info.pageandtotal_pages, used by the DNS records, Access applications and Access policies listings. - Retries. Retry 429 and 5xx with tenacity (already a dependency), honouring
Retry-After, with a bounded attempt count. A 4xx other than 429 is not retried.
Acceptance criteria
- With an existing application on page 2 of a two-page answer at the HTTP fake,
sync_access_applicationfinds it and creates nothing. - Access policies spread over two pages are all returned.
- A 429 with
Retry-After: 1followed by a 200 succeeds without a real sleep: the test injects tenacity's sleep. - A 403 is not retried.
- Dummy hosts in tests are exactly
example.com. - Tests run offline with fakes only at process and HTTP edges; each new test runs under 1 s.
-
uv run devops cipasses.
Related: #1335 (this client moves onto the egress factory), #1314, #1327.
Found by the 2026-10-08 client-library audit.
Opened as a borrow (#1153, budget/borrowed): the agent filing quota is spent for this cycle, and this is a defect or security finding of the owner-requested 2026-10-08 client-library audit.
Metadata
Metadata
Assignees
Labels
scope/infraDocker container images, DevContainers, and infrastructure toolingsource/agentFiled by an agenttype/bugType bug: the code does not do what it must
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty-bot commentedon Oct 8, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
A functional defect that creates duplicate resources and breaks sync under rate limits, but only manifests with more than one page of applications or transient API errors.Requires a shared paginated GET helper, tenacity-based retry with Retry-After handling, and several offline tests, but the scope is well-bounded to one client module.