Public: anyone can read this; the crew can change it.

The /review diff stat uses the pull's stored base oid, not the live base tip #16925

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The /review diff stat is now taken against the base branch's current tip, not the base oid stored when the pull opened. I pushed it. bun x tsc --noEmit is clean.

Notes

opened this

The /review diff stat is now taken against the base branch's current tip, not the base oid stored when the pull opened. I pushed it. bun x tsc --noEmit is clean. test/review-evidence.test.ts and test/review-page.test.ts pass. I did not run the full suite or try it on a preview.

Why: the stat is meant to show what landing would change. Against the stored oid, it also counted commits the base had already taken in. #4731's review_evidence.ts is on main now, so the earlier decline no longer applies.

What changed

  • diffStatFor in src/web/studio/review_evidence.ts now reads refs/heads/<baseBranch> and uses that tip. The cache key and the git diff use that tip too.
  • If the ref can't be read, it falls back to the stored oid.
  • The tip comes from the ref file, with no git process, so a request still never waits on git. I added readTipSync to src/git/tips.ts for this, rather than making reviewPage async.
  • A test builds a repo where the base has moved on and already contains the head. It expects an empty stat, which the stored base would not give.
  • The existing fixture in test/review-evidence.test.ts pushed the head onto main, which the live-base read made empty. It now leaves main at the base and puts the head on topic.

What I chose not to do: the head still comes from the stored pull, as before. The issue only names the base. I made no terminal or docs/features change; the commit line says No door: because the figure on the /review row is the same.

Try it: open /review on the preview and read a pull's size line after its base branch has moved. It should match the diff the pull page shows against the current base.

Closes #4779

4 earlier comments
commented

The /review diff stat is now taken against the base branch's current tip, not the base oid stored when the pull opened. I pushed it. bun x tsc --noEmit is clean. test/review-evidence.test.ts and test/review-page.test.ts pass. I did not run the full suite or try it on a preview.

Why: the stat is meant to show what landing would change. Against the stored oid, it also counted commits the base had already taken in. #4731's review_evidence.ts is on main now, so the earlier decline no longer applies.

What changed

  • diffStatFor in src/web/studio/review_evidence.ts now reads refs/heads/<baseBranch> and uses that tip. The cache key and the git diff use that tip too.
  • If the ref can't be read, it falls back to the stored oid.
  • The tip comes from the ref file, with no git process, so a request still never waits on git. I added readTipSync to src/git/tips.ts for this, rather than making reviewPage async.
  • A test builds a repo where the base has moved on and already contains the head. It expects an empty stat, which the stored base would not give.
  • The existing fixture in test/review-evidence.test.ts pushed the head onto main, which the live-base read made empty. It now leaves main at the base and puts the head on topic.

What I chose not to do: the head still comes from the stored pull, as before. The issue only names the base. I made no terminal or docs/features change; the commit line says No door: because the figure on the /review row is the same.

Try it: open /review on the preview and read a pull's size line after its base branch has moved. It should match the diff the pull page shows against the current base.

commented

<!-- look-pages a541612489db --> Look pages for a541612, from the gate:

  • look pages (inferred): this pull changes src/web/studio/review_evidence.ts; the forge pictures /review (src/web/studio/review_evidence.ts), the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The feedback contained no change request, only the gate's inferred look page (/review). I agree with it, so I added a Looks: /review commit to confirm it and pushed. No code changed.

The four recurring refusals the feedback listed are already covered:

  • Both doors: the first commit carries a No door: line, because only the existing /review size figure changes.
  • Typed test input: the new test builds a real pull record, with no as never.
  • Issue number: the commit says Direction: … (#4779).
  • Dead code: readTipSync is called from review_evidence.ts.

The pull itself is unchanged. diffStatFor reads the base branch's current tip from its ref file, falling back to the stored oid, and still starts no process on a request. A new test builds a repo whose base has moved on and expects an empty stat. tsc and test/review-evidence.test.ts and test/review-page.test.ts passed when I pushed the first time; I did not rerun them this turn, since nothing changed.

Try it: open /review on the preview and read a pull's size line after its base branch has moved. It should match the diff the pull page shows against the current base.

commented

<!-- look-pages b91169724032 --> Look pages for b911697, from the gate:

  • look pages (named): this pull changes src/web/studio/review_evidence.ts; a commit names /review
commented

The /review diff stat now counts what landing would change, measured against the base branch's current tip instead of the oid stored when the pull opened. I made no new commits this round, so there is nothing new to push. The pull already holds the change.

The feedback was the gate's look-pages note and a list of common refusals. I ran bun scripts/gate.ts --explain against the branch:

  • Look pages: the note is informational. A commit already says Looks: /review, which satisfies the rule.
  • Both doors: this passes. The commit line says No door:. The change only alters how the existing /review figure is computed, so no page, action, route or tool changed.
  • Name the issue: this passes. The Direction commit carries #4779.
  • Real input in tests, not as never: the test file has no as never. The existing as unknown as App stub for the app is unchanged.
  • Dead code: this passes. readTipSync is called from src/web/studio/review_evidence.ts.
  • Comment width: gate --fix rewrapped nothing, so there was nothing to commit.

bun x tsc --noEmit is clean and test/review-evidence.test.ts passes (7 tests).

What changed

  • Live base tip: diffStatFor now takes the base from the branch's ref file. It uses the stored oid only when the ref can't be read. The result is cached under the live base and head pair, so a moved base gets a fresh stat.
  • No new process: readTipSync in src/git/tips.ts reads the loose ref, then packed-refs, so a request still starts no process.
  • New test: the base has already absorbed the pull's head, and the stat comes out at 0 files, 0 additions, 0 deletions. It would fail against the old stored-oid behaviour.
  • Existing fixture: I changed the existing fixture so main stays at the base and the head goes to a topic branch. That matches how a real pull behaves until something lands.

Not done

I left the terminal side and the how-to alone: the figure is the same, only computed against the live base.

Try it

Open /review on the preview and read a pull's size line after its base branch has moved. It should count only what is still left to land.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs