fix(wiki): treat an empty wiki's 404 as an empty page list #13

Merged
dsh merged 1 commit from fix/9-wiki-empty-list into master 2026-10-23 22:36:55 +00:00
Owner

What

gitea_wiki {action:"list"} treats an enabled-but-empty wiki as an error:

gitea_wiki failed: The target couldn't be found.

Forgejo's GET /repos/{owner}/{repo}/wiki/pages answers 404 when the wiki has no pages (there is no empty list to return). listWikiPages() now maps only that 404 to { ok: true, status: 404, data: [] }.

Auth (401), permission (403) and server (5xx) failures still surface as errors — the mapping is not a blanket swallow.

Verification

  • New test/wiki.test.mjs: mocked-fetch coverage for 404 → empty success, 200 → pages unchanged, 401/403/500 → still errors.
  • npm run check passes (49 tests, leak scan clean).

Acceptance (from #9)

  • Unit test with a mocked fetch 404: gitea_wiki list resolves ok: true with an empty list and no error text.
  • 401/403/5xx keep failing as before.
  • Live check on ml-lab/tardits after merge/reload (tracked in #9).
  • Live check that pvlb-infra/t14-deeps still lists all pages.

Closes #9.

## What `gitea_wiki {action:"list"}` treats an enabled-but-empty wiki as an error: ``` gitea_wiki failed: The target couldn't be found. ``` Forgejo's `GET /repos/{owner}/{repo}/wiki/pages` answers **404** when the wiki has no pages (there is no empty list to return). `listWikiPages()` now maps only that 404 to `{ ok: true, status: 404, data: [] }`. Auth (`401`), permission (`403`) and server (`5xx`) failures still surface as errors — the mapping is not a blanket swallow. ## Verification - New `test/wiki.test.mjs`: mocked-fetch coverage for 404 → empty success, 200 → pages unchanged, 401/403/500 → still errors. - `npm run check` passes (49 tests, leak scan clean). ## Acceptance (from #9) - [x] Unit test with a mocked `fetch` 404: `gitea_wiki list` resolves `ok: true` with an empty list and no error text. - [x] 401/403/5xx keep failing as before. - [ ] Live check on `ml-lab/tardits` after merge/reload (tracked in #9). - [ ] Live check that `pvlb-infra/t14-deeps` still lists all pages. Closes #9.
Forgejo answers 404 for an enabled-but-empty wiki. Map only that 404 to a successful empty list; 401/403/5xx still fail.
dsh merged commit 913013aa7c into master 2026-10-23 22:36:55 +00:00
Sign in to join this conversation.
No description provided.