GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / gridatlas / tools/satnav/walk/gate/jobs

Saved Plan Browser and 9 more files

A Python command-line tool in the walk folder of GridAtlas that opens map (`open_map`), covering walk.

673 lines of JavaScript and Python from gridatlas, in 10 files. Topic: Maps, GIS and field navigation. Section 687 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Plan Test test · gridatlas / tools/satnav/walk/gate/jobs/plan.test.mjs lines 1–91
  2. Plan other · gridatlas / tools/satnav/walk/gate/pilot/plan.mjs lines 1–46
  3. Replay transform · gridatlas / tools/satnav/walk/gate/pilot/replay.mjs lines 1–23
  4. Layers Browser render · gridatlas / tools/satnav/walk/layers-browser.py lines 1–79
  5. Local Distance Browser geodesy · gridatlas / tools/satnav/walk/local-distance-browser.py lines 1–102
  6. Orient17a Continuity Direct transform · gridatlas / tools/satnav/walk/orient17a-continuity-direct.mjs lines 1–53
  7. Orient17a Continuity Test test · gridatlas / tools/satnav/walk/orient17a-continuity.test.mjs lines 1–34
  8. Orient17a Direct transform · gridatlas / tools/satnav/walk/orient17a-direct.mjs lines 1–48
  9. Orient17a V9212 Direct transform · gridatlas / tools/satnav/walk/orient17a-v9212-direct.mjs lines 1–53
  10. Saved Plan Browser render · gridatlas / tools/satnav/walk/saved-plan-browser.py lines 1–144

Plan Test

A test in the jobs folder of GridAtlas that checks Council Router and Plan. It is built from the coords step (`coords`).

testgridatlas / tools/satnav/walk/gate/jobs/plan.test.mjs · lines 1–91 of 91 · Not reached from any entry point (candidate for review) · pattern coords (shared by 6 files)

