Cue-sheet caching so each route is enriched once #30

Closed
opened 2026-08-31 17:14:46 +02:00 by robert · 1 comment
robert commented 2026-08-31 17:14:46 +02:00 (Migrated from git.butzei.de)

Goal

Enrichment is slow and possibly online. Do it at import, never during a ride.

Acceptance criteria

  • Cue sheet serialised to disk, keyed by route id and enricher version
  • Cache invalidated when the route or the enricher version changes
  • Ride start loads from cache with no network and no BRouter round-trip
  • Which backend produced the cached sheet is recorded and displayed
  • Manual re-enrich available, for example after installing BRouter

Files

  • companion/.../route/enrich/CueSheetCache.kt
## Goal Enrichment is slow and possibly online. Do it at import, never during a ride. ## Acceptance criteria - [ ] Cue sheet serialised to disk, keyed by route id and enricher version - [ ] Cache invalidated when the route or the enricher version changes - [ ] Ride start loads from cache with no network and no BRouter round-trip - [ ] Which backend produced the cached sheet is recorded and displayed - [ ] Manual re-enrich available, for example after installing BRouter ## Files - `companion/.../route/enrich/CueSheetCache.kt`
Owner

Closed by PR #89 (merged): CueSheetCache (companion/core, pure JVM, 13 new host tests incl. one real end-to-end run against GpxCueEnricher + the real bikerouter-style-cues.gpx fixture) keyed by route id + a single pipeline-wide CURRENT_ENRICHER_VERSION constant \u2014 covers both a tier's own logic changing and a new tier slot being wired in later, no per-tier versioning needed. Backed by a new Room cue_sheets table with a real Migration(1,2) (checked field-for-field against CueSheetEntity: routeId/enricherVersion/cuesEncoded NOT NULL, tier nullable \u2014 matches). Which backend won is recorded via the existing RouteLibrary.updateEnrichment() hook, so RouteLibraryScreen's status line now shows real data with no new UI needed there; a manual re-enrich button was added.\n\nHonestly flagged, not papered over: raw GPX text (needed by tier 0) isn't persisted anywhere in the route library yet \u2014 GpxImporter discards it after parsing. getOrEnrich/forceReEnrich take it as optional; absent, tier 0 fails closed (same behaviour it already has for malformed input) and falls through to tier 1+. Not a regression \u2014 no caller anywhere can supply it post-import today anyway \u2014 documented as a separate follow-up (persisting rawGpx) rather than solved here.\n\nVerification split, same pattern as every companion PR tonight: :companion:core (the cache/codec logic) is host-tested and green. :companion:route (Room codegen, the migration actually running, UI wiring) is hand-reviewed only \u2014 no Android SDK in this sandbox.

Closed by PR #89 (merged): CueSheetCache (companion/core, pure JVM, 13 new host tests incl. one real end-to-end run against GpxCueEnricher + the real bikerouter-style-cues.gpx fixture) keyed by route id + a single pipeline-wide CURRENT_ENRICHER_VERSION constant \u2014 covers both a tier's own logic changing and a new tier slot being wired in later, no per-tier versioning needed. Backed by a new Room `cue_sheets` table with a real Migration(1,2) (checked field-for-field against CueSheetEntity: routeId/enricherVersion/cuesEncoded NOT NULL, tier nullable \u2014 matches). Which backend won is recorded via the existing RouteLibrary.updateEnrichment() hook, so RouteLibraryScreen's status line now shows real data with no new UI needed there; a manual re-enrich button was added.\n\n**Honestly flagged, not papered over**: raw GPX text (needed by tier 0) isn't persisted anywhere in the route library yet \u2014 GpxImporter discards it after parsing. getOrEnrich/forceReEnrich take it as optional; absent, tier 0 fails closed (same behaviour it already has for malformed input) and falls through to tier 1+. Not a regression \u2014 no caller anywhere can supply it post-import today anyway \u2014 documented as a separate follow-up (persisting rawGpx) rather than solved here.\n\n**Verification split, same pattern as every companion PR tonight**: :companion:core (the cache/codec logic) is host-tested and green. :companion:route (Room codegen, the migration actually running, UI wiring) is hand-reviewed only \u2014 no Android SDK in this sandbox.
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
robert/PedalPebble#30
No description provided.