feat(enchantedparks): bundle attraction locations for WoF + MA#211
Conversation
The EP WordPress source does not expose per-attraction lat/lng. Without
a location field on each emitted attraction, the collector proposes
deleting all existing coordinates on every tick — an infinite-rejection
loop on the moderation queue for the just-migrated Worlds of Fun and
Michigan's Adventure (57 + 54 attractions each).
Add a static JSON snapshot of the existing per-ride coordinates (taken
from the wiki right after the SixFlags-era data was preserved through
the migration) and wire it into the EnchantedParks base class.
Subclasses opt in by assigning `this.attractionLocations = locations`.
Name lookup folds curly apostrophe (’ U+2019) to straight (') and
lowercases — the WP source uses curly and the wiki snapshot uses
straight, which would otherwise lose ~20% of matches.
Verified:
- WoF: 57/57 attractions emit location
- MA: 52/54 attractions emit location (2 unmatched are area names
"Family Lagoon" / "Funland Farms" not present in the wiki snapshot)
- Vitest: 1187/1187 pass
Future attractions added by EP later won't have coordinates until they
are placed manually via the moderation queue, but that's a one-time
touch per ride rather than an every-tick treadmill.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the EnchantedParks destination implementation to preserve per-attraction geo coordinates for parks whose WordPress source lacks ride-level lat/lng, preventing repeated “delete location” proposals on each collector tick (specifically for Worlds of Fun and Michigan’s Adventure).
Changes:
- Add a base-class mechanism in
EnchantedParksto optionally attach per-attractionlocationfrom a static snapshot, using normalized-name matching (curly ↔ straight apostrophes + lowercase). - Wire Worlds of Fun and Michigan’s Adventure subclasses to opt into that mechanism by importing bundled JSON snapshots and assigning
this.attractionLocations. - Add static JSON snapshots for both parks’ attraction coordinates under
src/parks/enchantedparks/locations/.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/parks/enchantedparks/enchantedparks.ts | Adds optional attraction location snapshot support + name normalization and attaches locations to emitted attraction entities. |
| src/parks/enchantedparks/worldsoffun.ts | Imports the bundled WoF snapshot and enables attraction-location attachment via this.attractionLocations. |
| src/parks/enchantedparks/michigansadventure.ts | Imports the bundled MA snapshot and enables attraction-location attachment via this.attractionLocations. |
| src/parks/enchantedparks/locations/worldsoffun.json | Bundled static snapshot of WoF attraction coordinates. |
| src/parks/enchantedparks/locations/michigansadventure.json | Bundled static snapshot of MA attraction coordinates. |
| protected lookupAttractionLocation( | ||
| rideName: string, | ||
| ): {latitude: number; longitude: number} | undefined { | ||
| if (!this.attractionLocations) return undefined; | ||
| if (!this.normalizedLocations) { |
Added unit tests for the new lookup path that drives whether an emitted attraction retains its existing coordinates: - curly ’ (U+2019) vs straight ' apostrophe match - case-insensitive matching - missing-name returns undefined - no-snapshot returns undefined Full suite 1191/1191 pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Addressed on Test suite: 1191/1191 pass. |
| import {EnchantedParks} from './enchantedparks.js'; | ||
| import {destinationController} from '../../destinationRegistry.js'; | ||
| import type {DestinationConstructor} from '../../destination.js'; | ||
| import locations from './locations/worldsoffun.json' with {type: 'json'}; |
| import {EnchantedParks} from './enchantedparks.js'; | ||
| import {destinationController} from '../../destinationRegistry.js'; | ||
| import type {DestinationConstructor} from '../../destination.js'; | ||
| import locations from './locations/michigansadventure.json' with {type: 'json'}; |
|
Re: the JSON-imports-don't-survive-build concerns — those don't apply here. Verified on a clean rebuild: ``` $ node --input-type=module -e " With `resolveJsonModule: true` in `tsconfig.json` (already enabled in this repo), `tsc` does copy JSON assets into the output tree alongside the compiled JS. Both location files land at `dist/parks/enchantedparks/locations/*.json` and load correctly at runtime. The published npm package picks them up automatically since `dist/` is the package's entry point. |
Problem
After #210 landed and the Worlds of Fun / Michigan's Adventure migrations were committed, the wiki kept the per-ride coordinates that the SixFlags POI endpoint used to provide. But the EnchantedParks WordPress source has no per-attraction lat/lng — so every collector tick proposes deleting all 57+54 locations again, putting them right back into the moderation queue.
Rejecting them once doesn't fix it; they come back next tick.
Fix
Static JSON snapshot of the existing per-ride coordinates, bundled into the EnchantedParks base class:
src/parks/enchantedparks/locations/worldsoffun.json— 57 ridessrc/parks/enchantedparks/locations/michigansadventure.json— 54 ridesSnapshot taken from the wiki right after migration, while the SixFlags POI-era locations were still preserved.
Subclasses opt in by setting
this.attractionLocations = locationsin the constructor. Base class looks up by normalized name (curly’→ straight'+ lowercase — the WP source uses curly, the wiki uses straight, so without normalization ~20% of names miss).Coverage
Tests:
npm test— 1187/1187 pass.What's NOT in this PR
_useroverrides). Trivial follow-up if it surfaces — pull the snapshot, drop inlocations/valleyfair.json, two lines in the subclass.🤖 Generated with Claude Code