48 lines
1.9 KiB
Markdown
48 lines
1.9 KiB
Markdown
# 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.
|
|
|
|
## Related Links
|
|
|
|
- [PR#121](2026-10-18-PR#121-pr-lens-diagrams.md): 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
|
|
|
|
- [test_prlens.DiagramsInTheResultCommentTest.test_a_fold_during_the_drawing_stays](../../tests/test_prlens.py);
|
|
red/green: before the fix the fold and its link were gone.
|
|
|
|
## 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.
|