60 lines
2.5 KiB
Markdown
60 lines
2.5 KiB
Markdown
# PR#85: The Merge Base Stands In for an Unknown Base Commit
|
|
|
|
> **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.
|
|
|
|
## Problem
|
|
|
|
On 2026-10-06, `tools/dry-run` with werkrevisor 0.20.6 stopped on hs.hsadmin.ng #283 with
|
|
`the base commit is unknown, so .werkrevisor.toml cannot be read`.
|
|
|
|
The cause: #283 was a stacked PR on the branch `mihoe/rbac-grant-reachability-closure`,
|
|
which was deleted after the merge.
|
|
For such a PR, Gitea returns `base.sha = ''`, but it still knows `merge_base`.
|
|
|
|
Since 0.21.0 ([werkrevisor PR#39](https://git.javagil.de/mi/werkrevisor/pulls/39)),
|
|
werkrevisor reads `.werkrevisor.toml` at the head of the default branch, so the review no longer stops.
|
|
The base commit stays empty, though:
|
|
the result comment says `against base unknown`, and the usage record has `"base_sha": ""`.
|
|
|
|
## Non-Goals
|
|
|
|
- No change for a PR whose base branch still exists: `base.sha` stays the base commit shown.
|
|
- No change of the diff; Gitea computes it against the merge base anyway.
|
|
|
|
## Specification
|
|
|
|
### Feature: a review names a base commit also after the base branch was deleted
|
|
|
|
#### Scenario#85.01: the merge base stands in for an empty base commit
|
|
|
|
So that the result comment and the usage record name the commit the PR was reviewed against.
|
|
|
|
- **Given** a merged PR whose base branch was deleted, so Gitea returns an empty `base.sha` and a `merge_base`
|
|
- **When** werkrevisor reviews it without `WERKATOR_PR_BASE_SHA`
|
|
- **Then** the result comment and the usage record name the merge base as the base commit
|
|
|
|
##### Verified by
|
|
|
|
- [test_flow.PublishAndUsageTest.test_the_merge_base_stands_in_for_the_base_of_a_deleted_branch](../../tests/test_flow.py)
|
|
- [test_flow.PublishAndUsageTest.test_the_base_sha_wins_over_the_merge_base](../../tests/test_flow.py)
|
|
|
|
## Solution
|
|
|
|
- `cli.base_commit` takes `base.sha` and, if it is empty, `merge_base`;
|
|
`main` and `execute` use it when `WERKATOR_PR_BASE_SHA` is not set.
|
|
- Both tests fail without the fallback.
|
|
- A dry run of hs.hsadmin.ng #283 showed `against base unknown` with 0.32.10 and its merge base `b95fe2e` with 0.32.11.
|
|
- The guide for dev.hostsharing.net no longer names the bug as open.
|
|
- Werkbaum: `#ops.basecommit`.
|
|
- Version 0.32.11.
|
|
|
|
## Open Questions
|
|
|
|
None.
|
|
|
|
## Additional Changes
|
|
|
|
- Werkbaum: the idea `#model.codex`, an optional review by the Codex CLI with a frontier model in a subscription.
|