refactor(api): drop apiPostList, which no capped list reads

Every capped route is read with GET, so the POST reader had no caller
and failed the dead-code gate. The list-cap guard now binds a capped
route to apiGetList alone, which is the reader that exists.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 10:58:03 +02:00
1 parent b08d527045
commit 2be262d574
3 files changed
+4 -17

No files matched your search

+3 -3
View File
@@ -6,8 +6,8 @@
* / `meta.limit`). The web client read only `data` (`apiGet`), so the signal
* reached nobody: twelve routes sent it and no surface showed it. A capped
* route is now bound to a reader, a production file outside the API tree
* that fetches the route's path through `apiGetList` / `apiPostList`, the
* one client reader of the cap, which a surface pairs with `ListCapNotice`.
* that fetches the route's path through `apiGetList`, the one client reader
* of the cap, which a surface pairs with `ListCapNotice`.
*
* The routes are derived from the tree (every route file that answers with
* `apiListSuccess`), never listed by hand, so a newly capped route fails here
@@ -48,7 +48,7 @@ function clientPathPattern(route: string): RegExp {
)
.join("/");
return new RegExp(
`\\bapi(?:Get|Post)List\\s*<[\\s\\S]{0,200}?>\\s*\\(\\s*["\`]${body}(?:[?"\`])|\\bapi(?:Get|Post)List\\s*\\(\\s*["\`]${body}(?:[?"\`])`,
`\\bapiGetList\\s*<[\\s\\S]{0,200}?>\\s*\\(\\s*["\`]${body}(?:[?"\`])|\\bapiGetList\\s*\\(\\s*["\`]${body}(?:[?"\`])`,
);
}
-13
View File
@@ -231,19 +231,6 @@ export async function apiGetList<T = unknown>(
return { data, cap: readListCap(meta) };
}
/** POST variant of {@link apiGetList}, for a list read with a body. */
export async function apiPostList<T = unknown>(
path: string,
body?: unknown,
init?: RequestInit,
): Promise<{ data: T; cap: ListCap | null }> {
const { data, meta } = await apiFetchEnvelope<T>(
path,
withDefaultIdempotencyKey(withJsonBody("POST", body, init)),
);
return { data, cap: readListCap(meta) };
}
/** GET — resolves with the unwrapped `data` payload. */
export function apiGet<T = unknown>(
path: string,
+1 -1
View File
@@ -18,7 +18,7 @@
* reads `meta` decodes it unchanged. `truncated` is exact: true only when a
* row past the limit exists. The OpenAPI side is `listEnvelope` in
* `src/lib/openapi/routes/shared.ts`. A client reads it through `apiGetList`
* / `apiPostList` (`src/lib/api/api-fetch.ts`) and shows it with
* (`src/lib/api/api-fetch.ts`) and shows it with
* `ListCapNotice`; `src/__tests__/list-cap-reader-guard.test.ts` binds every
* capped route to such a reader.
*/