Files
werkrevisor/docs/prs/2026-10-05-PR#13-quiet-expected-404.md
claude-code ecad961fe0
werkator build succeeded after 00:34
werkrevisor 0.13.2: no error in the log for the missing version of an added, deleted or renamed file (#13)
PR-Agent logs a 404 as ERROR when it asks for the base version of an added file or the head version of a deleted one; werkrevisor now filters exactly that line.

Details: the PR document under `docs/prs/`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Reviewed-on: #13
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-05 20:34:36 +02:00

58 lines
2.6 KiB
Markdown

# PR#13: No error in the log for the missing version of an added, deleted or renamed file
> **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.
## The Problem
PR-Agent asks Gitea for the base version of every changed file and for the head version as well.
An added or renamed file has no base version under its path, and a deleted file has no head version, so Gitea answers 404.
PR-Agent logs that as `ERROR … Error getting file: <path>, content: (404)`.
The build log of PR#12 showed three such lines, although the review was complete.
## Non-Goals
- No change to what PR-Agent sends to the model.
- Other errors of PR-Agent stay visible, also a 404 for a file that the PR only changes.
## The Scenarios
### Feature: the build log shows only real errors
#### Scenario#13.01: the missing version of an added, deleted or renamed file is not logged
So that a complete review has an error-free log.
- **Given** a PR that adds `docs/prs/2026-10-05-PR#12-x.md`, deletes `old.py` and renames `o.py` to `n.py`
- **When** PR-Agent logs `Error getting file: <path>, content: (404)` for one of these files
- **Then** the line does not appear in the log
##### Verified by
- [test_logging.ExpectedMissingVersionTest.test_404_for_an_added_deleted_or_renamed_file_is_not_logged](../../tests/test_logging.py)
- [test_logging.AddedDeletedRenamedTest.test_the_review_notes_the_added_deleted_and_renamed_files](../../tests/test_logging.py)
- [test_logging.AddedDeletedRenamedTest.test_changed_file_knows_added_deleted_and_renamed](../../tests/test_logging.py)
#### Scenario#13.02: other errors stay in the log
So that a real problem still shows.
- **Given** a PR that adds `new.py`
- **When** PR-Agent logs a 404 for a changed file, a 500 for `new.py` or another error
- **Then** the line appears in the log
##### Verified by
- [test_logging.ExpectedMissingVersionTest.test_other_errors_stay_visible](../../tests/test_logging.py)
## The Solution
- `werkrevisor/review.py` filters this log line of PR-Agent's Gitea provider,
and only for the files that the PR adds, deletes or renames.
- PR-Agent asks for both versions under the new path, also for a renamed file, so the old path never gives a 404.
- The line does not say which version failed, so a real 404 on the other version of such a file is hidden too.
That risk is small: a file whose content is really missing still shows in the coverage check of werkrevisor.
- `ChangedFile.added` and `ChangedFile.renamed` name an added and a renamed file.
- werkrevisor 0.13.2.