Skip to content

fix(hotels): share and fly to a city without an IATA code (PET-504) - #116

Open
ahsan-amin-wego wants to merge 8 commits into
mainfrom
fix/PET-504-city-without-iata
Open

ahsan-amin-wego wants to merge 8 commits into
mainfrom
fix/PET-504-city-without-iata

Conversation

@ahsan-amin-wego

@ahsan-amin-wego ahsan-amin-wego commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PET-504 · Done when 4 (hotels share) and Done when 5 (flights skill guidance). API fix: wego/wego-ai#2134.

After wego/wego-ai#2134, wego places Makkah --types city returns a city with code 8283. A code that is not 3 uppercase letters is not a flight endpoint. The flights bullet in skills/wego/references/cli.md now tells the agent to:

  1. Run wego info airports-near <latitude>,<longitude> with the city row's coordinates.
  2. Read each row's name, because some rows are train stations (MKX is Makkah Train Station).
  3. Search only the nearest airport the user did not rule out (Makkah: JED, or TIF if Jeddah is ruled out), and tell the user which airport it chose. It gives the distance only when the row has coordinates. It searches a second airport only when the user asks to compare, because each search is metered.

hotels share (Done when 4): parseHotelsShareArgs accepts ^([A-Z]{3}|\d{1,9}(-\d{1,9})?)$, so 8283 (Makkah) and 1293-74 (Cannes) share like BKK. A refused code now gets: Pass a city code from `wego places <name> --types city`: 3 uppercase letters (BKK), or the numeric code a city without an airport carries (Makkah is 8283).

  • Behaviour change: a hotelId (710862) is numeric too, so the parser can no longer refuse it by shape. The usage-error case for it is removed, and the skill says to pass only a places code. The API cannot tell them apart either.
  • Contract: contract/openapi.json gets the search-link cityCode of wego/wego-ai#2134 (no pattern, new description), committed on its own. It is hand-applied because the API is not deployed yet; bun run api-contract:refresh replaces it after the deploy.
  • Proof: wego hotels share 8283 2027-01-20 2027-01-22 gives a 400 against API main and …/hotels/searches/8283/2027-01-20/2027-01-22?guests=2&ulang=en against API PR. That URL on wego.com opens Makkah, Saudi Arabia (216 properties):

wego.com/hotels/searches/8283 opens Makkah

PET-508 (rebase needed): this branch is off main and independent of wego/cli#115. git merge-tree of the two heads conflicts in src/hotels.test.ts (both add imports and tests). src/commands.ts, contract/openapi.json and integration/hotels.test.ts merge clean. A rebase is needed after whichever PR lands first, then bun run api-contract:refresh once both API PRs are deployed.

AGENTS.md: it says not to edit skills/. Here skills/wego/references/cli.md is the shipped skill text the ticket asks to change, as #112 did.

Done when (PET-504)

# Done when Result
1 7 affected cities return under --types city ✅ API PR: main 0/7, PR 7/7 (Table A)
2 A city row is the same whatever other types are asked for ✅ API PR, Table B there
3 No-match: no rows, metadata claims nothing ✅ API PR: totalCandidates: 0, hasAmbiguity: false
4 Hotels share recovery message ✅ This PR: hotels share 8283 builds a link that opens Makkah, and the refusal points at places --types city
5 Flights skill guidance resolves airport-less cities ✅ This PR. The command it names works on main and PR (below)
6 11 controls do not regress ✅ main 11/11, PR 11/11 (Table A)

Done when 5 evidence

wego places Makkah --types city → 8283 at 21.4227,39.8259 (PR API only, main returns no row). Then wego info airports-near 21.4227,39.8259, same on main and PR API:

type code name
airport MKX Makkah Train Station
airport JXD Al-Sulimaniyah Train Station
airport JED King Abdulaziz International Airport
airport TIF Taif Airport
airport KCX King Abdullah Economic City Train Station
airport ABT Al-Baha Airport

Table A: the ticket's commands, CLI at this repo's main (1.5.1) against API main vs API PR

Cell: where the expected code is among the city rows, the first city row, metadata.totalCandidates, metadata.hasAmbiguity.

Query Expected code main PR
wego places "Makkah" --types city 8283 missing: -/- · 0 rows · ambiguity false ✅ #1: Makkah/8283 · 1 rows · ambiguity false
wego places "Al Khobar" --types city 45884 missing: Al Baha/ABT · 6 rows · ambiguity true ✅ #1: Al Khobar/45884 · 14 rows · ambiguity true
wego places "Bethlehem" --types city 31956 missing: -/- · 0 rows · ambiguity false ✅ #1: Bethlehem/31956 · 5 rows · ambiguity true
wego places "Nazareth" --types city 9475 missing: -/- · 0 rows · ambiguity false ✅ #1: Nazareth/9475 · 6 rows · ambiguity true
wego places "Interlaken" --types city 6407 missing: -/- · 0 rows · ambiguity false ✅ #1: Interlaken/6407 · 2 rows · ambiguity true
wego places "Assisi" --types city 1014 missing: -/- · 0 rows · ambiguity false ✅ #1: Assisi/1014 · 2 rows · ambiguity true
wego places "Cannes" --types city 1293-74 missing: -/- · 0 rows · ambiguity false ✅ #1: Cannes/1293-74 · 3 rows · ambiguity true
wego places "Medina" --types city MED ✅ #1: Al Madinah/MED · 1 rows · ambiguity false ✅ #1: Al Madinah/MED · 10 rows · ambiguity true
wego places "Jeddah" --types city JED ✅ #1: Jeddah/JED · 1 rows · ambiguity false ✅ #1: Jeddah/JED · 1 rows · ambiguity false
wego places "Riyadh" --types city RUH ✅ #1: Riyadh/RUH · 1 rows · ambiguity false ✅ #1: Riyadh/RUH · 1 rows · ambiguity false
wego places "Dubai" --types city DXB ✅ #1: Dubai/DXB · 1 rows · ambiguity false ✅ #1: Dubai/DXB · 1 rows · ambiguity false
wego places "Cairo" --types city CAI ✅ #1: Cairo/CAI · 1 rows · ambiguity false ✅ #1: Cairo/CAI · 8 rows · ambiguity true
wego places "Doha" --types city DOH ✅ #1: Doha/DOH · 1 rows · ambiguity false ✅ #1: Doha/DOH · 2 rows · ambiguity true
wego places "Kuwait" --types city KWI ✅ #1: Kuwait City/KWI · 1 rows · ambiguity false ✅ #1: Kuwait City/KWI · 9 rows · ambiguity true
wego places "Manama" --types city BAH ✅ #1: Manama/BAH · 1 rows · ambiguity false ✅ #1: Manama/BAH · 3 rows · ambiguity true
wego places "Amman" --types city AMM ✅ #1: Amman/AMM · 1 rows · ambiguity false ✅ #1: Amman/AMM · 3 rows · ambiguity true
wego places "Taif" --types city TIF ✅ #1: Taif/TIF · 1 rows · ambiguity false ✅ #1: Taif/TIF · 1 rows · ambiguity false
wego places "Abha" --types city AHB ✅ #1: Abha/AHB · 1 rows · ambiguity false ✅ #1: Abha/AHB · 1 rows · ambiguity false

Setup: both APIs ran locally (bun --env-file=.env.local.example src/dev.ts, ports 3101 and 3102, local JWKS and token, POSTHOG_PROJECT_TOKEN and GENZO_API_URL empty). The CLI ran from source with WEGO_API_URL=http://localhost:<port>, so no PostHog key is baked in. bun run check: 1463 pass, 0 fail.

🤖 Generated with Devin

Open in Devin Desktop: https://app.devin.ai/desktop/session/688f10f7af7747e4bc50b1e40d8b65fd?variant=devin
Requested by: @ahsan-amin-wego


🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

Summary by CodeRabbit

  • Documentation
    • Clarified that selected city results with nonstandard codes require finding a nearby airport from the city’s coordinates, checking for train stations, and sharing the chosen airport and its distance. Other flight endpoints can still use airport or city IATA codes.
    • Clarified that hotel sharing accepts city codes, including numeric codes, but not hotel IDs, city names, or coordinates.
  • Bug Fixes
    • Hotel sharing now accepts valid numeric city codes, such as 8283, while rejecting invalid location formats.

…ports-near

PET-504: a places city row with a code that is not 3 letters (Makkah 8283) is not a flight endpoint.
Co-Authored-By: ahsan.amin@wego.com <ahsan.amin@wego.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Ahsan.amin

Implement PET-504: https://wego.atlassian.net/browse/PET-504

