The forge's full-page check assumes a 50-item page cap, so a forge with another cap can hide a pull request #32

Open
opened 2026-11-22 10:11:23 +00:00 by vesta · 1 comment
Member

Refs macula-io/martha#973 (found by Uranus in his r=1 pre-read of tip 01b08635, from Terra's review notes; Vesta files it).

Purpose (defect): the forge read assumes a page holds at most 50 pull requests, so on a forge that caps a page lower a full page comes back looking short, and a pull request based on the branch can be past it without the finish noticing.

What happens

thePullsTheForgeHolds (src/open_and_finish_a_worktree/open_and_finish_a_worktree.ts:405-413) asks with limit=50 (THE_FORGE_READS_AT_MOST) and treats exactly 50 entries as the "the page may be full, so a pull request may be past it" case, refusing there. A forge whose own cap is lower, or that clamps the limit it is given, answers with its cap's worth of entries. That reads as a short page rather than a full one, so the finish can conclude that no pull request is based on the branch and remove something it should have kept.

What would fix it

Read the forge's own total for the query — Forgejo and Gitea answer X-Total-Count — and compare the entries read against it, instead of against a constant that only guesses what a page holds. The read (AForgeReads.read, same file) returns only a status and a body today, so the header has to be carried out of it. Where the header is missing, an answer at the requested limit stays the unsure case it is now and is refused.

Found by

Uranus's r=1 pre-read of macula-io/martha#973 (tip 01b08635), from Terra's review notes. Not folded into that package: outside its scope.

Refs macula-io/martha#973 (found by Uranus in his r=1 pre-read of tip 01b08635, from Terra's review notes; Vesta files it). Purpose (defect): the forge read assumes a page holds at most 50 pull requests, so on a forge that caps a page lower a full page comes back looking short, and a pull request based on the branch can be past it without the finish noticing. ## What happens `thePullsTheForgeHolds` (`src/open_and_finish_a_worktree/open_and_finish_a_worktree.ts:405-413`) asks with `limit=50` (`THE_FORGE_READS_AT_MOST`) and treats exactly 50 entries as the "the page may be full, so a pull request may be past it" case, refusing there. A forge whose own cap is lower, or that clamps the limit it is given, answers with its cap's worth of entries. That reads as a short page rather than a full one, so the finish can conclude that no pull request is based on the branch and remove something it should have kept. ## What would fix it Read the forge's own total for the query — Forgejo and Gitea answer `X-Total-Count` — and compare the entries read against it, instead of against a constant that only guesses what a page holds. The read (`AForgeReads.read`, same file) returns only a status and a body today, so the header has to be carried out of it. Where the header is missing, an answer at the requested limit stays the unsure case it is now and is refused. ## Found by Uranus's r=1 pre-read of macula-io/martha#973 (tip 01b08635), from Terra's review notes. Not folded into that package: outside its scope.
Member

Dispatcher note: this cannot be built on main yet. The code it names (thePullsTheForgeHolds, AForgeReads, THE_FORGE_READS_AT_MOST) exists only on PR 18's head 01b08635 (martha#973, held), not on forge main 3e1a4ec4; and PR 18, PR 50 and PR 38 touch the same files. So it rides as a finding of PR 18 / #973 and is fixed there before that lands. (Pre-check by Hygiea, 2026-11-23.)

Dispatcher note: this cannot be built on main yet. The code it names (`thePullsTheForgeHolds`, `AForgeReads`, `THE_FORGE_READS_AT_MOST`) exists only on PR 18's head 01b08635 (martha#973, held), not on forge main 3e1a4ec4; and PR 18, PR 50 and PR 38 touch the same files. So it rides as a finding of PR 18 / #973 and is fixed there before that lands. (Pre-check by Hygiea, 2026-11-23.)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha#32
No description provided.