GET /api/v1/history paged with before set to a database id, which no response gives a client. before now takes the message id the history responses already carry: the server finds that message among those sent to target and returns the page of messages older than it. To page back, a client passes the id of the oldest message on the page it has. An id with no such message gets 400unknown before id instead of a silent full page. No internal id appears in any response.
The lookup lives in GetHistory in internal/db, which now takes the id; the handler spots an unknown one by sql.ErrNoRows, as the service package does for nick lookups.
A handler test pages back through five messages two at a time using only ids from earlier pages, and checks that every message comes back once, in order. A second test checks the 400 for a made-up id and for the id of a message in another channel. README.md's history section describes the new parameter and error.
Things the diff does not show:
Judgement call: the before message must have been sent to target itself, so the id of a message in another channel or DM is unknown there and gets the 400.
Judgement call: 400 rather than 404, so the error cannot be mistaken for 404channel not found.
A numeric before such as 0 is now an unknown id and gets the 400.
Model: opus-5-5
Closes https://git.eeqj.de/sneak/neoirc/issues/125.
`GET /api/v1/history` paged with `before` set to a database id, which no response gives a client. `before` now takes the message `id` the history responses already carry: the server finds that message among those sent to `target` and returns the page of messages older than it. To page back, a client passes the `id` of the oldest message on the page it has. An `id` with no such message gets `400` `unknown before id` instead of a silent full page. No internal id appears in any response.
The lookup lives in `GetHistory` in `internal/db`, which now takes the `id`; the handler spots an unknown one by `sql.ErrNoRows`, as the service package does for nick lookups.
A handler test pages back through five messages two at a time using only ids from earlier pages, and checks that every message comes back once, in order. A second test checks the `400` for a made-up `id` and for the `id` of a message in another channel. `README.md`'s history section describes the new parameter and error.
Things the diff does not show:
- Judgement call: the `before` message must have been sent to `target` itself, so the `id` of a message in another channel or DM is unknown there and gets the `400`.
- Judgement call: `400` rather than `404`, so the error cannot be mistaken for `404` `channel not found`.
- A numeric `before` such as `0` is now an unknown `id` and gets the `400`.
Model: opus-5-5
GET /api/v1/history took a database id for before, but history
responses carry only each message's id, so a client had nothing to
pass for the next page. before now takes that id: the server finds
the message among those sent to the target and returns the page
older than it. An id with no such message gets 400 "unknown before
id" instead of a silent full page. A handler test pages back through
a channel using only ids from earlier responses, and README.md's
history section describes the new parameter.
Model: opus-5-5
PASS: meets every item of #125, with before taking the message id the responses carry, each message returned once across page boundaries, an id from another channel or conversation treated as unknown (400), and README.md matching the code.
Model: opus-5-5
PASS: meets every item of https://git.eeqj.de/sneak/neoirc/issues/125, with `before` taking the message `id` the responses carry, each message returned once across page boundaries, an `id` from another channel or conversation treated as unknown (`400`), and `README.md` matching the code.
Model: opus-5-5
clawbot
merged commit 1019419b17 into next2026-10-20 11:58:40 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #125.
GET /api/v1/historypaged withbeforeset to a database id, which no response gives a client.beforenow takes the messageidthe history responses already carry: the server finds that message among those sent totargetand returns the page of messages older than it. To page back, a client passes theidof the oldest message on the page it has. Anidwith no such message gets400unknown before idinstead of a silent full page. No internal id appears in any response.The lookup lives in
GetHistoryininternal/db, which now takes theid; the handler spots an unknown one bysql.ErrNoRows, as the service package does for nick lookups.A handler test pages back through five messages two at a time using only ids from earlier pages, and checks that every message comes back once, in order. A second test checks the
400for a made-upidand for theidof a message in another channel.README.md's history section describes the new parameter and error.Things the diff does not show:
beforemessage must have been sent totargetitself, so theidof a message in another channel or DM is unknown there and gets the400.400rather than404, so the error cannot be mistaken for404channel not found.beforesuch as0is now an unknownidand gets the400.Model: opus-5-5
PASS: meets every item of #125, with
beforetaking the messageidthe responses carry, each message returned once across page boundaries, anidfrom another channel or conversation treated as unknown (400), andREADME.mdmatching the code.Model: opus-5-5
clawbot referenced this pull request2026-10-20 14:14:27 +02:00