Read the ticket in Jira. It is the source of truth, including the "Done when" checks.
Follow the AGENTS.md of wego/wego-ai (apps/api) and wego/cli.

  • Re-checked 2026-11-29 with CLI 1.5.1: upstream srv /places/search?query=makkah&types[]=city returns [], with types[]=city&types[]=hotel it returns Makkah 8283. So the fix is in how apps/api asks upstream, not in the CLI filter.
  • PET-508 (wego-ai #2132, cli #115) is in review and adds numeric city-code lookup. Branch off latest main, keep your diff independent of it, and say in the PR if a rebase on it is needed.
  • PRs naming PET-504, branches fix/PET-504-city-without-iata: wego-ai for the places route, wego/cli for the share message and skill text, only if the ticket needs them there.
  • Run the API on main and on your branch locally, point the CLI at each with WEGO_API_URL, and post a main vs PR table of the ticket's commands (7 affected cities, 11 control cities) in each PR. Keep analytics away from production.
  • Open the PRs as ready for review, not as drafts. Put the evidence for each "Done when" item in the PR descriptions.
  • Do not merge or promote, and do not edit Jira or post in Slack.
  • If the ticket is unclear, or the work needs anything outside its boundaries, stop and ask.

When done or blocked, reply with the PR URLs and one line per "Done when" item.

@devin-ai-integration devin-ai-integration Bot added the devin Authored by Devin label Nov 29, 2026
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: wego/cli
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 8cf691f
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: f2bdfd5b-86fc-4643-9dcb-ac2478d46967

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

Flight place-resolution instructions now describe how to resolve airports for selected cities with non-standard codes. Hotel-share accepts numeric city codes, and its API contract, guidance, and tests reflect the accepted formats.

Changes: Flight Place Resolution

Layer / File(s) Summary
Resolve airports for selected cities
skills/wego/references/cli.md
For selected cities with codes that are not three uppercase letters, the instructions direct resolving nearby airports from city coordinates, checking result names for train stations, and reporting the chosen airport and its computable distance.

Numeric Hotel City Codes

Layer / File(s) Summary
Document accepted city-code forms
contract/openapi.json
The getHotelSearchLink contract documents numeric city codes alongside three-letter codes. The required status and BKK example remain.
Parse and validate hotel-share locations
src/commands.ts, skills/wego/references/cli.md, integration/hotels.test.ts, src/hotels.test.ts
The parser accepts three-uppercase-letter codes, numeric codes, and numeric ranges. Guidance says to use a city code from wego places, not a hotel ID, name, or coordinates. Tests cover accepted formats, including 8283, and reject invalid locations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • wego/cli#115: Changes hotel-share code resolution through GET /v1/places; both PRs change the hotel-share contract.
Merge Risk: Low · previous review a47ad

This change lets hotel sharing accept numeric city codes and adds flight guidance for cities without airports. Two small gaps remain in the agent guidance. They are worth fixing but do not block merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the Conventional Commits form fix(hotels): .... The type fix is valid and the scope hotels names a real area of the change (hotel sharing and the hotels test/command code). The su…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title uses the Conventional Commits form fix(hotels): .... The type fix is valid and the scope hotels names a real area of the change (hotel sharing and the hotels test/command code). The subject is imperative and lowercase. The title matches the main change: making hotels share accept numeric city codes and updating flight guidance for cities without IATA codes. It does not mention the flights guidance change, which is a secondary part of the PR, but it is not misleading. No breaking-change ! is needed because the change widens accepted input rather than altering the wire contract or stdout. The PET-504 key is included, which the repo requirements do not mandate.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Co-Authored-By: ahsan.amin@wego.com <ahsan.amin@wego.com>
@devin-ai-integration devin-ai-integration Bot changed the title fix(skill): PET-504 route flights for a city without an IATA code through airports-near fix(skill): route flights for a city without an IATA code through airports-near (PET-504) Nov 29, 2026
Co-Authored-By: ahsan.amin@wego.com <ahsan.amin@wego.com>
coderabbitai[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

devin-ai-integration Bot and others added 3 commits November 29, 2026 15:11
Co-Authored-By: ahsan.amin@wego.com <ahsan.amin@wego.com>
Mirrors the search-link cityCode of wego/wego-ai#2134 (API 0.19.4) ahead of its deploy. bun run api-contract:refresh replaces it once the API ships.

Co-Authored-By: ahsan.amin@wego.com <ahsan.amin@wego.com>
hotels share accepts 8283 (Makkah) and 1293-74 (Cannes), which wego.com opens like a 3-letter city code, and the refusal points at places --types city. A hotelId is numeric too, so it is no longer refused by shape; the skill says to pass only a places code. (PET-504)

Co-Authored-By: ahsan.amin@wego.com <ahsan.amin@wego.com>
@devin-ai-integration devin-ai-integration Bot changed the title fix(skill): route flights for a city without an IATA code through airports-near (PET-504) fix(hotels): share and fly to a city without an IATA code (PET-504) Nov 29, 2026
@ahsan-amin-wego

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits November 29, 2026 15:36
…hout coordinates

airports-near refuses a numeric code, so a city row with no latitude and longitude ends with a question to the user. (PET-504)

Co-Authored-By: ahsan.amin@wego.com <ahsan.amin@wego.com>

This branch has not been deployed

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

Labels

devin Authored by Devin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant