In this section
- SatNav Unified Agent1 Browser render · gridatlas / tools/satnav/unified-agent1-browser.py lines 1–109
- SatNav Unified Gps Movement Browser render · gridatlas / tools/satnav/unified-gps-movement-browser.py lines 1–90
- SatNav V9202 Neon Dock Browser render · gridatlas / tools/satnav/v9202-neon-dock-browser.py lines 1–45
- SatNav Verify Unified Release automation · gridatlas / tools/satnav/verify-unified-release.mjs lines 1–106
- Council Router ingest · gridatlas / tools/satnav/walk/council/council-router.mjs lines 1–82
- Mapped Footpaths ingest · gridatlas / tools/satnav/walk/council/mapped-footpaths.mjs lines 1–161
- Public Map Browser render · gridatlas / tools/satnav/walk/council/public-map-browser.py lines 1–71
SatNav Unified Agent1 Browser
A Python command-line tool in the tools folder of GridAtlas covering postcodes and uses data from postcodes.io. It is built from the check step (`check`).
rendergridatlas / tools/satnav/unified-agent1-browser.py · lines 1–109 of 109 · Entry point
- What it does
- It draws postcodes. 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: postcodes, 11kV.
- Inputs & outputs
- In: data source: postcodes.io. Voltage levels named: 11kV.
- Downstream impact
- Used directly by 1 file: GridAtlas PR File Size Guard Workflow (gridatlas).
- What it achieves
- Real unified composition: native search, independent panel and GPS state. Its code works with 11 kV.
- Why it matters
- Run by GridAtlas PR File Size Guard Workflow.
- Application
- gridatlas · tools/satnav · Python CLI
- Uses
- os, pathlib, runpy, playwright.sync_api
- Used by
- run by GridAtlas PR File Size Guard Workflow (workflow run)
- 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/unified-agent1-browser.py:1-109 · blob c312506fcc31b7f5bee7e3f590c32905cc12638c · 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
"""Real unified composition: native search, independent panel and GPS state."""
import os
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect, sync_playwright
root = Path(__file__).resolve().parent
compact = run_path(str(root / 'compact-browser.py'))
convergence = run_path(str(root / 'convergence-browser.py'))
site = os.getenv('UNIFIED_TEST_URL', 'http://127.0.0.1:8873/atlas/v/satnav-unified-agent1-ci/')
out = Path('work/unified-agent1')
out.mkdir(parents=True, exist_ok=True)
def check(browser, name, width, height):
with browser.new_context(viewport={'width':width,'height':height},
is_mobile=width<900,has_touch=width<900) as ctx:
ctx.add_init_script(compact['GPS_SPY'])
page = ctx.new_page()
page.goto(site, wait_until='domcontentloaded', timeout=90000)
page.wait_for_function(convergence['READY'], timeout=120000)
toggle = page.locator('#satnav-toggle')
panel = page.locator('#satnav-compact')
search = page.locator('#search-input')
expect(toggle).to_be_visible()
expect(search).to_be_visible()
expect(panel).to_be_hidden()
expect(toggle).to_have_attribute('aria-expanded','false')
assert page.evaluate('window.__lineGpsTest.records') == {'starts':[],'stops':[]}
page.evaluate("""() => {
window.__unifiedTestMap=window.__GRIDATLAS_V9_MAP__;
window.__unifiedTestMap.jumpTo({center:[-.4,51.55],zoom:12});
}""")
# Deterministic provider fixture; the actual native gazetteer and SatNav
# controller run in the browser, not a mocked transfer implementation.
page.route('https://api.postcodes.io/postcodes/HA46AA', lambda route: route.fulfill(
json={'result': {'postcode':'HA4 6AA','longitude':-.4,'latitude':51.555,
'admin_district':'Hillingdon'}}))
search.fill('HA4 6AA')
search.press('Enter')
transfer = page.get_by_role('button',name='Use as SatNav destination',exact=True)
# The REPD lane can also return matching projects; select the UK result action.
uk = page.locator('#search-results .search-result-item[data-location-kind="postcode"]')
expect(uk).to_be_visible(timeout=120000)
uk.locator('xpath=following-sibling::button[1]').click()
expect(panel).to_be_visible()
assert page.evaluate("document.querySelector('#satnav-compact').satnavSurvey.getEndpoints()") == [None,[-.4,51.555]]
assert page.evaluate('window.__lineGpsTest.records') == {'starts':[],'stops':[]}
toggle.click()
# Grid menu uses its original proxy controls; the search projection must
# preserve the entire underlying checkbox inventory and selection.
grid = page.locator('#gridatlas-menu-bar .gm-title').filter(has_text='Grid')
grid.click()
layer_search=page.get_by_role('searchbox',name='Search layers')
expect(layer_search).to_be_visible(timeout=30000)
selection = """() => [...document.querySelectorAll('#scada-ui-container input[type=checkbox][data-layer-id],#scada-ui-container input[type=checkbox][data-pn-layer]')].map(x=>[x.getAttribute('data-layer-id')||x.getAttribute('data-pn-layer'),x.checked])"""
native_before=page.evaluate(selection)
assert len(native_before)==64, native_before
for query in ['UKPN','11 kV']:
layer_search.fill(query)
assert int(page.locator('#unified-layer-search').get_attribute('data-total'))>0
assert page.evaluate(selection)==native_before
page.locator('#unified-layer-search').get_by_role('button',name='Clear',exact=True).click()
assert page.evaluate(selection)==native_before
grid.click()
expect(layer_search).to_be_hidden()
page.screenshot(path=str(out/f'{name}-{width}x{height}-default.png'))
toggle.click()
expect(panel).to_be_visible()
expect(search).to_be_visible()
expect(toggle).to_have_attribute('aria-expanded','true')
page.evaluate("""() => {
document.querySelector('#satnav-compact').satnavSurvey.replacePlan([[-.4,51.55],[-.4,51.555]]);
}""")
page.locator('#satnav-walk-start').click()
page.evaluate("window.__lineGpsTest.emit([-.4,51.5505],4)")
page.wait_for_function(convergence['LINE'],timeout=15000)
before = page.evaluate("""() => {
const s=document.querySelector('#satnav-compact').satnavSurvey,m=s.getMap();
return {pins:s.getPins(),center:m.getCenter().toArray(),zoom:m.getZoom(),bearing:m.getBearing()};
}""")
page.screenshot(path=str(out/f'{name}-{width}x{height}-open.png'))
toggle.click()
expect(panel).to_be_hidden()
expect(search).to_be_visible()
expect(toggle).to_contain_text('GPS active')
page.evaluate("window.__lineGpsTest.emit([-.4,51.551],4)")
page.wait_for_function(convergence['LINE'],timeout=15000)
assert page.evaluate('window.__lineGpsTest.records') == {'starts':[1],'stops':[]}
assert page.evaluate("""() => window.__unifiedTestMap===window.__GRIDATLAS_V9_MAP__
&& document.querySelector('#satnav-compact').satnavSurvey.getMap()===window.__unifiedTestMap""")
toggle.click()
expect(panel).to_be_visible()
assert page.evaluate("document.querySelector('#satnav-compact').satnavSurvey.getPins()") == before['pins']
assert page.evaluate("window.__unifiedTestMap.getZoom()") == before['zoom']
assert page.evaluate("window.__unifiedTestMap.getBearing()") == before['bearing']
page.locator('#satnav-walk-stop').click()
assert page.evaluate('window.__lineGpsTest.records') == {'starts':[1],'stops':[1]}
print(f'{name} {width}x{height}: native search, collapsed controls, retained map and plan, one watch PASS',flush=True)
if __name__=='__main__':
with sync_playwright() as p:
for name in os.getenv('LINE_TEST_BROWSERS','chromium,webkit').split(','):
opts={'args':['--use-gl=angle','--use-angle=swiftshader','--enable-webgl','--enable-unsafe-swiftshader']} if name=='chromium' else {}
browser=getattr(p,name).launch(**opts)
try:
for width,height in [(393,852),(852,393),(1440,900)]:
check(browser,name,width,height)
finally:
browser.close()SatNav Unified Gps Movement Browser
A Python command-line tool in the tools folder of GridAtlas. It is built from the check step (`check`).
rendergridatlas / tools/satnav/unified-gps-movement-browser.py · lines 1–90 of 90 · 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 'gps'): 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
- Exact-composition GPS movement regression; only the GPS sensor is simulated.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- gridatlas · tools/satnav · 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/unified-gps-movement-browser.py:1-90 · blob cf543b06a63c08a4dde0f7dfd1f78913d534293b · 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
"""Exact-composition GPS movement regression; only the GPS sensor is simulated."""
import os
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect, sync_playwright
ROOT = Path(__file__).resolve().parent
GPS_SPY = run_path(str(ROOT / 'compact-browser.py'))['GPS_SPY']
CONVERGENCE = run_path(str(ROOT / 'convergence-browser.py'))
LINE = CONVERGENCE['LINE']
SITE = os.environ['UNIFIED_TEST_URL']
OUT = Path('work/unified-gps-movement')
OUT.mkdir(parents=True, exist_ok=True)
FIX_AT = """at => {
const m = window.__GRIDATLAS_V9_MAP__;
const src = m?.getSource('gridatlas-satnav-position');
const data = src?.serialize()?.data;
const f = data?.features?.find(f => f.properties.role === 'measured-gps');
return JSON.stringify(f?.geometry.coordinates) === JSON.stringify(at);
}"""
NO_FIX = """() => {
const data = window.__GRIDATLAS_V9_MAP__.getSource('gridatlas-satnav-position')?.serialize()?.data;
return Array.isArray(data?.features) && !data.features.some(f => f.properties.role === 'measured-gps');
}"""
PLAN = "document.querySelector('#satnav-compact').satnavSurvey.getPins()"
WATCH = 'window.__lineGpsTest.records'
def check(browser, engine, width, height):
with browser.new_context(viewport={'width': width, 'height': height},
is_mobile=width < 900, has_touch=width < 900) as ctx:
ctx.add_init_script(GPS_SPY)
page = ctx.new_page()
page.goto(SITE, wait_until='domcontentloaded', timeout=90000)
page.wait_for_function(CONVERGENCE['READY'], timeout=120000)
toggle = page.locator('#satnav-toggle')
panel = page.locator('#satnav-compact')
expect(toggle).to_be_visible(timeout=120000)
expect(panel).to_be_hidden()
assert page.evaluate(WATCH) == {'starts': [], 'stops': []}
page.evaluate("""() => {
const s = document.querySelector('#satnav-compact').satnavSurvey;
window.__movementMap = s.getMap();
s.getMap().jumpTo({center:[-.4,51.55],zoom:16,bearing:20});
s.replacePlan([[-.4,51.55],[-.4,51.555]]);
}""")
toggle.click()
page.locator('#satnav-walk-start').click()
first, second, third = [-.4,51.5505], [-.4,51.551], [-.4,51.5515]
page.evaluate('at => window.__lineGpsTest.emit(at,4)', first)
page.wait_for_function(FIX_AT, arg=first, timeout=15000)
page.wait_for_function(LINE, timeout=15000)
pins = page.evaluate(PLAN)
guidance = page.locator('#satnav-walk-guidance')
expect(guidance).to_contain_text('Direct to pin')
initial_guidance = guidance.inner_text()
toggle.click()
expect(panel).to_be_hidden()
for fix in (second, third):
page.evaluate('at => window.__lineGpsTest.emit(at,4)', fix)
page.wait_for_function(FIX_AT, arg=fix, timeout=15000)
page.wait_for_function(LINE, timeout=15000)
assert page.evaluate(WATCH) == {'starts': [1], 'stops': []}
assert page.evaluate(PLAN) == pins
assert page.evaluate('window.__movementMap === window.__GRIDATLAS_V9_MAP__')
page.screenshot(path=str(OUT / f'{engine}-{width}x{height}-hidden.png'))
toggle.click()
expect(panel).to_be_visible()
expect(guidance).to_contain_text('Direct to pin')
expect(guidance).not_to_have_text(initial_guidance)
page.locator('#satnav-walk-stop').click()
assert page.evaluate(WATCH) == {'starts': [1], 'stops': [1]}
page.wait_for_function(NO_FIX, timeout=15000)
page.evaluate('at => window.__lineGpsTest.emit(at,4)', first)
page.wait_for_function(NO_FIX, timeout=15000)
assert page.evaluate(PLAN) == pins
print(f'{engine} {width}x{height}: moving GPS coordinates, hidden-panel guidance, plan/map identity, stop PASS', flush=True)
if __name__ == '__main__':
with sync_playwright() as p:
for engine in os.getenv('LINE_TEST_BROWSERS', 'chromium,webkit').split(','):
opts = {'args': ['--use-gl=angle', '--use-angle=swiftshader', '--enable-webgl', '--enable-unsafe-swiftshader']} if engine == 'chromium' else {}
browser = getattr(p, engine).launch(**opts)
try:
for width, height in [(393,852),(852,393),(1440,900)]:
check(browser, engine, width, height)
finally:
browser.close()SatNav V9202 Neon Dock Browser
A Python command-line tool in the tools folder of GridAtlas.
rendergridatlas / tools/satnav/v9202-neon-dock-browser.py · lines 1–45 of 45 · 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.
- Downstream impact
- Used directly by 1 file: GridAtlas PR File Size Guard Workflow (gridatlas).
- What it achieves
- Defines `check`. Described from its file name only (a candidate, not yet checked against the code).
- Why it matters
- Run by GridAtlas PR File Size Guard Workflow.
- Application
- gridatlas · tools/satnav · Python CLI
- Uses
- os, pathlib, runpy, playwright.sync_api
- Used by
- run by GridAtlas PR File Size Guard Workflow (workflow run)
- 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/v9202-neon-dock-browser.py:1-45 · blob 9f2ac4b80a2c6c83d169684d4fa3d629ebd4853a · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: production_core
"""V9.202: actual native secondary geometry and responsive control bounds."""
import os
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect, sync_playwright
root=Path(__file__).resolve().parent
ready=run_path(str(root/'convergence-browser.py'))['READY']
site=os.environ['UNIFIED_TEST_URL']
out=Path('work/v9202-neon-dock');out.mkdir(parents=True,exist_ok=True)
def check(browser,name,width,height):
with browser.new_context(viewport={'width':width,'height':height},is_mobile=width<900,has_touch=width<900) as ctx:
page=ctx.new_page()
page.goto(site,wait_until='domcontentloaded',timeout=90000)
page.wait_for_function(ready,timeout=120000)
toggle=page.locator('#satnav-toggle')
tray=page.locator('#gridatlas-mobile-tray')
expect(toggle).to_be_visible(timeout=30000)
expect(tray).to_be_visible(timeout=30000)
page.wait_for_function("""() => {const a=document.querySelector('#satnav-toggle').getBoundingClientRect(),b=document.querySelector('#gridatlas-mobile-tray').getBoundingClientRect(),l=document.querySelector('#gridatlas-dash-toggle').getBoundingClientRect();return a.bottom<=b.top+1&&a.right>=innerWidth/2&&b.right>=innerWidth/2&&b.right<=innerWidth&&a.height>=44&&(b.bottom<=l.top+1||b.top>=l. … [line shortened here: 462 characters; full line on GitHub]
page.evaluate("""() => {const m=window.__GRIDATLAS_V9_MAP__;m.jumpTo({center:[0.1,51.5],zoom:12});const box=document.querySelector('#scada-ui-container input[data-layer-id="ukpn_secondary"]');if(!box.checked)box.click()}""")
page.wait_for_function("""() => window.__GRIDATLAS_V9_MAP__.getSource('src-ukpn_secondary')?.serialize().data?.features?.length===54558""",timeout=120000)
page.evaluate("""() => {const m=window.__GRIDATLAS_V9_MAP__;const f=m.getSource('src-ukpn_secondary').serialize().data.features.find(f=>Math.abs(f.geometry.coordinates[0])<0.3&&Math.abs(f.geometry.coordinates[1]-51.5)<0.1);m.jumpTo({center:f.geometry.coordinates,zoom:13})}""")
hit=page.wait_for_function("""() => {const m=window.__GRIDATLAS_V9_MAP__,c=m.getCanvas(),r=c.getBoundingClientRect();for(const f of m.queryRenderedFeatures({layers:['l-ukpn_secondary']})){const p=m.project(f.geometry.coordinates),x=p.x+r.left,y=p.y+r.top;if(document.elementFromPoint(x,y)!==c)continue;if(m.queryRenderedFeatures(p,{layers:['l-ukpn_secondary']})[0]?.properties?.name!==f.prope … [line shortened here: 500 characters; full line on GitHub]
page.mouse.click(hit['x'],hit['y'])
card=page.locator('[data-ukpn-detail][data-site]')
expect(card).to_have_attribute('data-site',hit['site'],timeout=20000)
card.get_by_role('button',name='Ventus Grid Engine',exact=True).click()
page.wait_for_function("""() => {const e=window.__GRIDATLAS_NEON_LINKS__,m=window.__GRIDATLAS_V9_MAP__,lines=m.getSource('gridatlas-neon-links')?.serialize().data?.features,nodes=m.getSource('gridatlas-neon-nodes')?.serialize().data?.features;return e.last_selection?.direction==='from-secondary'&&lines?.length>0&&nodes?.length===lines.length&&m.getLayer('l-neon-core')&&m.getLayoutProperty( … [line shortened here: 455 characters; full line on GitHub]
geometry=page.evaluate("""() => {const m=window.__GRIDATLAS_V9_MAP__,e=window.__GRIDATLAS_NEON_LINKS__,lines=m.getSource('gridatlas-neon-links').serialize().data.features,nodes=m.getSource('gridatlas-neon-nodes').serialize().data.features;return {name:e.last_selection.name,lines,nodes}}""")
assert geometry['name']==hit['site']
assert 1<=len(geometry['lines'])<=5
assert all(f['geometry']['type']=='LineString' and len(f['geometry']['coordinates'])==2 and f['properties']['km']>0 for f in geometry['lines'])
assert all(int(n['properties']['label'].split(' · ')[-1].split()[0])>=33 for n in geometry['nodes'])
page.screenshot(path=str(out/f'{name}-{width}x{height}.png'))
page.evaluate("window._closePopupKeepShape?.()")
page.wait_for_function("""() => !window.__GRIDATLAS_NEON_LINKS__.links_drawn""",timeout=15000)
print(f'{name} {width}x{height}: native secondary neon geometry and lower-right dock PASS',flush=True)
if __name__=='__main__':
with sync_playwright() as p:
for name in os.environ.get('LINE_TEST_BROWSERS','chromium,webkit').split(','):
opts={'args':['--use-gl=angle','--use-angle=swiftshader','--enable-webgl','--enable-unsafe-swiftshader']} if name=='chromium' else {}
b=getattr(p,name).launch(**opts)
try:
for w,h in [(393,852),(852,393),(1440,900)]:check(b,name,w,h)
finally:b.close()SatNav Verify Unified Release
A JavaScript module in the tools folder of GridAtlas that verifies manifest (`verifyManifest`), using SHA-256.
automationgridatlas / tools/satnav/verify-unified-release.mjs · lines 1–106 of 106 · Entry point · pattern verifyManifest (shared by 10 files)
- What it does
- It loads data. Defines 8 functions or classes, including verifyManifest, need, check, digest, git. Uses libraries node:crypto, node:fs, node:path, node:url, node:child_process. Side effects: reads or writes files; starts processes.
- 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.
- Inputs & outputs
- In: JSON file current.json; command-line arguments.
- Downstream impact
- Used directly by 1 file: GridAtlas PR File Size Guard Workflow (gridatlas).
- What it achieves
- It verifies manifest (`verifyManifest`) and is built from the need step (`need`) and the check step (`check`). G201-07: additive independent release verification; no writes or network.
- Why it matters
- Run by GridAtlas PR File Size Guard Workflow.
- Application
- gridatlas · tools/satnav · JavaScript module
- Uses
- GridAtlas — Index Page (new URL import.meta.url), node:crypto, node:fs, node:path, node:url, node:child_process
- Used by
- run by GridAtlas PR File Size Guard Workflow (workflow run)
- Produces
- verifyManifest, need, check, digest, git, blob, same, local
- Defines here
- verifyManifest, need, check, digest, git, blob, same, local
- 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/verify-unified-release.mjs:1-106 · blob fc431b8f6a17a0c7115998a94419c693af645132 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: production_core
// G201-07: additive independent release verification; no writes or network.
function verifyManifest(m, read, expected) {
const need=(ok,msg)=>{if(!ok)throw Error(msg)};
const hash=/^[a-f0-9]{64}$/;
need(m.schema==='gridatlas.current.v2' && m.architecture==='IMMUTABLE_SHELL_PLUS_HASHED_CARTRIDGES','schema/architecture');
need(m.generation===expected.generation,'generation mismatch');
need(m.composition_version===expected.version,'version mismatch');
if(expected.sourceSha){
need(m.source_revisions?.integration===expected.sourceSha,'integration source revision mismatch');
need(m.owner_test_mode==='unified','not a unified owner-test composition');
need(m.composition_id===`${m.generation}-gridatlas-${m.composition_version}`,'composition identity mismatch');
}
need(Array.isArray(m.cartridges)&&Array.isArray(m.cartridge_order),'registry missing');
const ids=m.cartridges.map(c=>c.id),order=m.cartridge_order;
need(ids.length>0&&ids.every(id=>typeof id==='string'&&id.length>0),'invalid ID');
need(new Set(ids).size===ids.length,'duplicate registry ID');
need(new Set(order).size===order.length,'duplicate order ID');
need(order.length===ids.length&&order.every(id=>ids.includes(id)),'registry/order mismatch');
const seen=new Set(), replacements=new Set(),paths=new Set(), receipts=[];
const check=(entry,kind)=>{
need(typeof entry.path==='string'&&entry.path.length>0,kind+' path');
need(hash.test(entry.sha256||''),kind+' hash declaration');
need(Number.isSafeInteger(entry.bytes)&&entry.bytes>=0,kind+' byte declaration');
const actual=read(entry.path,kind);
need(actual.sha256===entry.sha256,kind+' SHA-256 mismatch');
need(actual.bytes===entry.bytes,kind+' byte count mismatch');
receipts.push({kind,path:entry.path,...actual});
};
for(const id of order){
const c=m.cartridges.find(e=>e.id===id);
need(c.type==='script',id+' type');
if(c.slot==='replace-script'){
need(typeof c.replace_script==='string'&&expected.shellScripts.includes(c.replace_script),id+' missing shell replacement');
need(!replacements.has(c.replace_script),id+' duplicate replacement');
replacements.add(c.replace_script);
}else need(c.slot==='after-cartridge'&&seen.has(c.after),id+' invalid anchor');
need(!paths.has(c.path),id+' duplicate cartridge path');
paths.add(c.path);check(c,'cartridge:'+id);seen.add(id);
}
need(Array.isArray(m.runtime_dependency_pins),'runtime pins missing');
const pinPaths=new Set();
for(const pin of m.runtime_dependency_pins){
need(!pinPaths.has(pin.path),'duplicate runtime pin');
pinPaths.add(pin.path);check(pin,'runtime');
}
for(const pin of expected.requiredPins)need(pinPaths.has(pin),'missing inherited runtime pin '+pin);
return receipts;
}
// Independent release gate. Run only from a complete Git checkout:
// node tools/satnav/verify-unified-release.mjs <generation> <source-commit>
// Source commit is the reviewed assembly input, not the self-referential packaging commit.
import {createHash} from 'node:crypto';
import {readFileSync,realpathSync} from 'node:fs';
import {resolve,relative,dirname,isAbsolute,sep} from 'node:path';
import {fileURLToPath} from 'node:url';
import {execFileSync} from 'node:child_process';
const root=realpathSync(fileURLToPath(new URL('../../',import.meta.url)));
const baseline='a31234b180c991509e81621dc12d67c051ac6a59';
const predecessor='202612012118';
const [generation,sourceSha]=process.argv.slice(2);
if(!/^\d{12}$/.test(generation||'')||! /^[a-f0-9]{40}$/.test(sourceSha||''))throw Error('Usage: verify-unified-release.mjs <12-digit generation> <40-hex assembly source SHA>');
const digest=b=>({bytes:b.length,sha256:createHash('sha256').update(b).digest('hex')});
const git=(...args)=>execFileSync('git',args,{cwd:root,maxBuffer:32*1024*1024});
const blob=(rev,path)=>git('show',rev+':'+path);
const same=(a,b,label)=>{if(!a.equals(b))throw Error(label+' differs from pinned bytes')};
git('merge-base','--is-ancestor',baseline,sourceSha);
git('merge-base','--is-ancestor',sourceSha,'HEAD');
const route=resolve(root,'atlas/v',generation);
function local(base,path){
if(typeof path!=='string'||!path||isAbsolute(path)||/[\\\\?#:%]/.test(path))throw Error('Unsafe local path '+path);
const p=realpathSync(resolve(base,path)), rel=relative(root,p);
if(rel==='..'||rel.startsWith('..'+sep)||isAbsolute(rel))throw Error('Path escapes repository '+path);
return {p,rel:rel.split(sep).join('/')};
}
const manifest=JSON.parse(readFileSync(resolve(route,'current.json'),'utf8'));
const old=JSON.parse(blob(baseline,'atlas/v/'+predecessor+'/current.json'));
const shell=local(route,manifest.shell.index);
const historicalShell=local(resolve(root,'atlas/v',predecessor),old.shell.index);
if(shell.rel!==historicalShell.rel||manifest.shell.release_id!==old.shell.release_id)throw Error('Unexpected shell identity');
if(local(route,manifest.shell.base).p!==dirname(shell.p))throw Error('Shell base/index mismatch');
const shellBytes=readFileSync(shell.p);
same(shellBytes,blob(baseline,shell.rel),'immutable shell');
const router=readFileSync(resolve(route,'index.html'));
same(router,blob(baseline,'atlas/v/'+predecessor+'/index.html'),'versioned router');
same(readFileSync(resolve(root,'atlas/current.json')),blob(baseline,'atlas/current.json'),'production pointer');
const shellScripts=[...shellBytes.toString('utf8').matchAll(/<script\b[^>]*\bsrc=["']([^"']+)["'][^>]*>/gi)].map(m=>m[1].split('/').pop());
const receipts=verifyManifest(manifest,(path,kind)=>{
const f=local(kind==='runtime'?root:route,path);
const bytes=readFileSync(f.p);
same(bytes,blob(sourceSha,f.rel),kind+' assembly source');
return digest(bytes);
},{generation,version:'v9.201',sourceSha,shellScripts,requiredPins:old.runtime_dependency_pins.map(p=>p.path)});
const ledger=local(route,manifest.composition_manifest);
const record=JSON.parse(readFileSync(ledger.p,'utf8'));
for(const key of ['generation','composition_version','composition_id','owner_test_mode','source_revisions','cartridge_order','runtime_dependency_pins']){
if(JSON.stringify(record[key])!==JSON.stringify(manifest[key]))throw Error('Composition ledger mismatch: '+key);
}
if(record.cartridges.length!==manifest.cartridges.length)throw Error('Ledger registry length');
for(const c of manifest.cartridges){
const matches=record.cartridges.filter(e=>e.id===c.id);
if(matches.length!==1)throw Error('Ledger identity '+c.id);
const e=matches[0];
if(e.sha256!==c.sha256||e.bytes!==c.bytes||e.slot!==c.slot||e.after!==c.after||e.replace_script!==c.replace_script||local(resolve(root,'atlas'),e.path).p!==local(route,c.path).p)throw Error('Ledger entry mismatch '+c.id);
}
console.log(JSON.stringify({status:'PASS',generation,sourceSha,head:git('rev-parse','HEAD').toString().trim(),shell:digest(shellBytes),router:digest(router),manifest:digest(readFileSync(resolve(route,'current.json'))),ledger:digest(readFileSync(ledger.p)),receipts},null,2));Council Router
A JavaScript module in the walk folder of GridAtlas that fetches bristol footpaths and mickleham footpaths, using SHA-256.
ingestgridatlas / tools/satnav/walk/council/council-router.mjs · lines 1–82 of 82 · Not reached from any entry point (candidate for review)
- What it does
- It fetches bristol footpaths and mickleham footpaths. Defines readMicklehamSections, createPedestrianRouter, loadPedestrianRouter. Side effects: makes network requests.
- 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.
- Inputs & outputs
- Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid).
- Downstream impact
- Used directly by 1 file: Plan Test (gridatlas).
- What it achieves
- It reads mickleham sections (`readMicklehamSections`), creates pedestrian router (`createPedestrianRouter`) and loads pedestrian router (`loadPedestrianRouter`). Local, fixed council extracts. No endpoint or GPS fix is sent to a provider.
- Why it matters
- Checked by Plan Test.
- Application
- gridatlas · tools/satnav/walk/council · JavaScript module
- Uses
- Mapped Footpaths (import)
- Used by
- imported by Plan Test (import)
- Produces
- createPedestrianRouter, loadPedestrianRouter
- Defines here
- readMicklehamSections, createPedestrianRouter, loadPedestrianRouter
- 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/council/council-router.mjs:1-82 · blob d9cd7aef96b6ef1737b4c8c28033f3d6e38a6d40 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: network · domain stage: field_execution · users: EPC_contractor, landowner_planner · canonical: unreached_review
// Local, fixed council extracts. No endpoint or GPS fix is sent to a provider.
import { createBristolFootpathRouter, createMappedFootpathRouter } from './mapped-footpaths.mjs';
const SURREY_PAGE = 'https://www.surreycc.gov.uk/culture-and-leisure/countryside/management/footpaths-byways-and-bridleways/rights-of-way/open-data';
const BRISTOL_NOTICES = 'https://www.bristol.gov.uk/residents/streets-travel/highways/roadworks-road-closures-and-temporary-traffic-regulation-orders-ttros/temporary-traffic-regulation-order-ttros-notices';
const SURREY_ARCHIVE_HASH = 'e2ad1dfaecb0e522172af916f3ebbd4fde8c606fdb87f142a696c6bce97f6fdf';
const packs = [
['bristol', 'bristol-footpaths.geojson', '4b2b7af898c7e1cb617af7266e31bea960c22a4fc5e3fe08fcbe6e09338dcfd6'],
['mickleham', 'mickleham-footpaths-20260907.geojson', '10d9167fa8a38809a33dd77e30b1731af938d17f236e5231a61f3a12f393280c'],
];
function readMicklehamSections(pack) {
if (pack?.schema !== 'ventus.surrey-footpath-pack.v1' || pack.type !== 'FeatureCollection'
|| pack.source !== SURREY_PAGE || pack.archiveSha256 !== SURREY_ARCHIVE_HASH
|| !Array.isArray(pack.features) || pack.features.length > 39) {
throw new Error('Invalid Mickleham footpath source');
}
const chains = new Map();
const ids = new Set();
let pointCount = 0;
for (const feature of pack.features) {
const p = feature.properties;
if (p?.accessCode !== '01' || feature.geometry?.type !== 'LineString') continue;
const points = feature.geometry.coordinates;
if (!Number.isSafeInteger(feature.id) || ids.has(feature.id) || !/^\d+[A-Z]?$/.test(p.footpath)
|| !/^j\d+$/.test(p.chain) || !Number.isSafeInteger(p.position) || p.position < 0
|| typeof p.forward !== 'boolean' || !Array.isArray(points) || points.length < 2) {
throw new Error('Invalid Mickleham footpath section');
}
ids.add(feature.id);
pointCount += points.length;
if (pointCount > 20000 || !points.every(at => Array.isArray(at) && at.length === 2 && at.every(Number.isFinite)
&& at[0] > -0.5 && at[0] < 0 && at[1] > 51 && at[1] < 52)) throw new Error('Invalid Mickleham geometry');
// Chain IDs and positions come from exact original British National Grid
// endpoints on this numbered path. Separate components keep separate IDs.
const key = p.footpath + '/' + p.chain;
if (!chains.has(key)) chains.set(key, []);
const coords = points.map(at => [...at]);
chains.get(key).push({
route: 'Mickleham FP ' + p.footpath, code: 'Mickleham/' + feature.id,
sequence: p.position * 10, points: p.forward ? coords : coords.reverse(),
});
}
return chains;
}
export function createPedestrianRouter({ bristol, mickleham }, maths) {
const providers = [];
if (bristol) providers.push({
route: createBristolFootpathRouter(bristol, maths), attribution: bristol.source.attribution,
licence: bristol.source.licence, coverage: bristol.source.coverage, closureNotices: BRISTOL_NOTICES,
});
if (mickleham) providers.push({
route: createMappedFootpathRouter(readMicklehamSections(mickleham), maths, SURREY_PAGE),
attribution: mickleham.attribution, licence: mickleham.licence,
coverage: 'Mickleham public footpaths, 7 September 2026', closureNotices: mickleham.closureNotices,
});
return function findFootpath(from, to, excludedSections = []) {
for (const { route, ...publication } of providers) {
const result = route(from, to, excludedSections);
if (result.status === 'mapped') return { ...result, ...publication };
if (result.reason !== 'outside-coverage') return result;
}
return { status: 'unavailable', reason: providers.length ? 'outside-coverage' : 'footpath-data-unavailable' };
};
}
/** Read static site assets. A missing or corrupt pack does not disable other areas. */
export async function loadPedestrianRouter(maths) {
const loaded = await Promise.allSettled(packs.map(async ([name, file, expected]) => {
const response = await fetch(new URL(file, import.meta.url), { credentials: 'omit' });
if (!response.ok) throw new Error('Footpath data unavailable');
const bytes = await response.arrayBuffer();
const hash = await crypto.subtle.digest('SHA-256', bytes);
const actual = [...new Uint8Array(hash)].map(n => n.toString(16).padStart(2, '0')).join('');
if (actual !== expected) throw new Error('Footpath data differs from the published extract');
return [name, JSON.parse(new TextDecoder().decode(bytes))];
}));
const available = Object.fromEntries(loaded.filter(result => result.status === 'fulfilled').map(result => result.value));
return createPedestrianRouter(available, maths);
}Mapped Footpaths
A JavaScript module in the council folder of GridAtlas that reads sections (`readSections`) and creates bristol footpath router (`createBristolFootpathRouter`) and mapped footpath router (`createMappedFootpathRouter`).
Set aside from the main view: 94% of its lines are the same as tools/satnav/pedestrian/mapped-footpaths.mjs (gridatlas), which stays. (near-copy-of, proposed by families.py). 94% of lines shared with Mapped Footpaths; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9403 to gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/pedestrian/mapped-footpaths.mjs:1-155 44d18c1e8c58462ec0a78d90c614e7c0d199c84e
- sha256 7ccfb9fb7247632110067c6895c5f65e9a154a0894c2aa3f988538898fba0e98
- target sha256 6aa959062bc4ca2bb3b6e49ad7539d96f87455ceff7b8c04212057d37504244d
- group of 2 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
ingestgridatlas / tools/satnav/walk/council/mapped-footpaths.mjs · lines 1–161 of 161 · Not reached from any entry point (candidate for review) · pattern createBristolFootpathRouter (shared by 2 files)
- What it does
- It lists and searches its content. Defines 9 functions or classes, including same, valid, unavailable, readSections, consecutive.
- 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: Council Router (gridatlas).
- What it achieves
- It reads sections (`readSections`), creates bristol footpath router (`createBristolFootpathRouter`) and creates mapped footpath router (`createMappedFootpathRouter`). The Bristol extract has section IDs and shapes but no cross-path junction IDs.
- Why it matters
- Imported by Council Router.
- Application
- gridatlas · tools/satnav/walk/council · JavaScript module
- Uses
- none found
- Used by
- imported by Council Router (import)
- Produces
- createBristolFootpathRouter, createMappedFootpathRouter
- Defines here
- same, valid, unavailable, readSections, consecutive, chainsFor, locate, createBristolFootpathRouter, createMappedFootpathRouter
- 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/council/mapped-footpaths.mjs:1-161 · blob 461ebc5692b9e281528051407e52463bf83d32e9 · 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
// SPDX-License-Identifier: Apache-2.0
// The Bristol extract has section IDs and shapes but no cross-path junction IDs.
const COUNCIL_LAYER = 'https://maps2.bristol.gov.uk/server2/rest/services/ext/ll_transport/MapServer/0';
const SNAP_M = 12;
const same = (a, b) => a[0] === b[0] && a[1] === b[1];
const valid = p => Array.isArray(p) && p.length === 2 && p.every(Number.isFinite)
&& Math.abs(p[0]) <= 180 && Math.abs(p[1]) <= 90;
const unavailable = reason => ({ status: 'unavailable', reason });
function readSections(collection) {
if (collection?.type !== 'FeatureCollection' || collection.source?.url !== COUNCIL_LAYER
|| !Array.isArray(collection.features) || collection.features.length > 2000) {
throw new Error('Invalid Bristol footpath source');
}
const routes = new Map();
const seen = new Set();
let pointCount = 0;
for (const feature of collection.features) {
const props = feature?.properties;
if (props?.STATUS !== 'FP' || feature.geometry?.type !== 'LineString') continue;
const match = /^(BCC\/[0-9A-Z]+)\/(\d+)$/.exec(props.ROUTE_CODE);
if (!match) continue;
const [, route, digits] = match;
const sequence = Number(digits);
const key = route + '/' + sequence;
if (seen.has(key)) throw new Error('Duplicate footpath section');
seen.add(key);
const points = feature.geometry.coordinates;
pointCount += points?.length || 0;
if (pointCount > 20000 || !Array.isArray(points) || points.length < 2 || !points.every(valid)) {
throw new Error('Invalid footpath geometry');
}
if (!routes.has(route)) routes.set(route, []);
routes.get(route).push({ route, code: props.ROUTE_CODE, sequence, points: points.map(p => [...p]) });
}
return routes;
}
function consecutive(a, b) {
return a && b && b.sequence === a.sequence + 10;
}
function chainsFor(routes, maths) {
const chains = [];
for (const sections of routes.values()) {
sections.sort((a, b) => a.sequence - b.sequence);
let chain, last;
for (const [i, section] of sections.entries()) {
let points = section.points;
const first = points[0], end = points.at(-1);
if (consecutive(sections[i - 1], section) && (same(last, first) || same(last, end))) {
if (same(last, end)) points = [...points].reverse();
} else {
chain = { route: section.route, segments: [], lengthM: 0 };
chains.push(chain);
const next = sections[i + 1];
if (consecutive(section, next)
&& (same(first, next.points[0]) || same(first, next.points.at(-1)))) {
points = [...points].reverse();
}
}
for (let j = 1; j < points.length; j++) {
const a = points[j - 1], b = points[j];
if (same(a, b)) continue;
const lengthM = maths.distanceKm(...a, ...b) * 1000;
if (!Number.isFinite(lengthM) || lengthM <= 0 || lengthM > 1000) throw new Error('Unsupported footpath segment');
chain.segments.push({ a, b, first: j === 1, last: j === points.length - 1,
code: section.code, startM: chain.lengthM, lengthM });
chain.lengthM += lengthM;
}
last = points.at(-1);
}
}
return chains;
}
function locate(point, chains, maths) {
if (!valid(point)) return unavailable('invalid-point');
const hits = [];
for (const chain of chains) {
for (const seg of chain.segments) {
const hit = maths.distanceToSegmentKm(...point, ...seg.a, ...seg.b);
const offsetM = hit.km * 1000;
if (offsetM <= SNAP_M) {
let junction = null;
if (seg.first && hit.t === 0) junction = seg.a;
if (seg.last && hit.t === 1) junction = seg.b;
hits.push({ chain, offsetM, point: junction ?? hit.foot, junction, atM: seg.startM + hit.t * seg.lengthM });
}
}
}
hits.sort((a, b) => a.offsetM - b.offsetM);
const best = hits[0];
if (!best) return unavailable('outside-coverage');
const positions = new Map();
for (const h of hits) {
if (h.offsetM > best.offsetM + 1) break;
const prior = positions.get(h.chain);
if (prior && Math.abs(h.atM - prior.atM) > 3) return unavailable('ambiguous-tap');
if (!prior) positions.set(h.chain, h);
}
// A tap on a shared section endpoint can belong to either recorded path.
// Intersecting or closely parallel shapes elsewhere provide no junction evidence.
if (positions.size > 1 && [...positions.values()].some(h =>
!best.junction || !h.junction || !same(h.junction, best.junction))) return unavailable('ambiguous-tap');
return { positions };
}
// The caller supplies the pinned Ventus distanceKm/distanceToSegmentKm functions.
// Pins select positions on the mapped line. The measured GPS fix stays independent.
export function createBristolFootpathRouter(collection, maths) {
return createMappedFootpathRouter(readSections(collection), maths, COUNCIL_LAYER);
}
// A source-specific reader must have verified foot access, chain membership
// and section order before passing its mapped sections to the shared clipper.
export function createMappedFootpathRouter(sections, maths, source) {
const chains = chainsFor(sections, maths);
return function route(from, to, excludedSections = []) {
if (!Array.isArray(excludedSections) || !excludedSections.every(x => typeof x === 'string')) {
return unavailable('invalid-closures');
}
const blocked = new Set(excludedSections);
const fromHits = locate(from, chains, maths);
if (fromHits.status) return fromHits;
const toHits = locate(to, chains, maths);
if (toHits.status) return toHits;
const shared = [...fromHits.positions.keys()].filter(chain => toHits.positions.has(chain));
if (!shared.length) return unavailable('no-mapped-connection');
if (shared.length > 1) return unavailable('ambiguous-tap');
const start = fromHits.positions.get(shared[0]), finish = toHits.positions.get(shared[0]);
const reverse = finish.atM < start.atM;
const [lo, hi] = reverse ? [finish, start] : [start, finish];
if (hi.atM - lo.atM < 0.01) return unavailable('same-position');
const coordinates = [[...lo.point]];
const sectionCodes = [];
for (const seg of lo.chain.segments) {
const endM = seg.startM + seg.lengthM;
if (endM <= lo.atM || seg.startM >= hi.atM) continue;
if (blocked.has(seg.code)) return unavailable('excluded-section');
if (sectionCodes.at(-1) !== seg.code) sectionCodes.push(seg.code);
if (endM < hi.atM) coordinates.push([...seg.b]);
}
coordinates.push([...hi.point]);
if (reverse) {
coordinates.reverse();
sectionCodes.reverse();
}
return {
status: 'mapped',
route: start.chain.route,
sectionCodes,
geometry: { type: 'LineString', coordinates },
distanceM: hi.atM - lo.atM,
fromOffsetM: start.offsetM,
toOffsetM: finish.offsetM,
currentAccess: 'unverified',
source,
};
};
}Public Map Browser
A Python command-line tool in the council folder of GridAtlas covering bristol footpaths. It is built from the check step (`check`).
rendergridatlas / tools/satnav/walk/council/public-map-browser.py · lines 1–71 of 71 · Entry point
- What it does
- Defines check. Uses libraries functools, json, os, 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
- Check the normal phone map and its automatic Bristol routing in both engines.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- gridatlas · tools/satnav/walk/council · Python CLI
- Uses
- functools, json, os, threading, http.server, pathlib, runpy, urllib.parse
- 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/council/public-map-browser.py:1-71 · blob 0704e6ba17186b2970841a0b54d738b41d2b98a7 · 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
"""Check the normal phone map and its automatic Bristol routing in both engines."""
import functools
import json
import os
import threading
from http.server import ThreadingHTTPServer
from pathlib import Path
from runpy import run_path
from urllib.parse import urlsplit
from playwright.sync_api import expect, sync_playwright
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[3]
gate = run_path(str(HERE.parent / 'gate/browser.py'))
tap_endpoint = run_path(str(ROOT / 'tools/satnav/pedestrian-pilot/bristol-browser.py'))['tap_endpoint']
ENTRY = '/atlas/v/satnav-road-to-field-202611281640/'
def check(browser, url, width, height):
with browser.new_context(viewport={'width': width, 'height': height}, is_mobile=True, has_touch=True) as ctx:
ctx.route('**/*', functools.partial(gate['network'], host=urlsplit(url).hostname, broken_road=False))
page = ctx.new_page()
requests = []
page.on('request', lambda request: requests.append(urlsplit(request.url).path))
page.goto(url, wait_until='commit')
page.wait_for_function("document.querySelector('#satnav-layout') && document.querySelector('#satnav-walk-mode') && document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-sat')", timeout=60000)
expect(page.locator('#satnav-bristol')).to_have_count(0)
mode = page.locator('#satnav-walk-mode')
expect(mode).to_have_value('direct')
paths = json.loads((HERE / 'bristol-footpaths.geojson').read_bytes())['features']
lines = {f['properties']['ROUTE_CODE']: f['geometry']['coordinates'] for f in paths}
tap_endpoint(page, 'from', lines['BCC/21/10'][0])
tap_endpoint(page, 'to', lines['BCC/21/30'][-1])
mode.select_option('walking')
guide = page.locator('#satnav-walk-guidance')
expect(guide).to_contain_text('Walking route ready', timeout=15000)
source = page.locator('#satnav-walk-source')
source.locator('summary').tap()
expect(source).to_contain_text('Bristol City Council')
source.locator('summary').tap()
tap_endpoint(page, 'to', [-0.1276, 51.5072])
expect(guide).to_contain_text('Walking route unavailable here')
expect(source).to_be_hidden()
expect(page.locator('#satnav-bristol')).to_have_count(0)
assert not any(path.endswith('/pedestrian-pilot/bristol.mjs') for path in requests)
assert any(path.endswith('/walk/council/bristol-footpaths.geojson') for path in requests)
print(f'{browser.browser_type.name} {width}×{height}: public map, Bristol routing, attribution and coverage passed', flush=True)
if __name__ == '__main__':
server = ThreadingHTTPServer(('127.0.0.1', 0), functools.partial(gate['QuietHandler'], directory=ROOT))
threading.Thread(target=server.serve_forever, daemon=True).start()
try:
url = os.environ.get('SATNAV_TEST_URL', f'http://127.0.0.1:{server.server_port}{ENTRY}')
with sync_playwright() as pw:
for engine in os.environ.get('LINE_TEST_BROWSERS', 'chromium,webkit').split(','):
options = {}
if engine == 'chromium':
options['args'] = ['--use-gl=angle', '--use-angle=swiftshader', '--enable-webgl', '--enable-unsafe-swiftshader']
if os.environ.get('CHROMIUM_PATH'):
options['executable_path'] = os.environ['CHROMIUM_PATH']
with getattr(pw, engine).launch(**options) as browser:
for size in ((390, 664), (664, 390)):
check(browser, url, *size)
finally:
server.shutdown()
server.server_close()