Skip to content

build_flight_booking_url hardcodes economy — booking links open in the wrong cabin #213

Description

@drphilth

Every deep-link from build_flight_booking_url opens in economy for 1 passenger, regardless of the cabin searched, because the tfs seat-class field is hardcoded to 1 in build_tfs_token with no parameter. Affects the flights command's links too, not just multi. Verified by hand: flipping the field to 3 yields a business-class booking page. (Passenger count has the same issue but its encoding is a nested message — scoping this to cabin and noting pax as a follow-up.)

--- a/src/fli/search/_proto.py
+++ b/src/fli/search/_proto.py
@@ def build_tfs_token(
-def build_tfs_token(segments, *, is_one_way: bool = True) -> str:
+def build_tfs_token(segments, *, is_one_way: bool = True, seat: int = 1) -> str:
@@ payload = (
-        + _varint_field(9, 1)
+        + _varint_field(9, seat)   # 1=economy 2=premium 3=business 4=first
--- a/src/fli/search/flights.py
+++ b/src/fli/search/flights.py
@@ def build_flight_booking_url(self, flight, *, currency=None, language=None, country=None):
+        # seat_type: SeatType (ECONOMY=1 … FIRST=4); default economy for back-compat
-            tfs = build_tfs_token(segments, is_one_way=is_one_way)
+            tfs = build_tfs_token(segments, is_one_way=is_one_way, seat=seat_type.value)

Plus: add seat_type: SeatType = SeatType.ECONOMY to build_flight_booking_url's signature, and have the callers (cli/commands/flights.py, mcp/server.py::_execute_search) pass the search's seat_type through.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions