Skip to content

Cut polling/auth round trips; stop E2E timing out in CI - #30

Merged
ellmkay merged 3 commits into
mainfrom
fix/map-tile-cold-render-performance
Sep 24, 2026
Merged

ellmkay merged 3 commits into
mainfrom
fix/map-tile-cold-render-performance

Conversation

@ellmkay

@ellmkay ellmkay commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Same two commits as #29, now against main — #29 was merged into its base branch after #28 had already landed, so this brings them home. Branch CI for these exact commits: green (Running 44 spec files across 2 shards).

Summary

257deff — performance sweep (docs/perf-polling-and-auth-round-trips.md). Follow-up to the Cloud Run log review: the recurring slow endpoints were all polls or per-request plumbing.

  • competition.counterState (every 5 s/tab): 9 sequential queries → 1 statement with scalar subselects.
  • competition.dbStatus (every 3 s/tab, public): 3 queries → 1; pg_database_size() memoised 60 s (ttl-memo.ts).
  • assertRestAccess returns the resolved EventRef so handlers stop looking the slug up twice; countFinishedRunners only runs when it can change the capability set (finishedCountMatters). Semantics unchanged.
  • /api/maps/:nameId/window.png rasterises under the shared renderGate() with the same 503/Retry-After behaviour as tiles.
  • course.controlCompletionStatus (every 15 s) loads only the requested course's runners and the cards they carry.
  • One async wait widened in online-input-config.spec.ts.

00ca4ed — CI E2E failures. Every main run since #26 failed the E2E job (blocking publish); all failures were timeouts from four full stacks on a 4 vCPU runner.

  • scripts/e2e-sharded.mjs: default shard count min(4, floor(cores/2)); E2E_SHARDS still overrides.
  • phase2.spec.ts create/edit/delete derives names and card number from testInfo.retry (the one deterministic failure: a slow first attempt left a runner that made every retry hit the duplicate-card dialog).
  • Two long course-editor tests marked test.slow().
  • docs/e2e-sharding.md, AGENTS.md updated.

Test plan

Made with Cursor

marcus-kempe and others added 3 commits September 24, 2026 22:13
counterState and dbStatus each become one statement (the database size
is memoised for a minute), the REST guard hands back the event it
resolved instead of handlers looking it up again, the finished-runner
count only runs when it can change the capability set, the course-map
window preview shares the tile render gate, and controlCompletionStatus
loads only the requested course's runners and their cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
Four full stacks on a 4 vCPU runner ran every shard at half speed and
pushed 5 s expect budgets over; the shard count now follows the core
count. The runner create/edit/delete test derives its name and card
from the retry index so a slow first attempt cannot turn into a
duplicate-card dialog on retry, and the two long course-editor tests
declare themselves slow instead of racing the 30 s test timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ound-trips

Cut polling/auth round trips; stop E2E timing out in CI
@ellmkay
ellmkay merged commit ac56eca into main Sep 24, 2026
1 check failed
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