GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / registry_of_all_content_in_repos_and_dependencies / scripts

GlobalGrid2050 Build Project Identity V6 and 4 more files

A Python command-line tool in the scripts folder of Testcode that reads major projects, the Renewable Energy Planning Database (REPD) register, solar and battery storage (BESS), using SHA-256.

700 lines of Python and JavaScript and HTML from registry_of_all_content_in_repos_and_dependencies, spiders, testcode, in 5 files. Topic: Electricity markets and data pipelines. Section 1066 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. Validate Kernel Outputs ingest · registry_of_all_content_in_repos_and_dependencies / scripts/validate_kernel_outputs.py lines 1–134
  2. Federation transform · spiders / codex/build-plan/federation.mjs lines 1–76
  3. Federation Test test · spiders / codex/build-plan/federation.test.mjs lines 1–16
  4. Species — Federation Spider Page render · spiders / species/federation-spider/index.html lines 1–33
  5. GlobalGrid2050 Build Project Identity V6 automation · testcode / backups/202611140031-repd-2026q3-pre-release/globalgrid2050/scripts/build_project_identity_v6.py lines 1–441

Validate Kernel Outputs

A Python command-line tool in the scripts folder of Registry Of All Content In Repos And Dependencies that validates registry (`validate_registry`) and graph (`validate_graph`).

ingestregistry_of_all_content_in_repos_and_dependencies / scripts/validate_kernel_outputs.py · lines 1–134 of 134 · Entry point · pattern validate_registry (shared by 2 files)

What it does
It loads data. Defines 7 functions or classes, including fail, read_json, rel, validate_registry, validate_kernel. Uses libraries __future__, json, sys, pathlib, typing. Side effects: 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 latest.json.
Downstream impact
Used directly by 1 file: Registry Workflow (registry_of_all_content_in_repos_and_dependencies).
What it achieves
It reads JSON (`read_json`) and validates kernel (`validate_kernel`). Validate the registry pointer, kernel export, and graph export. It reads `latest.json`.
Why it matters
Run by Registry Workflow.
Application
registry_of_all_content_in_repos_and_dependencies · scripts · Python CLI
Uses
__future__, json, sys, pathlib, typing
Used by
run by Registry Workflow (workflow run)
Produces
fail, read_json, rel, validate_registry, validate_kernel, validate_graph, main
Defines here
fail, read_json, rel, validate_registry, validate_kernel, validate_graph, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
registry_of_all_content_in_repos_and_dependencies@2205a7abf98723f320f00aa4a0f6b648cf7109df scripts/validate_kernel_outputs.py:1-134 · blob 88b0362156c3759d0f0b27fd18a5f5aff70d6825 · GitHub at these lines
State
achieves: comment · context: auto · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
#!/usr/bin/env python3
"""Validate the registry pointer, kernel export, and graph export.

This is a non-mutating safety gate. It does not crawl GitHub and it does not write
new registry versions. It proves the current committed BIOS/kernel outputs are
internally consistent before Spider Printer or other applications boot from them.
"""
from __future__ import annotations

import json
import sys
from pathlib import Path
from typing import Any

ROOT = Path(__file__).resolve().parents[1]
REGISTRY_DIR = ROOT / "registry"


def fail(message: str) -> None:
    raise RuntimeError(message)


def read_json(path: Path) -> dict[str, Any]:
    if not path.exists():
        fail(f"Missing required file: {path.relative_to(ROOT)}")
    try:
        data = json.loads(path.read_text(encoding="utf-8"))
    except Exception as exc:
        fail(f"Invalid JSON in {path.relative_to(ROOT)}: {exc}")
    if not isinstance(data, dict):
        fail(f"Expected object at top level: {path.relative_to(ROOT)}")
    return data


def rel(path_str: str) -> Path:
    path = ROOT / path_str
    try:
        path.relative_to(ROOT)
    except ValueError:
        fail(f"Pointer escapes repository root: {path_str}")
    return path


def validate_registry(latest: dict[str, Any]) -> dict[str, Any]:
    for key in ["authoritative_version", "json_path", "md_path", "graph_path", "kernel_path"]:
        if key not in latest:
            fail(f"latest.json missing key: {key}")
    version = latest["authoritative_version"]
    if not isinstance(version, int) or version < 1:
        fail("latest.json authoritative_version must be a positive integer")
    expected_json = f"registry/registry_v{version:04d}.json"
    if latest["json_path"] != expected_json:
        fail(f"latest.json json_path should be {expected_json}, got {latest['json_path']}")
    registry = read_json(rel(latest["json_path"]))
    if registry.get("registry_version") != version:
        fail("registry_vNNNN.json registry_version does not match latest.json")
    totals = registry.get("totals", {})
    repos = registry.get("repos", [])
    if not isinstance(repos, list) or not repos:
        fail("registry contains no repos")
    actual_files = sum(len(repo.get("files", [])) for repo in repos)
    if totals.get("repo_count") != len(repos):
        fail("registry repo_count does not match actual repo entries")
    if totals.get("file_count") != actual_files:
        fail("registry file_count does not match actual file entries")
    if any(not repo.get("files") for repo in repos):
        empty = [repo.get("name", "<unknown>") for repo in repos if not repo.get("files")]
        fail(f"registry contains empty repo blocks: {empty}")
    if not rel(latest["md_path"]).exists():
        fail("registry.md pointer target is missing")
    return registry


def validate_kernel(latest: dict[str, Any], registry: dict[str, Any]) -> dict[str, Any]:
    kernel = read_json(rel(latest["kernel_path"]))
    if kernel.get("registry_version") != registry.get("registry_version"):
        fail("kernel.json registry_version does not match authoritative registry")
    if kernel.get("source_registry") != latest.get("json_path"):
        fail("kernel.json source_registry does not match latest.json json_path")
    if not kernel.get("boot_sequence"):
        fail("kernel.json boot_sequence is empty")
    if not kernel.get("repos"):
        fail("kernel.json repos is empty")
    return kernel


def validate_graph(latest: dict[str, Any], registry: dict[str, Any]) -> dict[str, Any]:
    graph = read_json(rel(latest["graph_path"]))
    data_source = graph.get("dataSource", {})
    if data_source.get("registryVersion") != registry.get("registry_version"):
        fail("graph_latest.json registryVersion does not match authoritative registry")
    if data_source.get("jsonPath") != latest.get("json_path"):
        fail("graph_latest.json jsonPath does not match latest.json json_path")
    nodes = graph.get("nodes", [])
    edges = graph.get("edges", [])
    if not isinstance(nodes, list) or not nodes:
        fail("graph_latest.json nodes is empty")
    if not isinstance(edges, list) or not edges:
        fail("graph_latest.json edges is empty")
    node_ids = {node.get("id") for node in nodes}
    if None in node_ids:
        fail("graph_latest.json contains a node without an id")
    dangling = []
    for edge in edges:
        if edge.get("from") not in node_ids or edge.get("to") not in node_ids:
            dangling.append(edge)
    if dangling:
        fail(f"graph_latest.json contains dangling edges: {dangling[:5]}")
    return graph


def main() -> int:
    latest = read_json(REGISTRY_DIR / "latest.json")
    registry = validate_registry(latest)
    kernel = validate_kernel(latest, registry)
    graph = validate_graph(latest, registry)
    print(
        "Kernel outputs OK:",
        f"registry_v{registry['registry_version']:04d}",
        f"repos={registry['totals']['repo_count']}",
        f"files={registry['totals']['file_count']}",
        f"kernel_repos={len(kernel['repos'])}",
        f"graph_nodes={len(graph['nodes'])}",
        f"graph_edges={len(graph['edges'])}",
    )
    return 0


if __name__ == "__main__":
    try:
        raise SystemExit(main())
    except Exception as exc:
        print(f"Kernel output validation failed: {exc}", file=sys.stderr)
        raise SystemExit(1)

Federation

A JavaScript module in the build plan folder of Spiders that validates plan (`validatePlan`) and compiles plan (`compilePlan`), using SHA-256. It validates plan (`validatePlan`) and compiles plan (`compilePlan`).

transformspiders / codex/build-plan/federation.mjs · lines 1–76 of 76 · pattern validatePlan (shared by 3 files)

What it does
It calculates its inputs. Defines 10 functions or classes, including record, text, safePath, canonical, hash. Uses libraries node:crypto.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'codex'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
In: JSON file nodes.json; JSON file edges.json; JSON file evidence.json.
Downstream impact
Used directly by 2 files: Federation Test (spiders); Build (spiders). Reached from 1 other entry point, including Genome Workflow (spiders).
What it achieves
Defines `record`, `text`, `safePath` and 7 more.
Why it matters
Imported by Build. Checked by Federation Test.
Application
spiders · codex/build-plan · JavaScript module
Uses
node:crypto
Used by
imported by Federation Test (import), imported by Build (import)
Produces
validatePlan, compilePlan
Defines here
record, text, safePath, canonical, hash, validatePlan, visit, compilePlan, node, edge
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
spiders@78fc0f90bd5ca73f3d5d7c0e0b7b5712cfe781e5 codex/build-plan/federation.mjs:1-76 · blob 989b69b2602667397a27c9dc86836864248b3d75 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unknown
import {createHash} from 'node:crypto';
const record=x=>x!==null&&typeof x==='object'&&!Array.isArray(x);
const text=x=>typeof x==='string'&&x.trim().length>0;
const safePath=x=>text(x)&&!/[\\:%?#]/.test(x)&&!x.startsWith('/')&&!x.split('/').some(p=>!p||p==='.'||p==='..');
const canonical=x=>Array.isArray(x)?'['+x.map(canonical).join(',')+']':record(x)?'{'+Object.keys(x).sort().map(k=>JSON.stringify(k)+':'+canonical(x[k])).join(',')+'}':JSON.stringify(x);
const hash=x=>createHash('sha256').update(canonical(x)).digest('hex');
export function validatePlan(plan){
 const errors=[],check=(ok,message)=>{if(!ok)errors.push(message);};
 check(record(plan)&&plan.type==='FeatureCollection'&&plan.schema==='ventus.build-plan.v1','Expected ventus.build-plan.v1 FeatureCollection');
 check(record(plan?.metadata),'Metadata object required');
 if(!Array.isArray(plan?.features))return {ok:false,errors:[...errors,'Features array required']};
 check(plan.features.length===100,'Exactly100 builds required');
 const ids=new Set(),counts={gridatlas:0,pipelinenews:0},deps=new Map(),migrationPins=new Map();
 for(const [i,f] of plan.features.entries()){
  const p=f?.properties,id=f?.id,label=text(id)?id:'feature'+i;
  check(f?.type==='Feature'&&f.geometry===null,label+': geometry must be null Feature');
  check(text(id)&&!ids.has(id),label+': missing or duplicate ID');if(text(id))ids.add(id);
  if(!record(p)){errors.push(label+': properties required');continue;}
  check(Object.hasOwn(counts,p.app),label+': unsupported app');if(Object.hasOwn(counts,p.app))counts[p.app]++;
  for(const k of ['title','change','rollback'])check(text(p[k]),label+': '+k+' required');
  check(/^Ventusltd\/[A-Za-z0-9_.-]+$/.test(p.ownerRepository||''),label+': ownerRepository invalid');
  check(safePath(p.modulePath),label+': unsafe modulePath');
  check(p.status==='planned'&&p.generation===null,label+': only planned unreleased builds allowed; acceptance requires separate proofs');
  check(Array.isArray(p.evidence),label+': evidence array required');
  check(record(p.acceptance)&&['local','chrome','ci','deployed'].every(k=>text(p.acceptance[k])||(Array.isArray(p.acceptance[k])&&p.acceptance[k].length>0&&p.acceptance[k].every(text))),label+': four acceptance contracts required');
  check(Array.isArray(p.sourceFeeds)&&p.sourceFeeds.every(text)&&new Set(p.sourceFeeds).size===p.sourceFeeds.length,label+': sourceFeeds must be unique strings');
  if(Object.hasOwn(p,'migration')){
   const m=p.migration;
   check(record(m)&&/^Ventusltd\/[A-Za-z0-9_.-]+$/.test(m.sourceRepository||'')&&/^[a-f0-9]{40}$/.test(m.sourceCommit||''),label+': migration source pin invalid');
   if(record(m)){
    check(m.destinationRepository===p.ownerRepository&&safePath(m.destinationPath),label+': migration destination must match owner');
    check(m.transferStatus==='blocked_pending_dependency_audit',label+': migration cannot claim completed transfer');
    const files=Array.isArray(m.files)?m.files:[],names=new Set();
    check(files.length>0,label+': migration files required');
    for(const f of files){check(record(f)&&safePath(f.path)&&/^[a-f0-9]{64}$/.test(f.sha256||'')&&['workflow','script'].includes(f.kind)&&!names.has(f.path),label+': invalid migration file');if(record(f)){names.add(f.path);const key=m.sourceRepository+'@'+m.sourceCommit+'::'+f.path;check(!migrationPins.has(key)||migrationPins.get(key)===f.sha256,label+': conflicting migration file digest');migrati  … [line shortened here: 427 characters; full line on GitHub]
    check(Array.isArray(m.dependencies),label+': migration dependencies required');
    for(const d of Array.isArray(m.dependencies)?m.dependencies:[])check(record(d)&&names.has(d.from)&&names.has(d.to)&&d.type==='runs_script'&&files.find(f=>f.path===d.from)?.kind==='workflow'&&files.find(f=>f.path===d.to)?.kind==='script'&&text(d.evidence),label+': unresolved migration dependency');
   }
  }
  const validDeps=Array.isArray(p.dependsOn)&&p.dependsOn.every(text)&&new Set(p.dependsOn).size===p.dependsOn.length;
  check(validDeps,label+': dependsOn must be unique IDs');deps.set(id,validDeps?p.dependsOn:[]);
 }
 check(counts.gridatlas===50&&counts.pipelinenews===50,'Exactly50 GridAtlas and50 PipelineNews builds required');
 for(const [id,list] of deps)for(const dep of list)check(ids.has(dep),id+': dangling dependency '+dep);
 const visiting=new Set(),done=new Set();
 function visit(id){if(visiting.has(id)){errors.push('Dependency cycle at '+id);return;}if(done.has(id))return;visiting.add(id);for(const dep of deps.get(id)||[])if(ids.has(dep))visit(dep);visiting.delete(id);done.add(id);}
 for(const id of ids)visit(id);
 return {ok:errors.length===0,errors};
}
export function compilePlan(plan){
 const validation=validatePlan(plan);if(!validation.ok)throw Error(validation.errors.join('\n'));
 const planSha256=hash(plan),nodesById=new Map(),links=[],records=[];
 function node(id,label,kind,extra={}){if(!nodesById.has(id))nodesById.set(id,{type:'Feature',id,geometry:null,properties:{label,repo_type:kind,scope_type:kind,status:'planned',rag:'grey',status_reason:'Declared build plan; not observed implementation or acceptance',child_manifest:null,...extra}});return id;}
 function edge(from,to,kind,buildId,pointer,detail={}){links.push({from,to,kind});records.push({from,to,kind,buildId,classification:'declared_plan',planSha256,jsonPointer:pointer,...detail});}
 for(const [i,f] of plan.features.entries()){
  const p=f.properties,base='/features/'+i,build=node('build:'+f.id,p.title,'build',{build_id:f.id,app:p.app}),repo=node('repo:'+p.ownerRepository,p.ownerRepository,'repository'),module=node('module:'+p.ownerRepository+'::'+p.modulePath,p.modulePath,'module',{owner_repository:p.ownerRepository});
  edge(repo,build,'plans',f.id,base+'/properties/ownerRepository');edge(build,module,'proposes_module',f.id,base+'/properties/modulePath');
  for(const [j,feed] of p.sourceFeeds.entries())edge(node('source:'+feed,feed,'source'),build,'planned_source_input',f.id,base+'/properties/sourceFeeds/'+j);
  if(p.migration){
   const m=p.migration,sourceIds=new Map();
   for(const [j,file] of m.files.entries()){
    const id=node('migration:'+m.sourceRepository+'@'+m.sourceCommit+'::'+file.path,file.path,file.kind,{source_repository:m.sourceRepository,source_commit:m.sourceCommit,sha256:file.sha256});sourceIds.set(file.path,id);
    edge(id,build,'migration_source',f.id,base+'/properties/migration/files/'+j,{sourceCommit:m.sourceCommit,sourceRepository:m.sourceRepository});
   }
   for(const [j,d] of m.dependencies.entries())edge(sourceIds.get(d.from),sourceIds.get(d.to),'runs_script',f.id,base+'/properties/migration/dependencies/'+j,{classification:'declared_from_source',sourceCommit:m.sourceCommit,sourceRepository:m.sourceRepository,evidence:d.evidence});
   edge(build,repo,'planned_destination',f.id,base+'/properties/migration/destinationRepository',{destinationPath:m.destinationPath,transferStatus:m.transferStatus});
  }
  for(const [j,dep] of p.dependsOn.entries())edge('build:'+dep,build,'planned_prerequisite',f.id,base+'/properties/dependsOn/'+j);
 }
 const features=[...nodesById.values()].sort((a,b)=>a.id<b.id?-1:a.id>b.id?1:0),indices=new Map(features.map((f,i)=>[f.id,i]));
 const edges=[...new Map(links.map(e=>{const triple=[indices.get(e.from),indices.get(e.to),e.kind];return [JSON.stringify(triple),triple];})).values()].sort((a,b)=>a[0]-b[0]||a[1]-b[1]||a[2].localeCompare(b[2]));
 const nodes={type:'FeatureCollection',features},edgeDoc={edge_format:'index-array-v1',status_note:'Declared planned dependencies only; no geography, Git history or acceptance inferred.',edges};
 const evidence={schema:'ventus.build-plan-evidence.v1',planSha256,records,sourceEvidence:plan.features.map(f=>({buildId:f.id,evidence:structuredClone(f.properties.evidence),...(Object.hasOwn(f.properties,'migration')?{migration:structuredClone(f.properties.migration)}:{})}))};
 const manifest={schema_version:'atlas-cartridge-v0.2',public_title:'Ventus100-build plan',public_strapline:'Fifty PipelineNews and fifty GridAtlas planned increments',scope:{id:'ventus-build-plan',label:'Declared product build plan',scope_type:'repository_federation',parent_manifest:null},counts:{nodes:features.length,edges:edges.length,sectors:0},key_law_status:'PLANNED_NOT_ACCEPTED',key_note:'G  … [line shortened here: 758 characters; full line on GitHub]
 return {nodes,edges:edgeDoc,evidence,manifest};
}

Federation Test

A test in the build plan folder of Spiders that checks Federation, using SHA-256.

testspiders / codex/build-plan/federation.test.mjs · lines 1–16 of 16 · Entry point

What it does
It tests its inputs. Uses libraries node:test.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'codex'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Downstream impact
Used directly by 1 file: Genome Workflow (spiders).
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 Genome Workflow.
Application
spiders · codex/build-plan · test
Uses
Federation (import), node:test
Used by
run by Genome 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
spiders@78fc0f90bd5ca73f3d5d7c0e0b7b5712cfe781e5 codex/build-plan/federation.test.mjs:1-16 · blob 2cafac444929ca9c9d090fc89e5c70e5a634e1ea · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unknown
import test from 'node:test';import assert from 'node:assert/strict';
import {validatePlan,compilePlan} from './federation.mjs';
function fixture(){return {type:'FeatureCollection',schema:'ventus.build-plan.v1',metadata:{purpose:'fixture'},features:Array.from({length:100},(_,i)=>({type:'Feature',id:'B'+i,geometry:null,properties:{app:i<50?'gridatlas':'pipelinenews',title:'Build '+i,ownerRepository:'Ventusltd/testcode',modulePath:'cartridges/build-'+i+'.mjs',dependsOn:i?['B'+(i-1)]:[],sourceFeeds:['source:fixture'],status:'p  … [line shortened here: 609 characters; full line on GitHub]
test('valid100plan compiles deterministic null-geometry positional graph with proof scope',()=>{const p=fixture(),before=JSON.stringify(p);assert.equal(validatePlan(p).ok,true);const a=compilePlan(p),b=compilePlan(p);assert.deepEqual(a,b);assert.equal(JSON.stringify(p),before);assert.ok(a.nodes.features.every(f=>f.geometry===null&&f.properties.status==='planned'));assert.equal(a.edges.edge_format,  … [line shortened here: 753 characters; full line on GitHub]
test('canonical digest ignores object key order but binds changed plan content',()=>{const p=fixture(),q={features:p.features,metadata:p.metadata,schema:p.schema,type:p.type};assert.equal(compilePlan(p).manifest.provenance.planSha256,compilePlan(q).manifest.provenance.planSha256);q.metadata={purpose:'different'};assert.notEqual(compilePlan(p).manifest.provenance.planSha256,compilePlan(q).manifest.  … [line shortened here: 426 characters; full line on GitHub]
test('duplicate dangling cyclic and self dependencies fail closed',()=>{for(const mutate of [p=>p.features[1].id='B0',p=>p.features[0].properties.dependsOn=['missing'],p=>p.features[0].properties.dependsOn=['B99'],p=>p.features[0].properties.dependsOn=['B0']]){const p=fixture();mutate(p);assert.equal(validatePlan(p).ok,false);assert.throws(()=>compilePlan(p));}});
test('unsafe module paths, fake completion and invented geography are rejected',()=>{for(const mutate of [p=>p.features[0].properties.modulePath='../escape',p=>p.features[0].properties.modulePath='a/%2e%2e/b',p=>p.features[0].properties.modulePath='C:/x',p=>p.features[0].properties.status='accepted',p=>p.features[0].properties.generation='202609052040',p=>p.features[0].geometry={type:'Point',coord  … [line shortened here: 487 characters; full line on GitHub]
test('counts and required acceptance contracts cannot be omitted',()=>{for(const mutate of [p=>p.features.pop(),p=>p.features[50].properties.app='gridatlas',p=>delete p.features[0].properties.acceptance.chrome,p=>p.features[0].properties.sourceFeeds=['duplicate','duplicate']]){const p=fixture();mutate(p);assert.equal(validatePlan(p).ok,false);}});

function migration(){return {sourceRepository:'Ventusltd/globalgrid2050',sourceCommit:'a'.repeat(40),destinationRepository:'Ventusltd/testcode',destinationPath:'pipelines/feed.py',transferStatus:'blocked_pending_dependency_audit',files:[{path:'.github/workflows/feed.yml',sha256:'b'.repeat(64),kind:'workflow'},{path:'scripts/feed.py',sha256:'c'.repeat(64),kind:'script'}],dependencies:[{from:'.githu  … [line shortened here: 507 characters; full line on GitHub]
test('migration graph retains pinned workflow-script relationship and blocked destination as metadata',()=>{const p=fixture();p.features[0].properties.migration=migration();const result=compilePlan(p),r=result.evidence.records.find(e=>e.kind==='runs_script');assert.equal(r.classification,'declared_from_source');assert.equal(r.sourceCommit,'a'.repeat(40));assert.ok(result.nodes.features.some(f=>f.p  … [line shortened here: 771 characters; full line on GitHub]
test('migration rejects unknown owner, short pin, unsafe paths, unresolved dependency or claimed transfer',()=>{for(const mutate of [m=>m.destinationRepository='Ventusltd/unassigned',m=>m.sourceCommit='main',m=>m.files[0].path='../escape',m=>m.dependencies[0].to='missing.py',m=>m.transferStatus='completed']){const p=fixture();p.features[0].properties.migration=migration();mutate(p.features[0].prop  … [line shortened here: 461 characters; full line on GitHub]

test('same pinned source file cannot acquire conflicting hashes across builds',()=>{const p=fixture();p.features[0].properties.migration=migration();p.features[1].properties.migration=migration();p.features[1].properties.migration.files[0].sha256='d'.repeat(64);assert.equal(validatePlan(p).ok,false);});

test('shared workflow-script relation is a single graph edge with separate build citations',()=>{const p=fixture();p.features[0].properties.migration=migration();p.features[1].properties.migration=migration();const result=compilePlan(p);assert.equal(result.edges.edges.filter(e=>e[2]==='runs_script').length,1);assert.equal(result.evidence.records.filter(e=>e.kind==='runs_script').length,2);assert.e  … [line shortened here: 590 characters; full line on GitHub]

Species — Federation Spider Page

A web page in Spiders using data from the data-federation-map-for-GlobalGrid2050-all-repos repository. Published at https://ventusltd.github.io/spiders/species/federation-spider/.

renderspiders / species/federation-spider/index.html · lines 1–33 of 33 · Entry point

What it does
It draws its content. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
Out: web page.
Downstream impact
Used directly by 2 files: Spiders — Index Page (spiders, https://ventusltd.github.io/spiders/); Root Index — V Page (spiders, https://ventusltd.github.io/spiders/site_versions/root_index/v20260704/). Reached from 270 other entry points, including Iterations — 43 Registry Growth Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/43-registry-growth/); Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html). It is itself an entry point, published at https://ventusltd.github.io/spiders/species/federation-spider/.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Loaded by the Spiders page at https://ventusltd.github.io/spiders/ and 1 other page.
Application
spiders · species/federation-spider · page
Uses
Spider Full Po Test (link), Spiders — Index Page (link)
Used by
linked from Spiders — Index Page (link), linked from Root Index — V Page (link)
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
spiders@78fc0f90bd5ca73f3d5d7c0e0b7b5712cfe781e5 species/federation-spider/index.html:1-33 · blob d38ed6c929aca1807d1d6fa970f89b2dc53726d3 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Federation Spider</title>
<style>
body{margin:0;min-height:100vh;background:#0b0d12;color:#eef2fb;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;display:flex;align-items:center;justify-content:center;padding:24px}
main{max-width:760px;border:1px solid #262b36;border-radius:20px;background:linear-gradient(160deg,rgba(255,255,255,.06),rgba(255,255,255,.015));padding:28px;box-shadow:0 30px 90px rgba(0,0,0,.25)}
h1{margin:0 0 8px;font-size:clamp(28px,6vw,52px)}
p{color:#9aa3b5;line-height:1.5}
a{color:#00e5ff;text-decoration:none;font-weight:700}
.grid{display:grid;gap:12px;margin-top:22px}
.card{display:block;border:1px solid #262b36;border-radius:14px;padding:16px;background:#12151c;color:#eef2fb;text-decoration:none}
.card:hover{border-color:#00e5ff}
.card b{display:block;color:#00e5ff;font-size:1.15rem;margin-bottom:8px}
.card span{display:block;color:#9aa3b5;line-height:1.5;font-weight:400}
.ey{font-family:ui-monospace,monospace;letter-spacing:.22em;text-transform:uppercase;color:#00e5ff;font-size:.72rem}
</style>
</head>
<body>
<main>
<div class="ey">Ventus · Global Grid 2050</div>
<h1>Federation Spider</h1>
<p>This is the first working Spider species. For now, the known-good live specimen still hibernates in the federation repository while this species folder becomes its permanent home.</p>
<div class="grid">
<a class="card" href="../../codex/build-plan/"><b>Open100-build dependency plan</b><span>Inspect owner repositories, proposed cartridges and pinned workflow-to-script migration links. Planned work, not accepted releases.</span></a>
<a class="card" href="https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/dashboard/sandbox/spider_full_po_test.html?utm_source=chatgpt.com"><b>Open Working Federation Spider</b><span>Launch the verified working Spider Sandbox specimen.</span></a>
<a class="card" href="../../"><b>Back to Spiders</b><span>Return to the Spider species lab portal.</span></a>
</div>
</main>
</body>
</html>

GlobalGrid2050 Build Project Identity V6

A Python command-line tool in the scripts folder of Testcode that reads major projects, the Renewable Energy Planning Database (REPD) register, solar and battery storage (BESS), using SHA-256.

automationtestcode / backups/202611140031-repd-2026q3-pre-release/globalgrid2050/scripts/build_project_identity_v6.py · lines 1–441 of 588 · version 2026-11-14 00:31 · Entry point · pattern build_public_snapshot (shared by 2 files)

What it does
It loads major projects, the REPD register, solar and battery storage (BESS). Defines 21 functions or classes, including clean, norm, numeric_sort, technology_category, lifecycle. Uses libraries __future__, csv, hashlib, io, json. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'repd'): 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, solar, battery storage (BESS).
Inputs & outputs
In: JSON file project_identity_v6.json; JSON file major_projects_v6.json.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
It splits refs (`split_refs`), loads manifest (`load_manifest`) and reads official rows (`read_official_rows`). Defines `clean`, `norm`, `numeric_sort` and 16 more.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
testcode · backups/202611140031-repd-2026q3-pre-release/globalgrid2050/scripts · Python CLI
Uses
__future__, csv, hashlib, io, json, re, collections, pathlib
Used by
none found
Produces
clean, norm, numeric_sort, technology_category, lifecycle, valid_planning_ref, canon_header, split_refs, short_hash, gg_project_id, UnionFind, resolve
Defines here
clean, norm, numeric_sort, technology_category, lifecycle, valid_planning_ref, canon_header, split_refs, short_hash, gg_project_id, UnionFind, __init__, find, union, resolve, load_manifest, ensure_official_csv, read_official_rows, build_registry
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
testcode@a8a215982b13d6e2f6019b40bf0bef5755719773 backups/202611140031-repd-2026q3-pre-release/globalgrid2050/scripts/build_project_identity_v6.py:1-441 · blob 2bc5c360fa47341de71018d3f4744235a722cd68 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: duplicate_candidate
#!/usr/bin/env python3
from __future__ import annotations

import csv
import hashlib
import io
import json
import re
from collections import defaultdict
from pathlib import Path

from repd_sources_v6 import (
    CANONICAL_CSV,
    EXPECTED_BESS_GT100,
    EXPECTED_ROWS,
    EXPECTED_SOLAR_GT1,
    MANIFEST,
    REPORT as SOURCE_REPORT,
    clean_ref,
    norm_date,
    norm_number,
)

ROOT = Path(__file__).resolve().parents[1]
DIST = ROOT / "dist"
IDENTITY_OUT = DIST / "project_identity_v6.json"
PROJECTS_OUT = DIST / "major_projects_v6.json"

SCHEMA = "globalgrid2050.project-identity.v6"
MIN_REPD_ROWS = 1000
MIN_REF_COVERAGE = 0.999


def clean(v):
    s = str(v or "").strip()
    return "" if s.lower() in {"nan", "none", "null", "not set"} else s


def norm(v):
    return re.sub(r"\s+", " ", re.sub(r"[^a-z0-9]+", " ", clean(v).lower().replace("&", " and "))).strip()


def numeric_sort(value):
    text = clean(value)
    return (0, int(text)) if text.isdigit() else (1, text)


def technology_category(value):
    value = norm(value)
    if "solar photovoltaic" in value:
        return "solar"
    if "battery" in value:
        return "bess"
    return None


def lifecycle(status):
    value = norm(status)
    if "operational" in value:
        return "OPERATIONAL"
    if "under construction" in value:
        return "UNDER_CONSTRUCTION"
    if any(word in value for word in ("abandon", "decommission", "refused", "withdrawn", "expired")):
        return "INACTIVE"
    if any(word in value for word in ("application", "awaiting", "consent", "approved", "pre construction")):
        return "LIVE_PRE_CONSTRUCTION"
    return "UNKNOWN"


def valid_planning_ref(value):
    value = norm(value)
    return bool(value and value not in {"n a", "na", "none", "not known", "unknown", "tbc", "pending"})


def canon_header(v):
    return norm(v)


def split_refs(v):
    # Avoid treating the trailing zero in Excel-style "12345.0" as another Ref ID.
    values = []
    for match in re.findall(r"(?<![A-Za-z0-9])\d+(?:\.0)?(?![A-Za-z0-9])", clean(v)):
        ref = clean_ref(match)
        if ref and ref not in values:
            values.append(ref)
    return values


def short_hash(value, n=16):
    return hashlib.sha256(value.encode("utf-8")).hexdigest()[:n].upper()


def gg_project_id(repd_ref, row):
    if repd_ref:
        return f"GG2050-REPD-{repd_ref}"

    # Never fabricate an REPD reference. A GlobalGrid-only ID is generated from the
    # strongest stable public anchors available, excluding capacity so capacity revisions
    # do not change identity.
    planning_ref = clean(row.get("planning_application_reference"))
    planning_authority = clean(row.get("planning_authority"))
    name = clean(row.get("site_name"))
    operator = clean(row.get("operator"))
    county = clean(row.get("county"))
    technology = clean(row.get("technology"))
    if planning_ref:
        fingerprint = f"planning|{norm(planning_authority)}|{norm(planning_ref)}"
        confidence = "strong"
    else:
        fingerprint = f"entity|{norm(name)}|{norm(operator)}|{norm(county)}|{norm(technology)}"
        confidence = "provisional"
    return f"GG2050-UK-{short_hash(fingerprint)}", confidence


class UnionFind:
    def __init__(self, values):
        self.parent = {v: v for v in values}

    def find(self, x):
        p = self.parent[x]
        if p != x:
            self.parent[x] = self.find(p)
        return self.parent[x]

    def union(self, a, b):
        if a not in self.parent or b not in self.parent:
            return
        ra, rb = self.find(a), self.find(b)
        if ra == rb:
            return
        # Stable representative: prefer numerically smaller REPD ref when possible.
        try:
            ka, kb = (0, int(ra)), (0, int(rb))
        except Exception:
            ka, kb = (1, ra), (1, rb)
        if ka <= kb:
            self.parent[rb] = ra
        else:
            self.parent[ra] = rb


def resolve(headers, *aliases):
    by_canon = {canon_header(h): h for h in headers}
    for alias in aliases:
        key = canon_header(alias)
        if key in by_canon:
            return by_canon[key]
    return ""


def load_manifest():
    if not MANIFEST.exists():
        raise RuntimeError("Missing dist/manifest_v6.json; source reconciliation must run first")
    manifest = json.loads(MANIFEST.read_text(encoding="utf-8"))
    report = json.loads(SOURCE_REPORT.read_text(encoding="utf-8")) if SOURCE_REPORT.exists() else {}
    if manifest.get("status") != "VALIDATED" or report.get("pass") is not True:
        raise RuntimeError("V6 source reconciliation has not passed")
    if not CANONICAL_CSV.exists():
        raise RuntimeError("Missing staged reconciled Q2 canonical CSV")
    return manifest


def ensure_official_csv(manifest):
    source_url = clean(manifest.get("source_url"))
    if not source_url or not source_url.lower().endswith(".csv") or "assets.publishing.service.gov.uk" not in source_url:
        raise RuntimeError(f"Manifest does not point to an official DESNZ CSV: {source_url!r}")
    return source_url, CANONICAL_CSV


def read_official_rows(path):
    raw = path.read_bytes()
    text = None
    for encoding in ("utf-8-sig", "utf-8", "cp1252"):
        try:
            text = raw.decode(encoding)
            break
        except UnicodeDecodeError:
            continue
    if text is None:
        raise RuntimeError("Unable to decode official REPD CSV")

    reader = csv.DictReader(io.StringIO(text))
    headers = reader.fieldnames or []
    if not headers:
        raise RuntimeError("Official REPD CSV has no header row")

    cols = {
        "ref_id": resolve(headers, "Ref ID"),
        "old_ref_id": resolve(headers, "Old Ref ID"),
        "record_updated": resolve(headers, "Record Last Updated (dd/mm/yyyy)", "Record Last Updated"),
        "site_name": resolve(headers, "Site Name"),
        "technology": resolve(headers, "Technology Type"),
        "capacity": resolve(headers, "Installed Capacity (MWelec)"),
        "status": resolve(headers, "Development Status (short)"),
        "operator": resolve(headers, "Operator (or Applicant)"),
        "county": resolve(headers, "County"),
        "region": resolve(headers, "Region"),
        "country": resolve(headers, "Country"),
        "planning_authority": resolve(headers, "Planning Authority", "Local Planning Authority"),
        "planning_application_reference": resolve(headers, "Planning Application Reference"),
        "planning_application_submitted": resolve(headers, "Planning Application Submitted"),
        "planning_application_withdrawn": resolve(headers, "Planning Application Withdrawn"),
        "planning_permission_refused": resolve(headers, "Planning Permission Refused"),
        "planning_permission_granted": resolve(headers, "Planning Permission Granted"),
        "planning_permission_expired": resolve(headers, "Planning Permission Expired"),
        "under_construction": resolve(headers, "Under Construction"),
        "operational": resolve(headers, "Operational"),
    }
    required = ["ref_id", "site_name", "technology"]
    missing = [k for k in required if not cols[k]]
    if missing:
        raise RuntimeError(f"Official REPD schema missing identity columns after header normalisation: {missing}; headers={headers}")

    relationship_columns = []
    for h in headers:
        ch = canon_header(h)
        if ch in {canon_header(cols["ref_id"]), canon_header(cols["old_ref_id"])}:
            continue
        if "repd ref" in ch or ("re applying" in ch and "ref" in ch):
            relation = "RELATED_APPLICATION"
            if "storage co location" in ch:
                relation = "COLOCATED_COMPONENT"
            elif "new repd ref" in ch:
                relation = "CURRENT_VERSION"
            elif "old repd ref" in ch:
                relation = "PREVIOUS_REPD_REF"
            relationship_columns.append((h, relation))

    rows = []
    for row_number, source in enumerate(reader, start=2):
        repd_ref = clean_ref(source.get(cols["ref_id"]))
        out = {
            "source_row": row_number,
            "repd_ref": repd_ref,
            "repd_old_ref": clean_ref(source.get(cols["old_ref_id"])) if cols["old_ref_id"] else "",
            "repd_record_updated_raw": clean(source.get(cols["record_updated"])) if cols["record_updated"] else "",
            "site_name": clean(source.get(cols["site_name"])),
            "technology": clean(source.get(cols["technology"])),
            "capacity_mw_raw": clean(source.get(cols["capacity"])) if cols["capacity"] else "",
            "status": clean(source.get(cols["status"])) if cols["status"] else "",
            "operator": clean(source.get(cols["operator"])) if cols["operator"] else "",
            "county": clean(source.get(cols["county"])) if cols["county"] else "",
            "region": clean(source.get(cols["region"])) if cols["region"] else "",
            "country": clean(source.get(cols["country"])) if cols["country"] else "",
            "planning_authority": clean(source.get(cols["planning_authority"])) if cols["planning_authority"] else "",
            "planning_application_reference": clean(source.get(cols["planning_application_reference"])) if cols["planning_application_reference"] else "",
            "planning_application_submitted_raw": clean(source.get(cols["planning_application_submitted"])) if cols["planning_application_submitted"] else "",
            "planning_application_withdrawn_raw": clean(source.get(cols["planning_application_withdrawn"])) if cols["planning_application_withdrawn"] else "",
            "planning_permission_refused_raw": clean(source.get(cols["planning_permission_refused"])) if cols["planning_permission_refused"] else "",
            "planning_permission_granted_raw": clean(source.get(cols["planning_permission_granted"])) if cols["planning_permission_granted"] else "",
            "planning_permission_expired_raw": clean(source.get(cols["planning_permission_expired"])) if cols["planning_permission_expired"] else "",
            "under_construction_raw": clean(source.get(cols["under_construction"])) if cols["under_construction"] else "",
            "operational_raw": clean(source.get(cols["operational"])) if cols["operational"] else "",
            "direct_related_repd_refs": [],
            "relationships": [],
        }
        related = []
        for h, relation in relationship_columns:
            for target in split_refs(source.get(h)):
                if target and target != repd_ref:
                    related.append(target)
                    out["relationships"].append({"repd_ref": target, "type": relation, "source_field": h})
        out["direct_related_repd_refs"] = [r for r in dict.fromkeys(related) if r and r != repd_ref]
        rows.append(out)
    return rows, headers, [{"field": field, "type": relation} for field, relation in relationship_columns]


def build_registry(rows, manifest, source_url):
    if len(rows) < MIN_REPD_ROWS:
        raise RuntimeError(f"Official REPD row count is implausibly small: {len(rows)}")

    current = {}
    missing_ref_rows = []
    duplicate_refs = []
    for row in rows:
        ref = row["repd_ref"]
        if not ref:
            missing_ref_rows.append(row)
            continue
        if ref in current:
            duplicate_refs.append(ref)
        current[ref] = row
    if duplicate_refs:
        raise RuntimeError(f"Duplicate official REPD Ref IDs: {sorted(set(duplicate_refs))[:20]}")

    coverage = len(current) / len(rows)
    if coverage < MIN_REF_COVERAGE:
        raise RuntimeError(f"Official REPD Ref ID coverage below {MIN_REF_COVERAGE:.3%}: {coverage:.3%}")

    refs = set(current)
    uf = UnionFind(refs)

    # Explicit REPD cross-references are the strongest grouping signal. Old Ref ID
    # links are used only when they point to another current official record; history
    # is otherwise retained without inventing a missing record.
    for ref, row in current.items():
        if row["repd_old_ref"] in refs:
            uf.union(ref, row["repd_old_ref"])
        for related in row["direct_related_repd_refs"]:
            if related in refs:
                uf.union(ref, related)

    # Planning references are strong development-level identifiers when combined with
    # planning authority. NSIP EN-references are nationally unique and may group without it.
    planning_groups = defaultdict(list)
    for ref, row in current.items():
        planning_ref = norm(row["planning_application_reference"])
        authority = norm(row["planning_authority"])
        if not valid_planning_ref(planning_ref):
            continue
        if re.fullmatch(r"en\s*\d{5,}", planning_ref.replace(" ", "")):
            key = ("nsip", planning_ref.replace(" ", ""))
        elif authority:
            key = ("local", authority, planning_ref)
        else:
            continue
        planning_groups[key].append(ref)
    for group in planning_groups.values():
        if len(group) > 1:
            anchor = group[0]
            for ref in group[1:]:
                uf.union(anchor, ref)

    planning_siblings_by_ref = defaultdict(list)
    for group in planning_groups.values():
        if len(group) < 2:
            continue
        for ref in group:
            planning_siblings_by_ref[ref] = [other for other in group if other != ref]

    groups = defaultdict(list)
    for ref in refs:
        groups[uf.find(ref)].append(ref)

    group_id = {}
    for root_ref, members in groups.items():
        members = sorted(members, key=numeric_sort)
        planning_candidates = []
        for ref in members:
            row = current[ref]
            pr = norm(row["planning_application_reference"])
            pa = norm(row["planning_authority"])
            if valid_planning_ref(pr):
                planning_candidates.append((pa, pr))
        if planning_candidates:
            pa, pr = sorted(planning_candidates)[0]
            anchor = f"planning|{pa}|{pr}"
            gid = f"GG2050-DEV-{short_hash(anchor, 14)}"
        else:
            gid = f"GG2050-DEV-REPD-{members[0]}"
        for ref in members:
            group_id[ref] = gid

    records = []
    seen_gg = set()
    for row in rows:
        ref = row["repd_ref"]
        if ref:
            gid = f"GG2050-REPD-{ref}"
            confidence = "authoritative"
            identity_status = "REPD_BOUND"
            siblings = sorted([r for r in groups[uf.find(ref)] if r != ref], key=numeric_sort)
            planning_siblings = planning_siblings_by_ref.get(ref, [])
            development_id = group_id[ref]
        else:
            generated = gg_project_id("", row)
            gid, confidence = generated
            identity_status = "GLOBALGRID_ONLY"
            siblings = []
            planning_siblings = []
            development_id = f"GG2050-DEV-{short_hash(gid, 14)}"

        if gid in seen_gg:
            raise RuntimeError(f"GlobalGrid project ID collision: {gid}")
        seen_gg.add(gid)

        related = list(row["relationships"])
        if row["repd_old_ref"] and row["repd_old_ref"] != ref:
            related.append(
                {
                    "repd_ref": row["repd_old_ref"],
                    "type": "PREVIOUS_REPD_REF",
                    "source_field": "Old Ref ID",
                }
            )
        capacity = norm_number(row["capacity_mw_raw"])
        updated = norm_date(row["repd_record_updated_raw"])

        records.append(
            {
                "gg_project_id": gid,
                "gg_development_id": development_id,
                "identity_status": identity_status,
                "identity_confidence": confidence,
                "repd_ref": ref or None,
                "repd_old_ref": row["repd_old_ref"] or None,
                "repd_record_updated": updated or None,
                "repd_record_updated_raw": row["repd_record_updated_raw"] or None,
                "site_name": row["site_name"],
                "technology": row["technology"],
                "capacity_mw": capacity,
                "capacity_known": capacity is not None,
                "capacity_mw_raw": row["capacity_mw_raw"] or None,
                "status": row["status"],
                "lifecycle": lifecycle(row["status"]),
                "operator": row["operator"],
                "county": row["county"],
                "region": row["region"],
                "country": row["country"],
                "planning_authority": row["planning_authority"],
                "planning_application_reference": row["planning_application_reference"],
                "planning_application_submitted": norm_date(row["planning_application_submitted_raw"]) or None,
                "planning_application_withdrawn": norm_date(row["planning_application_withdrawn_raw"]) or None,
                "planning_permission_refused": norm_date(row["planning_permission_refused_raw"]) or None,
                "planning_permission_granted": norm_date(row["planning_permission_granted_raw"]) or None,
                "planning_permission_expired": norm_date(row["planning_permission_expired_raw"]) or None,
                "under_construction": norm_date(row["under_construction_raw"]) or None,
                "operational": norm_date(row["operational_raw"]) or None,
                "relationships": related,
                "direct_related_repd_refs": sorted(row["direct_related_repd_refs"], key=numeric_sort),
                "planning_sibling_repd_refs": sorted(set(planning_siblings), key=numeric_sort),
                "development_repd_refs": ([ref] + siblings) if ref else [],
                "source_row": row["source_row"],
            }
        )

    registry = {
        "schema": SCHEMA,
        "source_owner": manifest.get("source_owner"),
        "source_url": source_url,
        "source_excel_url": manifest.get("source_excel_url"),
        "source_page": manifest.get("source_page"),
        "source_dataset_title": manifest.get("source_dataset_title"),
        "source_page_last_updated": manifest.get("source_page_last_updated"),
        "validated_at": manifest.get("validated_at"),
        "source_hashes": manifest.get("source_hashes"),
        "raw_record_count": len(rows),
        "repd_bound_count": len(current),
        "globalgrid_only_count": len(missing_ref_rows),
        "repd_ref_coverage": round(coverage, 8),
        "development_group_count": len(set(group_id.values())) + len(missing_ref_rows),