Reviewing pull requests in CodeBook
Comment on a linked pull request's lines, submit a review, follow a stack of pull requests and walk a guided review tour.
You can review a pull request linked to a story without leaving CodeBook. Comments and reviews are posted to the Git host — GitHub, GitLab or Gitea / Forgejo — and comments made at the host are read back.
Open the review
Open the card, go to Development and choose Review changes beside a linked pull request. In simple mode, open the story page and use Review the change.
The dialog reads the pull request from the host at its current head and has four tabs:
- Changes — each changed file and its diff.
- Conversations — every inline conversation, from CodeBook and from the host.
- Tours — guided review tours of this pull request.
- Review — submit your verdict.
Refresh reads the host again. Open at the host opens the pull request there.
Comment on a line
Select a line, or a range of lines, in Changes and write your comment. You can reply, Resolve and Reopen a conversation.
Your comment is posted at the host and is signed with your name. If someone pushed new commits after you opened the dialog, nothing is posted and you are asked to look at the new head. A conversation started on an older head is shown as outdated; it is not moved to new code.
If a post times out, retrying does not post the comment twice.
Submit a review
In Review, choose Comment, Request changes or Approve, and optionally summarise your review.
- Comment posts your summary at the host.
- Request changes is sent as a "changes requested" review on GitHub and Gitea. GitLab's API has no such verdict, so it is posted as a note that says so. If a host refuses a review from its own author, it is posted as a comment that says so.
- Approve is recorded in CodeBook only. CodeBook never approves at the host.
The reason: the host shows every comment as coming from the repository connection's account — the Bookbag GitHub App, or the owner of the GitLab or Gitea token. An approval sent from that account would count toward the repository's required approvals on behalf of whoever owns it. Approve at the host yourself when your approval must count there.
What each host supports
| GitHub | GitLab | Gitea / Forgejo | |
|---|---|---|---|
| Line comments | Lines and ranges | Lines and ranges | One line; a range is named in the comment |
| Resolve | At the host | At the host | Recorded in CodeBook only; the API cannot resolve |
| Request changes | Review at the host | A note | Review at the host |
| Approve | Recorded in CodeBook only | Recorded in CodeBook only | Recorded in CodeBook only |
Agents in review
A reviewing agent at a station with repository read access, on a card with a linked pull request, can comment on lines and write a review tour. It uses the same rules as a person. An agent cannot approve.
Stacked pull requests
A pull request is stacked when its base branch is another pull request's branch in the same repository. An agent can open a pull request on top of another story's branch.
Under a stacked pull request, Development shows the stack: each pull request in order, its story and its state. Only stories of the same workflow are named.
When a lower pull request merges:
- if the host already moved the next one, the stack shows Moved by the host;
- if the lower branch's commits are in the new base (a merge commit), CodeBook changes the next pull request's base to it: Moved onto the base below;
- if the lower change was squashed or rebased, CodeBook cannot tell that the next pull request is safe to move. It is Left for a person, with the reason, and you can choose Retarget anyway.
CodeBook only changes the base of a pull request. It never pushes to or rewrites a branch.
Guided review tours
A tour is an ordered list of stops — a file, a line range and a note — that tells a reviewer where to start and what to look at.
- In Tours, choose New tour, give it a title and Add stop for each place. A tour has 1 to 30 stops, and every stop must be on lines the pull request changes.
- Choose Walk to step through a tour with Previous and Next, and End tour when you are done.
A tour belongs to the head it was written on. Once the pull request has new commits, the tour is marked Stale: the pull request has new commits. Retire a tour you no longer need; retired tours are kept, not deleted.
Reverts on GitLab and Gitea / Forgejo
Revert changes now works for GitLab and Gitea / Forgejo repositories as well as GitHub, with the same preview, pinned target branch and protection against duplicates. GitLab opens a Draft: merge request; Gitea / Forgejo opens a [WIP] pull request.
Some changes cannot be written exactly through a host's API. They are shown as conflicts in the preview, before anything is written:
- symbolic links and submodules, on GitLab and Gitea;
- on Gitea, any file whose mode is not a plain file (for example an executable).
Before a revert pull request opens, CodeBook reads back the branch it wrote and compares it with the reviewed preview. Changes to .gitea/workflows, .forgejo/workflows and .gitlab-ci.yml, like .github/workflows, are never written automatically.
Limits
- These features were tested against local stand-ins of GitLab and Gitea driven through CodeBook's real clients, and a protocol stand-in of GitHub. They have not been run against a live GitHub, GitLab or Gitea account.
- The diff shown is what the host lists for the pull request. A host that lists no changed files shows none.
- For an agent's stacked pull request, the run's report and dependency scan still compare against the default branch.