fix: correct /stats wiki page count and Wiki.js listing pagination

- /stats passed the bare user name as path prefix (matched nothing, always
  reported 0 of 138 pages); it now counts pages under users/{user}
- list_pages applied the API-side limit before client-side path/tag filters,
  dropping matching pages that sort late; limit now applies after filtering
- list_all_pages replaced the fake while/break pagination with a real
  limit-growth loop: Wiki.js 2.x pages.list supports only a limit argument
  (no offset - verified via GraphQL introspection), so the client doubles
  the limit until the API returns fewer pages than requested

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 10:03:13 +02:00
co-authored by Claude Fable 5
parent 5c2284922d
commit 54204599a9
3 changed files with 81 additions and 36 deletions
+2 -2
View File
@@ -192,10 +192,10 @@ async def stats(
logger.error(f"Failed to get Qdrant stats: {e}")
qdrant_stats = {"error": str(e)}
# Wiki.js page count
# Wiki.js page count (pages live under the user namespace, e.g. "users/jpmschweitzer/...")
wiki_pages = 0
try:
pages = await wikijs.list_all_pages(user)
pages = await wikijs.list_all_pages(path_prefix=f"users/{user}")
wiki_pages = len(pages)
except Exception as e:
logger.warning(f"Failed to get Wiki.js stats: {e}")