Phase 3: code cleanup — remove dev page, split trail data#85
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
kwiens
force-pushed
the
oss-phase3-cleanup
branch
from
June 21, 2026 03:46
0e82897 to
2e0aeb2
Compare
src/app/test/page.tsx was a dev-only ride-recording harness. Removing it orphans its two exclusive dependencies — src/data/example-tracks.ts (demo GPS fixtures) and src/utils/gpx-parser.ts (GPX import) — neither of which is referenced or tested anywhere else. GPX import was only ever reachable through that dev page; the shipped feature is GPX export. README updated accordingly.
mountain-bike-trails.ts was 3,261 lines — ~3,000 of them a single array literal that buried the interfaces and region logic. Move the array (and the trailColor helper that only the array uses) into a new mountain-bike-trails.data.ts; the original keeps the MountainBikeTrail / ElevationProfile interfaces, layer-id constants, REGION_MAP, and regionFor, and re-exports the array. The data file's only import from the logic file is the MountainBikeTrail type, which is erased at compile time — no runtime circular dependency. Consumers importing from @/data/geo_data are unaffected. Update the trail scripts to match: - Both point at mountain-bike-trails.data.ts (add_trail_bounds.py was also pointing at the wrong file, geo_data.ts, which never held the array). - add_trail_elevation.py reads the Mapbox token from NEXT_PUBLIC_MAPBOX_TOKEN (env or .env.local) — Phase 1 moved the token out of map.config.ts, which had broken the script's regex-based extraction. docs/DATA.md updated to point curators at the data file.
The interface comment listed only "easy" | "intermediate" | "" but the data and trailColor() also use "advanced" and "expert". Flagged during the Phase 2 doc review as a Phase 3 cleanup item.
kwiens
force-pushed
the
oss-phase3-cleanup
branch
from
June 21, 2026 03:55
2e0aeb2 to
af3d2ee
Compare
The data file has 224 trails; '220+' matches CLAUDE.md phrasing and won't drift as trails are added or removed.
Phase 3 moved the editable mountainBikeTrails array (and trailColor) to src/data/mountain-bike-trails.data.ts. Point the elevation-script output and the 'add a trail' steps at the data file. The MTN_BIKE_* constants and REGION_MAP stayed in the wrapper mountain-bike-trails.ts, so those refs are unchanged.
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.
Third phase of the open-sourcing cleanup. Stacked on #84 (base
oss-phase2-docs) — merge #83 → #84 → this in order.Changes
Remove dev-only test page
src/app/test/page.tsxwas a dev-only ride-recording harness. Removing it orphaned its two exclusive dependencies —src/data/example-tracks.ts(demo GPS fixtures) andsrc/utils/gpx-parser.ts(GPX import) — neither referenced or tested anywhere else. All three removed. GPX import was only ever reachable through that dev page; the shipped feature is GPX export. README corrected (GPX import/export→GPX export).Split the trail data file
mountain-bike-trails.tswas 3,261 lines — ~3,000 of them a single array literal burying the interfaces and region logic. The array (and thetrailColorhelper only it uses) moves to a newmountain-bike-trails.data.ts; the original keeps the interfaces, layer-id constants,REGION_MAP,regionFor, and re-exports the array. The data file's only import from the logic file is theMountainBikeTrailtype (erased at compile time) — no runtime circular dependency. Consumers importing from@/data/geo_dataare unaffected; 224 trails, count unchanged.Trail scripts updated to match:
mountain-bike-trails.data.ts(add_trail_bounds.pywas also pointing at the wrong file —geo_data.ts— which never held the array).add_trail_elevation.pynow reads the Mapbox token fromNEXT_PUBLIC_MAPBOX_TOKEN(env or.env.local) — Phase 1 moved the token out ofmap.config.ts, which had silently broken the script's regex extraction.docs/DATA.mdupdated to point curators at the data file.Deferred — Map.tsx decomposition
The plan's
Map.tsxGPS/compass decomposition (and theMap.test.tsxevent-wiring tests) are deferred to a separate PR. That subsystem can't be verified headlessly (no GPS/compass), and the event-wiring tests are only worth writing once the logic is extracted into independently testable hooks — so decomposition + tests belong together, in a PR that can be device-tested.Test plan
pnpm test:run— 327 passpnpm lint— passes (8 pre-existing warnings)pnpm build— passes;/testroute gone