What it does
It tests its inputs. Defines read, open, step, coords. Uses libraries node:assert/strict, node:fs, node:test. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage field_execution (path word 'gate'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
Inputs & outputs
In: JSON file south-meadow-fictional.json; JSON file road.json; GeoJSON file bristol-footpaths.geojson.
What it achieves
Defines `read`, `open`, `step` and 1 more. It reads `./south-meadow-fictional.json`.
Why it matters
Guards the behaviour of Council Router and Plan.
Application
gridatlas · tools/satnav/walk/gate/jobs · test
Uses
Council Router (import), Plan (import), node:assert/strict, node:fs, node:test, ../../../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/vendor/grid-distance-maths/src/geodesy.mjs, ../../../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/nav/compass.mjs
Used by
none found
Produces
read, open, step, coords
Defines here
read, open, step, coords
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/gate/jobs/plan.test.mjs:1-91 · blob c083c1e1afa7f0dfa25ee02cd397cce1a4974136 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: unreached_review
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
import test from 'node:test';
import * as maths from '../../../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/vendor/grid-distance-maths/src/geodesy.mjs';
import * as compass from '../../../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/nav/compass.mjs';
import {createPedestrianRouter} from '../../council/council-router.mjs';
import {prepareGateJob} from './plan.mjs';

const read = path => JSON.parse(readFileSync(new URL(path, import.meta.url)));
const job = read('./south-meadow-fictional.json');
const open = (doc = job) => prepareGateJob(doc, maths, compass);

for (const [field, change, message] of [
  ['entrance', j => delete j.gate, /agreed entrance/],
  ['opening', j => delete j.gate.widthM, /measured opening width/],
  ['roadside', j => delete j.gate.roadside, /roadside arrival/],
  ['field side', j => j.gate.fieldSide = j.gate.centre, /inside Meadow Gate/],
  ['agreement', j => j.gate.agreed = false, /Confirm the agreed/],
  ['road start', j => delete j.roadStart, /start of the saved/],
  ['saved road', j => delete j.savedRoad, /Missing saved driving/],
  ['pins', j => j.fieldPins = [], /ordered field pins/],
  ['pin coordinates', j => j.fieldPins[0].coordinate = [null, 3], /field pin 1/],
  ['duplicate pin', j => j.fieldPins[0].id = j.fieldPins[1].id, /unique reference/],
  ['destination', j => j.fieldPins.reverse(), /last field pin/],
]) {
  test('identifies incomplete ' + field, () => {
    const copy = structuredClone(job);
    change(copy);
    assert.throws(() => open(copy), message);
  });
}

for (const [why, change] of [
  ['unavailable', j => j.savedRoad = null],
  ['external URL', j => j.savedRoad = 'https://example.invalid/road.json'],
  ['another gate', j => j.savedRoad.gateId = 'other'],
  ['wrong road end', j => j.savedRoad.response.routes[0].geometry.coordinates[3] = j.gate.fieldSide],
  ['wrong side of the boundary', j => j.gate.fieldSide = j.gate.roadside],
]) {
  test(why + ' road preserves the named field job', () => {
    const copy = structuredClone(job);
    change(copy);
    const {model, geometry, warning} = open(copy);
    assert.match(warning, /Meadow Gate/);
    assert.equal(geometry, null);
    assert.equal(model.locate(null).roadAvailable, false);
    assert.equal(model.startField(), true);
    assert.equal(model.locate(null).target, 'Willow turn');
  });
}

test('opposite-side job keeps both distances, targets and switch reasons', () => {
  const {model, warning} = open();
  assert.equal(warning, '');
  let time = 1000;
  function step(coordinates, accuracyM = 3) {
    time += 1000;
    const [longitude, latitude] = coordinates;
    return model.locate({longitude, latitude, accuracyM, timestampMs:time}, time);
  }
  const gate = job.gate;
  const beside = step(gate.roadside);
  assert.equal(beside.target, 'Meadow Gate');
  assert.equal(Math.round(beside.roadRemainingM), 0);
  assert.equal(Math.round(beside.gateDistanceM), 8);
  assert.equal(step([gate.roadside[0] + .0002, gate.roadside[1]]).leg, 'road');
  model.restart();
  step(gate.roadside);
  step(gate.centre, 9);
  assert.equal(step(gate.fieldSide).leg, 'road');
  model.restart();
  step(gate.roadside);
  step(gate.centre);
  const crossed = step(gate.fieldSide);
  assert.equal(crossed.enteredBy, 'crossing');
  assert.equal(crossed.target, 'Willow turn');
  assert.equal(step(job.fieldPins[0].coordinate).target, 'Meadow pump');
  assert.equal(step(job.fieldPins[1].coordinate).status, 'complete');
});

test('BCC/21 still follows three connected sections and London is outside coverage', () => {
  const bristol = read('../../council/bristol-footpaths.geojson');
  const route = createPedestrianRouter({bristol}, maths);
  const coords = code => bristol.features.find(f => f.properties.ROUTE_CODE === code).geometry.coordinates;
  const start = coords('BCC/21/10')[0], end = coords('BCC/21/30').at(-1);
  const result = route(start, end);
  assert.equal(result.status, 'mapped');
  assert.ok(Math.abs(result.distanceM - 578) < 1, String(result.distanceM));
  assert.match(result.attribution, /Bristol City Council/);
  assert.equal(route(start, [-0.1276, 51.5072]).reason, 'outside-coverage');
});

Plan

A JavaScript module in the pilot folder of GridAtlas.

othergridatlas / tools/satnav/walk/gate/pilot/plan.mjs · lines 1–46 of 46 · Not reached from any entry point (candidate for review)

Why it exists in the grid workflow
Domain stage field_execution (path word 'gate'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
Downstream impact
Used directly by 4 files: Controls (gridatlas); Handoff Test (gridatlas); Controls (gridatlas); Replay (gridatlas).
What it achieves
Illustrative coordinates and opening, designed for replay.
Why it matters
Imported by Controls and Replay. Checked by Handoff Test.
Application
gridatlas · tools/satnav/walk/gate/pilot · JavaScript module
Uses
none found
Used by
imported by Controls (import), imported by Handoff Test (import), imported by Controls (import), imported by Replay (import)
Produces
pilot
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/gate/pilot/plan.mjs:1-46 · blob 1a864abebd779a5f935c926dc6fdfec05badfe52 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: none found · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: unreached_review
// Illustrative coordinates and opening, designed for replay. No surveyed access is asserted.
export const pilot = {
  "assetName": "Pilot asset",
  "source": "Synthetic job plan, 28 November 2026",
  "roadStart": [
    -1.5008658,
    51.4999281
  ],
  "gate": {
    "id": "pilot-gate",
    "name": "Pilot gate",
    "agreed": true,
    "locked": false,
    "centre": [
      -1.5,
      51.5
    ],
    "roadside": [
      -1.5,
      51.4999281
    ],
    "fieldSide": [
      -1.5,
      51.5001258
    ],
    "widthM": 12
  },
  "fieldPins": [
    {
      "id": "turn",
      "name": "Turning pin",
      "coordinate": [
        -1.5,
        51.5002695
      ]
    },
    {
      "id": "asset",
      "name": "Pilot asset",
      "coordinate": [
        -1.4995671,
        51.5002695
      ]
    }
  ]
};

Replay

A JavaScript module in the pilot folder of GridAtlas. It replays gate checks (`replayGateChecks`).

transformgridatlas / tools/satnav/walk/gate/pilot/replay.mjs · lines 1–23 of 23 · Not reached from any entry point (candidate for review)

What it does
It calculates its inputs. Defines replayGateChecks.
Why it exists in the grid workflow
Domain stage field_execution (path word 'gate'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
Downstream impact
Used directly by 2 files: Controls (gridatlas); Controls (gridatlas).
What it achieves
Off-site phone replay. Its fixes stay inside separate model instances.
Why it matters
Imported by Controls.
Application
gridatlas · tools/satnav/walk/gate/pilot · JavaScript module
Uses
Handoff (import), Plan (import)
Used by
imported by Controls (import), imported by Controls (import)
Produces
replayGateChecks
Defines here
replayGateChecks
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/gate/pilot/replay.mjs:1-23 · blob 019dc1f77f7d950885d56fff9e0ebc33e4701faf · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: unreached_review
import {createGateHandoff} from '../handoff.mjs';
import {pilot} from './plan.mjs';

// Off-site phone replay. Its fixes stay inside separate model instances.
export function replayGateChecks(saved, maths, compass) {
  const cases = [
    ['8 m beside gate', [[-15,-8,4], [0,-8,4], [15,-8,4]]],
    ['Through gate', [[0,-12,4], [0,0,4], [0,12,4]]],
    ['Uncertain crossing', [[0,-12,4], [0,0,9], [0,12,4]]],
  ];
  return cases.map(([label, samples]) => {
    const model = createGateHandoff(pilot, maths, compass);
    model.setRoad(saved);
    let result;
    for (const [i, [east, north, accuracyM]] of samples.entries()) {
      const across = maths.destinationPoint(...pilot.gate.centre, Math.abs(east) / 1000, east < 0 ? 270 : 90);
      const [longitude, latitude] = maths.destinationPoint(...across, Math.abs(north) / 1000, north < 0 ? 180 : 0);
      const timestampMs = 1000 + i * 1000;
      result = model.locate({longitude, latitude, accuracyM, timestampMs}, timestampMs);
    }
    return {label, leg:result.leg};
  });
}

Layers Browser

A Python command-line tool in the walk folder of GridAtlas. It is built from the check step (`check`).

rendergridatlas / tools/satnav/walk/layers-browser.py · lines 1–79 of 79 · Entry point

What it does
Defines check. Uses libraries os, pathlib, runpy, playwright.sync_api. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage field_execution (path word 'satnav'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work. Domain terms in the code: 400kV.
Inputs & outputs
Voltage levels named: 400kV.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
Exercise the actual field-map Layers control while direct guidance is active. Its code works with 400 kV.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
gridatlas · tools/satnav/walk · Python CLI
Uses
os, pathlib, runpy, playwright.sync_api
Used by
none found
Produces
check
Defines here
check
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/layers-browser.py:1-79 · blob c7cebab75ce7adca9989ba7c282db39b884b535c · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: production_core
"""Exercise the actual field-map Layers control while direct guidance is active."""

import os
from pathlib import Path
from runpy import run_path

from playwright.sync_api import expect, sync_playwright

compact = run_path(str(Path(__file__).resolve().parents[1] / 'compact-browser.py'))
SITE = os.environ.get('WALK_TEST_URL', 'http://127.0.0.1:8873/atlas/v/satnav-walk-202611281345/')


def check(browser, engine, width, height):
    with browser.new_context(viewport={'width': width, 'height': height},
                             is_mobile=True, has_touch=True) as context:
        context.add_init_script(compact['GPS_SPY'])
        page = context.new_page()
        page.goto(SITE, wait_until='domcontentloaded', timeout=90000)
        page.wait_for_function("""() => document.querySelector('#gridatlas-menu-bar') &&
            document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-400') &&
            document.querySelectorAll('#fs-curtain-keys input[data-layer-id]').length >= 40""",
                               timeout=90000)
        start = page.locator('#satnav-walk-start')
        expect(start).to_be_visible()
        gap = page.evaluate("""() => document.querySelector('#satnav-from').getBoundingClientRect().top
            - document.querySelector('#gridatlas-menu-bar').getBoundingClientRect().bottom""")
        assert gap >= 7, gap
        page.locator('#satnav-to').tap()
        target = compact['map_canvas_tap'](page)['coordinates']
        start.tap()
        page.evaluate('at => window.__lineGpsTest.emit(at, 4)', [target[0], target[1] - .00057])
        guidance = page.locator('#satnav-walk-guidance')
        expect(guidance).to_contain_text('Direct to pin')
        expect(guidance).to_contain_text('° true')
        before = guidance.inner_text()
        button = page.locator('#gridatlas-dash-toggle')
        panel = page.locator('#fs-curtain')
        expect(button).to_have_attribute('aria-expanded', 'false')
        button.tap()
        expect(panel).to_be_visible()
        expect(button).to_have_attribute('aria-expanded', 'true')
        layer = panel.locator('input[data-layer-id="400"]')
        source = page.locator('#scada-ui-container input[data-layer-id="400"]')
        original = layer.is_checked()
        layer.tap()
        assert layer.is_checked() == source.is_checked() == (not original)
        page.wait_for_function("""state => window.__GRIDATLAS_V9_MAP__.getLayoutProperty('l-400','visibility') === state""",
                               arg='none' if original else 'visible')
        page.evaluate('at => window.__lineGpsTest.emit(at, 4)', [target[0], target[1] - .00032])
        expect(guidance).not_to_have_text(before)
        expect(guidance).to_contain_text('° true')
        button.tap()
        expect(panel).to_be_hidden()
        button.tap()
        expect(panel).to_be_visible()
        assert layer.is_checked() == (not original)
        layer.tap()
        page.wait_for_function("""state => window.__GRIDATLAS_V9_MAP__.getLayoutProperty('l-400','visibility') === state""",
                               arg='visible' if original else 'none')
        button.tap()
        expect(panel).to_be_hidden()
        page.locator('#satnav-walk-stop').tap()
        expect(guidance).to_have_text('Walk stopped')
        assert page.evaluate('window.__lineGpsTest.records') == {'starts': [1], 'stops': [1]}
        print(f'{engine} {width}×{height}: {gap:g}px header gap, 400 kV switched both ways, '
              'layer panel reopened, live guidance updated, one GPS watch started and cleared.', flush=True)


if __name__ == '__main__':
    with sync_playwright() as playwright:
        for name in os.environ.get('LINE_TEST_BROWSERS', 'chromium,webkit').split(','):
            options = {'args': ['--use-gl=angle', '--use-angle=swiftshader', '--enable-webgl',
                                '--enable-unsafe-swiftshader']} if name == 'chromium' else {}
            browser = getattr(playwright, name).launch(**options)
            try:
                for viewport in [(390, 664), (664, 390)]:
                    check(browser, name, *viewport)
            finally:
                browser.close()

Local Distance Browser

A Python command-line tool in the walk folder of GridAtlas. It is built from the check step (`check`).

geodesygridatlas / tools/satnav/walk/local-distance-browser.py · lines 1–102 of 102 · Entry point

What it does
Defines check. Uses libraries functools, os, re, threading, http.server. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage field_execution (path word 'satnav'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
Exercise the switch from the fictional entrance to a personal walk with synthetic GPS.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
gridatlas · tools/satnav/walk · Python CLI
Uses
functools, os, re, threading, http.server, pathlib, runpy, playwright.sync_api
Used by
none found
Produces
check
Defines here
check
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/local-distance-browser.py:1-102 · blob c9a33846daae580f13670359ab6907dbb3a96cf3 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: production_core
"""Exercise the switch from the fictional entrance to a personal walk with synthetic GPS."""
import functools
import os
import re
import threading
from http.server import ThreadingHTTPServer
from pathlib import Path
from runpy import run_path

from playwright.sync_api import expect, sync_playwright

HERE = Path(__file__).resolve().parent
gate = run_path(str(HERE / 'gate/browser.py'))
helpers = gate['HELPERS']
tap = run_path(str(HERE.parent / 'pedestrian-pilot/bristol-browser.py'))['tap_endpoint']
ENTRY = '/atlas/v/satnav-road-to-field-202611281800/'


def check(browser, size, url):
    with browser.new_context(viewport=dict(zip(('width', 'height'), size)), is_mobile=True, has_touch=True) as ctx:
        ctx.add_init_script(helpers['GPS_SPY'])
        ctx.route('**/*', functools.partial(gate['network'], host='127.0.0.1', broken_road=False))
        page = ctx.new_page()
        page.goto(url + '?pilot', wait_until='commit')
        page.wait_for_function("window.__GRIDATLAS_V9_MAP__?.getLayer('l-sat') && document.querySelector('#satnav-start-field')", timeout=60_000)
        sample = helpers['pins'](page, 3)
        gps, local_to = page.evaluate("""() => {
          const api = document.querySelector('#satnav-compact').satnavSurvey;
          const turningPin = api.getPins()[1].coordinate;
          return [77.84, 77.20].map(km => api.maths.destinationPoint(...turningPin, km, 85.1));
        }""")
        mode = page.locator('#satnav-walk-mode')
        start = page.locator('#satnav-walk-start')
        stop = page.locator('#satnav-walk-stop')
        guide = page.locator('#satnav-walk-guidance')
        start.tap()
        helpers['emit_fix'](page, gps, 7)
        helpers['measured'](page, gps)
        tap(page, 'to', local_to)
        expect(mode).to_have_value('direct')
        local = helpers['pins'](page, 2)
        assert local[0]['at'] == gps and local[0]['role'] == 'start-point'
        assert helpers['surface_distance'](local[1]['at'], local_to) < 2
        expect(guide).to_contain_text(re.compile(r'63[89] m to destination|64[012] m to destination'))
        expect(guide).not_to_contain_text('Waypoint')
        expect(page.locator('#satnav-status')).not_to_contain_text(' km')
        assert page.evaluate('window.__lineGpsTest.records.starts') == [1]

        # A waypoint explicitly chosen by the user must still be followed.
        tap(page, 'add', sample[1]['at'])
        personal = helpers['pins'](page, 3)
        expect(guide).to_contain_text('straight to destination')
        expect(guide).to_contain_text('77.84 km to waypoint')
        expect(guide).to_contain_text('155.04 km remaining via pins')
        mode.select_option('gate')
        assert helpers['pins'](page, 3, personal) == sample
        mode.select_option('direct')
        assert helpers['pins'](page, 3, sample) == personal
        expect(guide).to_contain_text('155.04 km remaining via pins')
        page.locator('#satnav-undo').tap()
        assert helpers['pins'](page, 2) == local
        expect(guide).not_to_contain_text(' km')
        stop.tap()
        assert page.evaluate('window.__lineGpsTest.records') == {'starts': [1], 'stops': [1]}

        # No location permission or GPS observation yet. Cancelling an edit
        # leaves the replay visible. Committing a personal TO drops its pins.
        page.reload(wait_until='commit')
        page.wait_for_function("window.__GRIDATLAS_V9_MAP__?.getLayer('l-sat') && document.querySelector('#satnav-start-field')", timeout=60_000)
        assert helpers['pins'](page, 3) == sample
        page.locator('#satnav-to').tap()
        page.locator('#satnav-to').tap()
        assert helpers['pins'](page, 3) == sample
        mode.select_option('direct')
        assert helpers['pins'](page, 0) == []
        mode.select_option('gate')
        tap(page, 'to', local_to)
        solo = helpers['pins'](page, 1)
        assert solo[0]['role'] == 'destination-point'
        start.tap()
        helpers['emit_fix'](page, gps, 7)
        helpers['measured'](page, gps)
        assert helpers['pins'](page, 2)[0]['at'] == gps
        expect(guide).to_contain_text('m to destination')
        expect(guide).not_to_contain_text(' km')
        stop.tap()
        print(f'{browser.browser_type.name} {size}: local destination, intentional via, restored plan and fresh GPS passed', flush=True)


if __name__ == '__main__':
    with ThreadingHTTPServer(('127.0.0.1', 0), functools.partial(gate['QuietHandler'], directory=gate['ROOT'])) as server:
        threading.Thread(target=server.serve_forever, daemon=True).start()
        url = f'http://127.0.0.1:{server.server_port}' + os.environ.get('SATNAV_JOB_ENTRY', ENTRY)
        with sync_playwright() as playwright:
            for engine in os.environ.get('LINE_TEST_BROWSERS', 'chromium,webkit').split(','):
                options = {'args': ['--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader']} if engine == 'chromium' else {}
                if engine == 'chromium' and os.environ.get('CHROMIUM_PATH'):
                    options['executable_path'] = os.environ['CHROMIUM_PATH']
                with getattr(playwright, engine).launch(**options) as browser:
                    for size in ((390, 664), (664, 390)):
                        check(browser, size, url)
        server.shutdown()

Orient17a Continuity Direct

A JavaScript module in the walk folder of GridAtlas that creates direct walk (`createDirectWalk`) and sets targets (`setTargets`). It creates direct walk (`createDirectWalk`) and sets targets (`setTargets`).

transformgridatlas / tools/satnav/walk/orient17a-continuity-direct.mjs · lines 1–53 of 53 · Not reached from any entry point (candidate for review) · pattern suspend (shared by 4 files)

What it does
It calculates its inputs. Defines 7 functions or classes, including samePin, walkTargets, createDirectWalk, setTargets, restart.
Why it exists in the grid workflow
Domain stage field_execution (path word 'satnav'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
Downstream impact
Used directly by 1 file: Orient17a Continuity Test (gridatlas).
What it achieves
Its `createDirectWalk` function gives direct guidance session reporting choose, waiting, guiding or complete, with distance and bearing where available from Maths and compass modules, ordered targets and timestamped GPS fixes with accuracy (VEDIC: detect destination arrival).
Why it matters
Checked by Orient17a Continuity Test.
Application
gridatlas · tools/satnav/walk · JavaScript module
VEDIC
DETECT DESTINATION ARRIVAL (GG2050-VEDIC-000102): SatNav · Location and navigation data. Maths and compass modules, ordered targets and timestamped GPS fixes with accuracy → Direct guidance session reporting choose, waiting, guiding or complete, with distance and bearing where available.
Uses
Orient17a Continuity Ordered (import), Orient17a Navigation (import)
Used by
imported by Orient17a Continuity Test (import)
Produces
walkTargets, createDirectWalk
Defines here
samePin, walkTargets, createDirectWalk, setTargets, restart, suspend, locate
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/orient17a-continuity-direct.mjs:1-53 · blob e09edc7a031bfb6f92258d48ab9113d1ee050c23 · GitHub at these lines
State
achieves: code · context: readme_derived · stage: transform · effects: none found · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: unreached_review
import {createWaypointGuidance} from '../guidance/orient17a-continuity-ordered.mjs';
import {geometry,createArrival} from '../orientation/orient17a-navigation.mjs';

const samePin = (a, b) => a?.id === b?.id && a.coordinate.every((n, i) => n === b.coordinate[i]);

// FROM is a saved design point. Direct guidance starts at the live measured
// position and targets the first VIA or TO. The final return leg is explicit.
export function walkTargets(pins, from, loop) {
  const targets = from ? pins.slice(1) : pins.slice();
  if (loop && from && pins.length >= 3) targets.push({id:'return-' + pins[0].id,coordinate:from});
  return targets;
}

export function createDirectWalk(maths, compass) {
  let ordered = createWaypointGuidance(maths, compass);
  let targets = [], lastTimestamp = -Infinity, notBefore=-Infinity;
  const proximity=createArrival();
  function setTargets(next) {
    if (next.length === targets.length && next.every((pin, i) => samePin(pin, targets[i]))) return;
    const singleChanged = next.length === 1 || targets.length === 1;
    targets = next;
    if (singleChanged) {proximity.reset(); lastTimestamp = -Infinity; notBefore=Date.now();}
    ordered.setRoute(targets);
  }
  function restart() {
    proximity.reset();
    notBefore=Date.now();
    lastTimestamp = -Infinity;
    ordered = createWaypointGuidance(maths, compass);
    ordered.setRoute(targets);
  }
  function suspend(now = Date.now()) {
    proximity.reset();
    notBefore = Math.max(notBefore, now);
    ordered.suspend(now);
  }
  function locate(fix, now = Date.now()) {
    if (!targets.length) return {status:'choose'};
    const quality = compass.fixQuality(fix, now);
    if (quality !== 'usable' || !fix || fix.accuracyM<=0 || fix.timestampMs<notBefore) {proximity.reset();ordered.resetEvidence();return {status:'waiting',quality};}
    if (targets.length > 1) {
      return ordered.locate(fix,now);
    }
    if (fix.timestampMs < lastTimestamp) { proximity.reset(); return {status:'waiting',quality:'out-of-order'}; }
    const metrics = geometry(fix,targets[0].coordinate,now);
    if (!Number.isFinite(metrics.distanceM)) {proximity.reset();return {status:'waiting'};}
    const arrived=proximity.observe({fix,metrics,key:targets[0].id,now});
    lastTimestamp = fix.timestampMs;
    return arrived ? {status:'complete'} : {status:'guiding', targetIndex:0,
      distanceM:metrics.distanceM,remainingM:metrics.distanceM,bearingDeg:metrics.bearingDeg};
  }
  return {setTargets,restart,locate,suspend};
}

Orient17a Continuity Test

A test in the walk folder of GridAtlas that checks Orient17a Continuity Direct.

testgridatlas / tools/satnav/walk/orient17a-continuity.test.mjs · lines 1–34 of 34 · Not reached from any entry point (candidate for review) · pattern observe (shared by 13 files)

What it does
It tests its inputs. Defines observe, eq. Uses libraries node:assert/strict.
Why it exists in the grid workflow
Domain stage field_execution (path word 'satnav'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
What it achieves
Defines `observe`.
Why it matters
Guards the behaviour of Orient17a Continuity Direct.
Application
gridatlas · tools/satnav/walk · test
Uses
Orient17a Continuity Direct (import), node:assert/strict, ../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/vendor/grid-distance-maths/src/geodesy.mjs, ../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/nav/compass.mjs
Used by
none found
Produces
observe, eq
Defines here
observe, eq
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/orient17a-continuity.test.mjs:1-34 · blob eeb4b7661fd2ba9f6321d5ac4d53657b1016a145 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: unreached_review
import assert from 'node:assert/strict';
import {createDirectWalk} from './orient17a-continuity-direct.mjs';
import * as maths from '../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/vendor/grid-distance-maths/src/geodesy.mjs';
import * as compass from '../vendor/9698781539e549deaa6ecaa4a2b34610c1f9fd29/nav/compass.mjs';
const base=Date.now()+1000;
const pins=[{id:'a',coordinate:[0,0]},{id:'b',coordinate:[0,0.001]}];
const walk=createDirectWalk(maths,compass);
walk.setTargets(pins);
let count=0;
const observe=(t,p=0,a=3,now=t)=>walk.locate({longitude:0,latitude:p,accuracyM:a,timestampMs:base+t},base+now);
const eq=(actual,expected,label)=>{assert.equal(actual,expected,label);count++};
eq(observe(0).targetIndex,0,'first fix');
eq(observe(1000).targetIndex,0,'second fix');
eq(observe(2000).targetIndex,1,'three distinct first-pin fixes');
eq(observe(3000,.001).targetIndex,1,'first second-pin fix');
walk.suspend(base+3500);
eq(observe(3000,.001,3,3600).status,'waiting','pre-resume fix rejected');
eq(observe(4000,.001).targetIndex,1,'visited prefix retained');
eq(observe(4000,.001).targetIndex,1,'duplicate cannot count');
eq(observe(5000,.001).targetIndex,1,'second post-resume fix');
eq(observe(6000,.001).status,'complete','third post-resume fix');
walk.restart();
eq(observe(7000).targetIndex,0,'explicit restart resets journey');
eq(observe(8000).targetIndex,0,'second new fix');
eq(observe(7500,0,3,8100).status,'waiting','out-of-order invalidates streak');
eq(observe(9000).targetIndex,0,'first after out-of-order');
eq(observe(10000).targetIndex,0,'second after out-of-order');
eq(observe(11000).targetIndex,1,'third after out-of-order');
eq(observe(12000,.001).targetIndex,1,'first final fix');
eq(observe(13000,.001,0).status,'waiting','zero accuracy invalidates streak');
eq(observe(14000,.001).targetIndex,1,'first after bad fix');
eq(observe(15000,.001).targetIndex,1,'second after bad fix');
eq(observe(16000,.001).status,'complete','third after bad fix');
console.log('ORIENT17A continuity checks',count);

Orient17a Direct

A JavaScript module in the walk folder of GridAtlas that creates direct walk (`createDirectWalk`) and sets targets (`setTargets`). It creates direct walk (`createDirectWalk`) and sets targets (`setTargets`).

transformgridatlas / tools/satnav/walk/orient17a-direct.mjs · lines 1–48 of 48 · Not reached from any entry point (candidate for review) · pattern createDirectWalk (shared by 6 files)

What it does
It calculates its inputs. Defines 6 functions or classes, including samePin, walkTargets, createDirectWalk, setTargets, restart.
Why it exists in the grid workflow
Domain stage field_execution (path word 'satnav'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
What it achieves
Its `createDirectWalk` function gives direct guidance session reporting choose, waiting, guiding or complete, with distance and bearing where available from Maths and compass modules, ordered targets and timestamped GPS fixes with accuracy (VEDIC: detect destination arrival).
Why it matters
No other file in the estate was found to import it.
Application
gridatlas · tools/satnav/walk · JavaScript module
VEDIC
DETECT DESTINATION ARRIVAL (GG2050-VEDIC-000102): SatNav · Location and navigation data. Maths and compass modules, ordered targets and timestamped GPS fixes with accuracy → Direct guidance session reporting choose, waiting, guiding or complete, with distance and bearing where available.
Uses
Orient17a Ordered (import), Orient17a Navigation (import)
Used by
none found
Produces
walkTargets, createDirectWalk
Defines here
samePin, walkTargets, createDirectWalk, setTargets, restart, locate
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/orient17a-direct.mjs:1-48 · blob a4ce7279ee915fcab76ec92ecf67854137c36b83 · GitHub at these lines
State
achieves: code · context: readme_derived · stage: transform · effects: none found · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: duplicate_candidate
import {createWaypointGuidance} from '../guidance/orient17a-ordered.mjs';
import {geometry,createArrival} from '../orientation/orient17a-navigation.mjs';

const samePin = (a, b) => a?.id === b?.id && a.coordinate.every((n, i) => n === b.coordinate[i]);

// FROM is a saved design point. Direct guidance starts at the live measured
// position and targets the first VIA or TO. The final return leg is explicit.
export function walkTargets(pins, from, loop) {
  const targets = from ? pins.slice(1) : pins.slice();
  if (loop && from && pins.length >= 3) targets.push({id:'return-' + pins[0].id,coordinate:from});
  return targets;
}

export function createDirectWalk(maths, compass) {
  let ordered = createWaypointGuidance(maths, compass);
  let targets = [], lastTimestamp = -Infinity, notBefore=-Infinity;
  const proximity=createArrival();
  function setTargets(next) {
    if (next.length === targets.length && next.every((pin, i) => samePin(pin, targets[i]))) return;
    const singleChanged = next.length === 1 || targets.length === 1;
    targets = next;
    if (singleChanged) {proximity.reset(); lastTimestamp = -Infinity; notBefore=Date.now();}
    ordered.setRoute(targets);
  }
  function restart() {
    proximity.reset();
    notBefore=Date.now();
    lastTimestamp = -Infinity;
    ordered = createWaypointGuidance(maths, compass);
    ordered.setRoute(targets);
  }
  function locate(fix, now = Date.now()) {
    if (!targets.length) return {status:'choose'};
    const quality = compass.fixQuality(fix, now);
    if (quality !== 'usable' || !fix || fix.accuracyM<=0 || fix.timestampMs<notBefore) {proximity.reset();return {status:'waiting',quality};}
    if (targets.length > 1) {
      return ordered.locate(fix,now);
    }
    if (fix.timestampMs < lastTimestamp) return {status:'waiting',quality:'out-of-order'};
    const metrics = geometry(fix,targets[0].coordinate,now);
    if (!Number.isFinite(metrics.distanceM)) {proximity.reset();return {status:'waiting'};}
    const arrived=proximity.observe({fix,metrics,key:targets[0].id,now});
    lastTimestamp = fix.timestampMs;
    return arrived ? {status:'complete'} : {status:'guiding', targetIndex:0,
      distanceM:metrics.distanceM,remainingM:metrics.distanceM,bearingDeg:metrics.bearingDeg};
  }
  return {setTargets,restart,locate};
}

Orient17a V9212 Direct

A JavaScript module in the walk folder of GridAtlas that creates direct walk (`createDirectWalk`) and sets targets (`setTargets`). It creates direct walk (`createDirectWalk`) and sets targets (`setTargets`).

transformgridatlas / tools/satnav/walk/orient17a-v9212-direct.mjs · lines 1–53 of 53 · Not reached from any entry point (candidate for review) · pattern suspend (shared by 4 files)

What it does
It calculates its inputs. Defines 7 functions or classes, including samePin, walkTargets, createDirectWalk, setTargets, restart.
Why it exists in the grid workflow
Domain stage field_execution (path word 'satnav'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
What it achieves
Its `createDirectWalk` function gives direct guidance session reporting choose, waiting, guiding or complete, with distance and bearing where available from Maths and compass modules, ordered targets and timestamped GPS fixes with accuracy (VEDIC: detect destination arrival).
Why it matters
No other file in the estate was found to import it.
Application
gridatlas · tools/satnav/walk · JavaScript module
VEDIC
DETECT DESTINATION ARRIVAL (GG2050-VEDIC-000102): SatNav · Location and navigation data. Maths and compass modules, ordered targets and timestamped GPS fixes with accuracy → Direct guidance session reporting choose, waiting, guiding or complete, with distance and bearing where available.
Uses
Orient17a V9212 Ordered (import), Orient17a V9212 Navigation (import)
Used by
none found
Produces
walkTargets, createDirectWalk
Defines here
samePin, walkTargets, createDirectWalk, setTargets, restart, suspend, locate
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/orient17a-v9212-direct.mjs:1-53 · blob 97301f2e0aad211bca2f2d640f293963e8c2db70 · GitHub at these lines
State
achieves: code · context: readme_derived · stage: transform · effects: none found · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: duplicate_candidate
import {createWaypointGuidance} from '../guidance/orient17a-v9212-ordered.mjs';
import {geometry,createArrival} from '../orientation/orient17a-v9212-navigation.mjs';

const samePin = (a, b) => a?.id === b?.id && a.coordinate.every((n, i) => n === b.coordinate[i]);

// FROM is a saved design point. Direct guidance starts at the live measured
// position and targets the first VIA or TO. The final return leg is explicit.
export function walkTargets(pins, from, loop) {
  const targets = from ? pins.slice(1) : pins.slice();
  if (loop && from && pins.length >= 3) targets.push({id:'return-' + pins[0].id,coordinate:from});
  return targets;
}

export function createDirectWalk(maths, compass) {
  let ordered = createWaypointGuidance(maths, compass);
  let targets = [], lastTimestamp = -Infinity, notBefore=-Infinity;
  const proximity=createArrival();
  function setTargets(next,now=Date.now()) {
    if (next.length === targets.length && next.every((pin, i) => samePin(pin, targets[i]))) return;
    const singleChanged = next.length === 1 || targets.length === 1;
    targets = next;
    if (singleChanged) {proximity.reset(); lastTimestamp = -Infinity; notBefore=now;}
    ordered.setRoute(targets,now);
  }
  function restart(now=Date.now()) {
    proximity.reset();
    notBefore=now;
    lastTimestamp = -Infinity;
    ordered = createWaypointGuidance(maths, compass);
    ordered.setRoute(targets,now);
  }
  function suspend(now = Date.now()) {
    proximity.reset();
    notBefore = Math.max(notBefore, now);
    ordered.suspend(now);
  }
  function locate(fix, now = Date.now()) {
    if (!targets.length) return {status:'choose'};
    const quality = compass.fixQuality(fix, now);
    if (quality !== 'usable' || !fix || fix.accuracyM<=0 || fix.timestampMs<notBefore) {proximity.reset();ordered.resetEvidence();return {status:'waiting',quality};}
    if (targets.length > 1) {
      return ordered.locate(fix,now);
    }
    if (fix.timestampMs < lastTimestamp) { proximity.reset(); return {status:'waiting',quality:'out-of-order'}; }
    const metrics = geometry(fix,targets[0].coordinate,now);
    if (!Number.isFinite(metrics.distanceM)) {proximity.reset();return {status:'waiting'};}
    const arrived=proximity.observe({fix,metrics,key:JSON.stringify([targets[0].id,targets[0].coordinate]),now});
    lastTimestamp = fix.timestampMs;
    return arrived ? {status:'complete'} : {status:'guiding', targetIndex:0,
      distanceM:metrics.distanceM,remainingM:metrics.distanceM,bearingDeg:metrics.bearingDeg};
  }
  return {setTargets,restart,locate,suspend};
}

Saved Plan Browser

A Python command-line tool in the walk folder of GridAtlas that opens map (`open_map`), covering walk.

rendergridatlas / tools/satnav/walk/saved-plan-browser.py · lines 1–144 of 144 · Entry point · pattern open_map (shared by 2 files)

What it does
It lists and searches walk. Defines open_map, disclosure, direct, feature, check_browser. Uses libraries json, math, os, re, pathlib. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage field_execution (path word 'satnav'): on-road and off-road field navigation to the farm gate (access gates, terrain slope, ground-bearing limits, electrical hazards), as Ventus Ltd describes its SatNav work.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
It checks browser (`check_browser`) and is built from the disclosure step (`disclosure`) and the direct step (`direct`). Start the same walk from map taps, the device's saved plan and a native file import.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
gridatlas · tools/satnav/walk · Python CLI
Uses
json, math, os, re, pathlib, runpy, tempfile, playwright.sync_api
Used by
none found
Produces
open_map, disclosure, direct, feature, check_browser
Defines here
open_map, disclosure, direct, feature, check_browser
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/walk/saved-plan-browser.py:1-144 · blob 3bc8a581c518b86823b9f10c0a4a4f3357b33f5a · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: production_core
"""Start the same walk from map taps, the device's saved plan and a native file import."""

import json
import math
import os
import re
from pathlib import Path
from runpy import run_path
from tempfile import TemporaryDirectory

from playwright.sync_api import expect, sync_playwright


helpers = run_path(str(Path(__file__).resolve().parents[1] / "waypoint-browser.py"))
SITE = os.environ.get("LINE_TEST_URL", "http://127.0.0.1:8873/atlas/v/satnav-walk-202611281345/")
SURVEY = "document.querySelector('#satnav-compact').satnavSurvey"


def open_map(page):
    page.goto(SITE, wait_until="domcontentloaded")
    page.wait_for_function("!!window.__GRIDATLAS_V9_MAP__?.getLayer('l-sat')", timeout=60000)
    expect(page.locator("#satnav-walk-start")).to_be_visible(timeout=30000)
    page.wait_for_function(SURVEY + ".getMap() === window.__GRIDATLAS_V9_MAP__")


def disclosure(page, name):
    summary = page.locator("summary").filter(has_text=re.compile(rf"^{re.escape(name)}$"))
    area = summary.locator("..")
    if not area.evaluate("el => el.open"):
        summary.tap()
    return area


def direct(page, metres, bearing):
    distances = "|".join(str(i) for i in range(metres - 2, metres + 3))
    bearings = "|".join(str(i % 360) for i in range(bearing - 2, bearing + 3))
    expect(page.locator("#satnav-walk-guidance")).to_have_text(
        re.compile(rf"Direct to pin · (?:{distances}) m · (?:{bearings})° true")
    )


def feature(kind, coordinates, role, **properties):
    return {"type": "Feature", "geometry": {"type": kind, "coordinates": coordinates},
            "properties": {"satnavRole": role, **properties}}


def check_browser(engine, name, width, height):
    options = {"args": ["--enable-webgl", "--use-gl=angle", "--use-angle=swiftshader",
                        "--enable-unsafe-swiftshader"]} if name == "chromium" else {}
    # An ephemeral WebKit context discards its cache when its last tab closes.
    with TemporaryDirectory() as profile, engine.launch_persistent_context(
        profile, viewport={"width": width, "height": height}, is_mobile=True, has_touch=True, **options
    ) as context:
        context.add_init_script(helpers["GPS_SPY"])
        page = context.new_page()
        open_map(page)
        page.evaluate("window.__GRIDATLAS_V9_MAP__.jumpTo({center:[-1.5,51.5],zoom:17}); void 0")
        helpers["place"](page, "from", 16)
        helpers["pins"](page, 1)
        helpers["place"](page, "to", 9)
        helpers["pins"](page, 2)
        plan = page.evaluate(SURVEY + ".getEndpoints()")
        start, end = plan
        south = [end[0], end[1] - 63 / 111195]
        start_button = page.get_by_role("button", name="Start walk", exact=True)
        stop_button = page.get_by_role("button", name="Stop walk", exact=True)
        start_button.tap()
        helpers["emit_fix"](page, south, accuracy=4)
        direct(page, 63, 0)

        offline = disclosure(page, "Offline plan")
        offline.get_by_role("button", name="Save plan", exact=True).tap()
        expect(offline.get_by_role("status")).to_contain_text("Saved.", timeout=25000)
        assert page.evaluate(SURVEY + ".getEndpoints()") == plan
        stop_button.tap()
        assert page.evaluate("window.__lineGpsTest.records") == {"starts": [1], "stops": [1]}

        # Reopen the same address in this device context, with no in-memory plan.
        page.close()
        page = context.new_page()
        open_map(page)
        assert page.evaluate(SURVEY + ".getEndpoints()") == [None, None]
        start_button = page.get_by_role("button", name="Start walk", exact=True)
        stop_button = page.get_by_role("button", name="Stop walk", exact=True)
        offline = disclosure(page, "Offline plan")
        restore = offline.get_by_role("button", name="Use saved plan")
        restore.tap()
        expect(offline.get_by_role("status")).to_contain_text("Saved plan loaded · 2 pins")
        assert page.evaluate(SURVEY + ".getEndpoints()") == plan
        assert page.evaluate("window.__lineGpsTest.records.starts") == []
        start_button.tap()
        helpers["emit_fix"](page, south, accuracy=4)
        direct(page, 63, 0)
        helpers["emit_fix"](page, end, accuracy=4)
        expect(page.locator("#satnav-walk-guidance")).to_contain_text("Arrived")

        east = [end[0] + 100 / (111195 * math.cos(math.radians(end[1]))), end[1]]
        record = [east[0] + .002, east[1] + .002]
        data = {"type": "FeatureCollection", "features": [
            feature("LineString", [start, east], "planned-route", name="Design walk"),
            feature("Point", record, "walked-fix", accuracyM=4, timestampMs=1000),
            feature("LineString", [south, record], "walked-track", accuracyM=[4, 4], timestampMs=[2000, 3000]),
        ]}
        layout = disclosure(page, "Layouts")
        with page.expect_file_chooser() as picker:
            layout.get_by_role("button", name="Import layout").tap()
        picker.value.set_files({"name": "walk.geojson", "mimeType": "application/geo+json",
                                "buffer": json.dumps(data).encode()})
        expect(layout.get_by_role("status")).to_contain_text("1 design · 2 recorded")
        expect(layout.get_by_role("combobox").locator("option")).to_have_text(["Design walk"])
        assert page.evaluate(SURVEY + ".getEndpoints()") == plan
        helpers["emit_fix"](page, end, accuracy=4)
        expect(page.locator("#satnav-walk-guidance")).to_contain_text("Arrived")
        layout.get_by_role("button", name="Use for walk").tap()
        assert page.evaluate(SURVEY + ".getEndpoints()") == [start, east]
        direct(page, 100, 90)
        helpers["measured"](page, end)
        assert page.evaluate("window.__lineGpsTest.records") == {"starts": [1], "stops": []}

        stop_button.tap()
        start_button.tap()
        helpers["emit_fix"](page, end, accuracy=4)
        direct(page, 100, 90)
        restore.tap()
        expect(page.locator("#satnav-walk-guidance")).to_contain_text("Arrived")
        assert page.evaluate(SURVEY + ".getEndpoints()") == plan
        helpers["measured"](page, end)
        offline.get_by_role("button", name="Forget saved plan").tap()
        expect(offline.get_by_role("status")).to_contain_text("removed")
        restore.tap()
        expect(offline.get_by_role("status")).to_contain_text("No saved plan")
        assert page.evaluate(SURVEY + ".getEndpoints()") == plan
        stop_button.tap()
        assert page.evaluate("window.__lineGpsTest.records") == {"starts": [1, 2], "stops": [1, 2]}
        print(f"{name} {width}×{height}: hand-placed, restored and imported starts passed; "
              "old arrival replaced by 100 m east; recorded features excluded; all watches cleared.", flush=True)


if __name__ == "__main__":
    with sync_playwright() as driver:
        for engine in os.environ.get("LINE_TEST_BROWSERS", "chromium,webkit").split(","):
            engine = engine.strip()
            for size in [(390, 664), (664, 390)]:
                check_browser(getattr(driver, engine), engine, *size)