Review a force-pushed pull request incrementally instead of falling back to the whole diff
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
Piste de recherche
Start with .claude/skills/codetrial-review/review-bundle.sh around lines 338–363, then read the related SKILL.md and lenses.md guidance. Trace how --since resolves heads and writes the manifest, and inspect the existing shell test setup before implementing the four described cases. Done means the bundle reports rewritten or rebased updates as specified, falls back for an unresolved head, and ./scripts/test.sh passes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Problem
review-bundle.sh --since <sha> gives a reviewer only the work added since the head an earlier review read, but only when that head is an ancestor of the new head and no merge commit lies between them (.claude/skills/codetrial-review/review-bundle.sh, lines 338-363). Otherwise the manifest records not an ancestor of the head, so the whole diff is reviewed, and no since.diff is written.
Maintainers routinely ask for a rebase or for commits to be squashed and the author answers with a force push, which is exactly the case where the old head stops being an ancestor. So the update that happens most often during review is the one that gets no incremental range, and the reviewer rereads a diff they have already read.
Current behavior
I ran review-bundle.sh 585 <dir> sysprog21/codetrial --since <sha> on main b2c2bc9 for three earlier heads of #585, which was force pushed before it merged: 9bfab6c, d8d4fe8 and 533bc5a (taken from the commit ids of its reviews and review comments). Each run records status: "diverged" with not an ancestor of the head, so the whole diff is reviewed, and writes no since.diff. These heads can still be fetched by full SHA (git fetch rejects the short form), and all four heads share the base efdd342.
For that pull request the whole diff is 1130 lines. What the author changed between d8d4fe8 and the final head is a 22-line diff that deletes 6 lines in one file (git diff d8d4fe8 6bf2003).
git range-diff efdd342..d8d4fe8 efdd342..6bf2003 is 133 lines for the same change, because every rewritten commit also gets a new Change-Id trailer and the commit message hunks show it. So range-diff alone is not the right first tool when the base did not move.
Desired outcome
When --since is not an ancestor, the bundle still tells the reviewer what the author changed since the head they read:
- If the old head and the new head have the same merge base with the target branch (a squash, an amend, a reorder), the answer is the plain tree diff
git diff <old head> <new head>. - If the base moved (a rebase), the answer is
git range-diff <old base>..<old head> <new base>..<new head>, so that a conflict-free rebase shows no change in any commit and a conflict resolution or an amended commit shows up as a change to read first.
Proposed scope
One pull request, limited to .claude/skills/codetrial-review/:
review-bundle.shtakes an optional--since-base <sha>next to--since. When--sinceis not an ancestor and the old head can be resolved locally or fetched by SHA, it writessince.difffor the same-merge-base case andsince.range-diff.txtfor the moved-base case, and records which one in the manifest asstatus: "rewritten"orstatus: "rebased". A short--sinceis expanded to the full SHA first, becausegit fetchdoes not accept the short form.- In the range-diff output, lines that only differ by a
Change-Id:trailer are not shown, so a hook-driven rechain is not reported as a change. - When the old head cannot be resolved, the behavior is unchanged: the manifest says why and the whole diff is reviewed.
SKILL.mdandlenses.mdsay that these files are a pointer to what to read first, not a replacement for the full diff, because the pairing is heuristic and merge commits are ignored by default.- A shell test that builds a small repository and checks four outcomes: a squash on an unchanged base, a conflict-free rebase, a rebase with a conflict resolved, and an unresolvable old head falling back.
Out of scope: a merge of the base into the branch (the whole diff is still reviewed), Change-Id tracking, and any change to memory.py or the findings ledger.
Open question
The old base is not recorded anywhere today; the manifest stores only the base of the current bundle. Should the caller pass --since-base explicitly, or should the manifest of the previous bundle be read when it is present? I would start with the explicit flag, which needs no new state.
Acceptance criteria
- For #585,
--since d8d4fe8writes asince.diffcontaining the 22-line diff of the author's change instead of recordingnot an ancestor, and the manifest saysrewritten. - After a conflict-free rebase in the new test,
since.range-diff.txtshows every commit as unchanged. - After a rebase with a conflict resolved, it shows that change and nothing else.
- With an unresolvable old head, the output is the same as today.
./scripts/test.shpasses, and the new test fails if the new branch is removed.
Related
#585 added a findings ledger that places findings again after a push; it does not change which diff a reviewer reads after a force push. I searched open and closed issues and pull requests for range-diff and found none.
I would like to implement this myself. I read review-bundle.sh and SKILL.md on main b2c2bc9. I will wait for the issue to be assigned to me before opening a pull request, and I will keep the change to one pull request with the test above.
- Langage dominant
- Rust
- Étoiles
- 223
- Forks
- 148
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 224
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de sysprog21/codetrial
-
Check C++ starter node comments against the C++ harnessPeut-être pris @bangyou0912 l’a pris aujourd’hui. Ouverte
sysprog21/codetrial#594 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Transcript tab does not scroll to new turnsPeut-être pris @henrylee1003 l’a pris aujourd’hui. Ouverte
sysprog21/codetrial#592 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Let candidates save and switch between named session setupsPeut-être pris @domin67 l’a pris il y a 1 jour. Ouverte
sysprog21/codetrial#591 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Let the candidate choose the editor indentation widthPeut-être pris @princelu1009 l’a pris il y a 1 jour. Ouverte
sysprog21/codetrial#589 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
CODETRIAL_DURATION_MIN does not preselect the interview length in the lobbyPeut-être pris @RWong04 l’a pris il y a 2 jours. Ouverte
sysprog21/codetrial#582 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de sysprog21/codetrial
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
Les mainteneurs répondent en général sous 1 jour
-
🐞 bug 🧩 bevy_gantz_egui
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
nannou-org/gantz#500 ·
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: Fedora 45 repoOuverteenhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
metasequoiaime/msime#10989 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
fritzprix/libr-agent#2612 ·
Les mainteneurs répondent en général sous 1 jour
-
find: -printf %h drops a doubled slashPeut-être pris @qodelicious l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour