Skip to content

reviews: classify the current attachment, not historical events#48

Merged
AntonNiklasson merged 1 commit into
mainfrom
an/auto-assigned-removal
May 19, 2026
Merged

reviews: classify the current attachment, not historical events#48
AntonNiklasson merged 1 commit into
mainfrom
an/auto-assigned-removal

Conversation

@AntonNiklasson
Copy link
Copy Markdown
Owner

@AntonNiklasson AntonNiklasson commented May 19, 2026

Follow-up to #44 addressing two Copilot review comments left after merge.

1. autoAssigned should reflect the current attachment

Comment on fetchers.ts:

autoAssigned uses some(...) over all timeline events, so a historical auto request (e.g., CODEOWNERS at creation) will keep autoAssigned=true even if the request was later removed and re-requested manually.

Walk the timeline in chronological order and track the latest review_requested event per reviewer/team that hasn't been superseded by a review_request_removed. Classify only that "current attachment" event. Same class of mistake as the false-positive case we fixed in #44 — we were looking at history instead of state.

New tests cover the two remove/re-add scenarios for both the direct and team paths.

2. f shortcut help text didn't reflect its scope

Comment on ShortcutHelp.tsx:

The help text lists f as a general action ("Toggle CODEOWNERS-attached reviews"), but the handler is scoped to activeSection === "reviews". Update the description to reflect that scope.

One-line description update. Broader help-overlay-scope structure tracked in #46.

Not addressing

Comment on SortControl.tsx about empty-fields safety — every call site passes a literal constant, so the failure mode is theoretical. Skipping unless it becomes a real concern.

Test plan

  • pnpm typecheck, pnpm test, pnpm lint, pnpm fmt:check
  • 110 server tests pass (was 107)

autoAssigned previously used some(...) over the full timeline, so a
CODEOWNERS auto-attach that was removed and later replaced by a manual
re-request would still come back as auto. Walk the timeline, track
the latest review_requested per reviewer/team minus any
review_request_removed that supersedes it, and classify only that
"current attachment".

Also: scope tag for the `f` shortcut in the help overlay.
@AntonNiklasson AntonNiklasson marked this pull request as ready for review May 19, 2026 13:54
Copilot AI review requested due to automatic review settings May 19, 2026 13:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines how the server determines whether a review request was auto-attached (CODEOWNERS-style) by classifying only the current review-request attachment state (accounting for removals/re-adds), and it updates the keyboard-shortcut help text to accurately reflect scope.

Changes:

  • Server: compute autoAssigned from the latest non-removed review_requested event per reviewer/team (instead of scanning historical events).
  • Server tests: add coverage for remove + re-request scenarios for both direct reviewer requests and team requests.
  • Web UI: clarify that the f shortcut applies only within the Reviews column.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/web/src/components/ShortcutHelp.tsx Updates shortcut help text to reflect that f is scoped to the Reviews column.
packages/server/src/fetchers.ts Tracks current review-request attachment per reviewer/team when computing autoAssigned.
packages/server/src/fetchers.integration.test.ts Adds integration tests for removed-and-readded review request scenarios (direct + team).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AntonNiklasson AntonNiklasson merged commit 265706f into main May 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants