Completing the Reviewable Change
Introduction
Welcome back to Ship a Reviewable Change. We are at Lesson 6 of 6, the final lesson in this course. We have already self-reviewed a ticket change, inspected its complete diff, documented its scope, cleared automated feedback, and extracted title normalization without changing comparison behavior.
Now we will place one focused behavior change on top of that reviewed foundation. We will define normalized title lookup, reuse the existing comparison helper, protect the new behavior with a focused test, and document the two changes in review order. Our goal is not only to make lookup work but also to keep the code, evidence, and review plan aligned.
Define the Dependent Lookup Contract
Before implementing lookup, we need a precise contract. As we established in the previous lesson, normalize_title() and titles_match() form the comparison boundary. The new function should call that boundary, not copy its lowercase and whitespace logic. The existing Ticket model still owns ticket data: it stores id, title, and notes, while add_note() appends notes. Lookup only reads the title.
create_ticket() shows the storage boundary: each Ticket is placed in the dictionary under its id, and the same object is then returned. Python dictionaries preserve insertion order, so tickets.values() represents the existing storage order. find_ticket_by_title() must return the first matching Ticket or None after completing the search. It must not create tickets, change stored titles, or reorder the collection.
Implement Lookup Through the Existing Comparison Helper
With the contract fixed, the implementation can stay small. The important design choice is to keep titles_match() as the one comparison boundary. Because that helper already calls normalize_title(), lookup does not need to repeat lower(), split(), or join(). This keeps the dependent change focused on searching, not on another refactor.
The loop visits stored Ticket objects directly. For each one, titles_match() normalizes both the stored title and the query, then compares them. The early return guarantees that the first match is returned. If the loop finishes, None communicates that no ticket matched. This direct scan checks each ticket at most once and uses constant extra space, which is the smallest design for the current collection.

