Learning center

Trace an accepted code review finding to the lines it changed

An accepted finding is the strongest evidence a review trial produces, so check each one before you count it. Find the commit the reviewer read, the lines it commented on, the commit that answered it and a way to show the defect, then record the four together.

Start from the finding and the commit it reviewed#

A Home Assistant pull request in October 2026 made the CalDAV calendar integration return events in order, as Home Assistant's calendar entities are required to. Its first version sorted the event list by each event's local start time:

event_list.sort(key=lambda event: event.start_datetime_local)

An automated reviewer reviewed that commit and recommended changes. Its finding was titled "Sort timezone-aware events by UTC timestamp across DST fallbacks", labelled medium severity, and summarized as: "The new sort reverses chronological order during daylight-saving fallbacks; a timestamp-based key avoids this." Review with the finding ยท Finding thread

Record the review's commit, not just the pull request. Later pushes move the lines and mark the thread as outdated, and a finding is only meaningful against the code the reviewer read. GitHub keeps that commit as the comment's original_commit_id, which the guide to counting comments that changed code uses.

Show the defect before you credit the finding#

The claim is checkable without the integration. Python compares two aware datetimes with the same time zone by their wall-clock times and ignores the fold attribute that marks the repeated hour. On 3 November 2024, clocks in New York went back from 02:00 to 01:00, so 01:30 before the change happens 45 minutes before 01:15 after it:

from datetime import datetime, timezone
from zoneinfo import ZoneInfo

ny = ZoneInfo("America/New_York")
first = datetime(2024, 11, 3, 5, 30, tzinfo=timezone.utc).astimezone(ny)   # 01:30 EDT
second = datetime(2024, 11, 3, 6, 15, tzinfo=timezone.utc).astimezone(ny)  # 01:15 EST

sorted([first, second])                              # 01:15 EST, then 01:30 EDT
sorted([first, second], key=lambda d: d.timestamp()) # 01:30 EDT, then 01:15 EST

The first sort puts the later event first. The finding describes a real defect, and its suggested key fixes the case it names.

A maintainer was not convinced at first and asked whether fold already handled the repeated hour. After checking PEP 495, they agreed: "fold is ignored when comparing datetimes with the same tzinfo, so the timestamp key is needed." Maintainer's conclusion Keep that exchange in the record. A finding that a careful maintainer doubted, and that turned out to be right, is worth more to a trial than one nobody needed to check.

Find the commit that answered it#

The author pushed a commit titled "Sort CalDAV events by timestamp to keep order across DST fallback". In the integration's code it changes only the commented line, and it adds a regression test:

-        event_list.sort(key=lambda event: event.start_datetime_local)
+        # Sort by timestamp, as datetimes in the same time zone are compared by
+        # wall time, which puts events in the wrong order when clocks fall back
+        event_list.sort(key=lambda event: event.start_datetime_local.timestamp())

Fix commit

The reviewer's next review, on the new commit, reported no open findings and one resolved since the last review. Follow-up review The pull request merged on 21 October 2026. The follow-through guide covers what to look for in that second review.

Record the four facts together#

For each accepted finding, write one row that another engineer could check without rereading the thread:

FactThis finding
Reviewed commit and lineThe first sort line in caldav/coordinator.py, at the commit the review names
Defect, as trigger and consequenceEvents in the repeated hour of a fall-back transition, returned in reverse order
Answering changeThe fix commit, which replaces the sort key on the commented line
Evidence the defect was realThe datetime comparison above, and the maintainer's confirmation

The last row is the one trials skip. An author who changes a line because a reviewer asked has accepted the finding, but has not shown it was right. Some accepted findings are harmless changes made to end a discussion. Count those as accepted and unconfirmed, and keep them apart from findings you could demonstrate, as the denominator guide recommends.

Notice what the record leaves out#

This finding was labelled medium. A wrong order for events in one hour a year is a small consequence, and the label fits. Record the label beside the consequence anyway, because the severity guide uses the pairs. Then compare the finding with its opposite case, where the author answered a finding with reasons and the code stayed as it was.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading