Skip to content

perf(server,web): one point query per hex refresh for both cell sizes - #755

Merged
efiten merged 1 commit into
masterfrom
perf/heatmap-one-query
Oct 29, 2026
Merged

efiten merged 1 commit into
masterfrom
perf/heatmap-one-query

Conversation

@efiten

@efiten efiten commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Closes #742

What changes

  • /api/heatmap accepts z=a,b (at most two values, else 400). It runs QueryPoints once and bins the rows into both sizes, returning {"layers":[{"res":..., "type":"FeatureCollection", "features":[...], "truncated":..., "covers_from":...}, ...]}. The guest ceiling applies per value, and sizes that fold to the same res come back as one layer, so a guest above zoom 12 gets a single res-12 layer.
  • A single z returns the bare FeatureCollection as before, so existing callers are unchanged.
  • drawHex (web/map.js) sends one request. The new web/heatmapanswers.js reads both shapes and works out capped, replacing the per-request resOfCells/capped logic.

Deploy order: server before website

An old server reads z=13,14 as z=0 and answers res-3 cells, which the new website would draw. Deploy the ingestor first. I did not add a client guard for that mismatch.

Tests

  • Go: TestHeatmapTwoSizesInOneAnswer, TestHeatmapTwoSizesFoldUnderTheGuestCeiling, TestHeatmapRefusesMoreThanTwoSizes. go vet ./... clean, go test ./... all ok.
  • Web: heatmapanswers.test.js (5 tests). vitest 870/870, eslint clean.
  • e2e mocks in zoomfade.spec.js and ui.spec.js follow the new shape. Playwright: 323 passed, 2 failed (barlayout.spec.js:158, onboarding.spec.js:167). Both also fail with the pre-change web/map.js, so they are not from this change.

Not done

  • No test counts the QueryPoints calls: RegisterRoutes takes a concrete *store.Store. One call holds by construction.
  • No changelog.d/ entry: a user cannot see this (AGENTS.md §6).
  • The production query cost was not measured.

…#742)

/api/heatmap accepts z=a,b and bins one QueryPoints result into both
sizes; sizes that fold under the guest ceiling come back as one layer.
drawHex asks once instead of once per size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@efiten
efiten merged commit 78868fc into master Oct 29, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 29, 2026
efiten pushed a commit that referenced this pull request Oct 31, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>app: 1.32.1</summary>

##
[1.32.1](app-v1.32.0...app-v1.32.1)
(2026-10-31)


### Bug Fixes

* **web:** a callout with its control in the menu sends the tour copy
into the panel
([#760](#760))
([8592da6](8592da6))
* **web:** keep the bar's labels on one line at tablet widths
([#759](#759))
([f27390c](f27390c))
</details>

<details><summary>server: 1.11.1</summary>

##
[1.11.1](server-v1.11.0...server-v1.11.1)
(2026-10-31)


### Performance Improvements

* **server,web:** one point query per hex refresh for both cell sizes
([#755](#755))
([78868fc](78868fc))
</details>

<details><summary>web: 1.28.1</summary>

##
[1.28.1](web-v1.28.0...web-v1.28.1)
(2026-10-31)


### Bug Fixes

* **web:** a callout with its control in the menu sends the tour copy
into the panel
([#760](#760))
([8592da6](8592da6))
* **web:** a registry answer from before a role change, or an older
failure, no longer moves the attributor
([#769](#769))
([087377d](087377d))
* **web:** date a registry slice from when it was asked for
([#765](#765))
([77badec](77badec))
* **web:** keep the bar's labels on one line at tablet widths
([#759](#759))
([f27390c](f27390c))


### Performance Improvements

* **server,web:** one point query per hex refresh for both cell sizes
([#755](#755))
([78868fc](78868fc))


### Code Refactoring

* **web:** drop the name-redraw hold, MapLibre never closes a popup on
redraw ([#770](#770))
([ba9a9b0](ba9a9b0))


### Tests

* **web:** release the mocked resolver when the popup is open, not after
600 ms ([#762](#762))
([2abc959](2abc959))
* **web:** retry the zoomfade hover until a painted cell answers
([#767](#767))
([9331dfa](9331dfa))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

web,server: every hex refresh runs /api/heatmap's point query twice, once per cell size

1 participant