Skip to content

Review package 23: course elevation fixes before PR #254 merges - #277

Merged
ellmkay merged 156 commits into
claude/project-thread-avzbksfrom
claude/project-thread-kc9780
Nov 27, 2026
Merged

ellmkay merged 156 commits into
claude/project-thread-avzbksfrom
claude/project-thread-kc9780

Conversation

@ellmkay

@ellmkay ellmkay commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Requested by Marcus · project thread

Package 23 of the November full code review (docs/reviews/2026-11-full-review.md): the findings against the unmerged course-elevation PR #254. This PR targets #254's branch; #254 itself stays open for Marcus's review and merge.

What's in it

  • Merge of main into Course climb, elevation profile and leg routes #254's branch (d5dd9ce): 9 conflicts resolved (backup table order, journal derived fields, course upsert on apply, course import keeps both "length only when stated" and the file climb, map change checks the lease before clearing climbs).
  • MAP-1 / D7: contour interval confirmed per map. New nullable contour_interval_m on club_maps and map_files (club map's value wins). The 5 m / 2.5 m scale guess is only a prefill. Until confirmed, a contour-based climb is an editor estimate (marked ≈) and is not stored, printed, exported or sent to Eventor; ground-model climbs are unaffected. Set in the map info dialog, the editor banner or the club library card; can be returned to "not confirmed". Setting a club map's value needs its uploader or an admin. A change clears and recomputes computed climbs of every live event on the map, in a background per-event queue. Contour heights are scaled to the confirmed interval (also in the route finder).
  • API-15 / CRS-014 (D8): background jobs respect the lease. Route refresh and climb compute skip (never throw) on a node that does not hold the lease, re-checked per chunk and per course; the post-map-refresh climb clear is gated the same way. The holder refreshes routes after a forwarded course-object write and recomputes climbs after its map refresh.
  • DB-53 / CRS-091: chosen routes read once per compute with a stamp check; clearComputedClimbs journals what it cleared.
  • API-37l / CRS-071: one long-lived route worker per refresh, per-job results and a 60 s per-job limit; a failing pair no longer blocks its chunk and is not retried until its basis changes.
  • CRS-048 / CRS-070: courses on each pair re-read per chunk; climbs recomputed after each chunk.
  • CRS-089: the route search stops at its target and reuses the field for the shortest model (same routes, no version bump).
  • CRS-090: changing first-as-start / last-as-finish clears the computed climb.
  • EVT-22: start-list and result uploads take includeCourse (default on), with a checkbox on the event page.
  • SYNC-17: fixed by main's knownFields; named test case added.
  • Journal: climbSource and winnerPaceSPerKm now travel in course.upserted (old senders still read as typed).
  • CRS-072 (narrowing the staleness basis) is deferred, with the other left-outs in docs/bugfixes/course-elevation-followups.md.

Migration

20261127140000_map_contour_interval: adds the two columns (CHECK 0 < x ≤ 100) and clears existing computed climbs once (only databases that ran #254 have any). Run pnpm db:migrate at bring-up. #254's own 20261122* migrations keep their names (they sort before main's newer ones; migrate deploy applies them regardless, and renaming would break a database that already applied them).

Docs

docs/course-elevation.md (§0 rows 43–45, §3, §4.4, §6, §7.5, §7.7, §8, Pending), map-terrain.md, map-storage.md, decision rows in decisions/slice-h.md (D7) and decisions/general.md (D8), guides course-editor.md, maps.md, event-setup.md, docs/bugfixes/course-elevation-review.md and course-elevation-followups.md.

Verification (cloud container)

  • pnpm build, pnpm lint (0 errors), pnpm test (shared 2725, api 1531, web 2734): pass.
  • Integration, full suite: 1350 passed, 2 skipped.
  • Affected E2E specs (elevation, profile, routes, phone, status, course-editor, courses, map-review, map-viewer-3d, club-map-library, eventor-push, mobile-layout): all pass. Full E2E is left to CI.
  • Docker images and stack bring-up not done here (worktree rule); the showcase hero shot needs a retake (follow-up).
  • Not checked against Test-Eventor.

Generated by Claude Code

claude and others added 30 commits November 21, 2026 10:54
The demo fixture now pins fixtures/okartan/okartan-demo.ocd (kind ocad,
1:15 000) instead of Puit de Laven, which stays as a test map.

Controls: `showcase-controls.mjs fit` now reads the OCAD map, tries each
quarter turn and slides the cloud over the map to the place with no
control in a forbidden area or near the slanted map's edge and the
fewest legs through water or buildings, then snaps each control onto
the nearest free boulder, knoll, depression or pit (starts and finishes
onto a path). Placed at x0.6 from the previous positions: all 34 placed
controls stand on a feature, two legs still cross water.

Showcase guard: club maps of the same forest exist, so a public run now
checks the pinned document's source hash against the committed demo map
instead of its bounds.

Retook the showcase shots and the gallery; dashboard and courses now
come from the demo, so only tracks.png still shows the club map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuNAoK7Vj1T7nXsnZM
…tests bite

Review follow-ups: capture.ts now refuses to run unless the demo event's
pinned document names the committed demo map (shared check in
e2e/showcase/demo-map.ts, which also sends x-competition-id so it works
with auth on). The snap and place tests now fail when spacing or the
crossing score is removed; the committed-positions test checks paths,
60 m spacing and the two documented crossings. A control that lands on
(0, 0) is nudged so it does not read as unplaced; removed controls no
longer veto a placement. The forbidden-name scan reads OCAD's UTF-16
strings too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuNAoK7Vj1T7nXsnZM
… and a sheet

The course lives in fixtures/showcase/showcase-course.sql, exported from a
database by scripts/showcase-course.mjs (course + variants, their
course_controls and sheets, the event's course objects, the controls that
are not the race's) and run by load-showcase.sh after showcase.sql.
showcase-controls export now leaves those controls out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuNAoK7Vj1T7nXsnZM
showcase-course.mjs export now writes the event's whole course setup
(every control and course as an upsert over showcase.sql's rows, every
course's course_controls, objects, sheets, and the seq counters past
every row), so race-course edits in the editor reach the fixture too.
showcase-start-finish.mts codes the starts and finishes and points the
Showcase course at its own start and finish and every other course at
the race's, through the API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuNAoK7Vj1T7nXsnZM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ked route)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuNAoK7Vj1T7nXsnZM
…demo map

A public showcase run now picks the demo's Showcase course (fork,
butterfly loop, corridor) for the course editor shots. The 3D shot moves
into the showcase script (map3d.shot.ts): the Courses page map in 3D on
the o-kartan demo map's own contour terrain, the Showcase course on it.
Software WebGL draws it in seconds, so no laptop is needed. The old 3D
shots (Puit de Laven, from the E2E run) are gone: map-3d.png is retaken,
map-3d-track.png is dropped until the demo has GPS routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuNAoK7Vj1T7nXsnZM
…x4em57

Move the demo competition onto the o-kartan map and retake the screenshots
Queue offline card reads and results under the event in the URL, scope the persisted query cache per event, make the kiosk drain its own outbox, await queue writes, and fix duplicate detection.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtkCKwS4ZmdC6ABW7p
…s, keep user queries, fetch after a server answer, in-flight duplicate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtkCKwS4ZmdC6ABW7p
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtkCKwS4ZmdC6ABW7p
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtkCKwS4ZmdC6ABW7p
…bdyw2c

Fix offline and kiosk readout path (review package 1)
One guard (decideReadoutApply) for applyResult, backup push and the result.applied ingest; hand-set status/finish flags; held card rows; Finish Station replace step; latest-card guard; kiosk no longer writes finishes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZsv48nEPvxG5M31m5u
…, banner list, finish.recorded guard

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZsv48nEPvxG5M31m5u
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZsv48nEPvxG5M31m5u
…apqrcj

Guard readout apply against overwriting results (review package 2)
…st (review package 3)

events.push now checks each entry's competition against the request,
requires the online action's capability per entry (sync secret bypasses
for the venue box), keeps idempotency per event, applies each entry in
one transaction and stops at the first apply failure, refuses reference
rows of another event and allow-lists their fields, and returns stable
refusal codes. Stations push each competition's entries under its own
header, classify server errors, and show refusal texts with Retry all.
runner.create is lowered to race.operate (D1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuXwAasnsnGcGfnEV9
… capability, per-competition block reason)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuXwAasnsnGcGfnEV9
Card 501438 is SI6, which the reader only detects (no punches), so the
readout guard from #256 rightly holds it as stale when Malin has a stored
result, and the notification turns into the Replace banner. Renumber her
to an SI8-range card in those two tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuXwAasnsnGcGfnEV9
…LC hold, re-run on lock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuXwAasnsnGcGfnEV9
… pass that settles nothing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZuXwAasnsnGcGfnEV9
Harden the journal sink (review package 3)
journal gets ingest_seq (arrival order) and pushed_at (delivered mark);
allocate_event_seq() now advances event_seqs past explicit seq values, with a
repair of lagging counters. Snapshot import merges the exporter's counters
with GREATEST instead of inserting over the trigger's rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZwULgQeS1943wQuZnh
shipEventOnce pushes and pulls entries with pushed_at NULL in ingest_seq
order and marks the acked prefix, so an entry arriving late with an old HLC
still ships and a pulled entry is no longer echoed. Adds events.unshipped and
events.ackShipped (events.since stays as the fallback for an older peer),
scopes shipAllOnce to events checked out against the peer, and seeds the node
clock from the journal at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZwULgQeS1943wQuZnh
…cquire

The cloud marks its existing journal delivered when it hands out the lease,
and exportEventSnapshot reads every part in one REPEATABLE READ transaction,
so an entry committed mid-export is pulled by the box instead of lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZwULgQeS1943wQuZnh
Checkout refuses to replace a held lease, a box-made event or unshipped
entries (overridable with discardLocal), requires event.manage (or an
instance admin for a new event), takes the peer lease inside the rollback
scope, commits the sync-state row and local lease with the import, and keeps
readout backups. Acquire and the peer's release are idempotent for the same
holder; checkin tolerates a peer that already let go and refuses race writes
on the box while its barrier runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZwULgQeS1943wQuZnh
…Venue panel

findGraphicClashes runs right after the snapshot is exported, before any blob
is fetched; the import refuses the same way unless the operator confirmed
(replaceClashingGraphics). VenueLease asks for confirmation on the
overridable refusals and shows the unshipped line without a lease.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZwULgQeS1943wQuZnh
ellmkay and others added 26 commits November 27, 2026 08:14
…r8fpef

Process stability: crash guards, import attempt limit, damaged OCAD, peer and Eventor timeouts (review package 21)
…ils the print

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtGdeTjLNYWYdCEm87
… nearest setter map

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtGdeTjLNYWYdCEm87
… who has raced keeps her variant

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtGdeTjLNYWYdCEm87
…ix notes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtGdeTjLNYWYdCEm87
…e skips uncomposable jobs, stronger tests, docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtGdeTjLNYWYdCEm87
…t with no parseable setter map

The worker now carries the error's name, so the offline store step skips a
job only for PrintGraphicMissingError (CRS-010); a worker that fails to start
stays an OfflinePrepareError. layout.adoptToSetters returns nothing when no
setter map of the scope parses instead of throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtGdeTjLNYWYdCEm87
…e main thread

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtGdeTjLNYWYdCEm87
…1b084m

Review package 22: course and print correctness
…age 23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
…ed contour interval, lease, includeCourse)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
…er refresh; failed pairs do not block their chunk

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
…recomputes climbs after a map refresh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
…case for the climb columns

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
…, descriptor, mutations, snapshot export

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
…ap info row, club card; Eventor push course switch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
… lease note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
…contours

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
… interval needs the uploader or an admin, background recompute queue, lease gates, searcher dead flag, shared interval rule, unconfirm control, finder interval

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
@ellmkay ellmkay self-assigned this Nov 27, 2026
… delete keeps the confirmed interval, mayChange hides the controls, prepare failure stops the refresh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DoDZtsfJbSyDuCEDaGpYK
@ellmkay
ellmkay merged commit d35b2cc into claude/project-thread-avzbks Nov 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants