GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / globalgrid2050 / automation/news/prospecting-ui

Adapter and 9 more files

A JavaScript module in the prospecting ui folder of GlobalGrid2050 that validates triage (`validateTriage`), parses artifact (`parseArtifact`) and selects records (`selectRecords`), using SHA-256. Served with the page at https://globalgrid2050.com/automation/news/prospecting-ui/.

368 lines of JavaScript and HTML and CSS from globalgrid2050, in 10 files. Topic: Electricity markets and data pipelines. Section 787 of 2044.

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

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

In this section

  1. Adapter ingest · globalgrid2050 / automation/news/prospecting-ui/adapter.mjs lines 1–90
  2. Bundle render · globalgrid2050 / automation/news/prospecting-ui/bundle.mjs lines 1–48
  3. News — Prospecting UI Page render · globalgrid2050 / automation/news/prospecting-ui/index.html lines 1–19
  4. Inline render · globalgrid2050 / automation/news/prospecting-ui/inline.css lines 1–10
  5. Prototype interaction · globalgrid2050 / automation/news/prospecting-ui/prototype.mjs lines 1–15
  6. Adapter Test test · globalgrid2050 / automation/news/prospecting-ui/tests/adapter.test.mjs lines 1–32
  7. Browser test · globalgrid2050 / automation/news/prospecting-ui/tests/browser.mjs lines 1–45
  8. Bundle Test test · globalgrid2050 / automation/news/prospecting-ui/tests/bundle.test.mjs lines 1–27
  9. Register Browser test · globalgrid2050 / automation/news/prospecting-ui/tests/register-browser.mjs lines 1–57
  10. View render · globalgrid2050 / automation/news/prospecting-ui/view.mjs lines 1–25

Adapter

A JavaScript module in the prospecting ui folder of GlobalGrid2050 that validates triage (`validateTriage`), parses artifact (`parseArtifact`) and selects records (`selectRecords`), using SHA-256. Served with the page at https://globalgrid2050.com/automation/news/prospecting-ui/.

ingestglobalgrid2050 / automation/news/prospecting-ui/adapter.mjs · lines 1–90 of 90 · pattern access (shared by 2 files)

What it does
It lists and searches its content. Defines 15 functions or classes, including require, text, number, integer, hash.
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Downstream impact
Used directly by 3 files: Bundle (globalgrid2050, https://globalgrid2050.com/automation/news/prospecting-ui/); Prototype (globalgrid2050, https://globalgrid2050.com/automation/news/prospecting-ui/); Browser (globalgrid2050). Reached from 3 other entry points, including News — Prospecting UI Page (globalgrid2050, https://globalgrid2050.com/automation/news/prospecting-ui/); GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (globalgrid2050); Bundle Test (globalgrid2050).
What it achieves
It validates triage (`validateTriage`), parses artifact (`parseArtifact`) and selects records (`selectRecords`). Bounded consumer for the V9.26 research-triage proposal.
Why it matters
Imported by Bundle and Prototype. Checked by Browser.
Application
globalgrid2050 · automation/news/prospecting-ui · JavaScript module
Uses
none found
Used by
imported by Bundle (import), imported by Prototype (import), imported by Browser (import), mentioned in Standalone (comment link)
Produces
SCHEMA, MAX_BYTES, safeSourceURL, validateTriage, parseArtifact, selectRecords
Defines here
require, text, number, integer, hash, moment, past, safeSourceURL, freshness, access, evidence, candidate, validateTriage, parseArtifact, selectRecords
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/news/prospecting-ui/adapter.mjs:1-90 · blob eebfdd17883c03bb07b8ad5ae84caec4ada67f51 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/** Bounded consumer for the V9.26 research-triage proposal. No acquisition. */
export const SCHEMA='globalgrid2050.prospecting.research-triage.v1';
export const MAX_BYTES=16*1024*1024;
const SHA=/^[a-f0-9]{64}$/;
const policy={paywalled_channels:'EXCLUDED',unknown_access:'DISABLED',corporate_enrichment:'LISTED_PARENT_GROUP_ONLY_WITH_IDENTITY_AND_MEMBERSHIP_EVIDENCE',sme_targeting:false,directors_officers_residential_addresses:false,government_hosting_implies_reuse_permission:false};
function require(value,message){if(!value)throw new Error(message);}
function text(value,label,nullable=false){require(nullable&&value===null||typeof value==='string'&&value.trim().length>0&&value.length<=1000,`${label}: bounded text required`);return value;}
function number(value,label){require(typeof value==='number'&&Number.isFinite(value)&&value>=0,`${label}: nonnegative finite number required`);return value;}
function integer(value,label){number(value,label);require(Number.isInteger(value),`${label}: integer required`);return value;}
function hash(value){require(SHA.test(value),'SHA256 required');return value;}
function moment(value){
  require(typeof value==='string'&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/.test(value),'UTC timestamp required');
  const parsed=new Date(value);require(Number.isFinite(+parsed)&&parsed.toISOString().slice(0,19)===value.slice(0,19),'Invalid calendar timestamp');return +parsed;
}
function past(value,asOf){const result=moment(value);require(result<=asOf,'Future source timestamp');return result;}
export function safeSourceURL(value){
  require(typeof value==='string'&&!/[\s\\\x00-\x1f]/.test(value),'Invalid source URL');
  const url=new URL(value);const host=url.hostname.toLowerCase();
  require(url.protocol==='https:'&&!url.username&&!url.password&&!url.port&&host.includes('.')&&!host.startsWith('[')&&!/^\d+(?:\.\d+){3}$/.test(host)&&!/(?:^|\.)(?:localhost|local|internal|test)$/.test(host),'Public HTTPS source required');return url.href;
}
function freshness(value,asOf,windowDays,calendar=false){
  require(value&&typeof value==='object','Freshness required');text(value.basis,'Freshness basis');
  if(value.state==='UNKNOWN'){require(value.timestamp===null&&value.age_days===null,'Unknown freshness must retain nulls');return {...value};}
  require(['STALE','WITHIN_WINDOW'].includes(value.state),'Unsupported freshness state');
  let when;
  if(calendar){require(/^\d{4}-\d{2}-\d{2}$/.test(value.timestamp),'Official calendar date required');when=moment(`${value.timestamp}T00:00:00Z`);}
  else when=past(value.timestamp,asOf);
  const reference=calendar?Math.floor(asOf/86400000)*86400000:asOf;
  const age=(reference-when)/86400000;require(age>=0,'Future record date');number(value.age_days,'Freshness age');
  require(Math.abs(value.age_days-age)<0.00011,'Freshness age disagrees with source clock');
  require(value.state===(age>windowDays?'STALE':'WITHIN_WINDOW'),'Freshness state disagrees with source clock');return {...value};
}
function access(value,asOf){require(value?.state==='OPEN','Paywalled or unknown access excluded');safeSourceURL(value.review_url);past(value.checked_at,asOf);}
function evidence(article,asOf){
  require(article.state==='PROVISIONAL','Machine evidence must remain provisional');
  text(article.id,'Article ID');text(article.title,'Headline');require(article.title.length<=300,'Headline display limit');text(article.publisher,'Publisher');safeSourceURL(article.url);
  const published=past(article.pub_date,asOf),first=past(article.first_seen,asOf),last=past(article.last_seen,asOf);require(published<=last&&first<=last,'Article clocks disagree');
  require(['exact_name','repd_id'].includes(article.match_method),'Unsupported match');
  const source=article.source;require(source&&typeof source==='object','Article receipt missing');text(source.id,'Source ID');safeSourceURL(source.url);safeSourceURL(source.rights_review_url);hash(source.response_sha256);past(source.fetched_at,asOf);access(source.channel_access,asOf);access(article.access,asOf);
  return {title:article.title,url:article.url,publisher:article.publisher,pub_date:article.pub_date,state:'PROVISIONAL',freshness:freshness(article.freshness,asOf,30),retrieval_freshness:freshness(article.retrieval_freshness,asOf,14)};
}
function candidate(row,index,asOf){
  require(row&&typeof row==='object','Record required');
  const official=row.record_type==='renewable_project';require(official||row.record_type==='data_centre','Unsupported record type');
  require((official?/^REPD-[1-9]\d*$/:/^DC-WD-Q[1-9]\d*$/).test(row.id),'Identity/type mismatch');
  require(row.rank===index+1,'Ranks must be consecutive');text(row.name,'Name',true);text(row.country,'Country',true);text(row.technology,'Technology');
  require(row.record_state===(official?'OFFICIAL':'PROVISIONAL'),'Unsupported record state');require(['UNKNOWN','PROVISIONAL'].includes(row.research_state),'Unsupported research state');text(row.official_status,'Official status',true);
  require(row.event_at===null,'Current adapter cannot assert an event');text(row.research_note,'Research note');require(row.research_note.startsWith('Research note:'),'Generated note must be labelled');
  const corporate=row.corporate_eligibility;
  require(corporate?.eligible===false&&corporate.state==='UNKNOWN'&&corporate.listed_parent===null&&Array.isArray(corporate.identity_evidence)&&corporate.identity_evidence.length===0&&Array.isArray(corporate.membership_evidence)&&corporate.membership_evidence.length===0,'Listed-parent eligibility not established');text(corporate.reason,'Corporate policy reason');
  const heat=row.heat;require(heat?.state==='UNKNOWN'&&heat.momentum_status==='UNKNOWN'&&heat.score===0&&heat.independent_signal_count===null&&Array.isArray(heat.components)&&heat.components.length===0,'Independent momentum not established');text(heat.reason,'Momentum reason');
  const capacities=row.capacities;require(capacities&&typeof capacities==='object','Typed capacity required');
  const keys=official?['repd_installed_mw']:['grid_connection_mw','it_load_mw','site_demand_mw'];require(JSON.stringify(Object.keys(capacities).sort())===JSON.stringify(keys),'Capacity basis mismatch');
  for(const value of Object.values(capacities)){if(value!==null)number(value,'Capacity');if(!official)require(value===null,'DC figures need reviewed successor adapter');}
  const source=row.source;require(source&&typeof source==='object','Source required');safeSourceURL(source.url);hash(source.sha256);
  if(!official){safeSourceURL(source.revision_url);require(source.publisher==='Wikidata'&&source.licence==='CC0-1.0','Unsupported DC attribution');past(source.retrieved_at,asOf);}
  const allowed=official?['capacity','technology','national_route','evidence_tier','research_follow_up']:['data_centre_topic'];
  require(Array.isArray(row.reasons)&&row.reasons.length===allowed.length,'Named reasons required');
  const reasons=row.reasons.map((reason,i)=>{require(reason.name===allowed[i],'Unexpected score component');number(reason.points,'Points');number(reason.max,'Maximum');require(reason.points<=reason.max,'Points exceed component maximum');text(reason.basis,'Score reason');return {name:reason.name,points:reason.points,max:reason.max,basis:reason.basis};});
  number(row.score,'Score');require(Math.abs(row.score-Math.round(reasons.reduce((sum,r)=>sum+r.points,0)*100)/100)<0.00001,'Score does not equal named components');
  require(Array.isArray(row.evidence)&&row.evidence.length<=100,'Evidence exceeds bounded display');const articles=row.evidence.map(article=>evidence(article,asOf));require(new Set(articles.map(a=>a.url)).size===articles.length,'Duplicate article');require(row.research_state===(articles.length?'PROVISIONAL':'UNKNOWN'),'Research state/count disagree');
  if(row.last_researched_at!==null)past(row.last_researched_at,asOf);
  return {id:row.id,rank:row.rank,name:row.name,country:row.country,record_type:row.record_type,technology:row.technology,record_state:row.record_state,official_status:row.official_status,score:row.score,reasons,capacities:{...capacities},source:{url:source.revision_url||source.url,sha256:source.sha256},record_freshness:freshness(row.record_freshness,asOf,90,official),retrieval_freshness:row.retri  … [line shortened here: 563 characters; full line on GitHub]
}
export function validateTriage(payload){
  require(payload?.schema===SCHEMA,'Unsupported research-priority schema');const asOf=moment(payload.as_of);
  require(payload.source_policy&&Object.entries(policy).every(([key,value])=>payload.source_policy[key]===value),'Source policy is not eligible');
  hash(payload.profile_sha256);require(payload.profile?.id==='research-triage.v1','Unsupported scoring profile');text(payload.purpose,'Purpose');text(payload.coverage,'Coverage');
  integer(payload.input_count,'Input count');integer(payload.eligible_count,'Eligible count');integer(payload.returned_count,'Returned count');integer(payload.limit,'Limit');
  require(payload.limit>=1&&payload.limit<=1000&&payload.input_count>=7775&&payload.eligible_count<=payload.input_count&&payload.returned_count<=payload.eligible_count&&payload.returned_count<=payload.limit,'Counts inconsistent');
  require([null,'renewable_project','data_centre'].includes(payload.record_type_filter),'Unsupported type filter');
  const receipts=payload.input_receipts;require(Array.isArray(receipts)&&receipts.length===3&&new Set(receipts.map(r=>r.id)).size===3,'Input receipts required');
  const official=receipts.find(r=>r.id==='official_repd');require(official?.state==='OFFICIAL'&&official.population===7775&&official.solar1000_count===1000&&official.release==='202611161244','Official population changed');hash(official.manifest_sha256);hash(official.solar1000_manifest_sha256);hash(official.source_workbook_sha256);
  for(const id of ['news_evidence','global_data_centres']){const r=receipts.find(r=>r.id===id);require(r&&['UNKNOWN','PROVISIONAL'].includes(r.state),'Invalid optional input receipt');if(r.state==='PROVISIONAL'){hash(r.sha256);freshness(r.freshness,asOf,14);}else text(r.reason,'Missing input reason');}
  require(Array.isArray(payload.unsupported_interfaces)&&payload.unsupported_interfaces.every(i=>i.enabled===false),'Unsupported source enabled');
  require(Array.isArray(payload.records)&&payload.records.length===payload.returned_count,'Record count differs');const records=payload.records.map((row,index)=>candidate(row,index,asOf));require(new Set(records.map(r=>r.id)).size===records.length,'Duplicate record identity');
  const news=receipts.find(r=>r.id==='news_evidence'),dc=receipts.find(r=>r.id==='global_data_centres');
  if(news.state==='PROVISIONAL'){require(news.rights_state==='ACCEPTED_RECEIPTS_SUPPLIED','Accepted news receipts required');const generated=past(news.generated_at,asOf);require(past(news.source_run_at,asOf)<=generated&&news.freshness.timestamp===news.source_run_at,'News receipt clocks disagree');}
  records.forEach((row,i)=>{require(!payload.record_type_filter||row.record_type===payload.record_type_filter,'Filter/type mismatch');require(!row.evidence.length||news.state==='PROVISIONAL','Article lacks admitted news input');require(row.record_type!=='data_centre'||dc.state==='PROVISIONAL','DC record lacks admitted input');if(i){const prior=records[i-1];require(prior.score>row.score||prior.scor  … [line shortened here: 480 characters; full line on GitHub]
  return {as_of:payload.as_of,purpose:payload.purpose,coverage:payload.coverage,input_count:payload.input_count,eligible_count:payload.eligible_count,returned_count:payload.returned_count,record_type_filter:payload.record_type_filter,profile_sha256:payload.profile_sha256,records};
}
export async function parseArtifact(bytes,expectedSHA256){
  require(bytes.byteLength<=MAX_BYTES,'Priority artifact exceeds size limit');
  if(expectedSHA256){hash(expectedSHA256);const actual=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),n=>n.toString(16).padStart(2,'0')).join('');require(actual===expectedSHA256,'Priority artifact hash mismatch');}
  return validateTriage(JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(bytes)));
}
export function selectRecords(model,{recordType='renewable_project',query='',sort='priority'}={}){
  const needle=query.trim().toLocaleLowerCase('en-GB');const rows=model.records.filter(row=>row.record_type===recordType&&[row.id,row.name||'',row.country||'',row.technology].join(' ').toLocaleLowerCase('en-GB').includes(needle));
  return sort==='name'?rows.sort((a,b)=>(a.name||a.id).localeCompare(b.name||b.id,'en-GB')||a.id.localeCompare(b.id)):rows.sort((a,b)=>a.rank-b.rank);
}

Bundle

A JavaScript module in the prospecting ui folder of GlobalGrid2050 that draws priority and the Renewable Energy Planning Database (REPD) register, using SHA-256. Served with the page at https://globalgrid2050.com/automation/news/prospecting-ui/.

renderglobalgrid2050 / automation/news/prospecting-ui/bundle.mjs · lines 1–48 of 48 · pattern require (shared by 53 files)

What it does
It draws priority and the REPD register. Defines require, digest, ids, parsePriorityBundle, attachProjectPriority. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
Inputs & outputs
In: JSON file priority.json.
Downstream impact
Used directly by 3 files: Bundle Test (globalgrid2050); Register Browser (globalgrid2050); Research Priority V927 (globalgrid2050). Reached from 1 other entry point, including GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (globalgrid2050).
What it achieves
It parses priority bundle (`parsePriorityBundle`) and attaches project priority (`attachProjectPriority`). Source-bound successor adapter. Never replaces official table rows or exports.
Why it matters
Imported by Research Priority V927. Checked by 2 tests, including Bundle Test.
Application
globalgrid2050 · automation/news/prospecting-ui · JavaScript module
Uses
Adapter (import), View (import)
Used by
run by Bundle Test (script call), imported by Register Browser (dynamic import), imported by Research Priority V927 (import)
Produces
parsePriorityBundle, attachProjectPriority
Defines here
require, digest, ids, parsePriorityBundle, attachProjectPriority
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/news/prospecting-ui/bundle.mjs:1-48 · blob 65a7dfe8ff69bc6aab2428f93e1fbee7a25d3661 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/** Source-bound successor adapter. Never replaces official table rows or exports. */
import {parseArtifact,MAX_BYTES} from './adapter.mjs';
import {attachPriority} from './view.mjs';
const SHA=/^[a-f0-9]{64}$/;
function require(value,message){if(!value)throw new Error(message);}
async function digest(bytes){return Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),n=>n.toString(16).padStart(2,'0')).join('');}
function ids(values,pattern,count){require(Array.isArray(values)&&values.length===count&&new Set(values).size===count&&values.every(v=>typeof v==='string'&&pattern.test(v)),'Invalid source identity inventory');return values;}
export async function parsePriorityBundle(priorityBytes,manifestBytes,expectedManifestSHA256){
  require(SHA.test(expectedManifestSHA256),'A pinned manifest SHA256 is required');
  require(manifestBytes.byteLength<=1024*1024&&priorityBytes.byteLength<=MAX_BYTES,'Priority bundle size exceeded');
  require(await digest(manifestBytes)===expectedManifestSHA256,'Manifest digest mismatch');
  const manifest=JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(manifestBytes));
  require(manifest.schema==='globalgrid2050.prospecting.export.v1'&&manifest.source_release==='202611161244'&&manifest.publication_state==='REVIEW_ARTIFACT','Unsupported priority manifest');
  require(manifest.official_count===7775&&manifest.solar_count===3604&&manifest.solar1000_count===1000,'Baseline counts changed');
  require(manifest.unranked_state==='OUTSIDE_RANKED_SUBSET'&&typeof manifest.rank_scope==='string','Rank scope missing');
  const inventory=manifest.inventory;
  const official=ids(inventory?.official_ids,/^REPD-[1-9]\d*$/,7775);
  const pilot=ids(inventory?.solar1000_ids,/^[1-9]\d*$/,1000);
  require(pilot.every((v,i)=>official.includes('REPD-'+v)&&(!i||Number(v)>Number(pilot[i-1]))),'Solar-1000 order or membership changed');
  const dc=ids(inventory?.data_centre_ids,/^DC-WD-Q[1-9]\d*$/,inventory?.data_centre_ids?.length);
  require(dc.length<=1000&&manifest.input_count===official.length+dc.length,'Input population mismatch');
  require(Object.keys(inventory).sort().join(',')==='data_centre_ids,official_ids,solar1000_ids','Unexpected inventory fields');
  const canonicalInventory=JSON.stringify({data_centre_ids:dc,official_ids:official,solar1000_ids:pilot},null,2)+'\n';
  require(await digest(new TextEncoder().encode(canonicalInventory))===manifest.inventory_sha256,'Inventory digest mismatch');
  require(manifest.files&&Object.keys(manifest.files).sort().join(',')==='priority.csv,priority.json','Unexpected bundle files');
  const record=manifest.files['priority.json'];
  require(record.bytes===priorityBytes.byteLength&&SHA.test(record.sha256),'Priority file receipt mismatch');
  const model=await parseArtifact(priorityBytes,record.sha256);
  require(model.as_of===manifest.as_of&&model.returned_count===manifest.ranked_count&&model.input_count===manifest.input_count&&model.profile_sha256===manifest.profile_sha256,'Priority model differs from manifest');
  const raw=JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(priorityBytes));
  require(JSON.stringify(raw.input_receipts)===JSON.stringify(manifest.input_receipts),'Source receipt differs from manifest');
  const members=new Set([...official,...dc]);
  require(model.records.every(r=>members.has(r.id)),'Ranked identity not in source inventory');
  return {model,manifest,members,byId:new Map(model.records.map(row=>[row.id,row]))};
}
export function attachProjectPriority(host,projectId,bundle){
  const row=host.closest('[id^="repd-"], [data-project-id]');
  const identity=row?.id?.startsWith('repd-')?'REPD-'+row.id.slice(5):row?.dataset.projectId;
  require(identity===projectId,'Priority host identity mismatch');
  // Remove only this adapter's prior rendering. Existing project facts/actions stay intact.
  host.querySelector(':scope > [data-priority-id]')?.remove();
  host.querySelector(':scope > [data-priority-state]')?.remove();
  if(!bundle){const label=document.createElement('span');label.dataset.priorityState='UNAVAILABLE';label.textContent='Research priority unavailable';host.append(label);return;}
  require(bundle.members.has(projectId),'Project absent from bound source inventory');
  const priority=bundle.byId.get(projectId);
  if(priority){attachPriority(host,priority,bundle.model.as_of);return;}
  const label=document.createElement('span');label.dataset.priorityState='OUTSIDE_RANKED_SUBSET';label.textContent='Outside this research-priority subset';host.append(label);
}

