In this section
- Renewable Energy Planning Database (REPD) Expanded energy-data · globalgrid2050 / uk_renewables_pipeline/202611221850/styles/repd-expanded.css lines 701–708
- Renewable Energy Planning Database (REPD) Expanded energy-data · globalgrid2050 / uk_renewables_pipeline/202611221900/repd-expanded.mjs lines 1–384
- Renewable Energy Planning Database (REPD) Expanded test · globalgrid2050 / uk_renewables_pipeline/202611221930/tests/repd-expanded.mjs lines 1–75
- V972 Vicinity A4 PDF test · globalgrid2050 / uk_renewables_pipeline/202611222222/tests/v972-vicinity-a4-pdf.mjs lines 1–82
- Renewable Energy Planning Database (REPD) Reports energy-data · globalgrid2050 / uk_renewables_pipeline/202611222330/styles/repd-reports.css lines 1–50
- V973 Renewable Energy Planning Database (REPD) Reports Browser test · globalgrid2050 / uk_renewables_pipeline/202611222330/tests/v973-repd-reports-browser.mjs lines 1–70
Renewable Energy Planning Database (REPD) Expanded
A style sheet in the styles folder of GlobalGrid2050 covering the REPD register.
energy-dataglobalgrid2050 / uk_renewables_pipeline/202611221850/styles/repd-expanded.css · lines 701–708 of 708 · version 2026-11-22 18:50 (continued from section 955) · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 — UK Renewables Pipeline Page (globalgrid2050, https://globalgrid2050.com/uk_renewables_pipeline/202611280922/). Reached from 4 other entry points, including GlobalGrid2050 Pipeline Legal Evidence Workflow (globalgrid2050); V923 Public Readback Workflow (neural-link-between-agents); A4 Legal Model (globalgrid2050).
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Loaded by the UK Renewables Pipeline page at https://globalgrid2050.com/uk_renewables_pipeline/202611280922/.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611221850/styles · style sheet
- Uses
- none found
- Used by
- loaded by GlobalGrid2050 — UK Renewables Pipeline Page (stylesheet)
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611221850/styles/repd-expanded.css:701-708 · blob 7382452220fec58c0c6540777caf604b19ae9c93 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
}
#pnExpandedHost #repdPanel #repdScroll thead th:first-child{
width:185px!important;min-width:185px!important;max-width:185px!important;
}
#pnExpandedHost #repdPanel #repdScroll #tbody tr[id^="repd-"]>td.site{
width:185px!important;min-width:185px!important;max-width:185px!important;
}
}Renewable Energy Planning Database (REPD) Expanded
A JavaScript module in the UK renewables pipeline folder of GlobalGrid2050 that scales clamp (`scaleClamp`), sets table scale (`setTableScale`), fits columns (`fitAllColumns`) and calculates planar distances (units: MW).
energy-dataglobalgrid2050 / uk_renewables_pipeline/202611221900/repd-expanded.mjs · lines 1–384 of 384 · version 2026-11-22 19:00 · Entry point · pattern centre (shared by 6 files)
- What it does
- It draws the REPD register. Defines 22 functions or classes, including scaleClamp, setTableScale, fitAllColumns, distance, centre. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 — UK Renewables Pipeline Page (globalgrid2050, https://globalgrid2050.com/uk_renewables_pipeline/202611280922/). Reached from 4 other entry points, including GlobalGrid2050 Pipeline Legal Evidence Workflow (globalgrid2050); V923 Public Readback Workflow (neural-link-between-agents); A4 Legal Model (globalgrid2050).
- What it achieves
- It sets table scale (`setTableScale`), fits columns (`fitAllColumns`) and mirrors map link (`mirrorMapLink`). V9.69: both orientations, MAP directly after Project, A4 stays at far right; full-height reading view. It responds to touchstart, touchmove and touchend events.
- Why it matters
- Loaded by the UK Renewables Pipeline page at https://globalgrid2050.com/uk_renewables_pipeline/202611280922/.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611221900 · JavaScript module
- Uses
- State (import), Projects V9 8 (import)
- Used by
- loaded by GlobalGrid2050 — UK Renewables Pipeline Page (script src)
- Produces
- scaleClamp, setTableScale, fitAllColumns, distance, centre, endPinch, resizeLiveGauges, scheduleGaugeResize, nativeMapLink, mirrorMapLink, syncMapColumn, clearMapColumn
- Defines here
- scaleClamp, setTableScale, fitAllColumns, distance, centre, endPinch, resizeLiveGauges, scheduleGaugeResize, nativeMapLink, mirrorMapLink, syncMapColumn, clearMapColumn, paintOperators, updateExpandedPager, dismissFilter, make, chooser, srcSelect, openFilter, doApply, show, close
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611221900/repd-expanded.mjs:1-384 · blob d0d3700a3481f1d5125b14b4b5367e5db3dc4f7d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
// V9.69: both orientations, MAP directly after Project, A4 stays at far right; full-height reading view.
import {state} from './scripts/core/state.js';
import {setExpandedPageRows} from './scripts/plugins/projects-v9-8.js';
(() => {
'use strict';
const root=document.getElementById('officialRegister');
const panel=document.getElementById('repdPanel');
const wrap=document.getElementById('repdScroll');
const toolbar=document.getElementById('pnScanToolbar');
const table=wrap?.querySelector('table');
const tbody=document.getElementById('tbody');
const tech=document.getElementById('tech');
const gauges=panel?.querySelector('.hud-gauges');
if(!root||!panel||!wrap||!toolbar||!table||!tbody||!tech||!gauges)return;
const launch=document.createElement('button');
launch.id='pnLiquidLaunch';launch.type='button';
launch.textContent='EXPANDED REPD VIEW';
launch.title='Open a full-screen REPD table';
launch.setAttribute('aria-haspopup','dialog');
launch.setAttribute('aria-controls','pnExpandedHost');
toolbar.append(launch);
const host=document.createElement('aside');
host.id='pnExpandedHost';host.hidden=true;
host.setAttribute('role','dialog');host.setAttribute('aria-modal','true');
host.setAttribute('aria-label','Expanded REPD table');
host.innerHTML='<div class="pn-expanded-top">'+
'<button type="button" id="pnExpandedClose" aria-label="Close expanded REPD view">×</button></div>'+
'<aside id="pnExpandedFilter" hidden aria-label="Column filter"></aside>';
document.body.append(host);
const filter=document.getElementById('pnExpandedFilter');
const closeButton=document.getElementById('pnExpandedClose');
let expanded=false,rootMark=null,techMark=null,snapshot=null,hadScan=false;
let lastFocus=null;
// A legible landscape reading table starts at its native size.
// Pinch scales table content only; the original normal-view gauges stay intact.
// Safari and Chromium understand CSS zoom, which also preserves scroll extents
// and native anchor/button hit targets (unlike a visual-only transform).
let fitScale=1,scale=1,pinch=null,gesture=null;
const scaleClamp=value=>Math.min(2,Math.max(.8,value));
function setTableScale(next,clientX=null,clientY=null){
if(!expanded)return;
const bounds=wrap.getBoundingClientRect();
const x=clientX===null?bounds.width/2:clientX-bounds.left;
const y=clientY===null?bounds.height/2:clientY-bounds.top;
const prior=Math.max(.001,scale);
const baseX=(wrap.scrollLeft+x)/prior,baseY=(wrap.scrollTop+y)/prior;
scale=scaleClamp(next);
table.style.zoom=String(scale);
wrap.dataset.zoom=String(scale);
wrap.scrollLeft=Math.max(0,baseX*scale-x);
wrap.scrollTop=Math.max(0,baseY*scale-y);
}
function fitAllColumns(){
if(!expanded)return;
// Do not miniaturise columns to fit: readable text and sideways scrolling
// are more useful than a tiny screenshot-like overview.
fitScale=1;scale=1;
table.style.zoom='1';
wrap.dataset.zoom='1';
wrap.scrollLeft=0;wrap.scrollTop=0;
}
function distance(a,b){return Math.hypot(a.clientX-b.clientX,a.clientY-b.clientY);}
function centre(a,b){return {x:(a.clientX+b.clientX)/2,y:(a.clientY+b.clientY)/2};}
wrap.addEventListener('touchstart',event=>{
if(!expanded||event.touches.length!==2)return;
const [a,b]=event.touches;
const mid=centre(a,b);
pinch={distance:Math.max(1,distance(a,b)),startScale:scale};
pinch.mid=mid;
},{passive:true});
wrap.addEventListener('touchmove',event=>{
if(!expanded||!pinch||event.touches.length!==2)return;
if(event.cancelable)event.preventDefault();
const [a,b]=event.touches,mid=centre(a,b);
setTableScale(pinch.startScale*distance(a,b)/pinch.distance,mid.x,mid.y);
},{passive:false});
const endPinch=event=>{if(event.touches.length<2)pinch=null;};
wrap.addEventListener('touchend',endPinch,{passive:true});
wrap.addEventListener('touchcancel',()=>{pinch=null;},{passive:true});
// Trackpad pinch gestures also zoom the TABLE, not the browser or gauges.
wrap.addEventListener('wheel',event=>{
if(!expanded||!event.ctrlKey)return;
event.preventDefault();
setTableScale(scale*Math.exp(-event.deltaY*.013),event.clientX,event.clientY);
},{passive:false});
// Safari's GestureEvent is a fallback for iOS browser-host pinch variants.
wrap.addEventListener('gesturestart',event=>{
if(!expanded)return;
event.preventDefault();
gesture={startScale:scale};
},{passive:false});
wrap.addEventListener('gesturechange',event=>{
if(!expanded||!gesture)return;
event.preventDefault();
setTableScale(gesture.startScale*event.scale,event.clientX,event.clientY);
},{passive:false});
wrap.addEventListener('gestureend',()=>{gesture=null;},{passive:true});
// Chart.js keeps its old measured canvas after its actual REPD node is moved.
// Resize the three real gauges once the expanded container has laid out.
function resizeLiveGauges(){
if(!window.Chart?.getChart)return;
for(const canvas of gauges.querySelectorAll('canvas')){
window.Chart.getChart(canvas)?.resize();
}
}
function scheduleGaugeResize(){
requestAnimationFrame(()=>{resizeLiveGauges();requestAnimationFrame(resizeLiveGauges);});
}
// The existing native header buttons remain sortable. Do not add a second
// layer of filter arrows to the expanded reading view.
// The new MAP cell is a presentation-only clone of the original per-row
// link. The last native cell and A4 control remain completely unchanged,
// including the original MAP href used by the A4 report model.
// Expanded MAP must follow the same native, enriched GridAtlas link as normal view.
// An early render can contain only the raw Atlas href; map-entry.mjs replaces it
// asynchronously with a journey/vicinity URL. Never freeze the early href.
function nativeMapLink(row){
const actions=row.cells[row.cells.length-1]?.querySelector('.project-actions');
const links=[...(actions?.querySelectorAll('a.pn-journey-action.atlaslink[href],a.atlaslink[href],a.action-link[href]')||[])];
return links.find(a=>a.classList.contains('pn-journey-action')&&!a.hidden)||
links.find(a=>!a.hidden&&getComputedStyle(a).display!=='none')||links[0]||null;
}
function mirrorMapLink(anchor,source){
if(!source)return false;
anchor.href=source.href;
// V9.42's normal-view policy: current-tab with Back on touch,
// native desktop new-tab otherwise. Both modes use the same real URL.
const touch=matchMedia('(pointer: coarse)').matches;
const target=touch?'_self':(source.getAttribute('target')||'_self');
anchor.target=target;
anchor.rel=source.rel||'noopener noreferrer';
anchor.title=source.title||'Open project map';
anchor.dataset.mapNavigation=target==='_blank'?'new-tab':'current-tab';
anchor.setAttribute('aria-description',target==='_blank'?
'Opens the grid map in a new tab.':'Opens the grid map in this tab. Use Back to return to these results.');
return true;
}
function syncMapColumn(){
if(!expanded)return;
const hr=table.tHead?.rows[0];
if(hr&&!hr.querySelector('.pn-expanded-map-heading')){
const h=document.createElement('th');
h.className='pn-expanded-map-heading';
h.scope='col';
h.textContent='MAP';
hr.cells[0].after(h);
}
for(const row of tbody.querySelectorAll('tr[id^="repd-"]')){
let cell=row.querySelector(':scope > .pn-expanded-map-cell');
if(!cell){
cell=document.createElement('td');
cell.className='pn-expanded-map-cell';
row.cells[0].after(cell);
}
const source=nativeMapLink(row);
let anchor=cell.querySelector('.pn-expanded-map-launch');
if(source){
if(!anchor){
cell.replaceChildren();
anchor=document.createElement('a');
anchor.className='action-link atlaslink pn-journey-link pn-expanded-map-launch';
anchor.textContent='MAP';
anchor.setAttribute('aria-label','Open project map');
// Capture the current native source immediately before browser navigation.
// This also works if enrichment occurs after the clone was first rendered.
anchor.addEventListener('click',event=>{
if(!mirrorMapLink(anchor,nativeMapLink(row)))event.preventDefault();
},true);
cell.append(anchor);
}
mirrorMapLink(anchor,source);
}else{
cell.replaceChildren();
const unavailable=row.cells[row.cells.length-1]?.querySelector('.pn-journey-unavailable,.action-disabled');
const span=document.createElement('span');
span.className='pn-expanded-map-unavailable';
span.textContent='—';
span.title=unavailable?.textContent.trim()||'Map unavailable';
cell.append(span);
}
}
}
function clearMapColumn(){
table.tHead?.querySelector('.pn-expanded-map-heading')?.remove();
for(const cell of tbody.querySelectorAll('.pn-expanded-map-cell'))cell.remove();
}
function paintOperators(){
if(!expanded)return;
for(const row of tbody.querySelectorAll('tr[id^="repd-"]')){
const td=row.cells[row.querySelector(':scope > .pn-expanded-map-cell')?4:3];
if(!td||td.querySelector('.pn-expanded-operator'))continue;
const full=td.textContent.trim();
const s=document.createElement('span');s.className='pn-expanded-operator';
s.textContent=full;td.textContent='';td.append(s);td.title=full;
}
}
function updateExpandedPager(){
if(!expanded)return;
const nav=document.getElementById('projectPager');
const meta=nav?.querySelector('.pager-meta');
if(!meta||!nav.dataset.page)return;
const n=Number(tbody.dataset.total)||0;
const start=Number(nav.dataset.from)||0;
const end=Number(nav.dataset.to)||0;
const current=Number(nav.dataset.page)||1;
const pages=Number(nav.dataset.pages)||1;
meta.title=start.toLocaleString('en-GB')+'–'+end.toLocaleString('en-GB')+
' of '+n.toLocaleString('en-GB')+' records, page '+current+' of '+pages;
meta.textContent=start.toLocaleString('en-GB')+'–'+end.toLocaleString('en-GB')+
' / '+n.toLocaleString('en-GB')+' · '+current+'/'+pages;
}
function dismissFilter(){filter.hidden=true;filter.replaceChildren();}
const make=(tag,text,cls)=>{
const node=document.createElement(tag);
if(text!==null)node.textContent=text;
if(cls)node.className=cls;
return node;
};
function chooser(label,choices,value,onChange){
const l=make('label',label);
const s=make('select',null,'pn-expanded-select');
for(const [v,t] of choices){
const option=new Option(t,v);s.add(option);
}
s.value=value;
s.addEventListener('change',()=>{onChange(s.value);dismissFilter();});
l.append(s);filter.append(l);return s;
}
function srcSelect(selector){
const source=document.querySelector(selector);
if(!source)return null;
return {source,choices:[...source.options].map(o=>[o.value,o.textContent.trim()])};
}
function openFilter(key,button){
if(!expanded)return;
if(!filter.hidden&&filter.dataset.key===key){dismissFilter();return;}
dismissFilter();filter.dataset.key=key;
filter.append(make('strong','FILTER · '+key.toUpperCase()));
if(key==='technology'||key==='status'){
const selector=key==='technology'?'#tech [data-technology]':'#status [data-official-status]';
const buttons=[...document.querySelectorAll(selector)];
const prop=key==='technology'?'technology':'officialStatus';
const choices=buttons.map(b=>[b.dataset[prop],b.textContent.trim()]);
const active=buttons.find(b=>b.getAttribute('aria-pressed')==='true');
chooser(key,choices,active?.dataset[prop]||choices[0]?.[0],value=>{
buttons.find(b=>b.dataset[prop]===value)?.click();
});
} else if(key==='county'){
const c=srcSelect('#county');
if(c)chooser('County / location',c.choices,c.source.value,value=>{
c.source.value=value;c.source.dispatchEvent(new Event('change',{bubbles:true}));
});
} else if(['updated','submitted','operational'].includes(key)){
const field=key==='updated'?'updatedYear':key==='submitted'?'submittedYear':'operationalYear';
const c=srcSelect('[data-year-filter="'+field+'"]');
if(c)chooser(key+' year',c.choices,c.source.value,value=>{
c.source.value=value;c.source.dispatchEvent(new Event('change',{bubbles:true}));
});
} else if(key==='capacity'){
const row=make('div',null,'pn-expanded-range');
for(const [id,text] of [['minMW','MIN MW'],['maxMW','MAX MW']]){
const label=make('label',text);
const input=make('input',null);
input.type='number';input.step='any';input.min='0';
input.value=document.getElementById(id)?.value||'';
input.dataset.for=id;
label.append(input);row.append(label);
}
const apply=make('button','APPLY MW','pn-expanded-apply');apply.type='button';
const doApply=()=>{
for(const input of row.querySelectorAll('input')){
document.getElementById(input.dataset.for).value=input.value;
}
document.getElementById('applyMW').click();
dismissFilter();
};
apply.addEventListener('click',doApply);
row.addEventListener('keydown',e=>{if(e.key==='Enter')doApply();});
filter.append(row,apply);
} else if(key==='name'||key==='operator'){
const label=make('label',key==='operator'?'Find operator or project':'Find project');
const input=make('input',null);
input.type='search';input.placeholder='Search REPD';
const source=document.getElementById('search');
input.value=source.value;
input.addEventListener('input',()=>{
source.value=input.value;
source.dispatchEvent(new Event('input',{bubbles:true}));
});
input.addEventListener('keydown',e=>{if(e.key==='Enter')dismissFilter();});
label.append(input);filter.append(label);
}
if(filter.children.length===1)return;
filter.hidden=false;
const rect=button.getBoundingClientRect();
const vw=window.innerWidth,vh=window.innerHeight;
filter.style.left=Math.max(6,Math.min(rect.left,vw-238))+'px';
filter.style.top=Math.max(6,Math.min(rect.bottom+3,vh-290))+'px';
filter.querySelector('select,input')?.focus({preventScroll:true});
}
function show(){
if(expanded)return;
lastFocus=document.activeElement;
const active=document.querySelector('.pipeline-tabs [role="tab"][aria-selected="true"]');
if(active?.id!=='solarTab'&&active?.id!=='bessTab')document.getElementById('solarTab')?.click();
const html=document.documentElement;
snapshot={overflow:document.body.style.overflow,htmlOverflow:html.style.overflow,
pageY:window.scrollY,scrollX:wrap.scrollLeft,scrollY:wrap.scrollTop};
rootMark=document.createComment('original REPD register');
root.parentNode.insertBefore(rootMark,root);
techMark=document.createComment('original technology filters');
tech.parentNode.insertBefore(techMark,tech);
hadScan=wrap.classList.contains('pn-scan-mode');
if(hadScan)document.getElementById('pnScanModeToggle')?.click();
host.append(root);
gauges.after(tech);
expanded=true;
host.hidden=false;
html.classList.add('pn-expanded-open');
document.body.style.overflow='hidden';html.style.overflow='hidden';
wrap.classList.add('pn-expanded-grid');
setExpandedPageRows(true);
syncMapColumn();
// Preserve readable native zoom across portrait and landscape.
requestAnimationFrame(fitAllColumns);
paintOperators();
requestAnimationFrame(updateExpandedPager);
closeButton.focus({preventScroll:true});
}
function close(){
if(!expanded)return;
dismissFilter();
// Clear view-only zoom BEFORE restoring the standard REPD dashboard.
pinch=null;gesture=null;table.style.removeProperty('zoom');delete wrap.dataset.zoom;
scale=1;fitScale=1;
setExpandedPageRows(false);
clearMapColumn();
if(hadScan&&!wrap.classList.contains('pn-scan-mode'))document.getElementById('pnScanModeToggle')?.click();
techMark?.replaceWith(tech);techMark=null;
rootMark?.replaceWith(root);rootMark=null;
wrap.classList.remove('pn-expanded-grid');
host.hidden=true;expanded=false;
document.documentElement.classList.remove('pn-expanded-open');
const s=snapshot;snapshot=null;
if(s){
document.body.style.overflow=s.overflow;
document.documentElement.style.overflow=s.htmlOverflow;
requestAnimationFrame(()=>{
wrap.scrollLeft=s.scrollX;wrap.scrollTop=s.scrollY;window.scrollTo(0,s.pageY);
resizeLiveGauges();
});
}
(lastFocus||launch).focus({preventScroll:true});
}
launch.addEventListener('click',show);
closeButton.addEventListener('click',close);
host.addEventListener('click',event=>{
const trigger=event.target.closest('[data-pn-expanded-filter]');
if(trigger){event.preventDefault();event.stopPropagation();openFilter(trigger.dataset.pnExpandedFilter,trigger);return;}
if(!filter.hidden&&!event.target.closest('#pnExpandedFilter'))dismissFilter();
});
document.addEventListener('keydown',event=>{
if(!expanded||event.key!=='Escape')return;
event.preventDefault();event.stopImmediatePropagation();
if(!filter.hidden)dismissFilter();else close();
},true);
window.addEventListener('pipeline-projects-rendered',()=>{
syncMapColumn();paintOperators();requestAnimationFrame(updateExpandedPager);
});
window.addEventListener('pipeline-journey-ready',syncMapColumn);
let mapSyncQueued=false;
new MutationObserver(()=>{
if(!expanded||mapSyncQueued)return;
mapSyncQueued=true;
queueMicrotask(()=>{mapSyncQueued=false;syncMapColumn();});
}).observe(tbody,{childList:true,subtree:true});
window.addEventListener('resize',()=>{
// Rotate without hiding the expanded register or resetting its map column.
// The same original table remains accessible in both orientations.
if(!expanded)return;
syncMapColumn();
},{passive:true});
window.addEventListener('pagehide',()=>{if(expanded)close();});
})();Renewable Energy Planning Database (REPD) Expanded
A JavaScript module in the tests folder of GlobalGrid2050 that tests the REPD register.
testglobalgrid2050 / uk_renewables_pipeline/202611221930/tests/repd-expanded.mjs · lines 1–75 of 75 · version 2026-11-22 19:30 · Entry point
- What it does
- It tests the REPD register. Uses libraries node:assert/strict, playwright. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register. README: "No code changes to `repd-expanded.mjs`, project renderer, GridAtlas receiver or A4 modules."
- Downstream impact
- Used directly by 7 files: GlobalGrid2050 Pn V965 Expanded Renewable Energy Planning Database (REPD) Workflow (globalgrid2050); GlobalGrid2050 Pn V966 Operator Actions Workflow (globalgrid2050); GlobalGrid2050 Pn V967 Native Columns Workflow (globalgrid2050); GlobalGrid2050 Pn V968 Focused Landscape Workflow (globalgrid2050); and 3 more.
- What it achieves
- V9.69 — full-height portrait/landscape, MAP second, A4 last, normal intact. It responds to click events.
- Why it matters
- Run by 7 workflows and scripts, including GlobalGrid2050 Pn V965 Expanded Renewable Energy Planning Database (REPD) Workflow, GlobalGrid2050 Pn V966 Operator Actions Workflow and GlobalGrid2050 Pn V967 Native Columns Workflow.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611221930/tests · JavaScript module
- Uses
- node:assert/strict, playwright
- Used by
- run by GlobalGrid2050 Pn V965 Expanded Renewable Energy Planning Database (REPD) Workflow (workflow run), run by GlobalGrid2050 Pn V966 Operator Actions Workflow (workflow run), run by GlobalGrid2050 Pn V967 Native Columns Workflow (workflow run), run by GlobalGrid2050 Pn V968 Focused Landscape Workflow (workflow run), run by GlobalGrid2050 Pn V969 Map Portrait Workflow (workflow run), run by GlobalGrid2050 Pn V970 Map Parity Workflow (workflow run), run by GlobalGrid2050 Pn V971 Retire Legacy Maximise Workflow (workflow run)
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611221930/tests/repd-expanded.mjs:1-75 · blob f51bf4ffe4240d4c790f7e49a167219d5259d5dd · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
// V9.69 — full-height portrait/landscape, MAP second, A4 last, normal intact.
import assert from 'node:assert/strict';
import {chromium,webkit} from 'playwright';
const url='http://127.0.0.1:8765/uk_renewables_pipeline/202611221930/';
for(const [engineName,engine] of [['chromium',chromium],['webkit',webkit]]){
const browser=await engine.launch({headless:true});
try{
for(const vp of [{name:'portrait',width:393,height:852},{name:'landscape',width:852,height:393}]){
const page=await browser.newPage({viewport:{width:vp.width,height:vp.height},hasTouch:true,reducedMotion:'reduce'});
const errors=[];page.on('pageerror',err=>errors.push(err.message));
try{
await page.route('https://raw.githubusercontent.com/**',r=>r.abort());
await page.goto(url,{waitUntil:'domcontentloaded',timeout:90000});
await page.waitForFunction(()=>document.querySelectorAll('#tbody tr[id^="repd-"]').length===50 &&
document.querySelectorAll('#tbody .pn-report-launch').length===50,{timeout:90000});
assert.equal(await page.locator('#pnRepdWideToggle').count(),0,'Old REPD maximise must not render');
assert.equal(await page.locator('#pnRepdWidePrompt').count(),0,'Old rotation prompt must not render');
assert.equal(await page.locator('#pnLiquidLaunch').count(),1,'Keep one modern expanded-view launcher');
const oldColour=await page.locator('#repdScroll thead th').first().evaluate(e=>getComputedStyle(e).color);
await page.locator('#pnLiquidLaunch').click();
await page.waitForFunction(()=>document.querySelectorAll('#tbody tr[id^="repd-"]').length===100 &&
!!document.querySelector('#pnExpandedHost #repdScroll thead .pn-expanded-map-heading'),{timeout:20000});
const v=await page.evaluate(()=>{
const rows=[...document.querySelectorAll('#tbody tr[id^="repd-"]')];
const h=[...document.querySelectorAll('#repdScroll thead th')];
const row=rows.find(r=>r.cells[1]?.querySelector('a.pn-expanded-map-launch'));
const actions=row?.cells[row.cells.length-1];
const host=document.getElementById('pnExpandedHost'),wrap=document.getElementById('repdScroll');
return {headCount:h.length,visible:h.filter(x=>getComputedStyle(x).display!=='none').length,
heading:h[1]?.textContent,normalRows:rows.length,mapCount:rows.filter(r=>!!r.cells[1]?.querySelector('a.pn-expanded-map-launch')).length,
colour:getComputedStyle(h[0]).color,hostVisible:!host.hidden,
topBar:getComputedStyle(document.querySelector('#pnExpandedHost .pn-expanded-top')).position,
viewportWidth:wrap.clientWidth,tableWidth:wrap.scrollWidth,
originalMap:!!actions?.querySelector('a.pn-journey-link[href],a.atlaslink[href]'),
lastA4:!!actions?.querySelector('.pn-report-launch'),
cells:row?.cells.length,
gauges:getComputedStyle(document.querySelector('#pnExpandedHost .hud-gauges')).display,
headerButtons:!!h[2]?.querySelector('[data-column-sort="capacity"]')};
});
assert.equal(v.headCount,14,JSON.stringify(v));
assert.equal(v.visible,11,JSON.stringify(v));
assert.equal(v.heading,'MAP');
assert.equal(v.cells,14);
assert.equal(v.normalRows,100);
assert.ok(v.mapCount>0,JSON.stringify(v));
assert.ok(v.originalMap&&v.lastA4,'MAP cloned but original MAP/A4 still at far right');
assert.equal(v.colour,oldColour);
assert.ok(v.hostVisible&&v.topBar==='absolute');
assert.equal(v.gauges,'none');
assert.ok(v.headerButtons);
assert.ok(v.tableWidth>v.viewportWidth);
await page.locator('#pnExpandedHost #repdScroll [data-column-sort="capacity"]').click();
await page.waitForFunction(()=>new URLSearchParams(location.search).get('sort')==='capacity_asc',{timeout:15000});
const mapped=page.locator('#pnExpandedHost #tbody tr[id^="repd-"] td:nth-child(2) .pn-expanded-map-launch').first();
await mapped.evaluate(el=>el.addEventListener('click',event=>{event.preventDefault();window.__mapHit=true},{once:true}));
await mapped.click();assert.equal(await page.evaluate(()=>window.__mapHit),true);
const a4=page.locator('#pnExpandedHost #tbody tr[id^="repd-"] td:last-child .pn-report-launch').first();
await a4.click();await page.waitForSelector('#pnRepdReport:not([hidden])',{timeout:15000});
assert.equal(await page.locator('[data-report-action="pdf"]').count(),1);
const map=await page.locator('#pnReportMap').evaluate(el=>({href:el.href,hidden:el.hidden}));
assert.ok(!map.hidden&&map.href.startsWith('https://'),'A4 must retain original MAP link');
await page.locator('[data-report-action="close"]').click();
await page.setViewportSize({width:vp.height,height:vp.width});
assert.ok(await page.locator('#pnExpandedHost').isVisible(),'Rotation must not dismiss expanded view');
await page.locator('#pnExpandedClose').click();
assert.equal(await page.locator('#repdScroll thead th').count(),13);
assert.equal(await page.locator('#tbody tr[id^="repd-"] td').count(),50*13);
assert.equal(await page.locator('#tbody tr[id^="repd-"] td:last-child .pn-report-launch').count(),50);
assert.ok(await page.locator('#repdPanel>.hud-gauges').isVisible(),'Normal cockpit restored');
assert.deepEqual(errors,[],JSON.stringify(errors));
console.log('PASS V9.69',engineName,vp.name,JSON.stringify(v));
}finally{await page.close()}
}
}finally{await browser.close()}
}V972 Vicinity A4 PDF
A JavaScript module in the tests folder of GlobalGrid2050 that tests the Renewable Energy Planning Database (REPD) register and uses data from the GridAtlas repository.
testglobalgrid2050 / uk_renewables_pipeline/202611222222/tests/v972-vicinity-a4-pdf.mjs · lines 1–82 of 82 · version 2026-11-22 22:22 · Entry point
- What it does
- It tests the REPD register. Defines pdfLiteral, compareA4AndPdf. Uses libraries node:assert/strict, node:fs/promises, playwright. Side effects: changes the web page (DOM); reads or writes files.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
- Inputs & outputs
- In: data source: gridatlas data.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Pn V972 Vicinity A4 PDF Workflow (globalgrid2050).
- What it achieves
- It compares a4 PDF (`compareA4AndPdf`) and is built from the PDF literal helper (`pdfLiteral`). V9.72: end-to-end REPD identity / normal MAP / A4 HTML / PDF / expanded MAP parity.
- Why it matters
- Run by GlobalGrid2050 Pn V972 Vicinity A4 PDF Workflow.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611222222/tests · JavaScript module
- Uses
- Report Model (import), Report PDF (import), GridAtlas — Atlas Page (estate URL), node:assert/strict, node:fs/promises, playwright
- Used by
- run by GlobalGrid2050 Pn V972 Vicinity A4 PDF Workflow (workflow run)
- Produces
- pdfLiteral, compareA4AndPdf
- Defines here
- pdfLiteral, compareA4AndPdf
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611222222/tests/v972-vicinity-a4-pdf.mjs:1-82 · blob cfff566c3bc4d562b5af60738c70ca9999edf18c · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
// V9.72: end-to-end REPD identity / normal MAP / A4 HTML / PDF / expanded MAP parity.
import assert from 'node:assert/strict';
import {readFile} from 'node:fs/promises';
import {chromium,webkit} from 'playwright';
import {reportData} from '../report-model.mjs';
import {buildA4Pdf} from '../report-pdf.mjs';
const atlas='https://ventusltd.github.io/gridatlas/atlas/';
const app='http://127.0.0.1:8765/uk_renewables_pipeline/202611222222/';
const testProject={repd_ref:'12588',technology:'solar',name:'Cowley pilot',operator:'Test operator'};
const projectMap=atlas+'?repd_ref=12588&latitude=51.75&longitude=-1.19&journey=vicinity';
const unit=reportData(testProject,projectMap);
assert.equal(unit.mapUrl,projectMap,'Report retains exact project URL');
assert.equal(reportData(testProject,atlas+'?repd_ref=123&latitude=51.75&longitude=-1.19').mapUrl,'','Reject different REPD identity');
assert.equal(reportData(testProject,'https://example.org/?repd_ref=12588').mapUrl,'','Reject unrelated origins');
assert.ok(Buffer.from(buildA4Pdf(unit)).toString('latin1').includes('/URI ('+projectMap+')'),'PDF contains real URI annotation');
const pdfLiteral=url=>url.replace(/\\/g,'\\\\').replace(/\(/g,'\\(').replace(/\)/g,'\\)');
async function compareA4AndPdf(page, rowSelector, expected){
const row=page.locator(rowSelector).first();
await row.locator('td:last-child .pn-report-launch').click();
await page.locator('#pnRepdReport:not([hidden])').waitFor({timeout:15000});
const reportHref=await page.locator('#pnReportMap').getAttribute('href');
assert.equal(reportHref,expected,'A4 HTML MAP must equal row MAP');
assert.equal(await page.locator('#pnReportMap').isVisible(),true,'A4 MAP action must remain visible');
const down=page.waitForEvent('download',{timeout:15000});
await page.locator('[data-report-action="pdf"]').click();
const download=await down;
assert.ok(download.suggestedFilename().endsWith('.pdf'));
const content=(await readFile(await download.path())).toString('latin1');
assert.ok(content.startsWith('%PDF-1.4'),'Download must be PDF');
const uri='/URI ('+pdfLiteral(expected)+')';
assert.ok(content.includes(uri),'PDF /URI differs from native MAP: '+content.match(/\/URI \(.{0,250}/)?.[0]);
assert.equal((content.match(/\/URI \(/g)||[]).length,1,'Exactly one outbound PDF MAP URI');
await page.locator('[data-report-action="close"]').click();
}
for(const [engineName,engine] of [['chromium',chromium],['webkit',webkit]]){
const browser=await engine.launch({headless:true});
try{
for(const vp of [{name:'portrait',width:393,height:852},{name:'landscape',width:852,height:393}]){
const context=await browser.newContext({viewport:{width:vp.width,height:vp.height},isMobile:true,hasTouch:true,acceptDownloads:true,reducedMotion:'reduce'});
const page=await context.newPage(), errors=[];
page.on('pageerror',e=>errors.push(e.message));
await context.route('https://raw.githubusercontent.com/**',r=>r.abort());
await context.route(atlas+'**',r=>r.fulfill({status:200,contentType:'text/html',body:'<!doctype html><title>GridAtlas test receiver</title>'}));
try{
await page.goto(app,{waitUntil:'domcontentloaded',timeout:90000});
await page.waitForFunction(()=>document.querySelectorAll('#tbody tr[id^="repd-"]').length===50
&&document.querySelector('#tbody .pn-journey-link.atlaslink[href]')
&&document.querySelector('#tbody .pn-report-launch'),{timeout:90000});
const first='#tbody tr[id^="repd-"]';
const row=page.locator(first).first();
const native=await row.locator('td:last-child .pn-journey-link.atlaslink[href]').getAttribute('href');
const ref=await row.getAttribute('id');
assert.equal(new URL(native).origin+new URL(native).pathname,atlas);
assert.equal(new URL(native).searchParams.get('repd_ref'),ref.slice(5));
// Distractor link previously won the A4 first-visible-link heuristic.
await row.evaluate(el=>{
const other=document.createElement('a');other.href='https://example.org/unrelated';
other.textContent='OTHER';other.className='irrelevant-action';
el.querySelector('td:last-child').prepend(other);
});
await compareA4AndPdf(page,first,native);
await page.locator('#pnLiquidLaunch').click();
await page.waitForFunction(()=>document.querySelectorAll('#tbody tr[id^="repd-"]').length===100
&&document.querySelector('#pnExpandedHost #tbody .pn-expanded-map-launch'),{timeout:30000});
const expanded='#pnExpandedHost #tbody tr[id^="repd-"]';
const expandedRow=page.locator(expanded).first();
const expandedMap=await expandedRow.locator('.pn-expanded-map-cell .pn-expanded-map-launch').getAttribute('href');
const expandedRef=await expandedRow.getAttribute('id');
const expandedNative=await expandedRow.locator('td:last-child .pn-journey-link.atlaslink[href]').getAttribute('href');
assert.equal(expandedMap,expandedNative,'Expanded MAP inherits native project map');
assert.equal(new URL(expandedMap).searchParams.get('repd_ref'),expandedRef.slice(5));
await compareA4AndPdf(page,expanded,expandedMap);
// Actual click navigation, not only event propagation: native target is same tab on touch.
const link=expandedRow.locator('.pn-expanded-map-cell .pn-expanded-map-launch');
await Promise.all([page.waitForURL(u=>u.href===expandedMap,{timeout:15000}),link.click()]);
assert.equal(page.url(),expandedMap,'Expanded MAP must navigate to canonical receiver');
assert.deepEqual(errors,[],'No uncaught browser errors');
console.log('PASS V9.72 MAP/A4/PDF parity',engineName,vp.name,expandedRef);
} finally{await context.close();}
}
} finally{await browser.close();}
}Renewable Energy Planning Database (REPD) Reports
A style sheet in the styles folder of GlobalGrid2050 covering the REPD register.
energy-dataglobalgrid2050 / uk_renewables_pipeline/202611222330/styles/repd-reports.css · lines 1–50 of 50 · version 2026-11-22 23:30 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 — UK Renewables Pipeline Page (globalgrid2050, https://globalgrid2050.com/uk_renewables_pipeline/202611280922/). Reached from 4 other entry points, including GlobalGrid2050 Pipeline Legal Evidence Workflow (globalgrid2050); V923 Public Readback Workflow (neural-link-between-agents); A4 Legal Model (globalgrid2050).
- What it achieves
- V9.73 additive REPD intelligence reports. Native palette, table, MAP/A4 untouched.
- Why it matters
- Loaded by the UK Renewables Pipeline page at https://globalgrid2050.com/uk_renewables_pipeline/202611280922/.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611222330/styles · style sheet
- Uses
- none found
- Used by
- loaded by GlobalGrid2050 — UK Renewables Pipeline Page (stylesheet)
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611222330/styles/repd-reports.css:1-50 · blob 526a069ffbbabdd6a62044542e8adb68fc9c4a3e · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* V9.73 additive REPD intelligence reports. Native palette, table, MAP/A4 untouched. */
#repdReportsPanel[hidden]{display:none!important}
.repd-report-launch{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:8px 0 5px}
.repd-report-launch button{border:1px solid #42636b;background:#060d11;color:#7ff1f0;
padding:8px 11px;min-height:34px;cursor:pointer;font:700 11px/1.25 "Courier New",monospace}
.repd-report-launch button[aria-pressed="true"]{border-color:#7ff1f0;background:#102d30;color:#fff}
.repd-report-launch button:focus-visible,.repd-report-close:focus-visible,
.repd-report-more:focus-visible,.repd-report-group summary:focus-visible{
outline:2px solid #ffff00;outline-offset:2px}
#repdReportsPanel{background:#03090c;border:1px solid #355660;color:#d9eff0;margin:4px 0 11px;
padding:10px;font:12px/1.35 "Courier New",monospace;min-width:0}
.repd-report-head{display:flex;gap:8px;flex-wrap:wrap;align-items:center;justify-content:flex-end}
.repd-report-head label{display:flex;align-items:center;gap:5px;margin-right:auto;font-weight:700}
.repd-report-head select,.repd-report-head button{background:#061013;color:#91eded;border:1px solid #36535b;
font:700 11px "Courier New",monospace;min-height:32px;padding:6px;cursor:pointer}
#repdReportsSummary{margin:9px 0;padding:5px 0;color:#a7d2d5;line-height:1.55}
#repdReportsBody{max-height:min(67vh,720px);overflow:auto;overscroll-behavior:contain}
.repd-report-row{display:grid;grid-template-columns:minmax(190px,2.4fr) repeat(4,minmax(100px,1fr));
align-items:center;gap:7px;padding:9px 7px;min-width:735px}
.repd-report-columns{font-weight:700;color:#8aabb5;background:#081316;position:sticky;top:0;z-index:2;
border-bottom:1px solid #49707c}
.repd-report-group{border-bottom:1px solid #1c3a43}
.repd-report-group summary{list-style:none;cursor:pointer;color:#e1f5f5}
.repd-report-group summary::-webkit-details-marker{display:none}
.repd-report-group summary:hover{background:#092026}
.repd-report-name{font-weight:700;color:#7dedf4;overflow-wrap:anywhere}
.repd-report-track{grid-column:1/-1;display:block;background:#0f2027;height:4px;overflow:hidden}
.repd-report-bar{display:block;height:100%;background:#3ba5b4}
.repd-report-group-details{padding:10px 8px 14px;background:#050e12}
.repd-report-subtitle{font-size:11px;letter-spacing:.2px;margin:8px 0;color:#85dce6}
.repd-report-statuses{display:grid;gap:2px;margin:3px 0 12px}
.repd-report-status-item{display:grid;grid-template-columns:minmax(150px,1.5fr) minmax(90px,.55fr) minmax(180px,2fr);
gap:8px;padding:6px 3px;border-bottom:1px solid #182c36}
.repd-report-project-list{display:grid;gap:3px}
.repd-report-project{display:grid;grid-template-columns:minmax(170px,2fr) 85px minmax(120px,1fr) 95px 54px;
gap:7px;align-items:center;padding:7px 2px;border-bottom:1px solid #1a2b32;min-width:610px}
.repd-report-project a{color:#85e5ef;text-decoration:underline;text-underline-offset:2px}
.repd-report-project a.repd-report-map{border:1px solid #39565e;color:#eff;border-radius:2px;
padding:3px 6px;text-align:center;text-decoration:none;font-weight:700}
.repd-report-no-map{color:#8b9da4}
.repd-report-more{margin:10px 0 2px;border:1px solid #4e6470;background:#101c22;color:#a9edef;
padding:8px 12px;cursor:pointer}
.repd-report-more[hidden]{display:none!important}
@media(max-width:680px){
#repdReportsPanel{padding:7px}
.repd-report-head{justify-content:flex-start}
.repd-report-head label{flex-basis:100%;flex-wrap:wrap}
.repd-report-status-item{grid-template-columns:1fr;gap:2px}
.repd-report-group-details{overflow-x:auto}
}V973 Renewable Energy Planning Database (REPD) Reports Browser
A JavaScript module in the tests folder of GlobalGrid2050 that tests the REPD register and uses data from the GridAtlas repository.
testglobalgrid2050 / uk_renewables_pipeline/202611222330/tests/v973-repd-reports-browser.mjs · lines 1–70 of 70 · version 2026-11-22 23:30 · Entry point
- What it does
- It tests the REPD register. Uses libraries node:assert/strict, playwright. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Pn V973 Capacity Reports Workflow (globalgrid2050).
- What it achieves
- Its code works with 1000 MW.
- Why it matters
- Run by GlobalGrid2050 Pn V973 Capacity Reports Workflow.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611222330/tests · JavaScript module
- Uses
- GridAtlas — Atlas Page (estate URL), node:assert/strict, playwright
- Used by
- run by GlobalGrid2050 Pn V973 Capacity Reports Workflow (workflow run)
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611222330/tests/v973-repd-reports-browser.mjs:1-70 · blob ec8ca7594fd54b1e5a8188d32c0a498c853dc7a0 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import assert from "node:assert/strict";
import { chromium, webkit } from "playwright";
const origin = "http://127.0.0.1:8765/uk_renewables_pipeline/202611222330/";
for (const [name, engine] of [["chromium", chromium], ["webkit", webkit]]) {
const browser = await engine.launch({ headless: true });
try {
for (const viewport of [{width:393,height:852},{width:852,height:393}]) {
const context = await browser.newContext({ viewport, isMobile:true, hasTouch:true, reducedMotion:"reduce" });
const page = await context.newPage();
const errors = [];
page.on("pageerror", error => errors.push(error.message));
await page.route("https://raw.githubusercontent.com/**", route => route.abort());
try {
await page.goto(origin, { waitUntil: "domcontentloaded", timeout: 90000 });
await page.waitForFunction(() =>
document.querySelectorAll("#tbody tr[id^=repd-]").length === 50 &&
!!document.querySelector("#tbody .pn-journey-link.atlaslink[href]"),
{ timeout: 90000 });
const initialMap = await page.locator("#tbody .pn-journey-link.atlaslink[href]").first().getAttribute("href");
assert.equal(new URL(initialMap).pathname, "/gridatlas/atlas/");
for (const dimension of ["operator","status","region"]) {
const button = page.locator('[data-repd-report="' + dimension + '"]');
await button.click();
assert.equal(await button.getAttribute("aria-pressed"), "true");
const panel = page.locator("#repdReportsPanel");
await panel.waitFor({state:"visible"});
await page.waitForFunction(() => document.querySelector("#repdReportsSummary")?.textContent?.includes("7,775 projects"));
const groups = await page.locator("#repdReportsBody .repd-report-group").count();
assert.ok(groups >= 2, dimension + " must show full REPD grouping");
const first = page.locator("#repdReportsBody .repd-report-group").first();
await first.locator("summary").click();
await first.locator(".repd-report-project").first().waitFor();
const refLink = await first.locator(".repd-report-project a").first().getAttribute("href");
assert.ok(new URL(refLink).searchParams.get("q"), dimension + " links into original REPD register");
const mapLink = first.locator(".repd-report-map").first();
if (await mapLink.count()) {
const href = new URL(await mapLink.getAttribute("href"));
assert.equal(href.origin + href.pathname,"https://ventusltd.github.io/gridatlas/atlas/");
assert.ok(href.searchParams.get("repd_ref"));
}
await page.locator("#repdReportsClose").click();
assert.equal(await panel.isVisible(), false);
assert.equal(await button.getAttribute("aria-pressed"), "false");
}
// Live filters stay in the canonical register, and the filtered report reconciles.
await page.locator('[data-repd-report="region"]').click();
await page.locator("#repdReportScope").selectOption("filtered");
await page.locator("#minMW").fill("1000");
await page.locator("#applyMW").click();
await page.waitForFunction(() => {
const text = document.querySelector("#repdReportsSummary")?.textContent || "";
const number = text.match(/([0-9,]+) projects/);
return number && Number(number[1].replaceAll(",","")) < 7775;
});
const filtered = await page.locator("#repdReportsSummary").textContent();
assert.ok(filtered.includes("Current REPD table filters"));
await page.locator("#repdReportsClose").click();
// The ≥1000 MW subset can legitimately lack coordinates: never assert MAP for every row.
await page.locator("#minMW").fill("");
await page.locator("#applyMW").click();
await page.waitForFunction(() => !!document.querySelector("#tbody .pn-journey-link.atlaslink[href]"));
assert.equal(await page.locator("#tbody .pn-journey-link.atlaslink[href]").first().getAttribute("href"), initialMap,
"Restored native REPD MAP must remain unchanged after report filtering");
assert.deepEqual(errors, [], "No uncaught errors in REPD/report integration");
console.log("PASS V9.73",name,viewport.width+"x"+viewport.height,"operator,status,region,drilldown,filtered,MAP");
} finally { await context.close(); }
}
} finally { await browser.close(); }
}