In this section
- Browser render · globalgrid2050 / automation/v934_preview/browser.mjs lines 1–71
- Browser render · globalgrid2050 / automation/v935_preview/browser.mjs lines 1–85
- Browser render · globalgrid2050 / automation/v936_preview/browser.mjs lines 1–76
- Contracts Test test · globalgrid2050 / automation/v936_preview/contracts.test.mjs lines 1–35
- Browser render · globalgrid2050 / automation/v937_preview/browser.mjs lines 1–46
- Contracts Test test · globalgrid2050 / automation/v937_preview/contracts.test.mjs lines 1–19
- Browser render · globalgrid2050 / automation/v938_preview/browser.mjs lines 1–30
- Contracts Test test · globalgrid2050 / automation/v938_preview/contracts.test.mjs lines 1–10
- Browser render · globalgrid2050 / automation/v939_preview/browser.mjs lines 1–27
- Contracts Test test · globalgrid2050 / automation/v939_preview/contracts.test.mjs lines 1–10
- Android render · globalgrid2050 / automation/v940_preview/android.mjs lines 1–211
- Browser render · globalgrid2050 / automation/v940_preview/browser.mjs lines 1–41
- Contracts Test test · globalgrid2050 / automation/v940_preview/contracts.test.mjs lines 1–11
Browser
A JavaScript module in the automation folder of GlobalGrid2050 covering the Renewable Energy Planning Database (REPD) register.
renderglobalgrid2050 / automation/v934_preview/browser.mjs · lines 1–71 of 71 · Not reached from any entry point (candidate for review) · pattern display (shared by 4 files)
- What it does
- It draws the REPD register. Defines display. Uses libraries node:assert/strict, node:http, node:fs, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files.
- Why it exists in the grid workflow
- Domain terms in the code: the REPD register.
- Inputs & outputs
- In: JSON file build_manifest.json; JSON file project_identity_2026q3.json. Out: JSON file receipt.json.
- What it achieves
- Defines `display`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/v934_preview · JavaScript module
- Uses
- node:assert/strict, node:http, node:fs, node:path, node:url
- Used by
- none found
- Produces
- display
- Defines here
- display
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v934_preview/browser.mjs:1-71 · blob 7c28a1fc46afd8f53c1f9b50fe32360d505fc6b8 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
import assert from 'node:assert/strict';
import {createServer} from 'node:http';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {resolve,extname} from 'node:path';
import {pathToFileURL} from 'node:url';
const root=resolve(import.meta.dirname,'../..'), edition='uk_renewables_pipeline/202611171141';
const {chromium}=await import(process.env.PLAYWRIGHT_MODULE ? pathToFileURL(process.env.PLAYWRIGHT_MODULE).href : 'playwright');
const manifest=JSON.parse(readFileSync(resolve(root,edition,'data/v9.1/build_manifest.json')));
const rows=manifest.project_partitions.flatMap(p=>JSON.parse(readFileSync(resolve(root,edition,p.path))).projects);
const fixture=JSON.parse(readFileSync(resolve(root,'uk_renewables_pipeline/202611132345/fixtures/2026q3/project_identity_2026q3.json')));
const source=new Map(fixture.records.map(r=>[r.repd_ref,r]));
for(const row of rows) for(const key of ['planning_application_submitted','repd_record_updated']) assert.equal(row[key],source.get(row.repd_ref)[key],row.repd_ref+' '+key);
const cases=[rows.find(r=>r.planning_application_submitted&&r.planning_application_submitted!==r.repd_record_updated),rows.find(r=>!r.planning_application_submitted)];
assert.ok(cases.every(Boolean));
const server=createServer((req,res)=>{try{const file=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://local').pathname));assert.ok(file.startsWith(root));const bytes=readFileSync(file);res.setHeader('Content-Type',({'.js':'text/javascript','.mjs':'text/javascript','.json':'application/json','.css':'text/css','.html':'text/html'})[extname(file)]||'application/octet-stream');res.end(bytes … [line shortened here: 438 characters; full line on GitHub]
await new Promise(r=>server.listen(0,'127.0.0.1',r));
const origin='http://127.0.0.1:'+server.address().port, out=resolve(process.env.V934_OUT||'D:/githubfiles/.qa-artifacts/v934-agent-a');mkdirSync(out,{recursive:true});
let browser;
const proof={edition,checks:[],canonical_rows:rows.length,source_dates_equal:true,submitted:rows.filter(r=>r.planning_application_submitted).length,missing:rows.filter(r=>!r.planning_application_submitted).length,limitations:['Local Chromium with external network blocked; no deployed or physical handset certification.']};
const display=v=>v?v.split('-').reverse().join('/'):'not supplied by REPD';
try{
browser=await chromium.launch({headless:true});
for(const width of [1440,393,390]){
const context=await browser.newContext({viewport:{width,height:900},isMobile:width<500,hasTouch:width<500});
await context.route('**/*',route=>route.request().url().startsWith(origin)?route.continue():route.abort());
const page=await context.newPage();await page.goto(origin+'/'+edition+'/index.html?technology=all');await page.waitForFunction(()=>Number(document.querySelector('#tbody')?.dataset.total)===7775);
assert.equal(await page.locator('#planningSubmittedHeader').evaluate(n=>n.previousElementSibling.id),'repdUpdatedHeader');
for(const project of cases){
await page.locator('#search').fill(project.repd_ref);const row=page.locator('#repd-'+project.repd_ref);await row.waitFor();
assert.equal(await row.getAttribute('data-planning-application-submitted'),project.planning_application_submitted||'');
assert.equal(await row.locator('.planning-submitted').textContent(),display(project.planning_application_submitted));
assert.equal(await row.locator('.planning-submitted').evaluate(n=>n.previousElementSibling.classList.contains('repd-updated')),true);
await row.locator('summary').click();assert.match(await row.locator('.record-grid').innerText(),new RegExp(display(project.planning_application_submitted).replaceAll('/','\\/')));
assert.match(await row.locator('.record-grid').innerText(),/PLANNING APPLICATION SUBMITTED/);
const downloadPromise=page.waitForEvent('download');await page.locator('#export').click();const download=await downloadPromise;const csv=readFileSync(await download.path(),'utf8');assert.ok(csv.includes('"Planning Application Submitted"'));assert.ok(csv.includes('"'+(project.planning_application_submitted||'')+'"'));
proof.checks.push({width,ref:project.repd_ref,submitted:project.planning_application_submitted,status:'PASS'});
}
await page.locator('#clearFilters').click();
for(const [field,prefix,yearId] of [['planning_application_submitted','submitted','submittedYear'],['repd_record_updated','updated','updatedYear']]){
const yearSelect=page.locator('[data-year-filter="'+yearId+'"]').first();
assert.deepEqual(await yearSelect.locator('option').evaluateAll(ns=>ns.slice(2).map(n=>n.value)),[...new Set(rows.map(r=>r[field]?.slice(0,4)).filter(Boolean))].sort().reverse());
for(const direction of ['asc','desc']){
await page.locator('#sortProjects').selectOption(prefix+'_'+direction);
const sorted=[...rows].sort((a,b)=>!a[field]?(b[field]?1:0):!b[field]?-1:direction==='asc'?a[field].localeCompare(b[field]):b[field].localeCompare(a[field]));
assert.equal(await page.locator('#tbody tr').first().getAttribute('id'),'repd-'+sorted[0].repd_ref);
assert.equal(await page.locator(prefix==='updated'?'#repdUpdatedHeader':'#planningSubmittedHeader').getAttribute('aria-sort'),direction==='asc'?'ascending':'descending');
}
for(const year of ['2025','missing']){
await yearSelect.selectOption(year);const expected=rows.filter(r=>year==='missing'?!r[field]:r[field]?.startsWith(year+'-'));
assert.equal(await page.locator('#tbody').getAttribute('data-total'),String(expected.length));
assert.equal(new URL(page.url()).searchParams.get(prefix+'_year'),year);
const promise=page.waitForEvent('download');await page.locator('#export').click();const csv=readFileSync(await (await promise).path(),'utf8');assert.equal(csv.split('\r\n').length-1,expected.length);
await page.reload();await page.waitForFunction(n=>Number(document.querySelector('#tbody')?.dataset.total)===n,expected.length);
assert.equal(await yearSelect.inputValue(),year);
}
await yearSelect.selectOption('All');proof.checks.push({width,field,sort_both_directions:true,years_and_missing:true,url_restored:true,csv_count:true,status:'PASS'});
}
await page.locator('[data-year-filter="submittedYear"]').first().selectOption('2025');await page.locator('[data-year-filter="updatedYear"]').first().selectOption('2025');
assert.equal(await page.locator('#tbody').getAttribute('data-total'),String(rows.filter(r=>r.planning_application_submitted?.startsWith('2025-')&&r.repd_record_updated?.startsWith('2025-')).length));
await page.locator('#clearFilters').click();assert.equal(await page.locator('#tbody').getAttribute('data-total'),'7775');
if(width===1440){
for(const prefix of ['submitted','updated']){
const header=page.locator(prefix==='submitted'?'#planningSubmittedHeader':'#repdUpdatedHeader');await header.locator('summary').click();await header.locator('[data-date-sort="'+prefix+'_asc"]').click();assert.equal(await header.getAttribute('aria-sort'),'ascending');
await header.locator('summary').click();await header.locator('select').selectOption('2025');assert.equal(await page.locator('[data-year-filter="'+(prefix==='submitted'?'submittedYear':'updatedYear')+'"]').first().inputValue(),'2025');await header.locator('summary').click();await page.locator('#clearFilters').click();
}
}
assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await page.screenshot({path:resolve(out,'planning-'+width+'.png')});await context.close();
}
proof.status='PASS';
}finally{if(browser)await browser.close();await new Promise(r=>server.close(r));writeFileSync(resolve(out,'receipt.json'),JSON.stringify(proof,null,2));}
console.log(JSON.stringify(proof));Browser
A JavaScript module in the automation folder of GlobalGrid2050 covering the Renewable Energy Planning Database (REPD) register.
renderglobalgrid2050 / automation/v935_preview/browser.mjs · lines 1–85 of 85 · Not reached from any entry point (candidate for review) · pattern display (shared by 4 files)
- What it does
- It draws the REPD register. Defines display. Uses libraries node:assert/strict, node:http, node:fs, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files.
- Why it exists in the grid workflow
- Domain terms in the code: the REPD register.
- Inputs & outputs
- In: JSON file build_manifest.json; JSON file project_identity_2026q3.json. Out: JSON file receipt.json.
- What it achieves
- Defines `display`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/v935_preview · JavaScript module
- Uses
- node:assert/strict, node:http, node:fs, node:path, node:url
- Used by
- none found
- Produces
- display
- Defines here
- display
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v935_preview/browser.mjs:1-85 · blob 539c871b86113d201a11c1059163dcaaa1747c67 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
import assert from 'node:assert/strict';
import {createServer} from 'node:http';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {resolve,extname} from 'node:path';
import {pathToFileURL} from 'node:url';
const root=resolve(import.meta.dirname,'../..'), edition='uk_renewables_pipeline/202611171217';
const {chromium}=await import(process.env.PLAYWRIGHT_MODULE ? pathToFileURL(process.env.PLAYWRIGHT_MODULE).href : 'playwright');
const manifest=JSON.parse(readFileSync(resolve(root,edition,'data/v9.1/build_manifest.json')));
const rows=manifest.project_partitions.flatMap(p=>JSON.parse(readFileSync(resolve(root,edition,p.path))).projects);
const fixture=JSON.parse(readFileSync(resolve(root,'uk_renewables_pipeline/202611132345/fixtures/2026q3/project_identity_2026q3.json')));
const source=new Map(fixture.records.map(r=>[r.repd_ref,r]));
for(const row of rows) for(const key of ['planning_application_submitted','repd_record_updated','operational']) assert.equal(row[key],source.get(row.repd_ref)[key],row.repd_ref+' '+key);
const cases=[rows.find(r=>r.planning_application_submitted&&r.planning_application_submitted!==r.repd_record_updated),rows.find(r=>!r.planning_application_submitted)];
assert.ok(cases.every(Boolean));
const server=createServer((req,res)=>{try{const file=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://local').pathname));assert.ok(file.startsWith(root));const bytes=readFileSync(file);res.setHeader('Content-Type',({'.js':'text/javascript','.mjs':'text/javascript','.json':'application/json','.css':'text/css','.html':'text/html'})[extname(file)]||'application/octet-stream');res.end(bytes … [line shortened here: 438 characters; full line on GitHub]
await new Promise(r=>server.listen(0,'127.0.0.1',r));
const origin='http://127.0.0.1:'+server.address().port, out=resolve(process.env.V935_OUT||'D:/githubfiles/.qa-artifacts/v935-operational-support');mkdirSync(out,{recursive:true});
let browser;
const proof={edition,checks:[],canonical_rows:rows.length,source_dates_equal:true,submitted:rows.filter(r=>r.planning_application_submitted).length,missing:rows.filter(r=>!r.planning_application_submitted).length,limitations:['Local Chromium with external network blocked; no deployed or physical handset certification.']};
const display=v=>v?v.split('-').reverse().join('/'):'not supplied by REPD';
try{
browser=await chromium.launch({headless:true});
for(const width of [1440,393,390]){
const context=await browser.newContext({viewport:{width,height:900},isMobile:width<500,hasTouch:width<500});
await context.route('**/*',route=>route.request().url().startsWith(origin)?route.continue():route.abort());
const page=await context.newPage();await page.goto(origin+'/'+edition+'/index.html?technology=all');await page.waitForFunction(()=>Number(document.querySelector('#tbody')?.dataset.total)===7775);
assert.equal(await page.locator('#operationalHeader').evaluate(n=>n.previousElementSibling.id),'planningSubmittedHeader');
assert.equal(await page.locator('#planningSubmittedHeader').evaluate(n=>n.previousElementSibling.id),'repdUpdatedHeader');
for(const project of cases){
await page.locator('#search').fill(project.repd_ref);const row=page.locator('#repd-'+project.repd_ref);await row.waitFor();
assert.equal(await row.getAttribute('data-planning-application-submitted'),project.planning_application_submitted||'');
assert.equal(await row.locator('.planning-submitted').textContent(),display(project.planning_application_submitted));
assert.equal(await row.locator('.planning-submitted').evaluate(n=>n.previousElementSibling.classList.contains('repd-updated')),true);
await row.locator('summary').click();assert.match(await row.locator('.record-grid').innerText(),new RegExp(display(project.planning_application_submitted).replaceAll('/','\\/')));
assert.match(await row.locator('.record-grid').innerText(),/PLANNING APPLICATION SUBMITTED/);
const downloadPromise=page.waitForEvent('download');await page.locator('#export').click();const download=await downloadPromise;const csv=readFileSync(await download.path(),'utf8');assert.ok(csv.includes('"Planning Application Submitted"'));assert.ok(csv.includes('"'+(project.planning_application_submitted||'')+'"'));
proof.checks.push({width,ref:project.repd_ref,submitted:project.planning_application_submitted,status:'PASS'});
}
await page.locator('#clearFilters').click();
for(const [field,prefix,yearId] of [['planning_application_submitted','submitted','submittedYear'],['repd_record_updated','updated','updatedYear'],['operational','operational','operationalYear']]){
const yearSelect=page.locator('[data-year-filter="'+yearId+'"]').first();
assert.deepEqual(await yearSelect.locator('option').evaluateAll(ns=>ns.slice(2).map(n=>n.value)),[...new Set(rows.map(r=>r[field]?.slice(0,4)).filter(Boolean))].sort().reverse());
for(const direction of ['asc','desc']){
await page.locator('#sortProjects').selectOption(prefix+'_'+direction);
const sorted=[...rows].sort((a,b)=>!a[field]?(b[field]?1:0):!b[field]?-1:direction==='asc'?a[field].localeCompare(b[field]):b[field].localeCompare(a[field]));
assert.equal(await page.locator('#tbody tr').first().getAttribute('id'),'repd-'+sorted[0].repd_ref);
assert.equal(await page.locator(prefix==='updated'?'#repdUpdatedHeader':prefix==='submitted'?'#planningSubmittedHeader':'#operationalHeader').getAttribute('aria-sort'),direction==='asc'?'ascending':'descending');
}
for(const year of ['2025','missing']){
await yearSelect.selectOption(year);const expected=rows.filter(r=>year==='missing'?!r[field]:r[field]?.startsWith(year+'-'));
assert.equal(await page.locator('#tbody').getAttribute('data-total'),String(expected.length));
assert.equal(new URL(page.url()).searchParams.get(prefix+'_year'),year);
const promise=page.waitForEvent('download');await page.locator('#export').click();const csv=readFileSync(await (await promise).path(),'utf8');assert.equal(csv.split('\r\n').length-1,expected.length);
await page.reload();await page.waitForFunction(n=>Number(document.querySelector('#tbody')?.dataset.total)===n,expected.length);
assert.equal(await yearSelect.inputValue(),year);
}
await yearSelect.selectOption('All');proof.checks.push({width,field,sort_both_directions:true,years_and_missing:true,url_restored:true,csv_count:true,status:'PASS'});
}
await page.locator('[data-year-filter="submittedYear"]').first().selectOption('2025');await page.locator('[data-year-filter="updatedYear"]').first().selectOption('2025');
assert.equal(await page.locator('#tbody').getAttribute('data-total'),String(rows.filter(r=>r.planning_application_submitted?.startsWith('2025-')&&r.repd_record_updated?.startsWith('2025-')).length));
await page.locator('#clearFilters').click();assert.equal(await page.locator('#tbody').getAttribute('data-total'),'7775');
if(width===1440){
for(const prefix of ['submitted','updated','operational']){
const header=page.locator(prefix==='submitted'?'#planningSubmittedHeader':prefix==='updated'?'#repdUpdatedHeader':'#operationalHeader');await header.locator('summary').click();await header.locator('[data-date-sort="'+prefix+'_asc"]').click();assert.equal(await header.getAttribute('aria-sort'),'ascending');
await header.locator('summary').click();await header.locator('select').selectOption('2025');assert.equal(await page.locator('[data-year-filter="'+(prefix==='submitted'?'submittedYear':prefix==='updated'?'updatedYear':'operationalYear')+'"]').first().inputValue(),'2025');await header.locator('summary').click();await page.locator('#clearFilters').click();
}
}
await page.locator('#clearFilters').click();
for(const project of [rows.find(r=>r.operational),rows.find(r=>!r.operational),...rows.filter(r=>['8100','21493'].includes(r.repd_ref)),rows.find(r=>r.status==='Operational'&&!r.operational)]){
assert.ok(project);await page.locator('#search').fill(project.repd_ref);const row=page.locator('#repd-'+project.repd_ref);await row.waitFor();assert.equal(await row.getAttribute('data-operational'),project.operational||'');assert.equal(await row.locator('.operational-date').textContent(),display(project.operational));assert.equal(await row.locator('td').nth(4).textContent(),project.status);awai … [line shortened here: 610 characters; full line on GitHub]
}
await page.locator('#clearFilters').click();await page.locator('[data-repd-expand]').click();
for(const [field,prefix] of [['planning_application_submitted','submitted'],['repd_record_updated','updated'],['operational','operational']])for(const direction of ['asc','desc']){
await page.locator('#sortProjects').selectOption(prefix+'_'+direction);
const oracle=[...rows].sort((a,b)=>!a[field]?(b[field]?1:0):!b[field]?-1:(direction==='asc'?1:-1)*(Date.parse(a[field])-Date.parse(b[field]))).map(r=>r.repd_ref);
const actual=await page.evaluate(async()=>{const {state}=await import(new URL('scripts/core/state.js',location.href));return state.filtered.map(r=>r.repd_ref);});assert.deepEqual(actual,oracle);assert.deepEqual(await page.locator('#tbody tr').evaluateAll(ns=>ns.map(n=>n.id.slice(5))),oracle.slice(0,20));
}
await page.locator('[data-year-filter="updatedYear"]').first().selectOption('2025');await page.locator('[data-year-filter="operationalYear"]').first().selectOption('missing');assert.equal(await page.locator('[data-year-filter="updatedYear"]').first().inputValue(),'2025');const expected=rows.filter(r=>r.repd_record_updated?.startsWith('2025-')&&!r.operational).map(r=>r.repd_ref).sort();const actu … [line shortened here: 890 characters; full line on GitHub]
await page.goto(origin+'/'+edition+'/index.html?technology=all&operational_year=invalid&updated_year=invalid&submitted_year=invalid&sort=invalid');await page.waitForFunction(()=>Number(document.querySelector('#tbody')?.dataset.total)===7775);assert.equal(await page.locator('#sortProjects').inputValue(),'capacity_desc');for(const id of ['operationalYear','updatedYear','submittedYear'])assert.equa … [line shortened here: 480 characters; full line on GitHub]
proof.checks.push({width,full_numeric_date_order_ids:rows.length*6,operational_status_edges_preserved:true,expanded_intersection_and_retention:true,invalid_url_defaults:true,status:'PASS'});
assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await page.screenshot({path:resolve(out,'planning-'+width+'.png')});await context.close();
}
proof.status='PASS';
}finally{if(browser)await browser.close();await new Promise(r=>server.close(r));writeFileSync(resolve(out,'receipt.json'),JSON.stringify(proof,null,2));}
console.log(JSON.stringify(proof));Browser
A JavaScript module in the automation folder of GlobalGrid2050 that draws pipeline headlines snapshot, using SHA-256. It is built from the touch drag helper (`touchDrag`).
renderglobalgrid2050 / automation/v936_preview/browser.mjs · lines 1–76 of 76 · Not reached from any entry point (candidate for review) · pattern touchDrag (shared by 6 files)
- What it does
- It draws pipeline headlines snapshot. Defines touchDrag. Uses libraries node:assert/strict, node:http, node:fs, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files.
- Inputs & outputs
- In: JSON file pipeline_headlines.snapshot.json. Out: JSON file receipt.json.
- What it achieves
- Defines `touchDrag`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/v936_preview · JavaScript module
- Uses
- Model (import), node:assert/strict, node:http, node:fs, node:path, node:url, node:crypto
- Used by
- none found
- Produces
- touchDrag
- Defines here
- touchDrag
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v936_preview/browser.mjs:1-76 · blob 8f7c06f14d1b484dda6b0a1e1a31801f7867bced · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
import assert from 'node:assert/strict';
import {createServer} from 'node:http';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {resolve,extname,sep} from 'node:path';
import {pathToFileURL} from 'node:url';
import {createHash} from 'node:crypto';
import {latestHeadlines} from '../../uk_renewables_pipeline/202611171507/scripts/layers/model.mjs';
const root=resolve(import.meta.dirname,'../..'),edition='uk_renewables_pipeline/202611171507';
const out=resolve(process.env.V936_OUT||'D:/githubfiles/.qa-artifacts/v936-ticker-worker');mkdirSync(out,{recursive:true});
const {chromium}=await import(process.env.PLAYWRIGHT_MODULE?pathToFileURL(process.env.PLAYWRIGHT_MODULE).href:'playwright');
const raw=readFileSync(resolve(root,edition,'news/pipeline_headlines.snapshot.json')),saved=JSON.parse(raw);
const observedRaw=process.env.V936_OBSERVED_LIVE_FILE?readFileSync(process.env.V936_OBSERVED_LIVE_FILE):null,observed=observedRaw?JSON.parse(observedRaw):null;
const fixture=count=>({schema:saved.schema,status:'ok',generated_at:'2026-11-17T14:00:00Z',scope:'Synthetic browser test; not collected publication evidence',items:Array.from({length:count},(_,i)=>({title:i===0?'<img src=x onerror=alert(1)> literal source title':'Synthetic attributed headline '+i,source:'Fixture publisher',link:'https://publisher.example/article/'+i,date:new Date(Date.parse('2026- … [line shortened here: 480 characters; full line on GitHub]
const server=createServer((req,res)=>{try{const file=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://local').pathname));assert.ok(file.startsWith(root+sep));const bytes=readFileSync(file);res.setHeader('Content-Type',({'.js':'text/javascript','.mjs':'text/javascript','.json':'application/json','.css':'text/css','.html':'text/html'})[extname(file)]||'application/octet-stream');res.end(b … [line shortened here: 442 characters; full line on GitHub]
await new Promise(r=>server.listen(0,'127.0.0.1',r));const origin='http://127.0.0.1:'+server.address().port;
const proof={status:'RUNNING',edition,utc:new Date().toISOString(),checks:[],saved_source:{sha256:createHash('sha256').update(raw).digest('hex'),generated_at:saved.generated_at,input:saved.items.length,eligible:latestHeadlines(saved.items).length},limitations:['Local Chromium desktop/touch emulation; physical handset and public served-byte acceptance are not claimed.','External network is blocked … [line shortened here: 513 characters; full line on GitHub]
async function touchDrag(session,{x,y,dx}){
await session.send('Input.dispatchTouchEvent',{type:'touchStart',touchPoints:[{x,y,id:1,radiusX:2,radiusY:2,force:1}]});
for(let i=1;i<=10;i++){await session.send('Input.dispatchTouchEvent',{type:'touchMove',touchPoints:[{x:x+dx*i/10,y,id:1,radiusX:2,radiusY:2,force:1}]});await new Promise(r=>setTimeout(r,16));}
await session.send('Input.dispatchTouchEvent',{type:'touchEnd',touchPoints:[]});
}
let browser;
try{
browser=await chromium.launch({headless:true});
for(const [width,reducedMotion] of [[1440,'no-preference'],[393,'no-preference'],[390,'reduce']]){
const context=await browser.newContext({viewport:{width,height:900},isMobile:width<500,hasTouch:width<500,reducedMotion});
await context.route('**/*',route=>route.request().url().startsWith(origin)?route.continue():route.abort());
const page=await context.newPage(),errors=[];page.on('pageerror',error=>errors.push(error.message));
await page.goto(origin+'/'+edition+'/index.html?technology=all');await page.waitForFunction(()=>Number(document.querySelector('#tbody')?.dataset.total)===7775&&document.querySelector('#headlineTicker')?.dataset.count==='71');
const host=page.locator('#headlineTicker'),search=host.getByRole('searchbox'),previous=host.getByRole('button',{name:'Previous headlines',exact:true}),next=host.getByRole('button',{name:'Next headlines',exact:true});
assert.equal(await page.locator('#newsStatus').getAttribute('data-state'),'snapshot');assert.match(await host.locator('.pn-ticker-label').innerText(),/saved snapshot collected.*articles may be older/i);assert.equal(await host.locator('.pn-ticker-label').isVisible(),true);
assert.equal(await page.locator('#liveNews .ln-item').count(),12);await page.locator('#liveNews .ln-more').click();assert.equal(await page.locator('#liveNews .ln-item').count(),24);
assert.equal(await host.getAttribute('data-count'),'71');assert.equal(await host.locator('a').count(),20);for(const href of await host.locator('a').evaluateAll(nodes=>nodes.map(node=>node.href)))assert.ok(saved.items.some(item=>item.link===href));
const savedLinks=[];for(let batch=0;batch<4;batch++){savedLinks.push(...await host.locator('a').evaluateAll(nodes=>nodes.map(node=>node.href)));assert.ok(await host.locator('a').count()<=20);if(await next.isDisabled())break;await next.click();}assert.deepEqual(savedLinks,latestHeadlines(saved.items).map(row=>row.link));assert.equal(await page.locator('#liveNews .ln-item').count(),24);
proof.checks.push({width,reducedMotion,saved_source71:true,all_saved71_pages_reachable:true,main_list12_then24:true,bounded20links:true,status:'PASS'});
await page.screenshot({path:resolve(out,'ticker-saved71-'+width+'.png')});
if(observed){
const eligible=latestHeadlines(observed.items);await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),observed);assert.equal(await host.getAttribute('data-count'),String(eligible.length));assert.deepEqual(await host.locator('a').evaluateAll(nodes=>nodes.map(node=>node.href)),eligible.slice(0,20).map(row=>row.link));assert.equal(await page.locator('#liveNews .ln-item').count(),12); … [line shortened here: 515 characters; full line on GitHub]
proof.checks.push({width,observed_live_replay:true,input:observed.items.length,eligible:eligible.length,generated_at:observed.generated_at,sha256:createHash('sha256').update(observedRaw).digest('hex'),main_list12_then24:true,status:'PASS'});
}
for(const count of [0,1,10,71,100]){
const doc=fixture(count);await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),doc);const expected=latestHeadlines(doc.items);
assert.equal(await host.getAttribute('data-count'),String(count));assert.equal(await host.getAttribute('data-filtered-count'),String(count));assert.match(await host.locator('.pn-ticker-count').innerText(),new RegExp(count+' of '+count+' headlines'));
assert.equal(await host.getByRole('button',{name:/pause|play|resume/i}).count(),0);assert.equal(await host.locator('[aria-hidden]').count(),0);assert.equal(await host.locator('img').count(),0);assert.equal(await host.locator('ul').count(),1);
const seen=[];let batch=0;
do{
const shown=expected.slice(batch*20,batch*20+20);assert.equal(await host.locator('a').count(),shown.length);assert.ok(shown.length<=20);
assert.deepEqual(await host.locator('a').allTextContents(),shown.map(row=>row.title+' \u2014 '+row.source));assert.deepEqual(await host.locator('time').evaluateAll(nodes=>nodes.map(node=>node.dateTime)),shown.map(row=>row.date));
seen.push(...await host.locator('a').evaluateAll(nodes=>nodes.map(node=>node.href)));assert.equal(await host.locator('.pn-ticker-track').evaluate(node=>getComputedStyle(node).animationName),'none');assert.equal(await host.locator('a[tabindex="-1"]').count(),0);
if(await next.isDisabled())break;await next.click();batch++;
}while(batch<6);
assert.deepEqual(seen,expected.map(row=>row.link));assert.equal(await page.locator('#liveNews .ln-item').count(),Math.min(count,12));
assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));proof.checks.push({width,count,all_source_items_reachable:true,bounded20links:true,one_list_no_clones_pause_animation:true,attribution_dates_title_literal:true,status:'PASS'});
}
const originalMain=await page.locator('#liveNews .ln-title').evaluateAll(nodes=>nodes.map(node=>node.href));await search.fill('literal source title');assert.equal(await host.getAttribute('data-filtered-count'),'1');assert.equal(await host.locator('a').count(),1);assert.equal(await host.locator('a').first().getAttribute('href'),'https://publisher.example/article/0');assert.equal(await host.getAtt … [line shortened here: 631 characters; full line on GitHub]
await search.fill('no such fixture headline');assert.equal(await host.getAttribute('data-filtered-count'),'0');assert.equal(await host.locator('a').count(),0);assert.match(await host.innerText(),/No matching headlines/);await search.fill('FIXTURE PUBLISHER');assert.equal(await host.getAttribute('data-filtered-count'),'100');await next.click();assert.equal(await host.getAttribute('data-page'),'2' … [line shortened here: 402 characters; full line on GitHub]
await search.focus();await page.evaluate(()=>{window.savedTickerSearch=document.querySelector('#headlineTicker input');window.savedTickerFirst=document.querySelector('#headlineTicker a');document.querySelector('#headlineTicker .pn-ticker-viewport').scrollLeft=100;});
const same=fixture(100);same.generated_at='2026-11-17T14:01:00Z';await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),same);assert.equal(await search.inputValue(),'FIXTURE PUBLISHER');assert.equal(await host.getAttribute('data-page'),'2');assert.equal(await page.evaluate(()=>document.querySelector('#headlineTicker input')===window.savedTickerSearch&&document.querySelector('#headl … [line shortened here: 590 characters; full line on GitHub]
await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),fixture(71));assert.equal(await search.inputValue(),'FIXTURE PUBLISHER');assert.equal(await host.getAttribute('data-page'),'1');assert.equal(await host.getAttribute('data-filtered-count'),'71');
await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),fixture(100));const viewport=host.locator('.pn-ticker-viewport'),keyboardLinks=[];
for(let batch=0;batch<5;batch++){
await viewport.scrollIntoViewIfNeeded();await viewport.focus();await page.keyboard.press('ArrowRight');await page.waitForFunction(()=>document.querySelector('#headlineTicker .pn-ticker-viewport').scrollLeft>0);
for(const anchor of await host.locator('a').all()){
await page.keyboard.press('Tab');assert.equal(await anchor.evaluate(node=>node===document.activeElement),true);assert.ok(await anchor.evaluate(node=>{const a=node.getBoundingClientRect(),v=node.closest('.pn-ticker-viewport').getBoundingClientRect();return a.right>v.left&&a.left<v.right;}));keyboardLinks.push(await anchor.getAttribute('href'));
}
if(batch<4)await next.click();
}
assert.equal(new Set(keyboardLinks).size,100);assert.equal(await next.isDisabled(),true);await previous.click();assert.equal(await host.getAttribute('data-page'),'4');
if(width<500){await viewport.evaluate(node=>{node.scrollLeft=0;});await viewport.scrollIntoViewIfNeeded();const box=await viewport.boundingBox(),session=await context.newCDPSession(page);await touchDrag(session,{x:box.x+box.width*.8,y:box.y+box.height*.5,dx:-Math.min(180,box.width*.6)});await page.waitForFunction(()=>document.querySelector('#headlineTicker .pn-ticker-viewport').scrollLeft>0);awa … [line shortened here: 421 characters; full line on GitHub]
await search.fill('');const mixed=fixture(1);mixed.items.push({...mixed.items[0]},{...mixed.items[0],link:'javascript:alert(1)'},{...mixed.items[0],link:'https://publisher.example/future',date:'2050-01-01'},{...mixed.items[0],link:'https://publisher.example/impossible',date:'2026-02-30'});await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),mixed);assert.equal(await host.locator( … [line shortened here: 472 characters; full line on GitHub]
const fallback=fixture(1);fallback.items[0].date=null;fallback.items[0].source='';await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),fallback);assert.match(await page.locator('#headlineTicker time').innerText(),/^First collected 2026-11-17T00:00:00Z$/);assert.match(await page.locator('#headlineTicker a').innerText(),/Publisher not supplied/);
await page.screenshot({path:resolve(out,'ticker-'+width+'.png')});assert.deepEqual(errors,[]);proof.checks.push({width,native_keyboard_all100_reachable_in5boundedpages:true,native_touch_scroll:width<500,title_publisher_search_beyondfirstpage:true,samefeed_preserves_nodes_focus_query_range_scroll:true,changedfeed_preserves_query_resets_range:true,main_list_independent:true,duplicate_future_unsafe … [line shortened here: 498 characters; full line on GitHub]
}
proof.status='PASS';
}finally{if(browser)await browser.close();await new Promise(r=>server.close(r));writeFileSync(resolve(out,'receipt.json'),JSON.stringify(proof,null,2)+'\n');}
console.log(JSON.stringify(proof));Contracts Test
A test in the automation folder of GlobalGrid2050 that checks Model, using SHA-256.
testglobalgrid2050 / automation/v936_preview/contracts.test.mjs · lines 1–35 of 35 · Entry point · pattern fixture (shared by 30 files)
- What it does
- It tests its inputs. Defines fixture. Uses libraries node:test, node:assert/strict, node:crypto, node:fs. Side effects: reads or writes files.
- Inputs & outputs
- In: JSON file pipeline_headlines.snapshot.json.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 V934 Preview Acceptance Workflow (globalgrid2050).
- What it achieves
- Defines `fixture`.
- Why it matters
- Run by GlobalGrid2050 V934 Preview Acceptance Workflow.
- Application
- globalgrid2050 · automation/v936_preview · test
- Uses
- Model (import), node:test, node:assert/strict, node:crypto, node:fs
- Used by
- run by GlobalGrid2050 V934 Preview Acceptance Workflow (workflow run)
- Produces
- fixture
- Defines here
- fixture
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v936_preview/contracts.test.mjs:1-35 · blob 6cffd5f38ac6a0ece163c083e37792d04a0e9f70 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
import {test} from 'node:test';
import assert from 'node:assert/strict';
import {createHash} from 'node:crypto';
import {readFileSync} from 'node:fs';
import {latestHeadlines} from '../../uk_renewables_pipeline/202611171507/scripts/layers/model.mjs';
const asOf=Date.parse('2026-11-17T23:00:00Z');
const fixture=count=>Array.from({length:count},(_,i)=>({title:'Synthetic attributed headline '+i,source:'Fixture publisher',link:'https://publisher.example/article/'+i,date:new Date(Date.parse('2026-11-01T00:00:00Z')+i*60000).toISOString(),first_seen:'2026-11-17T00:00:00Z'}));
for(const count of [0,1,10,71,100])test('available '+count+' headlines stay '+count+' without padding',()=>{
const input=fixture(count),copy=structuredClone(input),result=latestHeadlines(input,100,{asOf});assert.equal(result.length,count);assert.equal(new Set(result.map(row=>row.link)).size,count);assert.deepEqual(input,copy);
for(const row of result){const original=input.find(item=>item.link===row.link);assert.equal(row.title,original.title);assert.equal(row.source,original.source);assert.equal(row.date,original.date);assert.equal(row.dateKind,'Publisher date');}
});
test('default ceiling100 and explicit10 retain latest deterministic source order',()=>{
const items=fixture(130);assert.equal(latestHeadlines(items,undefined,{asOf}).length,100);const ten=latestHeadlines(items,10,{asOf});assert.equal(ten.length,10);assert.equal(ten[0].title,items.at(-1).title);assert.equal(ten.at(-1).title,items.at(-10).title);
for(const value of [0,-1,101,1.2,'10',NaN])assert.deepEqual(latestHeadlines(items,value,{asOf}),[]);
});
test('duplicates collapse by source URL and latest genuine date wins',()=>{
const items=fixture(2);items.push({...items[0],date:'2026-11-10',title:'Updated source headline'});const result=latestHeadlines(items,100,{asOf});assert.equal(result.length,2);assert.equal(result[0].title,'Updated source headline');
});
test('unsafe URLs, malformed/impossible/future clocks and blank titles withheld',()=>{
const original=fixture(1)[0];
for(const date of ['2026-02-30','2026-11-31T12:00:00Z','2026-11-17T24:00:00Z','2050-01-01','not-a-date','2026-13-01'])assert.deepEqual(latestHeadlines([{...original,date}],100,{asOf}),[],date);
for(const link of ['javascript:alert(1)','http://publisher.example/a','https://user:pass@publisher.example/a','https://127.0.0.1/a','https://localhost/a','https://192.168.1.1/a','https://[::1]/a','https://router.internal/a'])assert.deepEqual(latestHeadlines([{...original,link}],100,{asOf}),[],link);
for(const title of ['', ' ',null,{},'x'.repeat(1001)])assert.deepEqual(latestHeadlines([{...original,title}],100,{asOf}),[]);
assert.deepEqual(latestHeadlines(null),[]);assert.deepEqual(latestHeadlines(Array(10001).fill(original)),[]);assert.deepEqual(latestHeadlines([original],100,{asOf:NaN}),[]);
});
test('first-collected fallback and missing attribution remain explicitly unknown',()=>{
const item={...fixture(1)[0],date:null,first_seen:'2026-11-16T09:17:00Z',source:null};const [row]=latestHeadlines([item],100,{asOf});assert.equal(row.dateKind,'First collected');assert.equal(row.date,item.first_seen);assert.equal(row.source,'Publisher not supplied');
assert.deepEqual(latestHeadlines([{...item,first_seen:null}],100,{asOf}),[]);
assert.equal(latestHeadlines([{...item,date:'2024-02-29'}],100,{asOf})[0].dateKind,'Publisher date');
});
test('actual saved source snapshot supplies71 real attributed links and unchanged clocks',()=>{
const path=new URL('../../uk_renewables_pipeline/202611171507/news/pipeline_headlines.snapshot.json',import.meta.url),bytes=readFileSync(path),doc=JSON.parse(bytes);const result=latestHeadlines(doc.items,100,{asOf});assert.equal(doc.items.length,71);assert.equal(result.length,71);
for(const row of result){const original=doc.items.find(item=>item.link===row.link);assert.ok(original);assert.equal(row.title,original.title);assert.equal(row.source,original.source);assert.equal(row.date,original.date||original.first_seen);}
console.log('Pinned saved snapshot SHA256 '+createHash('sha256').update(bytes).digest('hex')+'; generated '+doc.generated_at+'; eligible '+result.length);
});Browser
A JavaScript module in the automation folder of GlobalGrid2050 that draws pipeline headlines snapshot and solar, using SHA-256.
renderglobalgrid2050 / automation/v937_preview/browser.mjs · lines 1–46 of 46 · Not reached from any entry point (candidate for review)
- What it does
- It draws pipeline headlines snapshot and solar. Uses libraries node:assert/strict, node:http, node:fs, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files.
- Why it exists in the grid workflow
- Domain terms in the code: solar.
- Inputs & outputs
- In: JSON file pipeline_headlines.snapshot.json; JSON file registry.json. Out: JSON file receipt.json.
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/v937_preview · JavaScript module
- Uses
- node:assert/strict, node:http, node:fs, node:path, node:url
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v937_preview/browser.mjs:1-46 · blob 7519ea003cfdb1a80f09c69245e6df7b3289adf6 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
import assert from 'node:assert/strict';
import {createServer} from 'node:http';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {resolve,extname,sep} from 'node:path';
import {pathToFileURL} from 'node:url';
const root=resolve(import.meta.dirname,'../..'),edition='uk_renewables_pipeline/202611171526',out=resolve(process.env.V937_OUT||'D:/githubfiles/.qa-artifacts/v937-news-worker');mkdirSync(out,{recursive:true});
const {chromium}=await import(process.env.PLAYWRIGHT_MODULE?pathToFileURL(process.env.PLAYWRIGHT_MODULE).href:'playwright');
const saved=JSON.parse(readFileSync(resolve(root,edition,'news/pipeline_headlines.snapshot.json'))),observed=process.env.V937_OBSERVED_LIVE_FILE?JSON.parse(readFileSync(process.env.V937_OBSERVED_LIVE_FILE)):null;
const server=createServer((req,res)=>{try{const file=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://local').pathname));assert.ok(file.startsWith(root+sep));const bytes=readFileSync(file);res.setHeader('Content-Type',({'.js':'text/javascript','.mjs':'text/javascript','.json':'application/json','.css':'text/css','.html':'text/html'})[extname(file)]||'application/octet-stream');res.end(b … [line shortened here: 442 characters; full line on GitHub]
await new Promise(r=>server.listen(0,'127.0.0.1',r));const origin='http://127.0.0.1:'+server.address().port;
const proof={status:'RUNNING',edition,utc:new Date().toISOString(),checks:[],limitations:['Integrated local Chromium/touch emulation; no physical handset or public publication claim.','Existing saved71 is real source; optional observed76 replays existing read-only bytes. Negative health/ranking/association inputs are explicitly synthetic.']};
const fixture=()=>({schema:saved.schema,generated_at:new Date().toISOString(),status:'ok',counts:{items:1,feeds_ok:1,feeds_failed:0},feeds:[{url:'https://www.gov.uk/example/feed',source:'GOV.UK',status:'ok',entries:1,kept:1,newest:'2026-11-17T10:00:00Z'}],scope:'Synthetic browser quality-negative fixture, not real publication evidence',items:[{title:'Synthetic UK solar planning decision for ambigu … [line shortened here: 679 characters; full line on GitHub]
let browser;
try{
browser=await chromium.launch({headless:true});
for(const width of [1440,393,390]){
const context=await browser.newContext({viewport:{width,height:900},isMobile:width<500,hasTouch:width<500});await context.route('**/*',route=>route.request().url().startsWith(origin)?route.continue():route.abort());
const page=await context.newPage(),errors=[];page.on('pageerror',error=>errors.push(error.message));await page.goto(origin+'/'+edition+'/index.html?technology=all');await page.waitForFunction(()=>document.querySelector('.pn-news-quality')?.dataset.filteredCount==='71'&&document.querySelector('#tbody')?.dataset.total==='7775');
const quality=page.locator('.pn-news-quality'),search=quality.getByRole('searchbox'),source=quality.getByRole('combobox',{name:'News publisher',exact:true}),topic=quality.getByRole('combobox',{name:'News topic',exact:true}),category=quality.getByRole('combobox',{name:'News category',exact:true}),kind=quality.getByRole('combobox',{name:'News ranking source type',exact:true}),clear=quality.getByRo … [line shortened here: 476 characters; full line on GitHub]
assert.equal(await page.locator('#liveNews .ln-item').count(),12);await page.locator('#liveNews .ln-more').click();assert.equal(await page.locator('#liveNews .ln-item').count(),24);await page.evaluate(()=>window.pipelineHeadlines.render(window.pipelineHeadlineDocument,'snapshot'));assert.equal(await page.locator('#liveNews .ln-item').count(),24);
await details.locator('summary').click();await details.locator('p').first().waitFor({state:'visible'});assert.match(await details.innerText(),/71 original articles; 15 distinct credited publisher labels/);assert.match(await details.innerText(),/50 of 50 feed checks succeeded; 0 failed/);assert.ok((await details.innerText()).includes(saved.generated_at));assert.match(await details.innerText(),/Un … [line shortened here: 413 characters; full line on GitHub]
const ticker=page.locator('#headlineTicker');await ticker.getByRole('searchbox').fill(' ');await ticker.getByRole('button',{name:'Next headlines',exact:true}).click();const tickerBefore={query:await ticker.getByRole('searchbox').inputValue(),page:await ticker.getAttribute('data-page'),count:await ticker.getAttribute('data-count'),links:await ticker.locator('a').evaluateAll(nodes=>nodes.map(node= … [line shortened here: 414 characters; full line on GitHub]
const original=await page.evaluate(()=>JSON.stringify(window.pipelineHeadlineDocument));await search.fill('solar planning');const expected=saved.items.filter(item=>[item.title,item.source,item.category,item.technology].join(' ').toLowerCase().includes('solar')&&[item.title,item.source,item.category,item.technology].join(' ').toLowerCase().includes('planning'));assert.equal(await quality.getAttri … [line shortened here: 756 characters; full line on GitHub]
assert.deepEqual({query:await ticker.getByRole('searchbox').inputValue(),page:await ticker.getAttribute('data-page'),count:await ticker.getAttribute('data-count'),links:await ticker.locator('a').evaluateAll(nodes=>nodes.map(node=>node.href))},tickerBefore);
await clear.click();await source.selectOption('BBC News');assert.equal(await quality.getAttribute('data-filtered-count'),String(saved.items.filter(item=>item.source==='BBC News').length));assert.ok((await page.locator('#liveNews .ln-meta').allTextContents()).every(text=>text.includes('BBC News')));await clear.click();await topic.selectOption('solar');assert.ok(Number(await quality.getAttribute(' … [line shortened here: 854 characters; full line on GitHub]
if(observed){await search.fill('solar');await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),observed);assert.equal(await search.inputValue(),'solar');await clear.click();assert.equal(await quality.getAttribute('data-filtered-count'),'76');assert.match(await details.innerText(),/76 original articles; 16 distinct credited publisher labels/);assert.match(await details.innerText(),/ … [line shortened here: 493 characters; full line on GitHub]
const bad=fixture();bad.counts.feeds_ok=999;await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),bad);await clear.click();assert.match(await details.innerText(),/Feed-health metadata unavailable or inconsistent/);assert.doesNotMatch(await details.innerText(),/999.*succeeded/);assert.equal(await kind.locator('option[value="regulator"]').count(),0);assert.match(await page.locator(' … [line shortened here: 534 characters; full line on GitHub]
const day=fixture();day.generated_at='2026-11-17';day.items[0].first_seen='2026-11-17';day.items[0].date='2026-11-16';await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'snapshot'),day);await clear.click();assert.match(await page.locator('#liveNews .ln-meta').innerText(),/PUBLISHER DATE 16 NOV 2026/);assert.equal(await page.locator('#liveNews .ln-collected').innerText(),'FIRST COLLECTE … [line shortened here: 910 characters; full line on GitHub]
const clock=fixture();clock.items[0].date=null;clock.items[0].first_seen=null;clock.items[0].source='';clock.items[0].title='<img src=x onerror=alert(1)> literal headline';clock.items[0].link='https://localhost./private';await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),clock);await clear.click();assert.match(await page.locator('#liveNews .ln-meta').innerText(),/ARTICLE DATE U … [line shortened here: 607 characters; full line on GitHub]
for(const status of ['ok','partial','failed']){const doc=fixture();doc.status=status;if(status!=='ok'){doc.feeds[0].status='failed';doc.counts.feeds_ok=0;doc.counts.feeds_failed=1;}await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),doc);assert.ok((await details.innerText()).includes('Recorded status: '+status));if(status==='partial')assert.match(await details.innerText(),/metad … [line shortened here: 435 characters; full line on GitHub]
const empty=fixture();empty.items=[];empty.counts.items=0;empty.feeds[0].kept=0;await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),empty);assert.match(await details.innerText(),/0 original articles/);assert.match(await details.innerText(),/1 of 1 feed checks succeeded/);const impossible=fixture();impossible.generated_at='2026-02-30T10:00:00Z';await page.evaluate(doc=>window.pip … [line shortened here: 531 characters; full line on GitHub]
await page.evaluate(()=>window.pipelineHeadlines.render(null,'none'));assert.equal(await quality.getAttribute('data-filtered-count'),'0');assert.match(await details.innerText(),/metadata unavailable or inconsistent/);
const ranked=fixture();await page.evaluate(async doc=>{
const bytes=new TextEncoder().encode(JSON.stringify(doc)),digest=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes))).map(v=>v.toString(16).padStart(2,'0')).join(''),item=doc.items[0];
const sidecar={schema:window.pipelineHeadlines.prioritySchema,input_sha256:digest,input_bytes:bytes.length,input_generated_at:doc.generated_at,input_count:1,as_of:doc.generated_at,profile_id:'uk-transition-global-context.v1',profile_sha256:'06250f2435088a522d8d25676f31f813165a430df1e19f602bd8baae03961c05',entries:[{link:item.link,source:item.source,title:item.title,rank:1,source_kind:'governmen … [line shortened here: 558 characters; full line on GitHub]
window.qualityTestInput={doc,bytes,sidecar};if(await window.pipelineHeadlines.validatePriority(doc,bytes,{...sidecar,input_sha256:'0'.repeat(64)}))throw Error('forged rank accepted');window.pipelineHeadlines.render(doc,'live');
},ranked);assert.equal(await kind.locator('option[value="government"]').count(),0);
await page.evaluate(async()=>{const {doc,bytes,sidecar}=window.qualityTestInput;if(!await window.pipelineHeadlines.validatePriority(doc,bytes,sidecar))throw Error('exact rank rejected');window.pipelineHeadlines.render(doc,'live');});assert.equal(await kind.locator('option[value="government"]').count(),1);await kind.selectOption('government');assert.equal(await quality.getAttribute('data-filtered … [line shortened here: 565 characters; full line on GitHub]
await page.evaluate(()=>{const {doc}=window.qualityTestInput;window.pipelineHeadlines.render(doc,'live',Date.parse(doc.generated_at)+40*3600000);});assert.equal(await kind.locator('option[value="government"]').count(),0);assert.match(await details.innerText(),/Unclassified/);
await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'snapshot'),saved);await clear.click();assert.equal(await page.locator('#tbody').getAttribute('data-total'),'7775');assert.equal(await page.locator('#operationalHeader').count(),1);assert.ok(await page.locator('#tbody a.atlaslink').first().getAttribute('href'));assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=inn … [line shortened here: 512 characters; full line on GitHub]
const inheritedStateProbe=JSON.parse(readFileSync(resolve(root,'automation/pipeline_release/registry.json'),'utf8')).versions.find(v=>v.id==='202611171526').browser_probes[0].js;await page.locator('#search').fill('12588');assert.equal(await page.locator('#tbody').getAttribute('data-total'),'1');assert.equal(await page.evaluate(expression=>(0,eval)(expression),inheritedStateProbe),true);assert.eq … [line shortened here: 468 characters; full line on GitHub]
proof.checks.push({width,status:'PASS',checks:['Real71/15publisherlabels/50feeds; optional76/16 replay','Main12 then24 and same-source range preserved','Stable title/source/topic/category/current-ranked-kind filters','Original document and V936 ticker query/page/data independent','Bogus/missing/inconsistent health unavailable; separate clocks and day precision without invented midnight','Safe te … [line shortened here: 646 characters; full line on GitHub]
}
proof.status='PASS';
}finally{if(browser)await browser.close();await new Promise(r=>server.close(r));writeFileSync(resolve(out,'receipt.json'),JSON.stringify(proof,null,2)+'\n');}
console.log(JSON.stringify(proof));Contracts Test
A test in the automation folder of GlobalGrid2050 that checks Model, using SHA-256.
testglobalgrid2050 / automation/v937_preview/contracts.test.mjs · lines 1–19 of 19 · Entry point
- What it does
- It tests solar. Uses libraries node:test, node:assert/strict, node:fs, node:crypto. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain terms in the code: solar.
- Inputs & outputs
- In: JSON file pipeline_headlines.snapshot.json; JSON file news-quality.v937.json.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 V934 Preview Acceptance Workflow (globalgrid2050).
- What it achieves
- It reads `../../uk_renewables_pipeline/202611171526/news/pipeline_headlines.snapshot.json`.
- Why it matters
- Run by GlobalGrid2050 V934 Preview Acceptance Workflow.
- Application
- globalgrid2050 · automation/v937_preview · test
- Uses
- Model (import), node:test, node:assert/strict, node:fs, node:crypto
- Used by
- run by GlobalGrid2050 V934 Preview Acceptance 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 automation/v937_preview/contracts.test.mjs:1-19 · blob d52605f794be2edfef18c4b63a501d6e5051ae39 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
import {test} from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
import {createHash} from 'node:crypto';
import {auditHealth,classification,selectEntries,validClock} from '../../automation/news_quality_ui/20261117-v937/model.mjs';
const saved=JSON.parse(readFileSync(new URL('../../uk_renewables_pipeline/202611171526/news/pipeline_headlines.snapshot.json',import.meta.url)));
const entries=saved.items.map(item=>({item}));
test('actual71 articles15 credited publisher labels50 successful feedrecords',()=>{const a=auditHealth(saved);assert.equal(a.available,true);assert.equal(a.articles,71);assert.equal(a.publishers.length,15);assert.equal(a.feeds,50);assert.equal(a.ok,50);assert.equal(a.failed,0);assert.equal(a.collectionClock,saved.generated_at);});
test('incomplete, bogus and duplicate feedhealth explicitly unavailable',()=>{
for(const mutate of [d=>delete d.feeds,d=>delete d.counts,d=>d.counts.feeds_ok=999,d=>d.counts.items=999,d=>d.counts.by_category.finance=999,d=>d.counts.with_possible_match=999,d=>d.feeds.push(d.feeds[0]),d=>delete d.feeds[0].kept,d=>d.feeds[0].newest='2026-02-30',d=>d.feeds[0].url='https://127.0.0.1/feed',d=>d.feeds[0].entries=-1,d=>d.status='failed']){const d=structuredClone(saved);mutate(d);co … [line shortened here: 517 characters; full line on GitHub]
assert.equal(auditHealth(null).collectionClock,null);assert.equal(auditHealth(null).articles,null);
});
test('duplicate publishers do not collapse different feed checks',()=>{const d=structuredClone(saved);d.feeds[1].source=d.feeds[0].source;assert.equal(auditHealth(d).feeds,50);assert.equal(auditHealth(d).publishers.length,15);});
test('partial and retained failed collection preserve recorded status',()=>{const d=structuredClone(saved);d.status='partial';d.feeds[0].status='failed';d.counts.feeds_ok=49;d.counts.feeds_failed=1;const a=auditHealth(d);assert.equal(a.available,true);assert.equal(a.failed,1);assert.equal(a.articles,71);d.status='failed';for(const f of d.feeds)f.status='failed';d.counts.feeds_ok=0;d.counts.feeds_f … [line shortened here: 456 characters; full line on GitHub]
test('filtering is stable derived view and screens unrelated source/topic matches',()=>{const before=JSON.stringify(saved);const selected=selectEntries(entries,{query:'solar planning'});assert.ok(selected.length>0&&selected.length<71);assert.ok(selected.every(e=>[e.item.title,e.item.source,e.item.category,e.item.technology].join(' ').toLowerCase().includes('solar')));assert.equal(JSON.stringify(sa … [line shortened here: 603 characters; full line on GitHub]
test('raw item sourcekind and forged/mismatched priority wrappers never classify',()=>{const item={...saved.items[0],source_kind:'government'};assert.equal(classification({item},false).kind,'Unclassified');const p={...item,source_kind:'government',topics:['solar']};assert.equal(classification({item,priority:p},false).kind,'Unclassified');assert.equal(classification({item,priority:{...p,title:'wron … [line shortened here: 506 characters; full line on GitHub]
test('publisher/collection clocks stay separate, impossible or unknown clocks unavailable',()=>{for(const value of ['2026-02-30','2026-11-31T10:00:00Z',null,'unknown','2026-11-17T25:00:00Z'])assert.equal(validClock(value),false);assert.equal(validClock('2024-02-29'),true);assert.equal(validClock('2026-11-17T13:48:13Z'),true);const d=structuredClone(saved);d.generated_at='bad';assert.equal(auditHea … [line shortened here: 432 characters; full line on GitHub]
test('possible ambiguous association remains a source field, never a verified filter claim',()=>{const item={title:'Synthetic ambiguous West Burton pair',source:'Synthetic publisher',category:'consent',technology:'solar',possible_match:{repd_ref:'10916',site_name:'West Burton Solar Project',verified:false}};const e={item};assert.equal(selectEntries([e],{query:'west burton'}).length,1);assert.equal … [line shortened here: 498 characters; full line on GitHub]
test('shared reader contract and actual stylesheet/module SRI bind final local bytes',()=>{const release=new URL('../../uk_renewables_pipeline/202611171526/',import.meta.url),contract=JSON.parse(readFileSync(new URL('contracts/news-quality.v937.json',release))),html=readFileSync(new URL('index.html',release),'utf8');for(const [name,digest]of Object.entries(contract.sha256)){const bytes=readFileSyn … [line shortened here: 829 characters; full line on GitHub]Browser
A JavaScript module in the automation folder of GlobalGrid2050 that draws notice and the Renewable Energy Planning Database (REPD) register.
renderglobalgrid2050 / automation/v938_preview/browser.mjs · lines 1–30 of 30 · Not reached from any entry point (candidate for review)
- What it does
- It draws notice and the REPD register. Uses libraries node:assert/strict, node:http, node:fs, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files.
- Why it exists in the grid workflow
- Domain terms in the code: the REPD register.
- Inputs & outputs
- In: JSON file notice.json. Out: JSON file receipt.json.
- What it achieves
- Its code works with 2 GW.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/v938_preview · JavaScript module
- Uses
- node:assert/strict, node:http, node:fs, node:path, node:url
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v938_preview/browser.mjs:1-30 · blob 4e89acc575af15e8d6af8eb8e19885b4c7369ad5 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
import assert from 'node:assert/strict';
import {createServer} from 'node:http';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {resolve,extname,sep} from 'node:path';
import {pathToFileURL} from 'node:url';
const root=resolve(import.meta.dirname,'../..'),edition='uk_renewables_pipeline/202611171550',out=resolve(process.env.V938_OUT||'D:/githubfiles/.qa-artifacts/v938-grid-worker');mkdirSync(out,{recursive:true});
const {chromium}=await import(process.env.PLAYWRIGHT_MODULE?pathToFileURL(process.env.PLAYWRIGHT_MODULE).href:'playwright');
const pending=JSON.parse(readFileSync(resolve(root,'automation/grid_notice_ui/20261117-v938/notice.json'))),approved=structuredClone(pending);approved.publishable=true;approved.review_state='NARROW_FACTS_REVIEWED';approved.notice_count=1;approved.approval={state:'APPROVED_FACTS_ONLY',rights_scope:'government_html_facts_only_no_images_or_third_party_material',facts_sha256:approved.facts_sha256,revi … [line shortened here: 663 characters; full line on GitHub]
const server=createServer((req,res)=>{try{const file=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://local').pathname));assert.ok(file.startsWith(root+sep));const bytes=readFileSync(file);res.setHeader('Content-Type',({'.js':'text/javascript','.mjs':'text/javascript','.json':'application/json','.css':'text/css','.html':'text/html'})[extname(file)]||'application/octet-stream');res.end(b … [line shortened here: 442 characters; full line on GitHub]
await new Promise(r=>server.listen(0,'127.0.0.1',r));const origin='http://127.0.0.1:'+server.address().port;let browser;
const proof={status:'RUNNING',edition,utc:new Date().toISOString(),checks:[],limitations:['Local Chromium desktop/touch emulation, no actual public or physical handset acceptance.','Approved-fixture mode uses explicitly synthetic review references; actual-approved mode reads unchanged local notice.json with real independent exact-fact review references, with no notice interception.','Existing remo … [line shortened here: 515 characters; full line on GitHub]
try{
browser=await chromium.launch({headless:true});
for(const width of [1440,393,390])for(const mode of ['pending','approved','actual-approved','changed-bytes']){
const context=await browser.newContext({viewport:{width,height:900},isMobile:width<500,hasTouch:width<500});const payload=mode==='pending'?{...pending,publishable:false,approval:null}:structuredClone(approved);if(mode==='changed-bytes')payload.facts.documents[0].source_sha256='0'.repeat(64);
await context.route('**/*',route=>mode!=='actual-approved'&&route.request().url().endsWith('/automation/grid_notice_ui/20261117-v938/notice.json')?route.fulfill({status:200,contentType:'application/json',body:JSON.stringify(payload)}):route.request().url().startsWith(origin)?route.continue():route.abort());
const page=await context.newPage(),errors=[];page.on('pageerror',error=>errors.push(error.message));await page.goto(origin+'/'+edition+'/index.html?technology=all');await page.waitForFunction(()=>document.querySelector('#tbody')?.dataset.total==='7775'&&document.querySelector('.pn-grid-notice')?.dataset.state!=='loading');const host=page.locator('.pn-grid-notice');assert.equal(await host.evaluat … [line shortened here: 542 characters; full line on GitHub]
await page.locator('#gridTab').click();await host.waitFor({state:'visible'});
if(mode==='approved'||mode==='actual-approved'){
assert.equal(await host.getAttribute('data-state'),'reviewed-facts');assert.equal(await host.getAttribute('data-notice-count'),'1');assert.match(await host.innerText(),/1 source-qualified notice.*2 government documents/);assert.match(await host.innerText(),/30 October 2026 \(DAY precision\)/);assert.match(await host.innerText(),/up to 2 GW, not current/);await host.locator('summary').click();as … [line shortened here: 446 characters; full line on GitHub]
for(const document of approved.facts.documents){assert.ok((await host.innerText()).includes(document.publisher));assert.ok((await host.innerText()).includes(document.retrieved_at));assert.equal(await host.locator('a[href="'+document.url+'"]').count(),1);}
for(const date of ['2025-03-27','2025-04-23','2026-07-30'])assert.ok((await host.innerText()).includes(date));assert.match(await host.innerText(),/no images|Images and linked third-party material are excluded/i);assert.match(await host.innerText(),/No REPD\/ETYS match/);assert.equal(await host.locator('img,iframe').count(),0);
await host.getByRole('searchbox').fill('no-matching-grid-notice');assert.equal(await host.getAttribute('data-filtered-count'),'0');assert.match(await host.getByRole('status').innerText(),/0 of 1/);assert.equal(await host.locator('article').isVisible(),false);await host.getByRole('searchbox').fill('NGET');assert.equal(await host.getAttribute('data-filtered-count'),'1');assert.equal(await host.lo … [line shortened here: 435 characters; full line on GitHub]
}else{assert.equal(await host.getAttribute('data-state'),'withheld');assert.equal(await host.getAttribute('data-notice-count'),null);assert.equal(await host.locator('article,a').count(),0);assert.match(await host.innerText(),/unavailable.*review is pending/);}
await page.locator('#solarTab').click();assert.equal(await host.isVisible(),false);assert.equal(await page.locator('#tbody').getAttribute('data-total'),'3604');await page.locator('#clearFilters').click();assert.equal(await page.locator('#tbody').getAttribute('data-total'),'7775');assert.equal(await page.locator('#operationalHeader').count(),1);assert.ok(await page.locator('#tbody a.atlaslink').f … [line shortened here: 703 characters; full line on GitHub]
proof.checks.push({width,mode,status:'PASS',checks:['Existing Grid tab only; no extra principal panel','One notice/two document count or explicitly unavailable','Typed DAY clocks, publisher vs reported operator, planned power qualification','Pending/changed-byte gates fail closed; no fabricated source join or image','Filtering, original7775/3604 source counts, dates and MAP preserved; no overflo … [line shortened here: 443 characters; full line on GitHub]
}
proof.status='PASS';
}finally{if(browser)await browser.close();await new Promise(r=>server.close(r));writeFileSync(resolve(out,'receipt.json'),JSON.stringify(proof,null,2)+'\n');}
console.log(JSON.stringify(proof));Contracts Test
A test in the automation folder of GlobalGrid2050 that checks Model, using SHA-256.
testglobalgrid2050 / automation/v938_preview/contracts.test.mjs · lines 1–10 of 10 · Entry point
- What it does
- It tests its inputs. Uses libraries node:test, node:assert/strict, node:fs, node:crypto. Side effects: reads or writes files.
- Inputs & outputs
- In: JSON file notice.json; JSON file grid-notice.v938.json.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 V934 Preview Acceptance Workflow (globalgrid2050).
- What it achieves
- It reads `../grid_notice_ui/20261117-v938/notice.json`.
- Why it matters
- Run by GlobalGrid2050 V934 Preview Acceptance Workflow.
- Application
- globalgrid2050 · automation/v938_preview · test
- Uses
- Model (import), node:test, node:assert/strict, node:fs, node:crypto
- Used by
- run by GlobalGrid2050 V934 Preview Acceptance Workflow (workflow run)
- Produces
- approvedFixture
- 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 automation/v938_preview/contracts.test.mjs:1-10 · blob 27dae4df9bd55b0449fa8cb2774e03f443d28bd8 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
import {test} from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
import {createHash} from 'node:crypto';
import {acceptedNotice,factsHash} from '../grid_notice_ui/20261117-v938/model.mjs';
const input=JSON.parse(readFileSync(new URL('../grid_notice_ui/20261117-v938/notice.json',import.meta.url)));
export function approvedFixture(){const doc=structuredClone(input);doc.publishable=true;doc.review_state='NARROW_FACTS_REVIEWED';doc.notice_count=1;doc.approval={state:'APPROVED_FACTS_ONLY',rights_scope:'government_html_facts_only_no_images_or_third_party_material',facts_sha256:factsHash,reviews:[{role:'AGENT_A',decision:'PASS',reference:'https://github.com/Ventusltd/neural-link-between-agents/iss … [line shortened here: 568 characters; full line on GitHub]
test('actual source facts with synthetic scoped review references satisfy the private gate',async()=>{const f=await acceptedNotice(approvedFixture());assert.equal(f.application_ref,'EN020026');assert.equal(f.reported_network_operator,'NGET');assert.equal(f.event_date.precision,'DAY');assert.equal(f.planned_metric.kind,'planned_transmission_upper_bound');assert.equal(f.current_capacity_mw,null);ass … [line shortened here: 498 characters; full line on GitHub]
test('pending, missing/duplicate reviews, broad rights and changed source bytes withheld',async()=>{for(const mutate of [d=>d.publishable=false,d=>d.approval=null,d=>d.approval.rights_scope='all_gov_content',d=>d.approval.reviews.pop(),d=>d.approval.reviews[1].reference=d.approval.reviews[0].reference,d=>d.facts.documents[0].source_sha256='0'.repeat(64),d=>d.facts.documents[0].publisher='NGET',d=> … [line shortened here: 734 characters; full line on GitHub]
test('new GRID host contract, stylesheet and module SRI bind actual shared bytes',()=>{const release=new URL('../../uk_renewables_pipeline/202611171550/',import.meta.url),contract=JSON.parse(readFileSync(new URL('contracts/grid-notice.v938.json',release))),html=readFileSync(new URL('index.html',release),'utf8');for(const [name,hash]of Object.entries(contract.sha256)){const bytes=readFileSync(new U … [line shortened here: 729 characters; full line on GitHub]Browser
A JavaScript module in the automation folder of GlobalGrid2050 that reads notice and facts.
renderglobalgrid2050 / automation/v939_preview/browser.mjs · lines 1–27 of 27 · Not reached from any entry point (candidate for review)
- What it does
- It loads notice and facts. Uses libraries node:assert/strict, node:http, node:fs, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files.
- Inputs & outputs
- In: JSON file notice.json; JSON file facts.json. Out: JSON file receipt.json.
- What it achieves
- Its code works with 2 GW.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/v939_preview · JavaScript module
- Uses
- node:assert/strict, node:http, node:fs, node:path, node:url
- 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
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v939_preview/browser.mjs:1-27 · blob ad7606985bf3a2ec3fab0de3ed6f0989a6a92ad2 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
import assert from 'node:assert/strict';
import {createServer} from 'node:http';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {resolve,extname,sep} from 'node:path';
import {pathToFileURL} from 'node:url';
const root=resolve(import.meta.dirname,'../..'),edition=process.env.V939_EDITION||'uk_renewables_pipeline/202611171609',inject=process.env.V939_INJECT==='1',out=resolve(process.env.V939_OUT||'D:/githubfiles/.qa-artifacts/v939-documents-worker');mkdirSync(out,{recursive:true});
const {chromium}=await import(process.env.PLAYWRIGHT_MODULE?pathToFileURL(process.env.PLAYWRIGHT_MODULE).href:'playwright');
const noticePath='/automation/grid_notice_ui/20261117-v938/notice.json',factsPath='/automation/document_facts_ui/20261117-v939/facts.json';
const original=JSON.parse(readFileSync(resolve(root,'.'+noticePath))),approved=structuredClone(original);approved.publishable=true;approved.review_state='NARROW_FACTS_REVIEWED';approved.notice_count=1;approved.approval={state:'APPROVED_FACTS_ONLY',rights_scope:'government_html_facts_only_no_images_or_third_party_material',facts_sha256:approved.facts_sha256,reviews:[{role:'AGENT_A',decision:'PASS', … [line shortened here: 626 characters; full line on GitHub]
const server=createServer((req,res)=>{try{const file=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://local').pathname));assert.ok(file.startsWith(root+sep));let bytes=readFileSync(file);if(inject&&file===resolve(root,edition,'index.html'))bytes=Buffer.from(bytes.toString().replace('</head>','<link rel="stylesheet" href="../../automation/document_facts_ui/20261117-v939/styles.css"><scri … [line shortened here: 743 characters; full line on GitHub]
await new Promise(r=>server.listen(0,'127.0.0.1',r));const origin='http://127.0.0.1:'+server.address().port;let browser;
const proof={status:'RUNNING',edition,injectedPreviewTags:inject,utc:new Date().toISOString(),checks:[],limitations:['Local Chromium emulation; no actual public or physical device acceptance.','Approved-fixture uses synthetic narrow review metadata; actual-approved uses unchanged committed actual independent review with no notice interception.','PDF extraction unavailable; only actual pinned gover … [line shortened here: 428 characters; full line on GitHub]
try{
browser=await chromium.launch({headless:true});
for(const width of [1440,393,390])for(const mode of ['approved-fixture','actual-approved','pending','changed-extraction']){
const context=await browser.newContext({viewport:{width,height:900},isMobile:width<500,hasTouch:width<500});
await context.route('**/*',route=>{const url=new URL(route.request().url());if(mode!=='actual-approved'&&url.pathname===noticePath)return route.fulfill({status:200,contentType:'application/json',body:JSON.stringify(mode==='pending'?{...original,publishable:false,approval:null}:approved)});if(mode==='changed-extraction'&&url.pathname===factsPath){const data=JSON.parse(readFileSync(resolve(root,'. … [line shortened here: 610 characters; full line on GitHub]
const page=await context.newPage(),errors=[];page.on('pageerror',e=>errors.push(e.message));await page.goto(origin+'/'+edition+'/index.html?technology=all');await page.waitForFunction(()=>document.querySelector('#tbody')?.dataset.total==='7775'&&document.querySelector('.pn-document-facts')?.dataset.state!=='loading');const host=page.locator('.pn-document-facts');assert.equal(await host.evaluate( … [line shortened here: 565 characters; full line on GitHub]
if(mode==='approved-fixture'||mode==='actual-approved'){
assert.equal(await host.getAttribute('data-state'),'source-qualified');assert.equal(await host.locator('section').count(),2);assert.equal(await host.locator('section details').count(),6);assert.equal(await host.locator('a').count(),2);assert.match(await host.innerText(),/6 automatically distilled facts from 2 government HTML/);assert.match(await host.innerText(),/Machine provisional/);assert.ma … [line shortened here: 457 characters; full line on GitHub]
for(const date of ['2025-03-27','2025-04-23','2026-07-30','2026-10-30'])assert.ok((await host.innerText()).includes(date));assert.match(await host.innerText(),/Planned transmission upper bound: 2 GW/);await host.locator('section details').last().locator('summary').click();assert.match(await host.innerText(),/forecast upper bound; not current/);assert.match(await host.innerText(),/Source paragra … [line shortened here: 715 characters; full line on GitHub]
for(const link of await host.locator('a').all())assert.ok((await link.getAttribute('href')).startsWith('https://www.gov.uk/government/'));await page.screenshot({path:resolve(out,'document-facts-'+width+'.png')});
}else{assert.equal(await host.getAttribute('data-state'),'withheld');assert.equal(await host.locator('section,a').count(),0);assert.match(await host.innerText(),/unavailable/);}
assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await page.locator('#solarTab').click();assert.equal(await host.isVisible(),false);await page.locator('#clearFilters').click();assert.equal(await page.locator('#tbody').getAttribute('data-total'),'7775');assert.equal(await page.locator('#operationalHeader').count(),1);assert.ok(await page.locator('#tbody a.atl … [line shortened here: 535 characters; full line on GitHub]
}proof.status='PASS';
}finally{if(browser)await browser.close();await new Promise(r=>server.close(r));writeFileSync(resolve(out,'receipt.json'),JSON.stringify(proof,null,2)+'\n');}
console.log(JSON.stringify(proof));Contracts Test
A test in the automation folder of GlobalGrid2050 that checks Model.
testglobalgrid2050 / automation/v939_preview/contracts.test.mjs · lines 1–10 of 10 · Entry point
- What it does
- It tests its inputs. Uses libraries node:test, node:assert/strict, node:fs. Side effects: reads or writes files.
- Inputs & outputs
- In: JSON file facts.json; JSON file notice.json.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 V934 Preview Acceptance Workflow (globalgrid2050).
- What it achieves
- It reads `../document_facts_ui/20261117-v939/facts.json`.
- Why it matters
- Run by GlobalGrid2050 V934 Preview Acceptance Workflow.
- Application
- globalgrid2050 · automation/v939_preview · test
- Uses
- Model (import), node:test, node:assert/strict, node:fs
- Used by
- run by GlobalGrid2050 V934 Preview Acceptance 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 automation/v939_preview/contracts.test.mjs:1-10 · blob 32dfa6c5c1edef58af32704ded4d0b940dc8ee09 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
import test from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
import {acceptedDocuments,bundleHash} from '../document_facts_ui/20261117-v939/model.mjs';
const bytes=readFileSync(new URL('../document_facts_ui/20261117-v939/facts.json',import.meta.url),'utf8');
const pending=JSON.parse(readFileSync(new URL('../grid_notice_ui/20261117-v938/notice.json',import.meta.url)));
function approved(){const n=structuredClone(pending);n.publishable=true;n.review_state='NARROW_FACTS_REVIEWED';n.notice_count=1;n.approval={state:'APPROVED_FACTS_ONLY',rights_scope:'government_html_facts_only_no_images_or_third_party_material',facts_sha256:n.facts_sha256,reviews:[{role:'AGENT_A',decision:'PASS',reference:'https://github.com/Ventusltd/neural-link-between-agents/issues/42#issuecomme … [line shortened here: 549 characters; full line on GitHub]
test('actual extracted bundle, synthetic narrow approval: six located provisional facts',async()=>{const data=await acceptedDocuments(bytes,approved());assert.equal(data.documents.length,2);assert.equal(data.documents.flatMap(d=>d.facts).length,6);assert.equal(data.documents[1].claims[0].value,'2');assert.equal(data.documents[1].claims[0].basis,'forecast');assert.ok(data.documents.every(d=>!d.publ … [line shortened here: 484 characters; full line on GitHub]
test('pending or spoofed reviews never authorize a display',async()=>{assert.equal(await acceptedDocuments(bytes,{...pending,publishable:false,approval:null}),null);const n=approved();n.approval.reviews[1].reference='https://evil.test/fake';assert.equal(await acceptedDocuments(bytes,n),null);});
test('changed extracted facts/locators, unsafe titles or source URLs fail exact-byte pin',async()=>{for(const mutate of [d=>d.documents[1].claims[0].value='2000',d=>d.documents[0].source_url='javascript:alert(1)',d=>d.documents[0].title='<img src=x onerror=alert(1)>',d=>d.documents[0].facts[0].locator.paragraph=99]){const d=JSON.parse(bytes);mutate(d);assert.equal(await acceptedDocuments(JSON.stri … [line shortened here: 431 characters; full line on GitHub]Android
A JavaScript module in the automation folder of GlobalGrid2050 that draws pipeline headlines snapshot, using SHA-256.
renderglobalgrid2050 / automation/v940_preview/android.mjs · lines 1–211 of 211 · Entry point · pattern rotate (shared by 3 files)
- What it does
- It draws pipeline headlines snapshot. Defines 9 functions or classes, including sha, git, save, rotate, tap. Uses libraries node:assert/strict, node:fs, node:path, node:http, node:child_process. Side effects: changes the web page (DOM); reads or writes files; starts processes.
- Inputs & outputs
- In: JSON file pipeline_headlines.snapshot.json. Out: JSON file receipt.json.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 V934 Preview Acceptance Workflow (globalgrid2050).
- What it achieves
- It is built from the sha step (`sha`), the git step (`git`) and the save step (`save`). Named Android emulation proof. Local saved-data acceptance and live observations are separate.
- Why it matters
- Run by GlobalGrid2050 V934 Preview Acceptance Workflow.
- Application
- globalgrid2050 · automation/v940_preview · JavaScript module
- Uses
- Ticker (script call), Header (script call), node:assert/strict, node:fs, node:path, node:http, node:child_process, node:url, node:crypto
- Used by
- run by GlobalGrid2050 V934 Preview Acceptance Workflow (workflow run)
- Produces
- sha, git, save, rotate, tap, swipe, originals, fallback, x
- Defines here
- sha, git, save, rotate, tap, swipe, originals, fallback, x
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v940_preview/android.mjs:1-211 · blob d6e9aedc804c9bd8316e9f006a971b291e9a500a · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, process · domain stage: unknown · users: none · canonical: production_core
/** Named Android emulation proof. Local saved-data acceptance and live observations are separate. */
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
import {execFileSync} from 'node:child_process';
import {pathToFileURL} from 'node:url';
import {createHash} from 'node:crypto';
const root = path.resolve(import.meta.dirname, '../..');
const edition = 'uk_renewables_pipeline/202611171710';
const sourceCommit = 'e008a5e031912f52c8d65c60161fe70357cd5162';
const sourceEditionTree = 'b027ff05286bd998abdf8304cc12c9a72732d477';
const output = path.resolve(process.env.V940_ANDROID_OUT || path.join(root, '.qa-artifacts/v940-android'));
const {chromium, devices} = await import(process.env.PLAYWRIGHT_MODULE ? pathToFileURL(path.resolve(process.env.PLAYWRIGHT_MODULE)).href : 'playwright');
const {latestHeadlines} = await import(pathToFileURL(path.join(root, edition, 'scripts/layers/model.mjs')).href);
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
const git = (...args) => execFileSync('git', args, {cwd: root, encoding: 'utf8'}).trim();
const selected = (process.env.ANDROID_DEVICE || 'Pixel 7,Galaxy S9+').split(',').map(s => s.trim());
const pins = {
[edition + '/index.html']: '97fe3ff68d2f2c21c639a7906c85a87a4dea780a68c1abeee85ff42de4852073',
'automation/ticker_neon_ui/20261117-v940/ticker.mjs': 'f9ed407157cd54209b797497e71e6884bda4ea1a373f68b6934cf85d0faf9653',
'automation/ticker_neon_ui/20261117-v940/header.mjs': '17fbbbf9488ceadfd46baeef8849a3f37862d30261916991fa56f85eb0a3b94d',
'automation/ticker_neon_ui/20261117-v940/styles.css': '9ac64ca9859a73263a532ef65f121c7a7e87627400e5abce6d235d46f4ae0db4'
};
fs.mkdirSync(output, {recursive: true});
const receipt = {
status: 'RUNNING', startedUTC: new Date().toISOString(), sourceCommit, sourceEditionTree,
worktreeHead: git('rev-parse', 'HEAD'), observedEditionTree: git('rev-parse', 'HEAD:' + edition), edition,
environment: 'Named Playwright Android device emulation using host Chromium; NOT physical Android/ADB acceptance',
local: [], public: [], sourceHashes: {},
limitations: [
'External requests are blocked ONLY for local saved-data fallback. Optional public observations have no interception.',
'Physical Android, mobile GPU, browser chrome, hardware keyboard and TalkBack acceptance remain unknown.'
]
};
const save = () => fs.writeFileSync(path.join(output, 'receipt.json'), JSON.stringify(receipt, null, 2) + '\n');
save();
for (const [file, expected] of Object.entries(pins)) {
const actual = sha(fs.readFileSync(path.join(root, file)));
receipt.sourceHashes[file] = actual;
assert.equal(actual, expected, file + ' differs from frozen UI source');
}
const saved = JSON.parse(fs.readFileSync(path.join(root, edition, 'news/pipeline_headlines.snapshot.json')));
const expectedRows = latestHeadlines(saved.items);
assert.equal(expectedRows.length, 71, 'Pinned saved-news population');
for (const name of selected) {
assert.ok(devices[name] && devices[name + ' landscape'], 'Unknown portrait/landscape device: ' + name);
assert.match(devices[name].userAgent, /Android/);
assert.equal(devices[name].hasTouch, true);
}
const server = http.createServer((req, res) => {
try {
const file = path.resolve(root, '.' + decodeURIComponent(new URL(req.url, 'http://local').pathname));
assert.ok(file.startsWith(root + path.sep));
res.setHeader('Content-Type', ({'.html': 'text/html', '.css': 'text/css', '.js': 'text/javascript', '.mjs': 'text/javascript', '.json': 'application/json'})[path.extname(file)] || 'application/octet-stream');
res.end(fs.readFileSync(file));
} catch { res.writeHead(404).end(); }
});
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
const origin = 'http://127.0.0.1:' + server.address().port;
const url = origin + '/' + edition + '/index.html?technology=all';
let browser;
async function rotate(page, session, name, landscape) {
const cfg = devices[name + (landscape ? ' landscape' : '')], vp = cfg.viewport;
await page.setViewportSize(vp);
await session.send('Emulation.setDeviceMetricsOverride', {
width: vp.width, height: vp.height, deviceScaleFactor: cfg.deviceScaleFactor, mobile: true,
screenWidth: cfg.screen?.width || vp.width, screenHeight: cfg.screen?.height || vp.height,
screenOrientation: {type: landscape ? 'landscapePrimary' : 'portraitPrimary', angle: landscape ? 90 : 0}
});
await page.waitForTimeout(120);
return page.evaluate(() => ({
viewport: {width: innerWidth, height: innerHeight}, screen: {width: screen.width, height: screen.height},
orientation: {type: screen.orientation.type, angle: screen.orientation.angle}, dpr: devicePixelRatio,
touch: navigator.maxTouchPoints, ua: navigator.userAgent, platform: navigator.platform,
hover: matchMedia('(hover:hover)').matches
}));
}
async function tap(session, x, y) {
await session.send('Input.dispatchTouchEvent', {type: 'touchStart', touchPoints: [{x, y, id: 1, radiusX: 2, radiusY: 2, force: 1}]});
await session.send('Input.dispatchTouchEvent', {type: 'touchEnd', touchPoints: []});
}
async function swipe(session, x, y, dx) {
await session.send('Input.dispatchTouchEvent', {type: 'touchStart', touchPoints: [{x, y, id: 1, radiusX: 2, radiusY: 2, force: 1}]});
for (let i = 1; i <= 12; i++) {
await session.send('Input.dispatchTouchEvent', {type: 'touchMove', touchPoints: [{x: x + dx * i / 12, y, id: 1, radiusX: 2, radiusY: 2, force: 1}]});
await new Promise(resolve => setTimeout(resolve, 18));
}
await session.send('Input.dispatchTouchEvent', {type: 'touchEnd', touchPoints: []});
}
async function originals(ticker) {
const actual = await ticker.locator('ul li').evaluateAll(nodes => nodes.map(n => ({
text: n.querySelector('a')?.textContent, href: n.querySelector('a')?.href,
date: n.querySelector('time')?.dateTime, dateText: n.querySelector('time')?.textContent
})));
assert.deepEqual(actual, expectedRows.map(row => ({text: `${row.title} \u2014 ${row.source}`, href: row.link, date: row.date, dateText: `${row.dateKind} ${row.date}`})), 'Every literal publisher/date/link matches the saved-source selector');
}
async function fallback(context, blocked) {
await context.route('**/*', route => {
if (route.request().url().startsWith(origin + '/')) return route.continue();
blocked.add(route.request().url());
return route.abort();
});
}
try {
browser = await chromium.launch({headless: true});
receipt.browserVersion = browser.version();
for (const name of selected) {
const context = await browser.newContext({...devices[name], reducedMotion: 'no-preference'}), blocked = new Set();
await fallback(context, blocked);
const page = await context.newPage(), session = await context.newCDPSession(page), errors = [], popups = [];
page.setDefaultTimeout(10000);
page.on('pageerror', e => errors.push(e.message));
page.on('popup', p => { popups.push(p.url()); p.close().catch(() => {}); });
const result = {device: name, descriptor: devices[name], rotations: [], errors, popups};
receipt.local.push(result); save();
await page.goto(url, {waitUntil: 'domcontentloaded', timeout: 20000});
await page.waitForFunction(() => document.querySelector('#tbody')?.dataset.total === '7775' && document.querySelector('#headlineTicker')?.dataset.count === '71');
await page.screenshot({path: path.join(output, name.replaceAll(' ', '-') + '-header.png')});
const ticker = page.locator('#headlineTicker'), view = ticker.locator('.pn-ticker-viewport');
const x = () => ticker.locator('ul').evaluate(n => n.getBoundingClientRect().x);
for (const landscape of [false, true, false]) {
const actual = await rotate(page, session, name, landscape);
assert.match(actual.ua, /Android/); assert.ok(actual.touch > 0 && actual.dpr > 1); assert.equal(actual.hover, false);
assert.equal(actual.orientation.angle, landscape ? 90 : 0);
await ticker.scrollIntoViewIfNeeded(); await page.mouse.move(0, 0);
const a = await x(); await page.waitForTimeout(400); const b = await x();
assert.ok(a - b > 5, 'Actual rendered Android ticker movement across frames');
assert.equal(await ticker.locator('input,button').count(), 0);
assert.equal(await page.locator('.masthead input[type=search]').count(), 1);
assert.equal(await page.locator('#headlinesHeading').evaluate(n => getComputedStyle(n).color), 'rgb(255, 255, 255)');
assert.equal(await ticker.locator('.pn-ticker-copy a,.pn-ticker-copy [tabindex]').count(), 0);
assert.equal(await ticker.locator('.pn-ticker-copy').getAttribute('aria-hidden'), 'true');
assert.notEqual(await ticker.locator('.pn-ticker-copy').getAttribute('inert'), null);
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 2));
assert.equal(await page.locator('#tbody').getAttribute('data-total'), '7775');
result.rotations.push({landscape, actual, renderedDelta: a - b});
await page.screenshot({path: path.join(output, name.replaceAll(' ', '-') + '-' + result.rotations.length + '.png')}); save();
}
const box = await view.boundingBox();
await tap(session, box.x + box.width * .5, box.y + 3); await page.waitForTimeout(80);
assert.equal(await ticker.getAttribute('data-reading'), 'true');
let a = await x(); await page.waitForTimeout(300); assert.ok(Math.abs(await x() - a) < 1);
const before = await view.evaluate(n => n.scrollLeft), beforeUrl = page.url();
await swipe(session, box.x + box.width * .8, box.y + box.height / 2, -Math.min(180, box.width * .6));
await page.waitForTimeout(150);
const after = await view.evaluate(n => n.scrollLeft);
assert.ok(after > before + 20, 'Native horizontal touch reading swipe');
assert.equal(page.url(), beforeUrl); assert.equal(popups.length, 0);
await tap(session, box.x + box.width * .5, box.y + 3); await page.waitForTimeout(80);
assert.equal(await ticker.getAttribute('data-reading'), 'false');
a = await x(); await page.waitForTimeout(400); assert.ok(a - await x() > 5);
result.touch = {paused: true, readSwipePixels: after - before, resumed: true, noLinkActivation: true};
const query = page.locator('.pn-news-header-search input'), target = saved.items.at(-1);
await query.fill(target.title);
assert.ok((await page.locator('#liveNews').textContent()).includes(target.title));
await page.locator('.pn-news-quality').getByRole('button', {name: 'Clear news filters'}).tap();
assert.equal(await page.locator('.pn-news-quality').getAttribute('data-filtered-count'), '71');
result.headerSearch = {singular: true, lastOriginalArticleMatched: true};
await originals(ticker);
result.attributionDates = {literalSourceEquality: true, originalLinks: expectedRows.length, datedOriginals: expectedRows.length};
assert.deepEqual(errors, []);
result.expectedBlockedExternal = [...blocked];
await context.close();
const reduced = await browser.newContext({...devices[name], reducedMotion: 'reduce'}), reducedBlocked = new Set();
await fallback(reduced, reducedBlocked);
const r = await reduced.newPage(), reducedErrors = []; r.on('pageerror', e => reducedErrors.push(e.message));
await r.goto(url, {waitUntil: 'domcontentloaded', timeout: 20000});
await r.waitForFunction(() => document.querySelector('#headlineTicker')?.dataset.count === '71');
const rt = r.locator('#headlineTicker'); await rt.scrollIntoViewIfNeeded();
a = await rt.locator('ul').evaluate(n => n.getBoundingClientRect().x);
await r.waitForTimeout(350);
assert.ok(Math.abs(await rt.locator('ul').evaluate(n => n.getBoundingClientRect().x) - a) < 1);
await rt.locator('ul a').last().focus();
assert.ok(await rt.locator('ul a').last().evaluate(n => { const a = n.getBoundingClientRect(), v = n.closest('.pn-ticker-viewport').getBoundingClientRect(); return a.right > v.left && a.left < v.right; }));
assert.ok(await r.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 2));
await originals(rt); assert.deepEqual(reducedErrors, []);
result.reducedMotion = {static: true, lastOriginalLinkReadable: true, literalSourceEquality: true, errors: reducedErrors};
await r.screenshot({path: path.join(output, name.replaceAll(' ', '-') + '-reduced.png')});
await reduced.close(); result.status = 'PASS'; save();
console.log(JSON.stringify({device: name, status: result.status, touch: result.touch, reducedMotion: result.reducedMotion}));
}
// Opt-in observation only. Public transport/content cannot establish acceptance of this source candidate.
if (process.env.V940_ANDROID_PUBLIC === '1') for (const target of ['https://globalgrid2050.com/uk_renewables_pipeline/202611171526/', 'https://globalgrid2050.com/']) {
const context = await browser.newContext({...devices[selected[0]]}), page = await context.newPage(), errors = [];
page.setDefaultTimeout(2500); page.on('pageerror', e => errors.push(e.message));
const observation = {requestedUrl: target, utc: new Date().toISOString(), device: selected[0], interception: false, acceptedFixClaim: false};
receipt.public.push(observation);
try {
const response = await page.goto(target, {waitUntil: 'domcontentloaded', timeout: 15000});
await page.waitForTimeout(1200);
observation.status = response?.status(); observation.finalUrl = page.url();
if (response) observation.htmlSha256 = sha(await response.body());
observation.dom = await page.evaluate(() => ({title: document.title, brand: document.querySelector('.release-brand small')?.textContent || null,
tickerControls: [...document.querySelectorAll('#headlineTicker input,#headlineTicker button')].map(e => ({tag: e.tagName, text: e.textContent, placeholder: e.getAttribute('placeholder')})),
tickerCount: document.querySelector('#headlineTicker')?.dataset.count || null,
pipelineLinks: [...document.querySelectorAll('a[href*="uk_renewables_pipeline/"]')].map(a => ({text: a.textContent, href: a.href})).slice(0, 30)}));
const track = page.locator('#headlineTicker .pn-ticker-track');
if (await track.count()) { await track.scrollIntoViewIfNeeded(); const a = await track.evaluate(n => n.getBoundingClientRect().x); await page.waitForTimeout(500); observation.renderedDelta = a - await track.evaluate(n => n.getBoundingClientRect().x); }
await page.screenshot({path: path.join(output, 'public-' + receipt.public.length + '.png'), timeout: 2500});
observation.errors = errors;
} catch (e) { observation.transportOrObservationError = e.message; }
save(); await context.close();
}
receipt.status = 'PASS'; receipt.completedUTC = new Date().toISOString(); save();
} catch (e) {
receipt.status = 'FAIL'; receipt.failure = {message: e.message, stack: e.stack}; save(); throw e;
} finally { await browser?.close(); await new Promise(resolve => server.close(resolve)); }Browser
A JavaScript module in the automation folder of GlobalGrid2050 that draws pipeline headlines snapshot.
renderglobalgrid2050 / automation/v940_preview/browser.mjs · lines 1–41 of 41 · Not reached from any entry point (candidate for review) · pattern fixture (shared by 30 files)
- What it does
- It draws pipeline headlines snapshot. Defines fixture. Uses libraries node:assert/strict, node:http, node:fs, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files.
- Inputs & outputs
- In: JSON file pipeline_headlines.snapshot.json. Out: JSON file receipt.json.
- What it achieves
- Defines `fixture`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/v940_preview · JavaScript module
- Uses
- node:assert/strict, node:http, node:fs, node:path, node:url
- Used by
- none found
- Produces
- fixture
- Defines here
- fixture
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/v940_preview/browser.mjs:1-41 · blob d52d8a1047edb7c479e4c419302fa7422aceb8ce · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
import assert from 'node:assert/strict';
import {createServer} from 'node:http';
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
import {resolve,extname,sep} from 'node:path';
import {pathToFileURL} from 'node:url';
const root=resolve(import.meta.dirname,'../..'),edition='uk_renewables_pipeline/202611171710',out=resolve(process.env.V940_OUT||'D:/githubfiles/.qa-artifacts/v940-neon-worker');mkdirSync(out,{recursive:true});
const {chromium}=await import(process.env.PLAYWRIGHT_MODULE?pathToFileURL(process.env.PLAYWRIGHT_MODULE).href:'playwright');
const saved=JSON.parse(readFileSync(resolve(root,edition,'news/pipeline_headlines.snapshot.json')));
const fixture=n=>({...saved,items:Array.from({length:n},(_,i)=>({title:'Synthetic headline '+i,source:'Fixture publisher',link:'https://publisher.example/article/'+i,date:'2026-11-17T10:00:00Z'}))});
const server=createServer((req,res)=>{try{const p=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://local').pathname));assert.ok(p.startsWith(root+sep));res.setHeader('Content-Type',({'.html':'text/html','.mjs':'text/javascript','.js':'text/javascript','.css':'text/css','.json':'application/json'})[extname(p)]||'application/octet-stream');res.end(readFileSync(p));}catch{res.writeHead(404 … [line shortened here: 412 characters; full line on GitHub]
await new Promise(r=>server.listen(0,'127.0.0.1',r));const origin='http://127.0.0.1:'+server.address().port,proof={status:'RUNNING',edition,checks:[],limitations:['Chromium viewport/touch/keyboard emulation; physical handset and assistive technology acceptance unknown.','Existing saved source and explicitly synthetic boundary fixtures; no public publication claimed.']};let browser;
try{
browser=await chromium.launch({headless:true});
for(const [width,motion]of [[1440,'no-preference'],[393,'no-preference'],[390,'reduce']]){
const context=await browser.newContext({viewport:{width,height:900},hasTouch:width<500,isMobile:width<500,reducedMotion:motion});await context.route('**/*',r=>r.request().url().startsWith(origin)?r.continue():r.abort());
const page=await context.newPage(),errors=[];page.on('pageerror',e=>errors.push(e.message));await page.goto(origin+'/'+edition+'/index.html?technology=all');await page.waitForFunction(()=>document.querySelector('#tbody')?.dataset.total==='7775'&&document.querySelector('#headlineTicker')?.dataset.count==='71'&&document.querySelector('.pn-news-header-search input'));
const ticker=page.locator('#headlineTicker'),viewport=ticker.locator('.pn-ticker-viewport'),primary=ticker.locator('ul'),headerQuery=page.locator('.pn-news-header-search input'),quality=page.locator('.pn-news-quality');
assert.equal(await ticker.locator('input,button').count(),0);assert.equal(await primary.locator('a').count(),71);assert.equal(await ticker.locator('.pn-ticker-copy a,.pn-ticker-copy [tabindex]').count(),0);assert.equal(await ticker.locator('.pn-ticker-copy').getAttribute('aria-hidden'),'true');assert.notEqual(await ticker.locator('.pn-ticker-copy').getAttribute('inert'),null);assert.equal(await … [line shortened here: 517 characters; full line on GitHub]
assert.equal(await page.locator('#headlinesHeading').evaluate(n=>getComputedStyle(n).color),'rgb(255, 255, 255)');
await ticker.scrollIntoViewIfNeeded();await page.mouse.move(0,0);const x=()=>primary.evaluate(n=>n.getBoundingClientRect().x);let a=await x();await page.waitForTimeout(450);let b=await x();if(motion==='reduce')assert.ok(Math.abs(b-a)<1);else assert.ok(a-b>5,'Actual rendered strip must move across frames');
if(width===1440&&motion!=='reduce'){
await ticker.hover();a=await x();await page.waitForTimeout(250);assert.ok(Math.abs(await x()-a)<1,'Hover pauses real frames');await page.mouse.move(0,0);
const wrap=await page.evaluate(async()=>{const h=document.querySelector('#headlineTicker'),t=h.querySelector('.pn-ticker-track'),p=h.querySelector('ul'),c=h.querySelector('.pn-ticker-copy'),v=h.querySelector('.pn-ticker-viewport'),animation=t.getAnimations()[0],duration=animation.effect.getTiming().duration;animation.currentTime=duration-60;await new Promise(r=>requestAnimationFrame(()=>request … [line shortened here: 1,113 characters; full line on GitHub]
}
await viewport.focus();a=await x();await page.waitForTimeout(350);b=await x();assert.ok(Math.abs(b-a)<1,'Focus pauses movement');assert.equal(await ticker.getAttribute('data-reading'),'true');
await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),fixture(100));await viewport.focus();
const visited=[];for(let i=0;i<100;i++){await page.keyboard.press('Tab');const focused=await page.evaluate(()=>({href:document.activeElement?.href,tag:document.activeElement?.tagName,visible:(()=>{const e=document.activeElement,r=e.getBoundingClientRect(),v=e.closest('.pn-ticker-viewport')?.getBoundingClientRect();return !!v&&r.right>v.left&&r.left<v.right;})()}));assert.ok(focused.visible,JSON. … [line shortened here: 492 characters; full line on GitHub]
await page.keyboard.press('Tab');await page.mouse.move(0,0);
for(const count of [0,1,10,71,100]){await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'live'),fixture(count));assert.equal(await primary.locator('a').count(),count);assert.equal(await ticker.locator('input,button').count(),0);assert.equal(await ticker.locator('.pn-ticker-copy a').count(),0);}
await page.evaluate(doc=>window.pipelineHeadlines.render(doc,'snapshot'),saved);
await headerQuery.fill('solar');assert.ok(Number(await quality.getAttribute('data-filtered-count'))>0);assert.ok(Number(await quality.getAttribute('data-filtered-count'))<71);await quality.getByRole('button',{name:'Clear news filters'}).click();assert.equal(await headerQuery.inputValue(),'');
const target=saved.items.at(-1);await headerQuery.fill(target.title);assert.ok((await page.locator('#liveNews').textContent()).includes(target.title),'Header search reaches beyond initial twelve');await quality.getByRole('button',{name:'Clear news filters'}).click();assert.equal(await quality.getAttribute('data-filtered-count'),'71');
await ticker.scrollIntoViewIfNeeded();await page.mouse.move(0,0);await page.evaluate(()=>{window.v940First=document.querySelector('#headlineTicker ul a');window.v940Animation=document.querySelector('#headlineTicker .pn-ticker-track').getAnimations()[0];});await page.evaluate(doc=>window.pipelineHeadlines.render({...doc,generated_at:'2026-11-17T14:01:00Z'},'snapshot'),saved);assert.equal(await pa … [line shortened here: 591 characters; full line on GitHub]
if(width<500&&motion!=='reduce'){
const session=await context.newCDPSession(page),box=await viewport.boundingBox(),tap=async()=>{await session.send('Input.dispatchTouchEvent',{type:'touchStart',touchPoints:[{x:box.x+box.width/2,y:box.y+3,id:1}]});await session.send('Input.dispatchTouchEvent',{type:'touchEnd',touchPoints:[]});};await tap();await page.waitForTimeout(80);assert.equal(await ticker.getAttribute('data-reading'),'true … [line shortened here: 712 characters; full line on GitHub]
}
assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));assert.equal(await page.locator('#tbody').getAttribute('data-total'),'7775');assert.ok(await page.locator('#tbody a.atlaslink').first().getAttribute('href'));assert.deepEqual(errors,[]);await page.screenshot({path:resolve(out,'neon-'+width+'-'+motion+'.png')});await page.evaluate(()=>scrollTo(0,0));await page. … [line shortened here: 700 characters; full line on GitHub]
}
const nojs=await browser.newContext({javaScriptEnabled:false,viewport:{width:393,height:852}}),fallback=await nojs.newPage();await nojs.route('**/*',r=>r.request().url().startsWith(origin)?r.continue():r.abort());await fallback.goto(origin+'/'+edition+'/index.html');assert.ok((await fallback.locator('body').innerText()).includes('JavaScript'));assert.ok(await fallback.locator('noscript a').count( … [line shortened here: 567 characters; full line on GitHub]
}finally{await browser?.close();await new Promise(r=>server.close(r));writeFileSync(resolve(out,'receipt.json'),JSON.stringify(proof,null,2)+'\n');}
console.log(JSON.stringify(proof));Contracts Test
A test in the automation folder of GlobalGrid2050 that checks Model and Edition History, using SHA-256.
testglobalgrid2050 / automation/v940_preview/contracts.test.mjs · lines 1–11 of 11 · Entry point
- What it does
- It tests its inputs. Uses libraries node:test, node:assert/strict, node:fs, node:path, node:crypto. Side effects: reads or writes files.
- Inputs & outputs
- In: JSON file ticker.v940.json.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 V934 Preview Acceptance Workflow (globalgrid2050).
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Run by GlobalGrid2050 V934 Preview Acceptance Workflow.
- Application
- globalgrid2050 · automation/v940_preview · test
- Uses
- Model (import), Edition History (import), node:test, node:assert/strict, node:fs, node:path, node:crypto
- Used by
- run by GlobalGrid2050 V934 Preview Acceptance 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 automation/v940_preview/contracts.test.mjs:1-11 · blob aaf709b795c9a77f9bb526148a6295c170a0c4be · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import {createHash} from 'node:crypto';
import {latestHeadlines} from '../../uk_renewables_pipeline/202611171710/scripts/layers/model.mjs';
import {protectedEditionChanges} from '../pipeline_release/edition_history.mjs';
const root=path.resolve(import.meta.dirname,'../..'),current=path.join(root,'uk_renewables_pipeline/202611171710'),parent=path.join(root,'uk_renewables_pipeline/202611171609'),hash=p=>createHash('sha256').update(fs.readFileSync(p)).digest('hex');
test('canonical data/news/Solar files and selector policy remain byte-identical',()=>{let checked=0;for(const dir of ['data','news','solar1000']){const base=path.join(parent,dir);if(!fs.existsSync(base))continue;function walk(p){for(const f of fs.readdirSync(p,{withFileTypes:true})){const file=path.join(p,f.name);if(f.isDirectory())walk(file);else{assert.equal(hash(file),hash(path.join(current,pat … [line shortened here: 595 characters; full line on GitHub]
test('safe source policy retains cap, attribution, null dates and hostile URL refusals',()=>{const items=Array.from({length:105},(_,i)=>({title:'Headline '+i,source:'Original publisher',link:'https://publisher.example/'+i,date:'2026-11-17T10:00:00Z'}));assert.equal(latestHeadlines(items).length,100);for(const bad of [{link:'javascript:alert(1)'},{date:'2050-01-01'},{date:'2026-02-30'},{date:null,f … [line shortened here: 483 characters; full line on GitHub]
test('exact shared successor and historical editions are pinned',()=>{const c=JSON.parse(fs.readFileSync(path.join(current,'contracts/ticker.v940.json')));for(const [name,sha]of Object.entries(c.shared_sha256))assert.equal(hash(path.join(root,'automation/ticker_neon_ui/20261117-v940',name)),sha);assert.deepEqual(protectedEditionChanges({cwd:root,base:'3a3106e248131f6e430c1ea03b4858d659755303'}),[] … [line shortened here: 405 characters; full line on GitHub]