Repository navigation
feat(web): summarize the changeset above the stream and start the side panel closed - #1336
Conversation
[Medium impact] The changes affect the browser review experience, but stay within that workflow. Meet the naming and unused-code requirements before merging; the two summary display issues are non-blocking. Findings
Fix with agent prompt### Issue 1
packages/hunk/src/web/overview/summarySentence.ts:47-49
**Incomplete counts misidentify dominant files.** `totalChurn` can be a lower bound, so this comparison does not establish an 80% share. A file with 9,000 counted lines beats another file counted only to 1,000 lines, even when that second file actually contains far more changes. Dropping `rest` does not prevent the false “Mostly” claim. Skip the file rule when other files have incomplete counts, or use bounds that actually establish the share.
### Issue 2
packages/hunk/src/web/styles.css:2766-2770
**Overview button gets clipped.** This rule measures the whole window, not the space left for the strip. At a 1,000px window with both panels open, the strip has roughly 360px. Five role chips, the badge, and the Overview button cannot shrink, so the strip’s `overflow: hidden` cuts off the trailing button. Hide chips based on the column’s width, or let them yield space before the button.
### Issue 3
packages/hunk/src/web/overview/SummaryStrip.tsx:1
**New filenames break repository rules.** The naming directive requires dash-case for `.ts` and `.tsx` files. Rename `SummaryStrip.tsx` and update its imports. `sizeBadge.ts` and `summarySentence.ts` have the same problem; the pattern also appears in the new unit test filename.
### Issue 4
test/web/webTestHarness.ts:374-380
**Unused panel helper remains.** `openTestSidePanel` is exported but has no callers. The repository directive says not to introduce dead code, including unused functions. Remove this helper until a test needs it, or use it in the tests it was added for.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds a fixed summary strip above the review stream and makes the side panel start closed unless the browser saved another choice.
The strip can hide its Overview button in narrow columns and can name the wrong dominant file when counts are incomplete. New filenames and an unused helper also need to meet the repository’s rules. Reviews (1) · Last reviewed commit: "feat(web): summarize the changeset above..." · Reviewed by Greptile |
| if (largest && totals.files > 1 && totalChurn > 0) { | ||
| const largestChurn = largest.additions + largest.deletions; | ||
| if (largestChurn >= totalChurn * DOMINANT_FILE_SHARE) { |
There was a problem hiding this comment.
Incomplete counts misidentify dominant files.
totalChurn can be a lower bound, so this comparison does not establish an 80% share. A file with 9,000 counted lines beats another file counted only to 1,000 lines, even when that second file actually contains far more changes. Dropping rest does not prevent the false “Mostly” claim. Skip the file rule when other files have incomplete counts, or use bounds that actually establish the share.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/hunk/src/web/overview/summarySentence.ts
Line: 47-49
Comment:
**Incomplete counts misidentify dominant files.** `totalChurn` can be a lower bound, so this comparison does not establish an 80% share. A file with 9,000 counted lines beats another file counted only to 1,000 lines, even when that second file actually contains far more changes. Dropping `rest` does not prevent the false “Mostly” claim. Skip the file rule when other files have incomplete counts, or use bounds that actually establish the share.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| /* Role counts go first when the strip runs short; the sentence then truncates. */ | ||
| @media (max-width: 900px) { | ||
| .summary-roles { | ||
| display: none; | ||
| } |
There was a problem hiding this comment.
Overview button gets clipped. This rule measures the whole window, not the space left for the strip. At a 1,000px window with both panels open, the strip has roughly 360px. Five role chips, the badge, and the Overview button cannot shrink, so the strip’s
overflow: hidden cuts off the trailing button. Hide chips based on the column’s width, or let them yield space before the button.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/hunk/src/web/styles.css
Line: 2766-2770
Comment:
**Overview button gets clipped.** This rule measures the whole window, not the space left for the strip. At a 1,000px window with both panels open, the strip has roughly 360px. Five role chips, the badge, and the Overview button cannot shrink, so the strip’s `overflow: hidden` cuts off the trailing button. Hide chips based on the column’s width, or let them yield space before the button.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| @@ -0,0 +1,151 @@ | |||
| /** @jsxImportSource react */ | |||
There was a problem hiding this comment.
New filenames break repository rules. The naming directive requires dash-case for
.ts and .tsx files. Rename SummaryStrip.tsx and update its imports. sizeBadge.ts and summarySentence.ts have the same problem; the pattern also appears in the new unit test filename.
Context Used: guidelines.mdc Cursor rule (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/hunk/src/web/overview/SummaryStrip.tsx
Line: 1
Comment:
**New filenames break repository rules.** The naming directive requires dash-case for `.ts` and `.tsx` files. Rename `SummaryStrip.tsx` and update its imports. `sizeBadge.ts` and `summarySentence.ts` have the same problem; the pattern also appears in the new unit test filename.
**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| /** Open the side panel through the toolbar's toggle, unless it is already open. */ | ||
| export async function openTestSidePanel(page: Page) { | ||
| const panel = page.getByTestId("side-panel"); | ||
| if (await panel.isVisible()) return; | ||
| await page.getByTestId("toggle-side-panel").click(); | ||
| await expect(panel).toBeVisible(); | ||
| } |
There was a problem hiding this comment.
Unused panel helper remains.
openTestSidePanel is exported but has no callers. The repository directive says not to introduce dead code, including unused functions. Remove this helper until a test needs it, or use it in the tests it was added for.
Context Used: guidelines.mdc Cursor rule (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/web/webTestHarness.ts
Line: 374-380
Comment:
**Unused panel helper remains.** `openTestSidePanel` is exported but has no callers. The repository directive says not to introduce dead code, including unused functions. Remove this helper until a test needs it, or use it in the tests it was added for.
**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
fb44908 to
32ab15b
Compare
514de71 to
bc0b026
Compare
32ab15b to
c825086
Compare
…e panel closed
The browser review page opened its side panel by default to say how big
a changeset is. A one-line strip above the stream now carries the size
badge, a sentence naming what most of the change is ("Mostly
data/huge.json (+24,999 −1). Without it: 46 files, +49 −46."), the
non-zero file roles, and a button to the Overview. The side panel starts
closed at every width and opens on Notes when the review has any. The
Overview tab drops zero rows and says what "Meaningful" leaves out.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
bc0b026 to
6ab11af
Compare
Problem
On a wide window the browser review page opens its side panel by default, on the Overview tab, and gives it about 342px beside the diff. The tab lists rows that are zero (Tests 0, Generated 0, Untracked 0) and shows "All changes" beside "Meaningful" without saying what "meaningful" leaves out. The first thing a reviewer wants to know, how big this is and what most of it is, takes a panel to say.
Approach
overview/SummaryStrip.tsx), one 40px line above the stream:overview/summarySentence.ts, a pure helper over data the overview already has. If one file holds at least 80% of the changed lines: "Mostlydata/huge.json(+24,999 −1). Without it: 46 files, +49 −46." Else if one top-level directory holds at least 60% of the files: "Mostly inimages/: 7 of 9 files." Else no sentence. The "without it" clause is dropped when any count is a lower bound, since subtracting from one would print a wrong figure;With the shared filter active the strip counts the filtered files, as the Overview tab does, and starts with "Filtered: N of M files." At 900px and below the chips drop and the sentence truncates.
REVIEW_MEANINGFUL_FILE_ROLES.core/is unchanged.docs/web-review-client.mdis updated for the panel default.Trade-off
The strip costs 40px of height at all times; closing the panel by default returns about 342px of width.
Tests
summarySentence.test.ts,panelPreferences.test.ts.test/web/review-summary.e2e.ts(10 tests): both sentence rules and the no-sentence case, exact "without it" figures, the filter prefix, chips that do not change the filter, the Overview button, and the 800px layout.review-tools: "starts closed at every width" and Notes-versus-Overview on first open. Tests that need the panel open seed the stored preference through a new harness helper; no assertion was weakened.bun run typecheck,bun run lint,bun run format:check,bun run deps:check: pass.bun test packages/hunk/src/web: 291 pass, 0 fail.bun run test:web: 137 passed, 8 skipped (the opt-in capture specs), 0 failed, run after the last edit. The measurement, large-review, and minimap specs pass unchanged.Checked in
github-dark-defaultandgithub-light-defaultat 1440px and 800px, panel closed and open. Platform: macOS only.Stack
8 of 9. Each PR is based on the one above it in this table and contains only its own change.
mainMerge order: 1 to 9, from the top of the table. After a PR merges, the next one's base becomes
main(GitHub retargets it when the merged branch is deleted; otherwise change the base by hand) and its diff still shows only its own change.This PR description was generated by Claude Code using Claude Fable 5.2