Files
werkrevisor/docs/prs/2026-10-20-PR#127-diagrams-keep-fold.md
claude-code 5a972645a1
werkator build succeeded after 00:22
werkator/werkrevisor-statistics build succeeded after 00:57
werkator/release build succeeded after 00:34
werkrevisor 0.59.1: attaching the diagrams no longer removes the note that a newer review replaced the comment (#127)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-21 21:42:24 +02:00

1.9 KiB

PR#127: Attaching the Diagrams No Longer Removes the Note That a Newer Review Replaced the Comment

Version: patch

WARNING: This document describes only the change applied in this PR. It may already be outdated once the next PR is merged. Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.

  • PR#121: diagrams of PR Lens in the result comment.

Problem

_attach_diagrams reads the body of the result comment, draws the diagrams for up to timeout_seconds, and then writes the body it read plus the links. If the review of a newer head finishes meanwhile, _fold_earlier folds this comment and links the newer result; the write of the diagrams then restores the old body and drops the fold. The Codex review of PR#121 found it after the merge (line comment 6411).

Non-Goals

  • No lock on the comment; Gitea has none.

Specification

Feature: the diagrams keep what a newer result wrote

Scenario#127.01: a fold during the drawing stays

… so that an earlier result still points to the newer one.

  • Given an enabled repository, and a newer head whose result folds this result comment while PR Lens draws
  • When werkrevisor attaches the diagrams
  • Then the comment keeps the fold and the link to the newer result, and the diagrams stand inside the fold
Verified by

Solution

  • _attach_diagrams reads the body again after the drawing and the uploads, and adds the diagrams to that body.
  • prlens.with_section puts them inside the fold of a folded comment, before its </details>.
  • A write between this read and the edit can still get lost; Gitea has no conditional edit. The window shrinks from the drawing, up to timeout_seconds, to one request.