Feat: add more filters based on browser testing deep dive#99
Merged
punitarani merged 10 commits intopunitarani:mainfrom Apr 1, 2026
Merged
Feat: add more filters based on browser testing deep dive#99punitarani merged 10 commits intopunitarani:mainfrom
punitarani merged 10 commits intopunitarani:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add flight search filters: emissions, bags, alliances, sort modes, and show-all results. Utilized a combination of browser testing and automated probing to determine results of changes to various flags in the requests.
Summary
--emissionsflag (ALL/LESS) maps to Google Flights' "Less emissions only" toggle--bagsand--carry-onflags include baggage fees in displayed prices, making budget vs full-service carrier comparisons fairer--all/--no-all(default on) returns ~100 results instead of ~30 curated ones, equivalent to clicking "Show more flights"ONEWORLD,SKYTEAM,STAR_ALLIANCEto the Airline enum so users can filter by alliance (e.g.--airlines STAR_ALLIANCE)SortByenum to match Google Flights — renamedNONE→TOP_FLIGHTS,TOP_FLIGHTS→BEST, addedEMISSIONSsortNotable
[1][6]) but cannot be implemented in our flat payload format — documented as a known limitationTest plan
make lintpassesGreptile Summary
This PR adds five new Google Flights search capabilities — emissions filtering, bags-in-price display, show-all-results toggle, airline alliance filtering, and updated sort modes — all wired consistently through the CLI, MCP server, and data models. The implementation is backed by documented systematic API probing (~150 requests) and includes 9 new tests covering all added features.
Key changes:
EmissionsFilterenum,BagsFiltermodel, andshow_all_resultsbool added to bothFlightSearchFiltersandDateSearchFilters(exceptshow_all_resultswhich is flights-only, correctly omitted from date search).SortByenum renamed:NONE→TOP_FLIGHTS(value 0),TOP_FLIGHTS→BEST(value 1), newEMISSIONS(value 6). The model default changed fromNONEtoBEST, which is a semantic shift for any code constructingFlightSearchFilterswithout an explicitsort_by.ONEWORLD,SKYTEAM,STAR_ALLIANCEadded to theAirlineenum; they serialize as their Python name (e.g.\"STAR_ALLIANCE\") via the existing.name-based serializer, consistent with how airline IATA codes work.FlightSearchFilters.format()andDateSearchFilters.format()now has a precise comment from empirical testing, significantly improving maintainability.CLAUDE.mdnot updated: The MCP tool reference section (line 118) still lists the oldsort_byvalues and does not mentionTOP_FLIGHTS,BEST, orEMISSIONS.Confidence Score: 5/5
Safe to merge — all remaining findings are minor style and documentation gaps with no runtime or data-integrity impact.
All 146 tests pass, the new filters are correctly wired through CLI, MCP, and models, and the payload positions were empirically verified. The three open comments are P2: a stale field description in FlightSearchParams, a missing upper-bound constraint on --bags in the CLI, and a redundant parse_emissions implementation. None affect correctness.
fli/mcp/server.py (stale sort_by description in FlightSearchParams) and CLAUDE.md (sort_by values not updated in the MCP tool reference).
Important Files Changed
emissions,bags,show_all_resultsfields and detailed comments on every payload index position; defaultsort_bychanged from removedNONEtoBEST.EmissionsFilterenum andBagsFilterPydantic model; renamesNONE→TOP_FLIGHTSand addsBEST/EMISSIONStoSortByenum.FlightSearchFiltersupdates: addsemissionsandbagsfields with correct payload position comments;show_all_resultsnot added (date API endpoint doesn't support it).ONEWORLD,SKYTEAM,STAR_ALLIANCE) to theAirlineenum; they serialize via.nameas their Python identifier in the API payload.parse_emissionsfunction; updatesparse_sort_bydocstring;parse_emissionsreimplements whatresolve_enumalready provides (minor style inconsistency).emissions,checked_bags,carry_on,show_all_resultsto bothFlightSearchParamsand thesearch_flightstool;FlightSearchParams.sort_bydescription remains stale (still lists old values).--layover,--emissions,--bags,--carry-on,--all/--no-alloptions;--bagshas no upper-bound enforcement unlike the MCPle=2constraint.show_all_results=Truedefault.parse_emissions, alliance airline parsing, and updatedSortByenum values with specific value assertions.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD CLI["CLI --emissions/--bags/--all/--layover"] --> Core["core/parsers.py\nparse_emissions()"] MCP["MCP search_flights()\nemissions, checked_bags,\ncarry_on, show_all_results"] --> Core Core --> Filters["FlightSearchFilters\n+ emissions: EmissionsFilter\n+ bags: BagsFilter | None\n+ show_all_results: bool"] Filters --> Format["format()\nouter[3] = show_all_results\nfilters[1][10] = bags\nsegment[13] = emissions"] Format --> Payload["Google Flights API\nURL-encoded payload"] Airline["Airline enum\n+ ONEWORLD\n+ SKYTEAM\n+ STAR_ALLIANCE"] --> Filters SortBy["SortBy enum\nTOP_FLIGHTS=0\nBEST=1 (new default)\nCHEAPEST=2\nEMISSIONS=6"] --> FiltersComments Outside Diff (1)
fli/mcp/server.py, line 236-239 (link)sort_bydescription inFlightSearchParamsThe
FlightSearchParams.sort_byfield description was not updated to include the new sort options added in this PR. Thesearch_flightstool function'ssort_byparameter was correctly updated, but this model's description still lists old values. WhileFlightSearchParamsis not directly exposed as an MCP tool schema, it could mislead developers reading the code or generating SDK clients from the model.Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "lint" | Re-trigger Greptile
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!
Context used: