Skip to content

Promote develop to main: README rewrite (T-105) and the awakening flight fix (T-104) - #95

Merged
CLYEH merged 4 commits into
mainfrom
develop
Sep 2, 2026
Merged

CLYEH merged 4 commits into
mainfrom
develop

Conversation

@CLYEH

@CLYEH CLYEH commented Sep 2, 2026

Copy link
Copy Markdown
Owner

develop → main: the README rewrite and the T-104 fix

Promotes three merged PRs to production so GitHub's default-branch README shows the new file and the live site carries the T-104 fix:

How verified

Task: T-104, T-105

CLYEH and others added 4 commits September 2, 2026 11:14
…104) (#92)

* fix(ui): a corridor change no longer cancels the flight it interrupts (T-104)

The first live tool call on a page is also the call that wakes the agent
chrome, so a `set_map_view` launched its flight and raised the inspector
lane in the same tick. Raising the lane re-pads the camera, and in
maplibre-gl 6 `Camera.setPadding(p)` is `jumpTo({padding: p})`, which
opens with `stop()`: the running ease was dropped at frame 0 and its
`finish` fired `moveend` SYNCHRONOUSLY with the pre-flight camera. That
event fell outside the `toMap` guard, so `pushViewFromMap` wrote the
landing camera back over the target and made it `lastView` — the tool
returned z15, the store held z15 for one tick, and the map stayed at z12.
An agent was told where the map was going and could then read back that
it had never gone. The same call on an already-awake page was correct,
which is what made this look like a flake rather than a rule.

`applyPadding` now knows whether a flight of ours is in the air. When one
is, it pads inside the `toMap` guard — that guard exists for re-entrant
camera events, and this is one: an event that reports where the map is
while lying about where it is going — and re-issues the flight towards
the target `lastView` still holds. The corridor change still happens
exactly as T-93 requires, and the flight now completes into the new
corridor instead of dying in it.

The fact is `flying`, not `map.isMoving()`, and it is cleared by every
`moveend` that reaches `pushViewFromMap`: a human dragging mid-flight has
taken the wheel, and re-flying them to a target they just overrode would
be the map arguing with the person holding it. The no-style path is
untouched — without a style `applyView` jumps, nothing is ever in the
air, and `applyPadding` takes the same single `setPadding` it always did.
That is also why the e2e suite, which blocks the basemap, could never
have caught this.

Verified live on `pnpm dev` and on a local production build: a cold
`set_map_view({place: "Daan Station"})` now settles at z15 @ 121.54355
with `bounds` identical to the awake-first control (east edge 944 px into
a 1280 px canvas, lane 336), and a hand drag afterwards still writes back
through `moveend`. The same repair covers the two sibling hazards: a
window resize and a hand-opened chrome mid-flight.

Task: T-104

* test(e2e): the first tool call's flight survives the awakening (T-104)

Adds e2e/awakening-flight.spec.ts, the end-to-end proof for the T-104 fix
(src/components/MapCanvas.tsx's applyPadding): a corridor change synchronous
with a flight's own first tick must re-issue that flight, not cancel it.
The existing suite's default network isolation hid this entirely (no style
loaded -> applyView jumps instead of flying -> nothing to cancel), so every
test here opts into a minimal-but-valid mocked basemap style so MapLibre
actually runs a render loop and flyTo actually eases.

Four tests, one describe block:
- "set_map_view as the very first tool call..." -- the direct regression:
  on a fresh page with no prior tool call, set_map_view is also the call
  that wakes the chrome. Polls the LIVE map object (window.__glassmapMap),
  not get_map_state alone, because set_map_view writes the store's view
  synchronously before a single animation frame runs -- only the live
  camera and `bounds` (written solely from a real moveend) can tell a
  landed flight from one that never left. Also checks the fast failure
  shape (live zoom must move off 12 within 1s) and the visible half
  (camera-readout mirrors the tool's own answer).
- "the settled camera sits in the padded corridor..." -- a cold first
  call's full settled state (center, zoom, bounds) must equal an
  already-awake control page's, to the tool's own 5-decimal rounding;
  a live map.project() check confirms bounds describes the padded
  336px-inset corridor, not the full canvas.
- "a mid-flight window resize..." -- the same corridor-interrupts-a-flight
  shape from a different cause (window resize, not the chrome arriving):
  the landed centre must still match the tool's answer, and bounds must
  reflect the new canvas width.
- "a hand drag mid-flight..." -- anti-regression for human authority: once
  a person's drag has taken over mid-flight, a later corridor change must
  not re-fly the map back to the agent's original target.

Red/green proof (see QA report): tests 1/2/3 fail against 42b6e4a (pre-fix)
and pass against 9fb55c7 (the committed fix); test 4 passes on both, since
it guards the fix's own `flying` invariant rather than the original defect.

Task: T-104

* fix(ui): a resize mid-flight lands where the tool said and republishes bounds (T-104)

Four findings from the review of the T-104 fix, all in the corridor path
that fix opened.

M1 - the resize listener published nothing. The flying branch of
`applyPadding` re-pads inside the `toMap` guard, which is what makes the
fix work and equally what swallows the `moveend` the resize used to
publish the new corridor with. `subscribeChromeVisible` already followed
`applyPadding` with `pushBoundsFromMap`; the resize listener did not, so
`get_map_state().bounds` went on describing the old canvas width for the
whole flight - byte-identical across a 1280 -> 1000 resize, on a page
that had visibly changed shape.

M2 - and that flight landed ~300 m from the centre the tool had already
returned, with the store recording the miss as fact. `flyTo` captures the
screen point it flies `center` to once, at issue time, and re-derives it
per frame only while the flight itself interpolates padding - which this
one does not, because `setPadding` applied the padding first. MapLibre
learns its canvas size from a ResizeObserver throttled by 50 ms, so our
`window.resize` listener runs while `tr.width` is still the old one and
the re-issued flight is aimed through a canvas that no longer exists.
`map.resize()` before `applyPadding()` fixes that, and cannot cancel the
flight it is protecting: `Map.resize` calls `stop()` and fires move
events only when `!this._camera._moving`, which a running ease makes
false (maplibre-gl 6.6.0, `dist/maplibre-gl-dev.mjs:24090-24100`).

L1 - `flying` could latch true. It was assigned after `map.flyTo(...)`,
and a flight that finished inside that call would already have fired the
`moveend` that clears it - inside the `toMap` guard, which drops it,
leaving the flag set with nothing left to clear it. Unreachable today
(both call sites pass `essential: true` and no duration), so it is now
asked rather than asserted: `flying = map.isMoving()`. Not
`Camera.isEasing()`, which is the narrower question but is not on `Map`
in maplibre-gl 6 - `Map` composes a `Camera` rather than extending one -
and the wider answer keeps the invariant anyway: while the map moves at
all there is a `moveend` still to come.

L2 - comment accuracy. The cancelled ease's `moveend` carries the frame
it had reached, which is the pre-flight camera only when the interruption
lands in the same tick as the flight; `jumpTo` then fires a second
synchronous `moveend` of its own, and both are guarded. `flying` says a
flight of ours is still owed, not whose camera the map is obeying - a
human who drags clears it. And the suite is not blind to this: its
default network isolation is what hides it, and a spec that opts into
`mockMinimalBasemap` reproduces it in seconds.

Verified live, before and after, on trees identical but for this file: a
resize mid-flight lands at 121.54355 (was 121.54162, target 121.54355)
and republishes `bounds` (was byte-identical); a hand drag mid-flight
still keeps the wheel; a plain resize with nothing in the air still puts
`bounds.east` at x=700 in a 1000 px canvas.

Task: T-104
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GvdrJcKNZkfREdb7QGRYYH

* fix(ui): two T-104 comments say what the code does (T-104)

M1: the `flying` docblock claimed the flag is "not `map.isMoving()`",
but both assignments are `flying = map.isMoving()`. `Map.isMoving()` is
`_camera.isMoving() || _handlers?.isMoving()`, so it does answer true
for a hand gesture. What is actually true is that `flying` is not a LIVE
read of it: it is sampled once, at the instant our `flyTo` is issued,
and cleared by any `moveend` that is not ours - which a hand-dragged map
duly fires, so the flag never outlives the person's decision.

L2: `onResize` blamed the stale transform on MapLibre's 50 ms
ResizeObserver throttle. That throttle is leading-edge - its first call
runs synchronously - so on the first event of a resize the real cause is
ordering: the window `resize` event fires in the resize steps, while
ResizeObserver delivery comes later in the same rendering update, after
rAF. The 50 ms only bites on the 2nd..Nth event of a drag-resize burst.
The conclusion is unchanged: `map.resize()` first.

Comments only; no behaviour change.

Task: T-104

* test(e2e): T-104's bounds republish and drag guard are load-bearing

M2: the mid-flight resize test never read the store between
setViewportSize and landing, so onResize's pushBoundsFromMap() call
was untested -- deleting it left 4/4 green. Added a get_map_state()
read right after the resize (while the ~2s flight is still in the
air) and assert its bounds differ from the pre-resize bounds, proving
the store republishes the new-width corridor at once rather than only
at the flight's own moveend. Verified red (assertion fails with the
line commented out in MapCanvas.tsx) then green (restored
byte-identical, git diff --exit-code clean), per the review's ask.

L3: the hand-drag test compared the store's TARGET camera (written
synchronously by set_map_view before a single frame runs) against the
post-drag camera, so the delta assertion could pass even with a no-op
drag -- the flight's own unfinished distance alone would account for
it. Now samples the LIVE camera via liveCamera() right before
mouse.down(), so the delta measures the hand's own effect. Also
replaced the inert "one more read call" with a real
page.setViewportSize() after the drag (flying is false at that point),
so the flying guard's not-flying branch is actually exercised and the
camera is asserted to stay exactly where the hand left it.

pnpm exec playwright test e2e/awakening-flight.spec.ts: 4/4 passed.
--repeat-each=3: 12/12 passed, 0 skipped. eslint and tsc --noEmit both
clean.

Task: T-104

* docs: T-104 on the board; F-12 widened to the not-flying resize (T-104)

Task: T-104

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
#94)

The fourth T-104 test compared the post-drag camera against a live sample
taken BEFORE `mouse.down()`, while the flight was still moving. On a slow
runner the flight's own motion between that sample and the mousedown ran
opposite to the 160x120px pan and cancelled most of it: CI read 0.00055
against the 0.001 floor (run 33586396145, PR #93). The pan handler is
`activateOnStart`, so the mousedown itself calls `stop(true)` and freezes
the camera; sampling right after it isolates the hand's effect exactly.

The fixed 400 ms inertia wait is now a poll on `!map.isMoving()`, so the
`moveend` the store publishes on has fired before the position is read.

Verified: 12/12 with `--workers=2 --repeat-each=3`; under a load average
above 150 (a parallel `--repeat-each=5` on this machine) the spec's other
tests also timed out, which is the runner, not the change.

Task: T-104
* docs: the README shows the map before it explains it (T-41 follow-up)

Removed: the roadmap/status roll-call ("Status:" line, set_layers mentions,
"cut"/"remaining" wording), the long City-wide breadth and Working-together
prose sections, the ASCII tool-layer diagram, and every "not yet
re-verified" hedge except the one dated ChatGPT desktop caveat the task
kept.

Added: the hero.jpg and landing.jpg screenshots (top of file and in "One
map, two hands"), the two screenshot-vs-WebMCP comparison GIFs with
captions and ledgers under "The same task, two ways", and a link to the
new docs/details.md.

Condensed 251 lines to 120: one condensed comparison table (3 rows,
2026-08-28), a 15-row tool table (≤20 words/row) replacing the old
per-tool prose, and 5-6 bullet summaries for design rules and
collaboration in place of full paragraphs.

New file docs/details.md carries, verbatim, the four facts cut from the
README that were not already documented elsewhere: the
describe_surroundings 300 m district fallback, the select_features
500-match cap, the get_share_link v1/v2/v3 versioning rule, and the
tier-2 permanent-vs-transient fetch failure rule. The tier-2 enrichment
tag list and coverage percentages were also cut but not moved, since
public/data/README.md already documents them in full.

Every number was re-verified against this worktree's tree before use:
tool roster (src/components/tool-roster.ts, 14 imperative + add_note),
Try Asking prompts (src/components/TryAsking.tsx), tool input schemas
(src/lib/map-tools/index.ts), tier-2 manifest (18 categories, 31,069
features, public/data/tier2/index.json), bundled dataset counts (109
mrt_station + 12 district + 865 park + 445 school + 607 supermarket + 25
listing = 2,063, public/data/*.geojson), Node 22 (.github/workflows/ci.yml),
MAX_SHARE_URL_BYTES/SELECT_MATCH_LIMIT (src/lib/map-tools/share.ts,
tier2-query.ts), the ?shim=1 behaviour (src/components/WebMcpProvider.tsx),
and the WebMCP flag/extension links (docs/webmcp-reference.md). The
comparison-table numbers and the two GIF ledgers are carried from
docs/comparison.md and the task's own recording ledger respectively, not
independently re-measured.

Second pass (adversarial review, T-41 follow-up), each item source-checked:
- Screenshot ledger: the radius was never read off an on-screen zoom
  readout (that readout lives in an off-screen .gm-machine block; the
  recording script hard-codes the radius) — now "a guess"; the other 5
  parks were reachable one click-and-read at a time, not unreadable — now
  says so; dropped the "42 s" timing, which was paced differently between
  clips and didn't belong next to the action counts.
- WebMCP ledger: 2 of the 7 parks are `Unnamed park` in OpenStreetMap
  (visible in the clip's own SELECTED panel) — the "each with a name"
  claim overstated it; now "an id ... two of them parks OpenStreetMap
  never named". Tool time corrected 53 ms -> 82 ms to match the
  re-recorded clip's on-screen ledger (docs/media/webmcp-agent.gif
  replaced by the orchestrator, not by this commit).
- Comparison-table honesty note: the table's Task A (16 actions) predates
  the human search box the live clips now use (docs/comparison.md honesty
  note 2), which is why the two measurements aren't directly comparable;
  now says so inline.
- Tool table: "Act (page state, no server)" was contradicted by
  plan_route, the one tool that calls out to FOSSGIS OSRM — reworded to
  "writes page state; only plan_route leaves the page", and the 15 rows
  are now grouped Perceive/Navigate/Act in that order (no new column).
- "Fourteen tools" (Try it) vs "Fifteen tools" (heading) both stood
  unexplained — now "fourteen registered tools" with the reason
  (add_note is a plain HTML form, not a document.modelContext
  registration). Moved that ChatGPT-verification sentence, and the
  docs/details.md link, out of "Try it" and the Data section to the end
  of "Fifteen tools", so "Try it" ends on the working DevTools snippet
  instead of a hedge.
- "always holds a link" -> "holds a link": a map whose hash would exceed
  MAX_SHARE_URL_BYTES leaves the previous hash in place instead of
  updating it (src/components/share-hash.ts:85).
- Added one clause: a share link carrying agent state opens with the
  inspector/activity feed already up, not replaying the idle-to-awake
  animation (src/lib/awaken/index.ts:177-179, bootMode).
- docs/details.md: fixed a dangling "is the clearest example. It" referent
  in the describe_surroundings opening; retitled the file and replaced
  the process note with one neutral sentence describing what the file is.
- Persuasion-only additions, no new facts: a strapline in the live-link
  line (15 tools, no backend, no API keys); a closing sentence on why this
  problem generalizes past this one map; a one-line lede on "One map, two
  hands" naming the map as shared state; a bullet naming the two distinct
  WebMCP registration paths (document.modelContext vs the add_note HTML
  form) that both write the same state; and a CI line (1,436 unit tests
  across 60 files, all green — pnpm check on this tree,
  .github/workflows/ci.yml) after the install/build commands.

README.md: 120 -> 122 lines (still under the 125-line budget).

Task: T-41

* docs: the WebMCP clip re-recorded with an honest ledger; polish (T-41 follow-up)

- docs/media/webmcp-agent.gif: re-recorded against the T-104-fixed build; the
  closing caption no longer says "named" (two of the seven parks are unnamed
  in OpenStreetMap) and reads 82 ms of tool time, which the README now quotes.
- README.md: impact sentence moved ahead of the accessibility disclaimer; the
  screenshot-arm caption split into two plain sentences; docs/details.md link
  and the ChatGPT caveat separated into their own paragraphs.
- src/components/TryAsking.tsx: the comment coupling ASK_CARDS to the README
  said three cards were quoted; the README now quotes all five.

Task: T-41

* docs: T-105 on the board, the README rewrite and its clips (T-105)

Task: T-105
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
glassmap Ready Ready Preview Sep 2, 2026 3:44am UTC

@CLYEH
CLYEH merged commit 44550ff into main Sep 2, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 3047d92b Deployed Sep 2, 2026 by vercel[bot]
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.

1 participant