Skip to content

fix: send list paging parameters in the JSON body - #38

Merged
marevol merged 1 commit into
mainfrom
fix/list-paging-json-body
Oct 7, 2026
Merged

marevol merged 1 commit into
mainfrom
fix/list-paging-json-body

Conversation

@marevol

@marevol marevol commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

fessctl <resource> list --size N --page M had no effect against Fess 15.8 and 15.9. The admin list endpoints read size, page and the endpoint's filters from the JSON body of the GET request and ignore the query string, but FessAPIClient.send_request only sent params=.

Observed with GET /api/admin/<resource>/settings and size=1&page=2:

Endpoint Fess Query string only JSON body only Both
scheduler 15.9.0-SNAPSHOT 15 rows (total 15) 1 1
role 15.9.0-SNAPSHOT 2 rows (total 2) 1 1
labeltype 15.9.0-SNAPSHOT 3 rows 1 1
scheduler 15.8.0 14 rows 1 1
role 15.8.0 2 rows 1 1
labeltype 15.8.0 3 rows 1 1

So every list command returned the server default of 25 rows. A script that pages with --page 1,2,... until it has total rows (for example a migration helper) read page 1 repeatedly and silently skipped the rest once there were more than 25 entries.

Change

  • Action.LIST requests now go through httpx.request("GET", ..., params=params, json=params): the parameters travel in the JSON body (what the server reads) and stay in the query string (harmless; keeps a server that reads either channel working). One place in send_request, not the 23 list_* methods.
  • Action.GET (single record by id) is unchanged.
  • Visible effect: the existing --size default of 100 now actually applies.

Fess 14.x was not probed (no image at hand). The client already parses the Fess version if a gate is ever needed.

Tests

  • Unit (tests/unit/test_client.py): TestListPaging asserts that all 23 list_* methods put page/size into the JSON body and the query string, that a list call without parameters sends no body, and that a GET by id sends no body. The new list tests fail on the previous client (25 of 26) and pass now; two existing tests that mocked httpx.get for list calls now mock httpx.request. uv run pytest tests/unit: 155 passed.
  • Integration (tests/commands/test_scheduler.py::test_scheduler_list_size_and_page): --size 1 returns exactly one row on page 1 and a different row on page 2, with total greater than 1. It failed before the change (15 == 1 on 15.9, 14 == 1 on 15.8.0) and passes on both versions.
  • tests/commands against 15.8.0: 47 passed, 1 skipped (test_tagtype, 15.8.0 has no tagtype API). Against the 15.9 snapshot: 47 passed, 1 failed - test_user_crud_flow at the update step ("roleA is not a registered role or group id"); it fails the same way without this change.

The Fess admin list endpoints (Fess 15.8 and 15.9) bind size, page and
the per-endpoint filters from the JSON request body of the GET and ignore
the query string. fessctl sent them only as query parameters, so
`--size` and `--page` never reached the server: every list command
returned the server default page (25 rows), and a caller that walked the
pages re-read page 1 and missed everything after the first 25 entries.

`send_request` now sends the parameters of a list request both as the JSON
body and as the query string, so a server that reads either channel works.
Single-record lookups are unchanged.
@marevol marevol self-assigned this Oct 7, 2026
@marevol
marevol merged commit b2208a9 into main Oct 7, 2026
4 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.

1 participant