🐛 filter walk-in / non-web-bookable campsites by default (UseDirect)#413
Open
luckyrandom wants to merge 1 commit into
Open
🐛 filter walk-in / non-web-bookable campsites by default (UseDirect)#413luckyrandom wants to merge 1 commit into
luckyrandom wants to merge 1 commit into
Conversation
## The bug
The UseDirect API (ReserveCalifornia and siblings) marks walk-in /
non-web-bookable nights as `availability_status="Available"`, the same
status reservable sites get. Camply forwards every "Available" night to
the user, so cancellation watchers fire false-positive notifications on
sites that physically cannot be reserved online — the user races to
ReserveCalifornia.com, picks the date, and the site isn't even listed.
Concrete reproducer at Sugarloaf Ridge SP (campground id 731) for
2026-06-06:
camply campsites --provider ReserveCalifornia --campground 731 \
--start-date 2026-06-06 --end-date 2026-06-07 --nights 1
Reports 3 "available" sites: juftin#4, juftin#5, juftin#35. None of the three can
actually be booked via the website. Raw API dump for those same units:
site AllowWebBooking IsWalkin
juftin#4 True True
juftin#5 False True
juftin#35 False True
The data is already there in `UseDirectAvailabilityUnit.AllowWebBooking`
(per-site) and `UseDirectAvailabilitySlice.IsWalkin` (per-night). Camply
just wasn't reading them when deciding whether to surface a site.
Note that `AllowWebBooking=True` does not imply bookable — site juftin#4 is
normally bookable but held back for walk-ups on this specific date,
which is what `IsWalkin` captures. Both flags must be checked.
## The fix
Treat a slice as bookable only when:
availability_slice.IsWalkin is not True
and unit.AllowWebBooking is not False
The check is in the same loop in `UseDirectProvider.get_campsites`
that already filters by `availability_status == "Available"` — minimal
surface area, no new API calls.
## Escape hatch
Add `--include-walkin` (off by default) so anyone who wants the old
behavior — or who's specifically hunting walk-ins — can opt back in:
camply campsites ... --include-walkin
Plumbing follows the existing `--equipment` pattern: click option in
`cli.py`, threaded through `_get_provider_kwargs_from_cli` into
`provider_kwargs`, accepted by `SearchUseDirect.__init__`, forwarded to
`UseDirectProvider.get_campsites`.
## Verification
Same query as the reproducer above:
(default) 0 Reservable Campsites Matching ✓
--include-walkin 3 Reservable Campsites Matching ✓
Other providers (Recreation.gov, GoingToCamp, Yellowstone, …) are
unaffected — the param is UseDirect-specific and only the UseDirect
search class reads it.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Author
|
Please let me know if it should be off by default for better backward compatibility. |
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.
The bug
The UseDirect API (ReserveCalifornia and siblings) marks walk-in /
non-web-bookable nights as
availability_status="Available", the samestatus reservable sites get. Camply forwards every "Available" night to
the user, so cancellation watchers fire false-positive notifications on
sites that physically cannot be reserved online — the user races to
ReserveCalifornia.com, picks the date, and the site isn't even listed.
Concrete reproducer at Sugarloaf Ridge SP (campground id 731) for
2026-06-06:
Reports 3 "available" sites: #4, #5, #35. None of the three can
actually be booked via the website. Raw API dump for those same units:
The data is already there in
UseDirectAvailabilityUnit.AllowWebBooking(per-site) and
UseDirectAvailabilitySlice.IsWalkin(per-night). Camplyjust wasn't reading them when deciding whether to surface a site.
Note that
AllowWebBooking=Truedoes not imply bookable — site #4 isnormally bookable but held back for walk-ups on this specific date,
which is what
IsWalkincaptures. Both flags must be checked.The fix
Treat a slice as bookable only when:
The check is in the same loop in
UseDirectProvider.get_campsitesthat already filters by
availability_status == "Available"— minimalsurface area, no new API calls.
Escape hatch
Add
--include-walkin(off by default) so anyone who wants the oldbehavior — or who's specifically hunting walk-ins — can opt back in:
Plumbing follows the existing
--equipmentpattern: click option incli.py, threaded through_get_provider_kwargs_from_cliintoprovider_kwargs, accepted bySearchUseDirect.__init__, forwarded toUseDirectProvider.get_campsites.Verification
Same query as the reproducer above:
Other providers (Recreation.gov, GoingToCamp, Yellowstone, …) are
unaffected — the param is UseDirect-specific and only the UseDirect
search class reads it.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com