News — Prospecting UI Page

A web page in the automation folder of GlobalGrid2050 that reads inputs for artifact and sort. Published at https://globalgrid2050.com/automation/news/prospecting-ui/.

renderglobalgrid2050 / automation/news/prospecting-ui/index.html · lines 1–19 of 19 · Entry point

What it does
It draws its content. Uses libraries prototype.css. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. README: "`index.html` is an isolated review shell with a local JSON file input."
Inputs & outputs
In: user-supplied file (file picker); form fields (user input). Out: web page.
Downstream impact
Used directly by 1 file: Browser (globalgrid2050). It is itself an entry point, published at https://globalgrid2050.com/automation/news/prospecting-ui/.
What it achieves
Local review prototype.
Why it matters
Checked by Browser.
Application
globalgrid2050 · automation/news/prospecting-ui · page
Uses
Prototype (script src), prototype.css
Used by
referenced by Browser (new URL import.meta.url)
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/news/prospecting-ui/index.html:1-19 · blob 4029dafe98d2b9414ea1e0d256f82ed553305875 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>V9.26 research priority · local review prototype</title><link rel="stylesheet" href="prototype.css"></head>
<body>
<main>
  <header><p class="eyebrow">GLOBALGRID2050 · V9.26 LOCAL PROTOTYPE</p><h1>Project research priorities</h1><p>A review of the proposed inline priority display. No production release or live research feed is changed.</p><nav aria-label="Page"><a href="#news">01 News</a><a href="#pipeline">02 Pipeline</a></nav></header>
  <section id="news" aria-labelledby="news-title"><p class="eyebrow">01 / CONTEXT</p><h2 id="news-title">News</h2><p>The existing News section remains first in the full dashboard. This isolated prototype does not acquire, repeat or rank live headlines.</p></section>
  <section id="pipeline" aria-labelledby="pipeline-title">
    <p class="eyebrow">02 / PROJECTS AND INFRASTRUCTURE</p><h2 id="pipeline-title">Pipeline</h2>
    <p>Research priority belongs within project details. Canonical project rows, the immutable Solar-1000 selection, maps and official CSV exports remain independent.</p>
    <label class="upload">Load a generated review artifact <input id="artifact" type="file" accept="application/json,.json"></label>
    <p id="artifactStatus" role="status">No review artifact loaded. Rankings and momentum are unavailable.</p>
    <div role="tablist" aria-label="Project datasets"><button id="ukTab" type="button" role="tab" aria-selected="true" aria-controls="reviewRows" data-type="renewable_project">UK projects</button><button id="dcTab" type="button" role="tab" aria-selected="false" aria-controls="reviewRows" tabindex="-1" data-type="data_centre">Global data centres</button></div>
    <div class="toolbar"><label>Find a project <input id="search" type="search" placeholder="Name, ID, country or technology"></label><label>Order review subset <select id="sort"><option value="priority">Research priority</option><option value="name">Project name</option></select></label></div>
    <p id="reviewCount">0 records loaded</p><div id="reviewRows" role="tabpanel" aria-labelledby="ukTab"></div>
  </section>
</main>
<script type="module" src="prototype.mjs"></script>
</body></html>

Inline

A style sheet in the prospecting ui folder of GlobalGrid2050. Served with the page at https://globalgrid2050.com/automation/news/prospecting-ui/.

renderglobalgrid2050 / automation/news/prospecting-ui/inline.css · lines 1–10 of 10 · Not reached from any entry point (candidate for review)

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
What it achieves
Additive project-detail styling only; existing table, actions and CSV unchanged.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · automation/news/prospecting-ui · style sheet
Uses
none found
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/news/prospecting-ui/inline.css:1-10 · blob 249557f51676d77dc42b331f755aa2ca826f6e23 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/* Additive project-detail styling only; existing table, actions and CSV unchanged. */
.project-record>.research-priority{max-width:100%;margin-top:10px;border-top:1px solid #304550;white-space:normal}
.project-record>.research-priority>summary{padding:9px 0;min-height:40px;color:#86e1d1;white-space:normal;cursor:pointer}
.project-record .priority-content{padding:2px 0 12px;font-size:12px;line-height:1.55;overflow-wrap:anywhere}
.project-record .priority-content p{margin:8px 0;font-weight:400}
.project-record .priority-content ul{margin:8px 0;padding-left:18px}
.project-record .priority-content li{margin:6px 0}
.project-record .priority-content .priority-note{color:#d5b976}
.project-record .priority-content .priority-unknown{font-weight:600}
.project-record>[data-priority-state]{display:block;margin-top:8px;font-size:12px;line-height:1.5;color:#a9bdc9;white-space:normal;overflow-wrap:anywhere}

Prototype

A JavaScript module in the prospecting ui folder of GlobalGrid2050. Served with the page at https://globalgrid2050.com/automation/news/prospecting-ui/.

interactionglobalgrid2050 / automation/news/prospecting-ui/prototype.mjs · lines 1–15 of 15 · Entry point · pattern activate (shared by 9 files)

What it does
Defines render, activate. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'prototype'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
Used directly by 1 file: News — Prospecting UI Page (globalgrid2050, https://globalgrid2050.com/automation/news/prospecting-ui/). It is itself an entry point, published at https://globalgrid2050.com/automation/news/prospecting-ui/.
What it achieves
Defines `render` and `activate`. It responds to change, click and keydown events.
Why it matters
Loaded by the Prospecting UI page at https://globalgrid2050.com/automation/news/prospecting-ui/.
Application
globalgrid2050 · automation/news/prospecting-ui · JavaScript module
Uses
Adapter (import), View (import)
Used by
loaded by News — Prospecting UI Page (script src)
Produces
render, activate
Defines here
render, activate
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/news/prospecting-ui/prototype.mjs:1-15 · blob 8e9b6349c95172619549650b83f62ffb24d0aec2 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
import {parseArtifact,selectRecords,MAX_BYTES} from './adapter.mjs';
import {renderReviewRows} from './view.mjs';
let model=null,recordType='renewable_project';
const rows=document.querySelector('#reviewRows'),status=document.querySelector('#artifactStatus'),search=document.querySelector('#search'),sort=document.querySelector('#sort');
function render(){const selected=model?selectRecords(model,{recordType,query:search.value,sort:sort.value}):[];renderReviewRows(rows,selected,model?.as_of);document.querySelector('#reviewCount').textContent=model?`${selected.length} shown from ${model.returned_count} ranked review records; ${model.eligible_count} eligible input records. This subset is not Solar-1000.`:'0 records loaded';}
document.querySelector('#artifact').addEventListener('change',async event=>{
  const file=event.target.files[0];if(!file)return;
  try{if(file.size>MAX_BYTES)throw new Error('Priority artifact exceeds size limit');const next=await parseArtifact(await file.arrayBuffer());model=next;status.textContent=`Review artifact validated as of ${next.as_of}. ${next.coverage} Local file bytes are not a publication or source-authenticity approval.`;}
  catch{model=null;status.textContent='Review artifact unavailable: contract validation failed. No rankings or source claims displayed.';}
  render();
});
const tabs=Array.from(document.querySelectorAll('[role=tab]'));
function activate(tab){recordType=tab.dataset.type;for(const button of tabs){button.setAttribute('aria-selected',String(button===tab));button.tabIndex=button===tab?0:-1;}rows.setAttribute('aria-labelledby',tab.id);render();}
tabs.forEach((tab,index)=>{tab.addEventListener('click',()=>activate(tab));tab.addEventListener('keydown',event=>{if(!['ArrowLeft','ArrowRight','Home','End'].includes(event.key))return;event.preventDefault();const next=tabs[event.key==='Home'?0:event.key==='End'?tabs.length-1:(index+(event.key==='ArrowRight'?1:tabs.length-1))%tabs.length];activate(next);next.focus();});});
search.addEventListener('input',render);sort.addEventListener('change',render);render();

Adapter Test

A test in the tests folder of GlobalGrid2050 that uses SHA-256.

testglobalgrid2050 / automation/news/prospecting-ui/tests/adapter.test.mjs · lines 1–32 of 32 · Entry point

What it does
It tests its inputs. Uses libraries node:test.
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Downstream impact
Used directly by 1 file: GlobalGrid2050 Pipeline Project Evidence Weekly 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 Pipeline Project Evidence Weekly Workflow.
Application
globalgrid2050 · automation/news/prospecting-ui/tests · test
Uses
node:test, ./fixture.mjs
Used by
run by GlobalGrid2050 Pipeline Project Evidence Weekly 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/news/prospecting-ui/tests/adapter.test.mjs:1-32 · blob f945e7306d0c21fe3dd4415c1bf676509ac48ef8 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import test from 'node:test';import assert from 'node:assert/strict';import {createHash} from 'node:crypto';
import {fixture,article} from './fixture.mjs';import {validateTriage,parseArtifact,selectRecords,safeSourceURL} from '../adapter.mjs';
test('keeps canonical source identities, distinct capacity bases, rank reasons and unknown momentum',()=>{const model=validateTriage(fixture());assert.equal(model.records[0].capacities.repd_installed_mw,50);assert.equal(model.records[1].capacities.it_load_mw,null);assert.equal(model.records[1].heat.independent_signal_count,null);assert.equal(selectRecords(model,{query:'1018'})[0].id,'REPD-1018');a  … [line shortened here: 483 characters; full line on GitHub]
const invalid={
  paywall:p=>p.source_policy.paywalled_channels='SECONDARY',
  sme:p=>p.source_policy.sme_targeting=true,
  personal:p=>p.source_policy.directors_officers_residential_addresses=true,
  population:p=>p.input_receipts[0].population=7774,
  seed:p=>p.input_receipts[0].solar1000_count=999,
  score:p=>p.records[0].score=99,
  verification:p=>p.records[1].record_state='VERIFIED',
  momentum:p=>p.records[0].heat.state='HOT',
  financeEvent:p=>p.records[0].event_at=p.as_of,
  groupInference:p=>p.records[0].corporate_eligibility.eligible=true,
  capacity:p=>p.records[1].capacities.it_load_mw=0,
  negativeMW:p=>p.records[0].capacities.repd_installed_mw=-1,
  wrongID:p=>p.records[0].id='DC-WD-Q123',
  rank:p=>p.records[0].rank=2,
  count:p=>p.returned_count=1,
  source:p=>p.records[0].source.url='javascript:alert(1)',
  future:p=>p.records[1].source.retrieved_at='2027-01-01T00:00:00Z',
  falseFresh:p=>p.records[1].retrieval_freshness.age_days=10,
  impossibleDate:p=>p.as_of='2026-02-30T00:00:00Z',
  reason:p=>p.records[0].reasons[0].name='funding',
  enabledSource:p=>p.unsupported_interfaces[0].enabled=true,
};
for(const [name,mutate] of Object.entries(invalid))test(`rejects ${name}`,()=>{const input=fixture();mutate(input);assert.throws(()=>validateTriage(input));});
test('stale record clock stays stale and retrieval date cannot overwrite it',()=>{const input=fixture();input.records[0].record_freshness={state:'STALE',basis:'official record update date',timestamp:'2026-01-01',age_days:319};assert.equal(validateTriage(input).records[0].record_freshness.state,'STALE');});
test('source texts remain literal and unused personal fields are never projected',()=>{const input=fixture();input.records[0].officer_address='DO NOT PROJECT';const model=validateTriage(input);assert.match(model.records[0].name,/<img/);assert.equal(JSON.stringify(model).includes('DO NOT PROJECT'),false);});
test('article requires an admitted input, provisional state and open channel plus per-article access',()=>{const input=fixture();input.records[0].evidence=[article()];input.records[0].research_state='PROVISIONAL';assert.throws(()=>validateTriage(input));Object.assign(input.input_receipts[1],{state:'PROVISIONAL',sha256:'b'.repeat(64),rights_state:'ACCEPTED_RECEIPTS_SUPPLIED',generated_at:input.as_o  … [line shortened here: 684 characters; full line on GitHub]
test('hash mismatch fails before display and invalid UTF8 is rejected',async()=>{const bytes=new TextEncoder().encode(JSON.stringify(fixture()));const sha=createHash('sha256').update(bytes).digest('hex');assert.equal((await parseArtifact(bytes,sha)).returned_count,2);await assert.rejects(parseArtifact(bytes,'0'.repeat(64)));await assert.rejects(parseArtifact(new Uint8Array([255])));});
for(const url of ['https://127.0.0.1/x','https://host.internal/x','https://user:pass@example.org/x','https://example.org:444/x','http://example.org/x'])test(`unsafe URL ${url}`,()=>assert.throws(()=>safeSourceURL(url)));

Browser

A JavaScript module in the tests folder of GlobalGrid2050 that tests synthetic only, generated local review and invalid only.

testglobalgrid2050 / automation/news/prospecting-ui/tests/browser.mjs · lines 1–45 of 45 · Not reached from any entry point (candidate for review)

What it does
It tests synthetic only, generated local review and invalid only. Uses libraries node:http. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Inputs & outputs
In: JSON file SYNTHETIC-TEST-ONLY.json; JSON file generated-local-review.json; JSON file INVALID-TEST-ONLY.json.
What it achieves
Isolated test server and installed Chrome; does not alter the release harness.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · automation/news/prospecting-ui/tests · JavaScript module
Uses
Adapter (import), News — Prospecting UI Page (new URL import.meta.url), node:http, ../../acquisition/browser/node_modules/playwright/index.mjs, ./fixture.mjs, ./view.mjs, ./adapter.mjs, ./tests/fixture.mjs
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/news/prospecting-ui/tests/browser.mjs:1-45 · blob 607b46fcd9e1a75ab0cff22055e996b36a869533 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
// Isolated test server and installed Chrome; does not alter the release harness.
import {createServer} from 'node:http';import {readFile,mkdir} from 'node:fs/promises';import {fileURLToPath} from 'node:url';import {resolve,sep,extname} from 'node:path';import assert from 'node:assert/strict';
import {chromium} from '../../acquisition/browser/node_modules/playwright/index.mjs';
import {fixture} from './fixture.mjs';
import {parseArtifact} from '../adapter.mjs';
const root=fileURLToPath(new URL('../',import.meta.url));
const output=resolve(process.env.PRIORITY_SCREENSHOTS||'tmp/prospecting-ui-browser');await mkdir(output,{recursive:true});
const mime={'.html':'text/html; charset=utf-8','.mjs':'text/javascript; charset=utf-8','.css':'text/css; charset=utf-8'};
const server=createServer(async(req,res)=>{try{const path=resolve(root,'.'+decodeURIComponent(new URL(req.url,'http://localhost').pathname));if(!path.startsWith(root.endsWith(sep)?root:root+sep))throw new Error('path');const bytes=await readFile(path);res.writeHead(200,{'Content-Type':mime[extname(path)]||'application/octet-stream'});res.end(bytes);}catch{res.writeHead(404);res.end('Not found');}}  … [line shortened here: 402 characters; full line on GitHub]
await new Promise(done=>server.listen(0,'127.0.0.1',done));let browser;let passed=0;
try{
  browser=await chromium.launch({channel:'chrome',headless:true});
  for(const width of [375,390,393,768,1440]){
    const page=await browser.newPage({viewport:{width,height:900}});const errors=[];page.on('pageerror',error=>errors.push(error.message));
    await page.goto(`http://127.0.0.1:${server.address().port}/index.html`);
    assert.equal(await page.locator('[data-priority-id]').count(),0);
    assert.equal(await page.evaluate(()=>Boolean(document.querySelector('#news').compareDocumentPosition(document.querySelector('#pipeline'))&Node.DOCUMENT_POSITION_FOLLOWING)),true);
    await page.locator('#artifact').setInputFiles({name:'SYNTHETIC-TEST-ONLY.json',mimeType:'application/json',buffer:Buffer.from(JSON.stringify(fixture()))});
    await page.locator('[data-priority-id="REPD-1018"]').waitFor();
    await page.locator('[data-priority-id] > summary').click();
    assert.match(await page.locator('#reviewRows').innerText(),/Momentum: unknown/);
    assert.match(await page.locator('#reviewRows').innerText(),/Current financing: not assessed/);
    assert.equal(await page.locator('#reviewRows img').count(),0);
    assert.match(await page.locator('#reviewRows').innerText(),/<img src=x/);
    assert.equal(await page.locator('#reviewRows a').getAttribute('rel'),'noopener noreferrer');
    assert.equal(await page.evaluate(async()=>{const {attachPriority}=await import('./view.mjs');const {validateTriage}=await import('./adapter.mjs');const {fixture}=await import('./tests/fixture.mjs');const model=validateTriage(fixture());const host=document.createElement('div');attachPriority(host,model.records[0],model.as_of);attachPriority(host,model.records[0],model.as_of);return host.querySe  … [line shortened here: 445 characters; full line on GitHub]
    await page.locator('#search').fill('no such site');assert.equal(await page.locator('[data-record-id]').count(),0);await page.locator('#search').fill('1018');assert.equal(await page.locator('[data-record-id]').count(),1);await page.locator('#search').fill('');
    await page.locator('#dcTab').click();await page.locator('[data-priority-id="DC-WD-Q123"] > summary').click();
    assert.match(await page.locator('#reviewRows').innerText(),/IT load: unknown/);assert.match(await page.locator('#reviewRows').innerText(),/Grid connection: unknown/);
    assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);
    await page.locator('#pipeline').evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:resolve(output,`priority-${width}.png`),fullPage:true});
    await page.locator('#dcTab').press('ArrowLeft');assert.equal(await page.locator('#ukTab').getAttribute('aria-selected'),'true');
    if(process.env.PRIORITY_REVIEW_ARTIFACT){
      const bytes=await readFile(process.env.PRIORITY_REVIEW_ARTIFACT),actual=await parseArtifact(bytes);
      await page.locator('#artifact').setInputFiles({name:'generated-local-review.json',mimeType:'application/json',buffer:bytes});
      await page.waitForFunction(()=>document.querySelector('#artifactStatus').textContent.includes('Review artifact validated'));
      await page.locator(actual.record_type_filter==='data_centre'?'#dcTab':'#ukTab').click();
      assert.equal(await page.locator('[data-record-id]').count(),actual.records.filter(r=>r.record_type===(actual.record_type_filter||'renewable_project')).length);
      await page.locator('[data-priority-id] > summary').first().click();await page.locator('#pipeline').evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:resolve(output,`producer-review-${width}.png`)});
    }
    const broken=fixture();broken.source_policy.paywalled_channels='ALLOWED';await page.locator('#artifact').setInputFiles({name:'INVALID-TEST-ONLY.json',mimeType:'application/json',buffer:Buffer.from(JSON.stringify(broken))});
    await page.waitForFunction(()=>document.querySelector('#artifactStatus').textContent.includes('validation failed'));assert.equal(await page.locator('[data-priority-id]').count(),0);assert.deepEqual(errors,[]);passed++;await page.close();
  }
  console.log(JSON.stringify({browser:'installed Google Chrome',version:browser.version(),viewport_checks:passed,widths:[375,390,393,768,1440],fixtures:'synthetic tests only',additional_producer_artifact:Boolean(process.env.PRIORITY_REVIEW_ARTIFACT),android_device:false}));
}finally{await browser?.close();await new Promise(done=>server.close(done));}

Bundle Test

A test in the tests folder of GlobalGrid2050 that checks Bundle, using SHA-256.

testglobalgrid2050 / automation/news/prospecting-ui/tests/bundle.test.mjs · lines 1–27 of 27 · Entry point · pattern bytes (shared by 19 files)

What it does
It tests its inputs. Defines bytes, sha. Uses libraries node:test, node:assert/strict, node:child_process, node:crypto, node:url. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Inputs & outputs
In: JSON file priority.json; CSV file priority.csv.
Downstream impact
Used directly by 1 file: GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (globalgrid2050).
What it achieves
Defines `bytes` and `sha`.
Why it matters
Run by GlobalGrid2050 Pipeline Project Evidence Weekly Workflow.
Application
globalgrid2050 · automation/news/prospecting-ui/tests · test
Uses
Bundle (script call), node:test, node:assert/strict, node:child_process, node:crypto, node:url
Used by
run by GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (workflow run)
Produces
bytes, sha
Defines here
bytes, sha
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/news/prospecting-ui/tests/bundle.test.mjs:1-27 · blob 342213636a4cb3eda150139eb204460e4aaa977d · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import test from 'node:test';
import assert from 'node:assert/strict';
import {execFileSync} from 'node:child_process';
import {createHash} from 'node:crypto';
import {fileURLToPath} from 'node:url';
import {parsePriorityBundle} from '../bundle.mjs';
const root=fileURLToPath(new URL('../../../../',import.meta.url));
const result=JSON.parse(execFileSync('python',['-c',"import json; from automation.news.build_prospecting_priority import build_artifacts; print(json.dumps({k:v.decode() for k,v in build_artifacts(as_of='2026-11-16T17:40:00Z').items()}))"],{cwd:root,encoding:'utf8',maxBuffer:24*1024*1024}));
const bytes=value=>new TextEncoder().encode(value);
const priority=bytes(result['priority.json']),manifest=bytes(result['manifest.json']);
const sha=value=>createHash('sha256').update(value).digest('hex');
test('actual producer bundle preserves all official and pilot identities',async()=>{
  const b=await parsePriorityBundle(priority,manifest,sha(manifest));
  assert.equal(b.members.size,7775);assert.equal(b.byId.size,1000);assert.equal(b.manifest.inventory.solar1000_ids.length,1000);
  assert.equal(b.model.records.every(r=>r.heat.state==='UNKNOWN'&&r.evidence.length===0),true);
});
test('requires a trusted manifest digest',async()=>{await assert.rejects(parsePriorityBundle(priority,manifest),/pinned/);});
test('altered manifest rejected',async()=>{await assert.rejects(parsePriorityBundle(priority,bytes(result['manifest.json']+' '),sha(manifest)),/digest/);});
test('altered priority rejected',async()=>{const altered=priority.slice();altered[4]^=1;await assert.rejects(parsePriorityBundle(altered,manifest,sha(manifest)),/hash/);});
for(const [name,mutate,pattern] of [
  ['duplicate inventory',m=>{m.inventory.official_ids[1]=m.inventory.official_ids[0];},/inventory/],
  ['wrong pilot order',m=>m.inventory.solar1000_ids.reverse(),/order/],
  ['wrong rank count',m=>m.ranked_count++,/differs/],
  ['wrong source receipt',m=>m.input_receipts[0].manifest_sha256='0'.repeat(64),/receipt/],
  ['wrong as-of',m=>m.as_of='2026-11-17T17:40:00Z',/differs/],
  ['missing output',m=>delete m.files['priority.csv'],/files/],
])test(name,async()=>{const m=JSON.parse(result['manifest.json']);mutate(m);const raw=bytes(JSON.stringify(m));await assert.rejects(parsePriorityBundle(priority,raw,sha(raw)),pattern);});

Register Browser

A JavaScript module in the tests folder of GlobalGrid2050 that tests priority and the Renewable Energy Planning Database (REPD) register, using SHA-256.

testglobalgrid2050 / automation/news/prospecting-ui/tests/register-browser.mjs · lines 1–57 of 57 · Not reached from any entry point (candidate for review)

What it does
It tests priority and the REPD register. Uses libraries node:assert/strict, node:fs/promises, node:crypto, node:path. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
Inputs & outputs
In: JSON file priority.json.
What it achieves
Genuine installed Chrome against the existing 7,775-row page; no release edits.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · automation/news/prospecting-ui/tests · JavaScript module
Uses
Server (import), Bundle (dynamic import), node:assert/strict, node:fs/promises, node:crypto, node:path, ../../acquisition/browser/node_modules/playwright/index.mjs
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/news/prospecting-ui/tests/register-browser.mjs:1-57 · blob 7aeebc9261cb2263ae09e71f3ddcd3ef0842ef16 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
// Genuine installed Chrome against the existing 7,775-row page; no release edits.
import assert from 'node:assert/strict';
import {readFile,mkdir} from 'node:fs/promises';
import {createHash} from 'node:crypto';
import {resolve} from 'node:path';
import {chromium} from '../../acquisition/browser/node_modules/playwright/index.mjs';
import {createTestServer} from '../../acquisition/browser/server.mjs';
const artifact=process.env.PRIORITY_REVIEW_DIR||'tmp/prospecting-v927';
const priority=await readFile(resolve(artifact,'priority.json'));
const manifest=await readFile(resolve(artifact,'manifest.json'));
const spec=JSON.parse(manifest),raw=JSON.parse(priority),ranked=raw.records[0].id;
const unranked=spec.inventory.official_ids.find(id=>!raw.records.some(r=>r.id===id));
const pin=createHash('sha256').update(manifest).digest('hex');
const server=createTestServer();await new Promise(done=>server.listen(0,'127.0.0.1',done));
const origin=`http://127.0.0.1:${server.address().port}`;
const screenshots=resolve('tmp/prospecting-register-browser');await mkdir(screenshots,{recursive:true});
let browser;const checks=[];
try{
  browser=await chromium.launch({channel:'chrome',headless:true});
  for(const width of [375,768,1440]){
    const page=await browser.newPage({viewport:{width,height:900}});const errors=[];page.on('pageerror',e=>errors.push(e.message));
    // External source health is independent; retain the page's honest saved/unavailable labels.
    await page.route('**/*',route=>route.request().url().startsWith(origin+'/')?route.continue():route.abort());
    await page.goto(origin+'/uk_renewables_pipeline/202611161630/');
    await page.addStyleTag({url:origin+'/automation/news/prospecting-ui/inline.css'});
    await page.waitForFunction(()=>document.querySelector('#tbody')?.dataset.complete==='true');
    assert.match(await page.locator('#resultsMeta').innerText(),/7,775/);
    await page.evaluate(async({priority,manifest,pin})=>{
      const {parsePriorityBundle}=await import('/automation/news/prospecting-ui/bundle.mjs');
      window.priorityTestBundle=await parsePriorityBundle(new TextEncoder().encode(priority),new TextEncoder().encode(manifest),pin);
    },{priority:priority.toString(),manifest:manifest.toString(),pin});
    for(const [identity,expected] of [[ranked,'ranked'],[unranked,'unranked']]){
      const ref=identity.slice(5);await page.locator('#search').fill(ref);
      const row=page.locator('#repd-'+ref),record=row.locator('.project-record');
      const before=await row.locator('a.atlaslink').getAttribute('href');
      await page.evaluate(async({ref,identity})=>{const {attachProjectPriority}=await import('/automation/news/prospecting-ui/bundle.mjs');const host=document.querySelector('#repd-'+ref+' .project-record');attachProjectPriority(host,identity,window.priorityTestBundle);attachProjectPriority(host,identity,window.priorityTestBundle);},{ref,identity});
      await record.locator(':scope > summary').click();
      if(expected==='ranked'){
        assert.equal(await record.locator('[data-priority-id]').count(),1);
        await record.locator('[data-priority-id] > summary').click();
        assert.match(await record.innerText(),/Momentum: unknown/);
        await record.screenshot({path:resolve(screenshots,`record-${width}.png`)});
      }else assert.equal(await record.locator('[data-priority-state]').innerText(),'Outside this research-priority subset');
      assert.equal(await row.locator('a.atlaslink').getAttribute('href'),before);
    }
    const identityCheck=await page.evaluate(async({unranked,ranked})=>{const {attachProjectPriority}=await import('/automation/news/prospecting-ui/bundle.mjs');const host=document.querySelector('#repd-'+unranked.slice(5)+' .project-record');try{attachProjectPriority(host,ranked,window.priorityTestBundle);return false;}catch{return true;}},{unranked,ranked});
    assert.equal(identityCheck,true);
    await page.evaluate(async({unranked})=>{const {attachProjectPriority}=await import('/automation/news/prospecting-ui/bundle.mjs');const host=document.querySelector('#repd-'+unranked.slice(5)+' .project-record');attachProjectPriority(host,unranked,null);},{unranked});
    assert.equal(await page.locator('#repd-'+unranked.slice(5)+' [data-priority-state]').innerText(),'Research priority unavailable');
    await page.locator('#clearFilters').click();
    const downloadPromise=page.waitForEvent('download');await page.locator('#exportInline').click();const download=await downloadPromise;
    assert.equal((await readFile(await download.path(),'utf8')).trim().split(/\r?\n/).length,7776);
    assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);
    assert.deepEqual(errors,[]);checks.push({width,official_rows:7775,csv_rows:7775,identity_guard:true});await page.close();
  }
  console.log(JSON.stringify({browser:'installed Google Chrome',version:browser.version(),checks,native_android:false,live_source_health_tested:false}));
}finally{await browser?.close();await new Promise(done=>server.close(done));}

View

A JavaScript module in the prospecting ui folder of GlobalGrid2050 that renders priority (`renderPriority`) and attaches priority (`attachPriority`) (units: MW). Served with the page at https://globalgrid2050.com/automation/news/prospecting-ui/.

renderglobalgrid2050 / automation/news/prospecting-ui/view.mjs · lines 1–25 of 25

What it does
It draws its content. Defines 6 functions or classes, including node, link, clockLabel, renderPriority, attachPriority. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (topic 'markets-data'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Downstream impact
Used directly by 2 files: Bundle (globalgrid2050, https://globalgrid2050.com/automation/news/prospecting-ui/); Prototype (globalgrid2050, https://globalgrid2050.com/automation/news/prospecting-ui/). Reached from 3 other entry points, including News — Prospecting UI Page (globalgrid2050, https://globalgrid2050.com/automation/news/prospecting-ui/); GlobalGrid2050 Pipeline Project Evidence Weekly Workflow (globalgrid2050); Bundle Test (globalgrid2050).
What it achieves
It renders priority (`renderPriority`), attaches priority (`attachPriority`) and renders review rows (`renderReviewRows`). Safe DOM renderer; append compact details inside an existing project row.
Why it matters
Imported by Bundle and Prototype.
Application
globalgrid2050 · automation/news/prospecting-ui · JavaScript module
Uses
none found
Used by
imported by Bundle (import), imported by Prototype (import)
Produces
renderPriority, attachPriority, renderReviewRows
Defines here
node, link, clockLabel, renderPriority, attachPriority, renderReviewRows
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/news/prospecting-ui/view.mjs:1-25 · blob 3f809dc3333815906409c19ca905d062a561d787 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/** Safe DOM renderer; append compact details inside an existing project row. */
function node(tag,text,className){const element=document.createElement(tag);if(text!==undefined)element.textContent=text;if(className)element.className=className;return element;}
function link(label,url){const element=node('a',label);element.href=url;element.target='_blank';element.rel='noopener noreferrer';return element;}
function clockLabel(value){return value?`${value.basis}: ${value.timestamp??'unknown'} (${value.state.toLowerCase().replaceAll('_',' ')})`:'Source observation date: unknown';}
const capacityLabels={repd_installed_mw:'Official installed capacity',it_load_mw:'IT load',site_demand_mw:'Site demand',grid_connection_mw:'Grid connection'};
export function renderPriority(row,asOf){
  const details=node('details',undefined,'research-priority');details.dataset.priorityId=row.id;
  details.append(node('summary',`Research priority #${row.rank} · ${row.score} points`));
  const content=node('div',undefined,'priority-content');details.append(content);
  content.append(node('p','Research ordering only. This score is not verification, investment value or available grid capacity.','priority-note'));
  content.append(node('p',`Ranked as of ${asOf}. Source record: ${row.record_state.toLowerCase()}.`));
  const reasons=node('ul');for(const reason of row.reasons)reasons.append(node('li',`${reason.name.replaceAll('_',' ')}: ${reason.points}/${reason.max} — ${reason.basis}`));content.append(reasons);
  content.append(node('p','Momentum: unknown','priority-unknown'),node('p',row.heat.reason),node('p',clockLabel(row.record_freshness)),node('p',clockLabel(row.retrieval_freshness)));
  const figures=node('ul');for(const [key,value] of Object.entries(row.capacities))figures.append(node('li',`${capacityLabels[key]}: ${value===null?'unknown':`${value} MW`}`));content.append(figures);
  content.append(node('p',`Official status: ${row.official_status??'unknown'}. This is not a newly occurring event.`),node('p','Current financing: not assessed'),node('p',row.research_note),node('p',row.corporate_reason),link('Inspect source record',row.source.url));
  if(row.evidence.length){const list=node('ul');for(const article of row.evidence){const item=node('li');item.append(link(article.title,article.url),node('p',`${article.publisher} · published ${article.pub_date} · provisional association`),node('p',clockLabel(article.retrieval_freshness)));list.append(item);}content.append(list);}
  else content.append(node('p','Project news coverage: unknown. No supplied match does not establish inactivity.'));
  return details;
}
export function attachPriority(host,row,asOf){host.querySelector(':scope > [data-priority-id]')?.remove();host.append(renderPriority(row,asOf));}
export function renderReviewRows(host,rows,asOf){
  host.replaceChildren();
  for(const row of rows){const item=node('article',undefined,'review-row');item.dataset.recordId=row.id;item.append(node('h3',row.name??'Name not supplied by source'),node('p',`${row.id} · ${row.country??'Country unknown'} · ${row.technology}`,'record-meta'),renderPriority(row,asOf));host.append(item);}
  if(!rows.length)host.append(node('p','No records in this loaded review subset match these filters.'));
}