In this section
- SatNav Orient16 Responsive Browser render · gridatlas / tools/satnav/orient16-responsive-browser.py lines 1–185
- SatNav Orient17 Regional Browser render · gridatlas / tools/satnav/orient17-regional-browser.py lines 1–72
- SatNav Orient17a Browser render · gridatlas / tools/satnav/orient17a-browser.py lines 1–57
- SatNav Orient17a V9211 Browser render · gridatlas / tools/satnav/orient17a-v9211-browser.py lines 1–99
- SatNav Orient17a V9212 Browser render · gridatlas / tools/satnav/orient17a-v9212-browser.py lines 1–99
- SatNav Orient17a V9214 Browser render · gridatlas / tools/satnav/orient17a-v9214-browser.py lines 1–101
SatNav Orient16 Responsive Browser
A Python module in the tools folder of GridAtlas.
rendergridatlas / tools/satnav/orient16-responsive-browser.py · lines 1–185 of 185 · Not reached from any entry point (candidate for review)
- What it does
- Uses libraries os, json, 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.
- What it achieves
- ORIENT-14: real numbered GridAtlas composition; only the GPS boundary is simulated.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · tools/satnav · Python module
- Uses
- os, json, pathlib, runpy, playwright.sync_api
- Used by
- none found
- Produces
- none declared
- 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/orient16-responsive-browser.py:1-185 · blob 31ad863a14365e66a7c24885eb9a238750293c79 · 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: unreached_review
"""ORIENT-14: real numbered GridAtlas composition; only the GPS boundary is simulated."""
import os
import json
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect, sync_playwright
helpers=run_path(str(Path(__file__).with_name('compact-browser.py')))
gps=helpers['GPS_SPY']
map_canvas_tap=helpers['map_canvas_tap']
surface_distance=helpers['surface_distance']
site='http://127.0.0.1:8873/atlas/v/202612031346/'
with sync_playwright() as p:
engine=os.environ['ORIENT_BROWSER']
browser=getattr(p,engine).launch()
for width,height,mobile in [(390,844,True),(844,390,True),(1280,800,False),(1366,768,False),(1920,1080,False)]:
with browser.new_context(viewport={'width':width,'height':height},is_mobile=mobile,has_touch=True) as ctx:
ctx.add_init_script(gps)
page=ctx.new_page()
page.goto(site,wait_until='domcontentloaded',timeout=90000)
page.wait_for_function("""() => document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-sat') && document.querySelector('#satnav-walk-mode')""",timeout=120000)
panel=page.locator('#satnav-compact')
if not panel.is_visible():
page.locator('#satnav-toggle').tap()
expect(panel).to_be_visible()
page.evaluate("window.__GRIDATLAS_V9_MAP__.jumpTo({center: [-1.5, 51.5], zoom: 16})")
page.locator('#satnav-to').tap()
tap=map_canvas_tap(page)
actual=page.evaluate("document.querySelector('#satnav-compact').satnavSurvey.getEndpoints()[1]")
assert surface_distance(tap['coordinates'],actual)<2,(tap,actual)
page.evaluate("""() => document.querySelector('#satnav-compact').satnavSurvey.replacePlan([[-0.4,51.55],[-0.4,51.65]])""")
endpoint="document.querySelector('#satnav-compact').satnavSurvey.getEndpoints()"
initial=page.evaluate(endpoint)
assert initial==[[-0.4,51.55],[-0.4,51.65]],initial
mode=page.locator('#satnav-walk-mode')
objective=page.locator('#satnav-route-objective')
start=page.locator('#satnav-walk-start')
guidance=page.locator('#satnav-walk-guidance')
expect(mode).to_have_value('walking')
panel_width=panel.bounding_box()['width']
if width==844: assert panel_width<=174,panel_width
if width==1920: assert 280<=panel_width<=290,panel_width
animation=lambda: mode.evaluate("(el)=>getComputedStyle(el).animationName")
assert animation()=='orient16-walking',animation()
mode.select_option('driving')
assert animation()=='orient16-driving',animation()
mode.select_option('direct')
assert animation()=='orient16-manual',animation()
page.emulate_media(reduced_motion='reduce')
assert animation()=='none',animation()
page.emulate_media(reduced_motion='no-preference')
mode.select_option('walking')
expect(start).to_be_disabled()
expect(guidance).to_contain_text('Shortest walking route unavailable')
assert page.evaluate('window.__lineGpsTest.records.starts')==[]
mode.select_option('driving')
expect(objective).to_be_visible()
expect(start).to_be_disabled()
expect(guidance).to_contain_text('Shortest driving route unavailable')
objective.select_option('fastest')
expect(guidance).to_contain_text('Estimated fastest route unavailable')
assert page.evaluate(endpoint)==initial
mode.select_option('direct')
expect(start).to_be_enabled()
start.tap()
page.evaluate("window.__lineGpsTest.emit([-0.4,51.551],4)")
expect(guidance).to_contain_text('straight-line guidance')
expect(guidance).to_contain_text('straight to destination')
# No directional bearing within GPS uncertainty; do not imply arrival.
page.evaluate("window.__lineGpsTest.emit([-0.4,51.64999],4)")
expect(guidance).to_contain_text('straight to destination')
expect(guidance).not_to_contain_text('° true')
page.wait_for_timeout(20)
page.evaluate("window.__lineGpsTest.emit([-0.4,51.551],4)")
expect(guidance).to_contain_text('° true')
# Deterministically emulate document suspension and resume, not physical OS suspension.
page.evaluate("Object.defineProperty(document,'hidden',{configurable:true,value:true});document.dispatchEvent(new Event('visibilitychange'))")
expect(guidance).to_contain_text('Guidance suspended')
expect(guidance).not_to_contain_text('° true')
page.evaluate("Object.defineProperty(document,'hidden',{configurable:true,value:false});document.dispatchEvent(new Event('visibilitychange'))")
expect(guidance).to_contain_text('Waiting for a fresh GPS fix')
page.wait_for_timeout(20)
page.evaluate("window.__lineGpsTest.emit([-0.4,51.552],4)")
expect(guidance).to_contain_text('° true')
# Panel collapse/reopen must not change destination or acquire a second GPS watch.
for _ in range(3):
page.locator('#satnav-toggle').tap()
expect(panel).to_be_hidden()
assert page.evaluate(endpoint)==initial
page.locator('#satnav-toggle').tap()
expect(panel).to_be_visible()
expect(page.get_by_role('combobox',name='Guidance mode')).to_be_visible()
expect(guidance).to_have_attribute('role','status')
expect(page.get_by_role('button',name='Stop guidance')).to_be_visible()
assert mode.bounding_box()['height']>=44
assert page.evaluate('window.__lineGpsTest.records.starts')==[1]
page.wait_for_timeout(11000)
expect(guidance).to_contain_text('Waiting for a fresh GPS fix')
page.evaluate("window.__lineGpsTest.emit([-0.4,51.552],4)")
expect(guidance).to_contain_text('straight to destination')
assert page.evaluate('window.__lineGpsTest.records.starts')==[1]
for k in range(10):
mode.select_option('walking' if k%2==0 else 'driving')
expect(start).to_be_disabled()
assert page.evaluate(endpoint)==initial
assert page.evaluate('window.__lineGpsTest.records')=={'starts':[1],'stops':[]}
mode.select_option('direct')
start.tap()
assert page.evaluate('window.__lineGpsTest.records.starts')==[1]
# Real pointer and keyboard acceptance, not synthetic MapLibre events.
api="document.querySelector('#satnav-compact').satnavSurvey"
map_js="window.__GRIDATLAS_V9_MAP__"
layer_state="""() => [...document.querySelectorAll('#scada-ui-container input[data-layer-id]')].map(x=>[x.dataset.layerId,x.checked]).sort()"""
saved_layers=page.evaluate(layer_state)
toggle=page.locator('#satnav-toggle')
toggle.focus()
toggle.press('Enter')
expect(panel).to_be_hidden()
expect(toggle).to_have_attribute('aria-expanded','false')
assert page.evaluate(endpoint)==initial
layers=page.locator('#gridatlas-dash-toggle')
dash_state="""()=>({full:!!(document.fullscreenElement||document.webkitFullscreenElement||document.body.classList.contains('fs-active')||document.getElementById('map-container')?.classList.contains('is-fullscreen')),curtain:document.getElementById('fs-curtain')?.classList.contains('curtain-open'),collapsed:window.__GRIDATLAS_DASH__?.collapsed})"""
before=page.evaluate(dash_state)
state_key='curtain' if before['full'] else 'collapsed'
assert isinstance(before[state_key],bool),before
layers.click()
page.wait_for_function("(arg)=>("+dash_state+")()[arg.key]!==arg.value",arg={'key':state_key,'value':before[state_key]})
layers.click()
page.wait_for_function("(arg)=>("+dash_state+")()[arg.key]===arg.value",arg={'key':state_key,'value':before[state_key]})
assert page.evaluate(layer_state)==saved_layers
# Reopen by keyboard; location is the existing sole camera controller.
toggle.focus()
toggle.press('Enter')
expect(panel).to_be_visible()
expect(toggle).to_have_attribute('aria-expanded','true')
location=page.locator('#satnav-location')
location.click()
page.wait_for_timeout(30)
page.evaluate("window.__lineGpsTest.emit([-0.4,51.553],4)")
page.wait_for_function("()=>"+api+".isFollowing()")
zoom=page.evaluate(map_js+".getZoom()")
toggle.click()
expect(panel).to_be_hidden()
# Choose a completely exposed horizontal segment of the map canvas.
segment=page.wait_for_function("""()=>{const m=window.__GRIDATLAS_V9_MAP__;if(m.isMoving())return null;const c=m.getCanvas(),r=c.getBoundingClientRect();
for(const fy of [.72,.62,.52,.42])for(const fx of [.24,.44,.64]){
const x=Math.round(r.left+r.width*fx),y=Math.round(r.top+r.height*fy);
if([0,15,30,45,60].every(d=>document.elementFromPoint(x+d,y)===c))return {x,y};}
return null;}""",timeout=15000).json_value()
page.mouse.move(segment['x'],segment['y'])
page.mouse.down()
page.mouse.move(segment['x']+60,segment['y'],steps=12)
page.mouse.up()
page.wait_for_function("()=>!"+api+".isFollowing() && !"+map_js+".isMoving()",timeout=15000)
paused=page.evaluate(map_js+".getCenter().toArray()")
page.wait_for_timeout(30)
page.evaluate("window.__lineGpsTest.emit([-0.4,51.554],4)")
assert surface_distance(paused,page.evaluate(map_js+".getCenter().toArray()"))<2
assert abs(page.evaluate(map_js+".getZoom()")-zoom)<0.01
toggle.click()
expect(location).to_contain_text('Resume follow')
location.click()
page.wait_for_function("()=>"+api+".isFollowing()")
page.wait_for_timeout(30)
page.evaluate("window.__lineGpsTest.emit([-0.4,51.555],4)")
page.wait_for_function("()=>Math.abs("+map_js+".getCenter().lat-51.555)<0.00001")
assert abs(page.evaluate(map_js+".getZoom()")-zoom)<0.01
assert page.evaluate(endpoint)==initial
assert page.evaluate(layer_state)==saved_layers
assert page.evaluate('window.__lineGpsTest.records.starts')==[1]
# Measure actual unobstructed hit area, not only canvas CSS dimensions.
toggle.click()
expect(panel).to_be_hidden()
usable=page.evaluate("""()=>{const c=window.__GRIDATLAS_V9_MAP__.getCanvas();let hit=0,total=0;
for(let y=10;y<innerHeight;y+=20)for(let x=10;x<innerWidth;x+=20){total++;if(document.elementFromPoint(x,y)===c)hit++;}
return {hit,total,ratio:hit/total};}""")
print('ORIENT16_INTERACTION',json.dumps({'engine':engine,'width':width,'height':height,'map_hit_area':usable,'zoom':zoom,'destination_preserved':True,'follow_resumed':True}),flush=True)
assert usable['ratio']>0.5,usable
toggle.click()
expect(panel).to_be_visible()
page.locator('#satnav-walk-stop').tap()
assert page.evaluate('window.__lineGpsTest.records')=={'starts':[1],'stops':[1]}
assert page.evaluate(endpoint)==initial
print(f'PASS {engine} {width}x{height}: composed three-mode UI, shared plan, unavailable states, one GPS watch and stop')
browser.close()SatNav Orient17 Regional Browser
A Python module in the tools folder of GridAtlas that routes fixture (`route_fixture`). It is built from the encode step (`encode`).
rendergridatlas / tools/satnav/orient17-regional-browser.py · lines 1–72 of 72 · Not reached from any entry point (candidate for review) · pattern encode (shared by 21 files)
- What it does
- Defines encode, route_fixture. Uses libraries os, json, 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.
- What it achieves
- ORIENT-17.2 composed browser fixture, explicitly synthetic transport, not actual routing.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · tools/satnav · Python module
- Uses
- os, json, pathlib, runpy, playwright.sync_api
- Used by
- none found
- Produces
- encode
- Defines here
- encode, route_fixture
- 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/orient17-regional-browser.py:1-72 · blob 4e40e9e2a34ee9a989d60b073d6d95cdeb4a3a1e · 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: unreached_review
"""ORIENT-17.2 composed browser fixture, explicitly synthetic transport, not actual routing."""
import os, json
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect, sync_playwright
gps=run_path(str(Path(__file__).with_name('compact-browser.py')))['GPS_SPY']
site='http://127.0.0.1:8873/atlas/v/202612031704/'
graph='a'*64
start=[-.12,51.5]
target=[-.119,51.501]
def encode(points):
prev=[0,0];out=[]
for x,y in points:
nxt=[round(y*1e6),round(x*1e6)]
for d in (nxt[0]-prev[0],nxt[1]-prev[1]):
n=-2*d-1 if d<0 else 2*d
while n>=32:
out.append(chr((n%32+32)+63));n//=32
out.append(chr(n+63))
prev=nxt
return ''.join(out)
with sync_playwright() as p:
browser=getattr(p,os.environ['ORIENT_BROWSER']).launch()
for width,height in [(390,844),(1366,768)]:
for configured in (False,True):
with browser.new_context(viewport={'width':width,'height':height},has_touch=True) as ctx:
ctx.add_init_script(gps)
calls=[]
if configured:
ctx.route('**/tools/satnav/regional/regional-config.mjs',lambda route:route.fulfill(content_type='text/javascript',body="export const regionalConfig={endpoint:'/satnav-routing/route',graphRevision:'"+graph+"'};"))
def route_fixture(route):
payload=route.request.post_data_json
calls.append(payload)
a,b=[[v['lon'],v['lat']] for v in payload['locations']]
route.fulfill(content_type='application/json',headers={'X-GridAtlas-Graph-Revision':graph},body=json.dumps({'trip':{'status':0,'summary':{'length':.15},'legs':[{'shape':encode([a,b]),'maneuvers':[]}]}}))
ctx.route('**/satnav-routing/route',route_fixture)
page=ctx.new_page()
page.goto(site,wait_until='domcontentloaded',timeout=90000)
page.wait_for_function("()=>document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-sat')&&document.querySelector('#satnav-walk-mode')",timeout=120000)
panel=page.locator('#satnav-compact')
if not panel.is_visible(): page.locator('#satnav-toggle').tap()
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,target])
endpoint="document.querySelector('#satnav-compact').satnavSurvey.getEndpoints()"
initial=page.evaluate(endpoint)
mode=page.locator('#satnav-walk-mode')
button=page.locator('#satnav-walk-start')
guide=page.locator('#satnav-walk-guidance')
if not configured:
expect(button).to_be_disabled()
expect(guide).to_contain_text('no verified regional service')
assert not calls
else:
expect(button).to_be_enabled()
button.tap()
page.evaluate("p=>window.__lineGpsTest.emit(p,4)",start)
expect(guide).to_contain_text('remaining',timeout=12000)
assert calls[-1]['costing']=='pedestrian'
assert page.evaluate(endpoint)==initial
mode.select_option('driving')
expect(button).to_be_enabled()
page.locator('#satnav-route-objective').select_option('fastest')
button.tap()
page.evaluate("p=>window.__lineGpsTest.emit(p,4)",start)
expect(guide).to_contain_text('remaining',timeout=12000)
assert calls[-1]['costing']=='auto'
assert page.evaluate(endpoint)==initial
assert page.evaluate('window.__lineGpsTest.records.starts')==[1]
page.locator('#satnav-walk-stop').tap()
assert page.evaluate('window.__lineGpsTest.records.stops')==[1]
assert page.evaluate(endpoint)==initial
print('ORIENT17_SYNTHETIC_BROWSER_PASS',os.environ['ORIENT_BROWSER'],width,height,configured,flush=True)
browser.close()SatNav Orient17a Browser
A Python module in the tools folder of GridAtlas.
rendergridatlas / tools/satnav/orient17a-browser.py · lines 1–57 of 57 · Not reached from any entry point (candidate for review)
- What it does
- 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.
- What it achieves
- ORIENT17A partial composed checkpoint. WMM missing: must fail closed, not fake true heading.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · tools/satnav · Python module
- Uses
- os, pathlib, runpy, playwright.sync_api
- Used by
- none found
- Produces
- none declared
- 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/orient17a-browser.py:1-57 · blob 07159b4a9d459db6be203bc154d370b61f8518d8 · 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: unreached_review
"""ORIENT17A partial composed checkpoint. WMM missing: must fail closed, not fake true heading."""
import os
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect,sync_playwright
gps=run_path(str(Path(__file__).with_name('compact-browser.py')))['GPS_SPY']
start=[-.12,51.5]
target=[-.12,51.501]
site='http://127.0.0.1:8873/atlas/v/202612032137/'
with sync_playwright() as p:
browser=getattr(p,os.environ['ORIENT_BROWSER']).launch()
for width,height in [(390,844),(844,390),(1366,768),(1920,1080)]:
with browser.new_context(viewport={'width':width,'height':height},has_touch=True) as ctx:
ctx.add_init_script(gps)
ctx.add_init_script("""Object.defineProperty(window,'DeviceOrientationEvent',{configurable:true,value:class extends Event{static async requestPermission(){return 'granted';}}});""")
page=ctx.new_page()
page.goto(site,wait_until='domcontentloaded',timeout=90000)
page.wait_for_function("()=>document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-sat')&&document.querySelector('#satnav-walk-mode')&&document.querySelector('#field-compass-toggle')",timeout=120000)
if not page.locator('#satnav-compact').is_visible(): page.locator('#satnav-toggle').tap()
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,target])
mode=page.locator('#satnav-walk-mode')
button=page.locator('#satnav-walk-start')
for val in ('walking','driving','mapped'):
mode.select_option(val)
expect(button).to_be_disabled()
mode.select_option('direct')
button.tap()
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
card=page.locator('#orient17a-direction')
arrow=page.locator('#orient17a-arrow')
expect(card).to_be_visible()
expect(card).to_contain_text('Direction uncertain')
expect(card).to_contain_text('straight line')
expect(arrow).to_be_hidden()
page.locator('#field-compass-toggle').tap()
page.evaluate("""()=>{const e=new Event('deviceorientation');Object.defineProperties(e,{webkitCompassHeading:{value:90},webkitCompassAccuracy:{value:3},beta:{value:0},gamma:{value:0}});window.dispatchEvent(e);}""")
expect(arrow).to_be_hidden()
expect(card).to_contain_text('Direction uncertain')
guide=page.locator('#satnav-walk-guidance')
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).to_contain_text('Near last pin')
assert page.evaluate("window.__lineGpsTest.records.starts")==[1]
page.locator('#satnav-toggle').tap()
expect(card).to_be_visible()
page.locator('#satnav-toggle').tap()
page.locator('#satnav-walk-stop').tap()
expect(card).to_be_hidden()
assert page.evaluate("window.__lineGpsTest.records.stops")==[1]
page.screenshot(path=f"orient17a-{os.environ['ORIENT_BROWSER']}-{width}x{height}.png")
print('ORIENT17A partial composed checkpoint PASS',os.environ['ORIENT_BROWSER'],width,height,flush=True)
browser.close()SatNav Orient17a V9211 Browser
A Python module in the tools folder of GridAtlas that emits heading (`emit_heading`).
rendergridatlas / tools/satnav/orient17a-v9211-browser.py · lines 1–99 of 99 · Not reached from any entry point (candidate for review) · pattern emit_heading (shared by 5 files)
- What it does
- Defines emit_heading. 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.
- What it achieves
- V9.211 composed application acceptance: simulated acquisition, not device evidence.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · tools/satnav · Python module
- Uses
- os, pathlib, runpy, playwright.sync_api
- Used by
- none found
- Produces
- none declared
- Defines here
- emit_heading
- 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/orient17a-v9211-browser.py:1-99 · blob 19657fa9d4bf3081df39e8b2a20caea957057614 · 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: unreached_review
"""V9.211 composed application acceptance: simulated acquisition, not device evidence."""
import os
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect,sync_playwright
gps=run_path(str(Path(__file__).with_name('compact-browser.py')))['GPS_SPY']
start=[-.12,51.5]
target=[-.12,51.501]
site='http://127.0.0.1:8873/atlas/v/202612040045/'
with sync_playwright() as p:
browser=getattr(p,os.environ['ORIENT_BROWSER']).launch()
for width,height in [(390,844),(844,390),(1366,768),(1920,1080)]:
with browser.new_context(viewport={'width':width,'height':height},has_touch=True) as ctx:
ctx.add_init_script(gps)
ctx.add_init_script("""Object.defineProperty(window,'DeviceOrientationEvent',{configurable:true,value:class extends Event{static async requestPermission(){return 'granted';}}});""")
page=ctx.new_page()
page.goto(site,wait_until='domcontentloaded',timeout=90000)
page.wait_for_function("()=>document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-sat')&&document.querySelector('#satnav-walk-mode')&&document.querySelector('#field-compass-toggle')",timeout=120000)
if not page.locator('#satnav-compact').is_visible(): page.locator('#satnav-toggle').tap()
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,target])
mode=page.locator('#satnav-walk-mode')
button=page.locator('#satnav-walk-start')
for val in ('walking','driving','mapped'):
mode.select_option(val)
expect(button).to_be_disabled()
mode.select_option('direct')
button.tap()
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
card=page.locator('#orient17a-direction')
arrow=page.locator('#orient17a-arrow')
expect(card).to_be_visible()
expect(card).to_contain_text('Direction uncertain')
expect(card).to_contain_text('straight line')
expect(arrow).to_be_hidden()
page.locator('#field-compass-toggle').tap()
page.evaluate("""()=>{const e=new Event('deviceorientation');Object.defineProperties(e,{webkitCompassHeading:{value:90},webkitCompassAccuracy:{value:3},beta:{value:0},gamma:{value:0}});window.dispatchEvent(e);}""")
expect(arrow).to_be_visible()
def emit_heading(heading, accuracy=3, beta=0):
page.evaluate("""args=>{const e=new Event('deviceorientation');Object.defineProperties(e,{webkitCompassHeading:{value:args[0]},webkitCompassAccuracy:{value:args[1]},beta:{value:args[2]},gamma:{value:0}});window.dispatchEvent(e);}""",[heading,accuracy,beta])
for heading in (0,45,90,135,180,225,270,315):
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
emit_heading(heading,-1)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
emit_heading(heading)
expect(arrow).to_be_visible()
actual=page.evaluate("""()=>Number(document.querySelector('#orient17a-arrow').style.transform.match(/rotate\(([-.\d]+)deg\)/)[1])""")
assert abs((actual+heading+180)%360-180)<5,(heading,actual)
emit_heading(0,3,100)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
emit_heading(0)
expect(arrow).to_be_visible()
# Map rotation is not handset rotation.
before=arrow.get_attribute('style')
page.evaluate("()=>document.querySelector('#satnav-compact').satnavSurvey.getMap().jumpTo({bearing:90})")
expect(arrow).to_be_visible()
assert arrow.get_attribute('style')==before
page.evaluate("()=>document.querySelector('#satnav-compact').satnavSurvey.getMap().jumpTo({bearing:0})")
page.evaluate("p=>window.__lineGpsTest.emit(p,75)",start)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
emit_heading(0)
expect(arrow).to_be_visible()
page.wait_for_timeout(3200)
expect(arrow).to_be_hidden()
guide=page.locator('#satnav-walk-guidance')
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).to_contain_text('Near last pin')
# A visited intermediate pin survives a simulated page visibility suspension.
mid=[-.12,51.5005]
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,mid,target])
page.wait_for_timeout(40)
for i in range(3):
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",mid)
if i<2: page.wait_for_timeout(1100)
expect(guide).to_contain_text('Waypoint 2 of 2')
page.evaluate("""()=>{Object.defineProperty(document,'hidden',{configurable:true,value:true});document.dispatchEvent(new Event('visibilitychange'));}""")
page.evaluate("""()=>{delete document.hidden;document.dispatchEvent(new Event('visibilitychange'));}""")
page.wait_for_timeout(40)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",mid)
expect(guide).to_contain_text('Waypoint 2 of 2')
assert page.evaluate("window.__lineGpsTest.records.starts")==[1]
page.locator('#satnav-toggle').tap()
expect(card).to_be_visible()
page.locator('#satnav-toggle').tap()
page.locator('#satnav-walk-stop').tap()
expect(card).to_be_hidden()
assert page.evaluate("window.__lineGpsTest.records.stops")==[1]
page.screenshot(path=f"orient17a-{os.environ['ORIENT_BROWSER']}-{width}x{height}.png")
print('V9.211 composed acquisition checkpoint PASS',os.environ['ORIENT_BROWSER'],width,height,flush=True)
browser.close()SatNav Orient17a V9212 Browser
A Python module in the tools folder of GridAtlas that emits heading (`emit_heading`).
Set aside from the main view: 90% of its lines are the same as tools/satnav/orient17a-v9214-browser.py (gridatlas), which stays. (near-copy-of, proposed by families.py). 90% of lines shared with SatNav Orient17a V9214 Browser; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9012 to gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/satnav/orient17a-v9214-browser.py:1-101 4c359a784a44a8fa0de3c2cf75dbd808f01cb1e3
- sha256 bde425dfff8c4de6ef29d2bff5b0fc409086f3ca5c6dee857889c6e74fc1676f
- target sha256 99746d672b23397cd13578d505fc11acded9d4334a9d2f90b6685bb947c14211
- group of 2 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
rendergridatlas / tools/satnav/orient17a-v9212-browser.py · lines 1–99 of 99 · Not reached from any entry point (candidate for review) · pattern emit_heading (shared by 5 files)
- What it does
- Defines emit_heading. 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.
- What it achieves
- V9.212 composed application acceptance: simulated acquisition, not device evidence.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · tools/satnav · Python module
- Uses
- os, pathlib, runpy, playwright.sync_api
- Used by
- none found
- Produces
- none declared
- Defines here
- emit_heading
- 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/orient17a-v9212-browser.py:1-99 · blob e839022a75a28b69264a87aa2094b1840354b7e3 · 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: unreached_review
"""V9.212 composed application acceptance: simulated acquisition, not device evidence."""
import os
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect,sync_playwright
gps=run_path(str(Path(__file__).with_name('compact-browser.py')))['GPS_SPY']
start=[-.12,51.5]
target=[-.12,51.501]
site='http://127.0.0.1:8873/atlas/v/202612040055/'
with sync_playwright() as p:
browser=getattr(p,os.environ['ORIENT_BROWSER']).launch()
for width,height in [(390,844),(844,390),(1366,768),(1920,1080)]:
with browser.new_context(viewport={'width':width,'height':height},has_touch=True) as ctx:
ctx.add_init_script(gps)
ctx.add_init_script("""Object.defineProperty(window,'DeviceOrientationEvent',{configurable:true,value:class extends Event{static async requestPermission(){return 'granted';}}});""")
page=ctx.new_page()
page.goto(site,wait_until='domcontentloaded',timeout=90000)
page.wait_for_function("()=>document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-sat')&&document.querySelector('#satnav-walk-mode')&&document.querySelector('#field-compass-toggle')",timeout=120000)
if not page.locator('#satnav-compact').is_visible(): page.locator('#satnav-toggle').tap()
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,target])
mode=page.locator('#satnav-walk-mode')
button=page.locator('#satnav-walk-start')
for val in ('walking','driving','mapped'):
mode.select_option(val)
expect(button).to_be_disabled()
mode.select_option('direct')
button.tap()
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
card=page.locator('#orient17a-direction')
arrow=page.locator('#orient17a-arrow')
expect(card).to_be_visible()
expect(card).to_contain_text('Direction uncertain')
expect(card).to_contain_text('straight line')
expect(arrow).to_be_hidden()
page.locator('#field-compass-toggle').tap()
page.evaluate("""()=>{const e=new Event('deviceorientation');Object.defineProperties(e,{webkitCompassHeading:{value:90},webkitCompassAccuracy:{value:3},beta:{value:0},gamma:{value:0}});window.dispatchEvent(e);}""")
expect(arrow).to_be_visible()
def emit_heading(heading, accuracy=3, beta=0):
page.evaluate("""args=>{const e=new Event('deviceorientation');Object.defineProperties(e,{webkitCompassHeading:{value:args[0]},webkitCompassAccuracy:{value:args[1]},beta:{value:args[2]},gamma:{value:0}});window.dispatchEvent(e);}""",[heading,accuracy,beta])
for heading in (0,45,90,135,180,225,270,315):
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
emit_heading(heading,0)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
emit_heading(heading)
expect(arrow).to_be_visible()
actual=page.evaluate("""()=>Number(document.querySelector('#orient17a-arrow').style.transform.match(/rotate\(([-.\d]+)deg\)/)[1])""")
assert abs((actual+heading+180)%360-180)<5,(heading,actual)
emit_heading(0,3,100)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
emit_heading(0)
expect(arrow).to_be_visible()
# Map rotation is not handset rotation.
before=arrow.get_attribute('style')
page.evaluate("()=>document.querySelector('#satnav-compact').satnavSurvey.getMap().jumpTo({bearing:90})")
expect(arrow).to_be_visible()
assert arrow.get_attribute('style')==before
page.evaluate("()=>document.querySelector('#satnav-compact').satnavSurvey.getMap().jumpTo({bearing:0})")
page.evaluate("p=>window.__lineGpsTest.emit(p,75)",start)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
emit_heading(0)
expect(arrow).to_be_visible()
page.wait_for_timeout(3200)
expect(arrow).to_be_hidden()
guide=page.locator('#satnav-walk-guidance')
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).to_contain_text('Near last pin')
# A visited intermediate pin survives a simulated page visibility suspension.
mid=[-.12,51.5005]
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,mid,target])
page.wait_for_timeout(40)
for i in range(3):
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",mid)
if i<2: page.wait_for_timeout(1100)
expect(guide).to_contain_text('Waypoint 2 of 2')
page.evaluate("""()=>{Object.defineProperty(document,'hidden',{configurable:true,value:true});document.dispatchEvent(new Event('visibilitychange'));}""")
page.evaluate("""()=>{delete document.hidden;document.dispatchEvent(new Event('visibilitychange'));}""")
page.wait_for_timeout(40)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",mid)
expect(guide).to_contain_text('Waypoint 2 of 2')
assert page.evaluate("window.__lineGpsTest.records.starts")==[1]
page.locator('#satnav-toggle').tap()
expect(card).to_be_visible()
page.locator('#satnav-toggle').tap()
page.locator('#satnav-walk-stop').tap()
expect(card).to_be_hidden()
assert page.evaluate("window.__lineGpsTest.records.stops")==[1]
page.screenshot(path=f"orient17a-v9212-{os.environ['ORIENT_BROWSER']}-{width}x{height}.png")
print('V9.212 composed acquisition checkpoint PASS',os.environ['ORIENT_BROWSER'],width,height,flush=True)
browser.close()SatNav Orient17a V9214 Browser
A Python module in the tools folder of GridAtlas that emits heading (`emit_heading`).
rendergridatlas / tools/satnav/orient17a-v9214-browser.py · lines 1–101 of 101 · Not reached from any entry point (candidate for review) · pattern emit_heading (shared by 5 files)
- What it does
- Defines emit_heading. 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.
- What it achieves
- V9.214 composed application acceptance: simulated acquisition, not device evidence.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · tools/satnav · Python module
- Uses
- os, pathlib, runpy, playwright.sync_api
- Used by
- none found
- Produces
- none declared
- Defines here
- emit_heading
- 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/orient17a-v9214-browser.py:1-101 · blob 4c359a784a44a8fa0de3c2cf75dbd808f01cb1e3 · 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: unreached_review
"""V9.214 composed application acceptance: simulated acquisition, not device evidence."""
import os
from pathlib import Path
from runpy import run_path
from playwright.sync_api import expect,sync_playwright
gps=run_path(str(Path(__file__).with_name('compact-browser.py')))['GPS_SPY']
start=[-.12,51.5]
target=[-.12,51.501]
site='http://127.0.0.1:8873/atlas/v/202612040125/'
with sync_playwright() as p:
browser=getattr(p,os.environ['ORIENT_BROWSER']).launch()
for width,height in [(390,844),(844,390),(1366,768),(1920,1080)]:
with browser.new_context(viewport={'width':width,'height':height},has_touch=True) as ctx:
ctx.add_init_script(gps)
ctx.add_init_script("""Object.defineProperty(window,'DeviceOrientationEvent',{configurable:true,value:class extends Event{static async requestPermission(){return 'granted';}}});""")
page=ctx.new_page()
page.goto(site,wait_until='domcontentloaded',timeout=90000)
page.wait_for_function("()=>document.querySelector('#satnav-compact')?.satnavSurvey?.getMap()?.getLayer('l-sat')&&document.querySelector('#satnav-walk-mode')&&document.querySelector('#field-compass-toggle')",timeout=120000)
if not page.locator('#satnav-compact').is_visible(): page.locator('#satnav-toggle').tap()
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,target])
mode=page.locator('#satnav-walk-mode')
button=page.locator('#satnav-walk-start')
for val in ('walking','driving','mapped'):
mode.select_option(val)
expect(button).to_be_disabled()
mode.select_option('direct')
button.tap()
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
card=page.locator('#orient17a-direction')
arrow=page.locator('#orient17a-arrow')
expect(card).to_be_visible()
expect(card).to_contain_text('Direction uncertain')
expect(card).to_contain_text('straight line')
expect(arrow).to_be_hidden()
page.locator('#field-compass-toggle').tap()
page.evaluate("""()=>{const e=new Event('deviceorientation');Object.defineProperties(e,{webkitCompassHeading:{value:90},webkitCompassAccuracy:{value:3},beta:{value:0},gamma:{value:0}});window.dispatchEvent(e);}""")
expect(arrow).to_be_visible()
def emit_heading(heading, accuracy=3, beta=0):
page.evaluate("""args=>{const e=new Event('deviceorientation');Object.defineProperties(e,{webkitCompassHeading:{value:args[0]},webkitCompassAccuracy:{value:args[1]},beta:{value:args[2]},gamma:{value:0}});window.dispatchEvent(e);}""",[heading,accuracy,beta])
for heading in (0,45,90,135,180,225,270,315):
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
page.wait_for_timeout(30)
emit_heading(heading,0)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
emit_heading(heading)
expect(arrow).to_be_visible()
actual=page.evaluate("""()=>Number(document.querySelector('#orient17a-arrow').style.transform.match(/rotate\(([-.\d]+)deg\)/)[1])""")
assert abs((actual+heading+180)%360-180)<5,(heading,actual)
page.wait_for_timeout(30)
emit_heading(0,3,100)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
emit_heading(0)
expect(arrow).to_be_visible()
# Map rotation is not handset rotation.
before=arrow.get_attribute('style')
page.evaluate("()=>document.querySelector('#satnav-compact').satnavSurvey.getMap().jumpTo({bearing:90})")
expect(arrow).to_be_visible()
assert arrow.get_attribute('style')==before
page.evaluate("()=>document.querySelector('#satnav-compact').satnavSurvey.getMap().jumpTo({bearing:0})")
page.evaluate("p=>window.__lineGpsTest.emit(p,75)",start)
expect(arrow).to_be_hidden()
page.wait_for_timeout(30)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",start)
emit_heading(0)
expect(arrow).to_be_visible()
page.wait_for_timeout(3200)
expect(arrow).to_be_hidden()
guide=page.locator('#satnav-walk-guidance')
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).not_to_contain_text('Near last pin')
page.wait_for_timeout(1100)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",target)
expect(guide).to_contain_text('Near last pin')
# A visited intermediate pin survives a simulated page visibility suspension.
mid=[-.12,51.5005]
page.evaluate("pts=>document.querySelector('#satnav-compact').satnavSurvey.replacePlan(pts)",[start,mid,target])
page.wait_for_timeout(40)
for i in range(3):
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",mid)
if i<2: page.wait_for_timeout(1100)
expect(guide).to_contain_text('Waypoint 2 of 2')
page.evaluate("""()=>{Object.defineProperty(document,'hidden',{configurable:true,value:true});document.dispatchEvent(new Event('visibilitychange'));}""")
page.evaluate("""()=>{delete document.hidden;document.dispatchEvent(new Event('visibilitychange'));}""")
page.wait_for_timeout(40)
page.evaluate("p=>window.__lineGpsTest.emit(p,3)",mid)
expect(guide).to_contain_text('Waypoint 2 of 2')
assert page.evaluate("window.__lineGpsTest.records.starts")==[1]
page.locator('#satnav-toggle').tap()
expect(card).to_be_visible()
page.locator('#satnav-toggle').tap()
page.locator('#satnav-walk-stop').tap()
expect(card).to_be_hidden()
assert page.evaluate("window.__lineGpsTest.records.stops")==[1]
page.screenshot(path=f"orient17a-v9214-{os.environ['ORIENT_BROWSER']}-{width}x{height}.png")
print('V9.214 composed acquisition checkpoint PASS',os.environ['ORIENT_BROWSER'],width,height,flush=True)
browser.close()