From 85039b76efb714567dd44a3c9daec5fbee586e75 Mon Sep 17 00:00:00 2001 From: SimpleTest Date: Tue, 25 Aug 2026 20:36:36 +0300 Subject: [PATCH] Make embedded maps cooperate with page gestures --- assets/js/hooks.js | 2 + assets/js/map_interactions.test.mjs | 13 ++++++ scripts/kind-rolling-verify.sh | 69 +++++++++++++++++++++++------ 3 files changed, 70 insertions(+), 14 deletions(-) create mode 100644 assets/js/map_interactions.test.mjs diff --git a/assets/js/hooks.js b/assets/js/hooks.js index 2e711df..8ff6494 100644 --- a/assets/js/hooks.js +++ b/assets/js/hooks.js @@ -883,6 +883,7 @@ const createAidMap = element => { attributionControl: true, renderWorldCopies: false, trackResize: false, + cooperativeGestures: true, dragRotate: !demoMap, pitchWithRotate: !demoMap, scrollZoom: !demoMap @@ -2483,6 +2484,7 @@ export const Hooks = { zoom: initialCoordinates ? 13 : 5, locale: mapUiLocale(), attributionControl: true, + cooperativeGestures: true, dragRotate: false, pitchWithRotate: false }) diff --git a/assets/js/map_interactions.test.mjs b/assets/js/map_interactions.test.mjs new file mode 100644 index 0000000..92c3569 --- /dev/null +++ b/assets/js/map_interactions.test.mjs @@ -0,0 +1,13 @@ +import assert from "node:assert/strict" +import {readFile} from "node:fs/promises" +import test from "node:test" + +const hooksSource = await readFile(new URL("./hooks.js", import.meta.url), "utf8") + +test("every embedded MapLibre map uses cooperative gestures", () => { + const constructors = hooksSource.match(/new maplibregl\.Map\(\{/g) || [] + const cooperativeOptions = hooksSource.match(/cooperativeGestures:\s*true/g) || [] + + assert.equal(constructors.length, 2) + assert.equal(cooperativeOptions.length, constructors.length) +}) diff --git a/scripts/kind-rolling-verify.sh b/scripts/kind-rolling-verify.sh index a20eefd..1dc9f4f 100755 --- a/scripts/kind-rolling-verify.sh +++ b/scripts/kind-rolling-verify.sh @@ -140,6 +140,50 @@ pod_snapshot() { ] | sort_by(.component, .name)' >"$1" } +web_readiness_snapshot() { + local output_file=$1 + local jsonl_file="${output_file%.json}.jsonl" + local body + local pod + + mapfile -t web_pods < <( + "${kube[@]}" get pods \ + -l app.kubernetes.io/component=web \ + --field-selector=status.phase=Running \ + -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' + ) + + if [[ "${#web_pods[@]}" -ne 2 ]]; then + echo "Expected two running web pods; observed ${#web_pods[@]}." >&2 + return 1 + fi + + : >"$jsonl_file" + + for pod in "${web_pods[@]}"; do + if ! body=$( + "${kube[@]}" exec -c web "$pod" -- sh -c \ + 'curl --silent --show-error --fail --max-time 2 \ + "http://127.0.0.1:${PORT:?}/healthz/ready"' + ); then + echo "The readiness endpoint failed inside web pod $pod." >&2 + return 1 + fi + + jq -cn \ + --arg pod "$pod" \ + --arg body "$body" \ + '{ + pod: $pod, + body: $body, + response: (try ($body | fromjson) catch null) + }' >>"$jsonl_file" + done + + jq -s 'sort_by(.pod)' "$jsonl_file" >"$output_file" + unlink "$jsonl_file" +} + stop_probe() { unlink "$probe_marker" 2>/dev/null || true @@ -406,24 +450,21 @@ jq -s '{ samples: length, failures: (map(select(.status != "200")) | length), retried_samples: (map(select(.retries > 0)) | length), - total_retries: (map(.retries) | add), - nodes: (map(.body | fromjson? | .node) | map(select(. != null)) | unique) + total_retries: (map(.retries) | add) }' "$probe_log" >"$output_dir/readiness-summary.json" -"${kube[@]}" get pods \ - -l app.kubernetes.io/component=web \ - -o json | - jq '[.items[].status.podIP | "who_need_help@" + .] | sort' \ - >"$output_dir/current-web-nodes.json" +web_readiness_snapshot "$output_dir/web-pod-readiness.json" + +if ! jq -e '.samples > 0 and .failures == 0' \ + "$output_dir/readiness-summary.json" >/dev/null; then + echo "Kind readiness was unavailable during the rollout." >&2 + exit 1 +fi if ! jq -e \ - --slurpfile current "$output_dir/current-web-nodes.json" ' - .samples > 0 and - .failures == 0 and - ($current[0] | length) == 2 and - (($current[0] - .nodes) | length) == 0 - ' "$output_dir/readiness-summary.json" >/dev/null; then - echo "Kind readiness was unavailable or did not reach both web replicas." >&2 + 'length == 2 and all(.response.status == "ready")' \ + "$output_dir/web-pod-readiness.json" >/dev/null; then + echo "Both replacement web pods did not pass direct readiness checks." >&2 exit 1 fi