In this section
- Check V9 21 test · globalgrid2050 / uk_renewables_pipeline/202611141017/tests/check_v9_21.mjs lines 1–112
- Run V9 21 test · globalgrid2050 / uk_renewables_pipeline/202611141017/tests/run_v9_21.sh lines 1–98
- V9 22 render · globalgrid2050 / uk_renewables_pipeline/202611151300/styles/v9-22.css lines 1–27
- Browser Stage Agent7 test · globalgrid2050 / uk_renewables_pipeline/202611151300/tests/browser_stage_agent7.mjs lines 1–163
- Check V9 22 test · globalgrid2050 / uk_renewables_pipeline/202611151300/tests/check_v9_22.mjs lines 1–113
- Live News Regression V9 22 test · globalgrid2050 / uk_renewables_pipeline/202611151300/tests/live_news_regression_v9_22.mjs lines 1–117
Check V9 21
A JavaScript module in the tests folder of GlobalGrid2050 that tests major project news, interconnectors and the Renewable Energy Planning Database (REPD) register, using SHA-256.
Set aside from the main view: 90% of its lines are the same as uk_renewables_pipeline/202611161244/tests/check_v9_24.mjs (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 90% of lines shared with Check V9 24; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.901 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611161244/tests/check_v9_24.mjs:1-112 700efbfe31ebe902d25f320adfb69b6f150fb1bc
- sha256 0817a8cf4cb1d72ceb249b76a4bc43bcc955d516aff48f8719c05eca266813dc
- target sha256 1c81f345cfcdbe865764ea9bd72cbf5e60f60637c126a7cf0734ec65ccbd164a
- group of 4 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
testglobalgrid2050 / uk_renewables_pipeline/202611141017/tests/check_v9_21.mjs · lines 1–112 of 112 · version 2026-11-14 10:17
- What it does
- It tests major project news, interconnectors and the REPD register. Defines text, json, sha256, fmt. Uses libraries node:assert/strict, node:crypto, node:fs/promises, node:url, node:path. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: interconnectors, the REPD register.
- Inputs & outputs
- In: JSON file release.v9.1.json; JSON file release.v9.5.1.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json; JSON file interconnectors.v9.8.json; JSON file interconnectors.json; JSON file interconnectors_manifest.json.
- Downstream impact
- Used directly by 1 file: Run V9 21 (globalgrid2050).
- What it achieves
- It is built from the text step (`text`), the JSON step (`json`) and the sha256 step (`sha256`). Pipeline News V9.21, proven from the bytes and through the page's OWN loaders (the pattern of `check_v9_13.mjs`).
- Why it matters
- Checked by Run V9 21.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611141017/tests · JavaScript module
- Uses
- Canonical Projects V9 5 1 (new URL import.meta.url), node:assert/strict, node:crypto, node:fs/promises, node:url, node:path
- Used by
- run by Run V9 21 (script call)
- Produces
- text, json, sha256, fmt
- Defines here
- text, json, sha256, fmt
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611141017/tests/check_v9_21.mjs:1-112 · blob 885ba4fdd54ce32019643600c00f6ddaa2fba06d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* check_v9_21.mjs - Pipeline News V9.21, proven from the bytes and through the
* page's OWN loaders (the pattern of check_v9_13.mjs).
*
* 1. The contracts bind the fixtures held by 202611132345 by path and sha256.
* 2. The page's own loader chain is imported unmodified and executed against the
* files in this folder; every invariant the browser asserts is asserted here.
* 3. The spine partitions are what the manifest says (sha256 and counts).
* 4. The UK newspaper feed is unchanged and Beacon Fen still resolves.
* 5. The interconnector product and contract are the parent's, byte for byte.
* 6. The page states its own identity and version label.
*
* Run: node tests/check_v9_21.mjs
*/
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { basename, dirname, join } from "node:path";
const HERE = dirname(fileURLToPath(import.meta.url));
const RELEASE = join(HERE, "..");
const ID = basename(RELEASE);
const ROOT = join(RELEASE, "..", "..");
const VERSION = "9.21";
const STATE = "BUILD";
const PARENT_ID = "202611140306";
const FIXTURE_OWNER = "202611132345";
const PARENT = join(RELEASE, "..", PARENT_ID);
const text = (p) => readFile(p, "utf8");
const json = async (p) => JSON.parse(await text(p));
const sha256 = (b) => createHash("sha256").update(b).digest("hex");
const NEWS_FEED_SHA256 = "cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd";
// 1. contracts bind fixtures
const c91 = await json(join(RELEASE, "contracts", "release.v9.1.json"));
const c951 = await json(join(RELEASE, "contracts", "release.v9.5.1.json"));
assert.equal(c91.source.dataset, "DESNZ Renewable Energy Planning Database Q3 2026");
for (const [pathKey, shaKey] of [["identity_fixture", "identity_fixture_sha256"], ["coordinate_fixture", "coordinate_fixture_sha256"]]) {
const rel = c91.source[pathKey];
assert.ok(rel.startsWith(`uk_renewables_pipeline/${FIXTURE_OWNER}/fixtures/`), `${pathKey} must be the fixture owner's: ${rel}`);
assert.equal(sha256(await readFile(join(ROOT, rel))), c91.source[shaKey], `${pathKey} bytes`);
}
const coords = await json(join(ROOT, c91.source.coordinate_fixture));
assert.equal(coords.source_workbook_sha256, c91.source.workbook_sha256, "coordinate fixture names the contract workbook");
const identity = await json(join(ROOT, c91.source.identity_fixture));
assert.equal(identity.schema, "globalgrid2050.project-identity.v6");
assert.equal(identity.records.length, identity.raw_record_count);
assert.equal(coords.source_records, identity.raw_record_count, "workbook and identity hold the same refs");
// 2. the page's own loader, unmodified, against these bytes
const ORIGIN = "http://release.invalid";
const BASE = `${ORIGIN}/uk_renewables_pipeline/${ID}/`;
globalThis.window = { location: { origin: ORIGIN, href: BASE } };
globalThis.fetch = async (path) => {
const url = new URL(path, BASE);
assert.ok(url.pathname.startsWith(`/uk_renewables_pipeline/${ID}/`), `loader fetched outside the release: ${url}`);
const file = join(RELEASE, decodeURIComponent(url.pathname.slice(`/uk_renewables_pipeline/${ID}/`.length)));
const body = await text(file);
return { ok: true, status: 200, url: url.href, json: async () => JSON.parse(body) };
};
const loader = await import(new URL("../scripts/data/canonical-projects-v9-5-1.js", import.meta.url).href);
const model = await loader.loadCanonicalProjectsV9_5_1();
assert.equal(model.projects.length, c951.expected.project_count);
assert.equal(Math.round(model.metadata.capacity_mw), c951.expected.displayed_capacity_mw);
// 3. partitions are the manifest's bytes
const manifest = await json(join(RELEASE, "data", "v9.1", "build_manifest.json"));
for (const part of [...manifest.project_partitions, ...manifest.atlas_partitions]) {
assert.equal(sha256(await readFile(join(RELEASE, part.path))), part.sha256, `${part.path} hash`);
}
const atlasFeatures = manifest.atlas_partitions.reduce((n, p) => n + p.feature_count, 0);
assert.equal(atlasFeatures, manifest.geometry_count, "atlas features = valid geometries");
for (const key of Object.keys(c91.expected)) assert.equal(manifest[key], c91.expected[key], `manifest ${key}`);
assert.equal(manifest.source_dataset, c91.source.dataset);
assert.equal(manifest.source_record_count, identity.raw_record_count);
// 4. the newspaper: unchanged Q2 feed, every bound ref still resolves
const feedBytes = await readFile(join(ROOT, "dist", "major_project_news_v9_5_1.json"));
assert.equal(sha256(feedBytes), NEWS_FEED_SHA256, "dist/major_project_news_v9_5_1.json must not be rebuilt by this release");
const feed = JSON.parse(feedBytes);
const byRef = new Map(model.projects.map((p) => [p.repd_ref, p]));
const boundRefs = new Set(feed.canonical_items.map((item) => String(item.repd_ref)));
const unresolved = [...boundRefs].filter((ref) => !byRef.has(ref));
const beacon = byRef.get(feed.beacon_fen_contract.repd_ref);
assert.ok(beacon, "Beacon Fen must be in the spine");
assert.equal(beacon.capacity_mw, feed.beacon_fen_contract.official_capacity_mw, "Beacon Fen official capacity");
// 5. interconnectors are the parent's
for (const rel of ["contracts/interconnectors.v9.8.json", "data/v9.8/interconnectors.json", "data/v9.8/interconnectors_manifest.json"]) {
assert.equal(sha256(await readFile(join(RELEASE, rel))), sha256(await readFile(join(PARENT, rel))), `${rel} is the parent's`);
}
// 6. page identity
const fmt = (n) => n.toLocaleString("en-GB");
const html = await text(join(RELEASE, "index.html"));
assert.ok(html.includes(`UK RENEWABLES PIPELINE ${ID}`), "index.html h1 names this release");
assert.ok(new RegExp(`Canonical DESNZ REPD Q3 2026[^<]*${fmt(manifest.project_count)} solar, BESS and wind records`).test(html), "index.html states the Q3 register count");
assert.ok(!html.includes("REPD Q2 2026: 7,680"), "index.html must not claim the Q2 register");
assert.ok(html.includes("scripts/app-v9-8.js"), "index.html loads the v9.8 app");
const label = html.slice(html.indexOf("<body>"), html.indexOf('<section class="newspaper">'));
assert.ok(!/CANDIDATE/.test(label.replaceAll("RELEASE CANDIDATE", "")), "brand, nav, h1 and meta carry no candidate label other than this version's own state");
assert.ok(label.includes(`<small>UK RENEWABLES PIPELINE · V${VERSION}</small>`), "brand names the version");
assert.ok(label.includes(`<a class="active" href="#">V${VERSION} ${STATE} · REPD Q3 2026</a>`), "nav names the version");
assert.ok(label.includes(`<a href="../${PARENT_ID}/">`), "nav links back to the parent");
assert.ok(label.includes('<a href="../versions.html">'), "nav links to the list of all versions");
assert.ok(new RegExp(`<strong>V${VERSION.replace(".", "\\.")} · REPD OCTOBER 2026 \\(Q3\\) · [^<]+ · ${STATE} · \\d+ November 2026</strong>`).test(label), "meta line names the version and its date");
assert.ok(html.includes(`<title>GlobalGrid2050 | UK Renewables Pipeline ${ID}</title>`), "title names this release");
console.log(`check_v9_21: ${ID} loader PASS - ${fmt(model.projects.length)} records, ${model.metadata.capacity_mw.toLocaleString("en-GB", { minimumFractionDigits: 2 })} MW, `
+ `${manifest.geometry_count} with geometry / ${manifest.missing_geometry_count} without; news feed unchanged, `
+ `${boundRefs.size - unresolved.length}/${boundRefs.size} bound refs resolve${unresolved.length ? ` (unresolved: ${unresolved.join(", ")})` : ""}`);Run V9 21
A shell script in the tests folder of GlobalGrid2050 that tests interconnectors.
Set aside from the main view: A comment at the top of the file says a tool wrote it. (noise-generated, proposed by noise.py). All set-aside files, with reasons. Nothing was deleted.
Evidence
- line 4 comment: # Written by automation/pipeline_release/new_version.py by the pattern of run_v9_13.sh.
testglobalgrid2050 / uk_renewables_pipeline/202611141017/tests/run_v9_21.sh · lines 1–98 of 98 · version 2026-11-14 10:17 · Entry point · pattern is_listed (shared by 38 files)
- What it does
- It tests interconnectors. Defines is_listed, walk. Side effects: starts processes.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: interconnectors.
- Inputs & outputs
- In: JSON file release.v9.1.json.
- Downstream impact
- It is itself an entry point (shell script); no other file was found loading it.
- What it achieves
- Defines `is_listed` and `walk`.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611141017/tests · shell script
- Uses
- Check V9 21 (script call)
- Used by
- none found
- Produces
- is_listed, walk
- Defines here
- is_listed, walk
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611141017/tests/run_v9_21.sh:1-98 · blob 2cb11fe5b313c1a5c17fb1afb519ec45fba955bf · 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
#!/usr/bin/env bash
# run_v9_21.sh - Pipeline News V9.21: one visible step on its parent, same REPD
# October 2026 (Q3 2026) register. Offline, in a git checkout or a plain copy.
# Written by automation/pipeline_release/new_version.py by the pattern of run_v9_13.sh.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
RELEASE="$(cd "$HERE/.." && pwd)"
ID="$(basename "$RELEASE")"
PARENT_ID="202611140306"
FIXTURE_OWNER="202611132345"
PARENT="$(cd "$RELEASE/../$PARENT_ID" && pwd)"
ROOT="$(cd "$RELEASE/../.." && pwd)"
# The parent by git tree of the bytes ON DISK.
PARENT_TREE="365d7df093368c39c3878daacf65449ba32e7267"
SCRATCH="$(mktemp -d)"
trap 'rm -rf "$SCRATCH"' EXIT
git init -q --bare "$SCRATCH/objects.git"
(cd "$ROOT" && find "uk_renewables_pipeline/$PARENT_ID" -type f -not -path '*/__pycache__/*' -not -name '*.pyc' -not -path '*/node_modules/*' | sort) \
| GIT_DIR="$SCRATCH/objects.git" GIT_WORK_TREE="$ROOT" GIT_INDEX_FILE="$SCRATCH/index" \
git -C "$ROOT" -c core.autocrlf=false update-index --add --stdin
actual_tree="$(GIT_DIR="$SCRATCH/objects.git" GIT_INDEX_FILE="$SCRATCH/index" git write-tree --prefix="uk_renewables_pipeline/$PARENT_ID/")"
test "$actual_tree" = "$PARENT_TREE" || { echo "parent $PARENT_ID tree is $actual_tree, expected $PARENT_TREE" >&2; exit 1; }
# WHAT THIS VERSION CHANGES FROM ITS PARENT, NAMED ONE FILE AT A TIME.
CHANGED_FROM_PARENT=(
CHANGES.md
README.md
index.html
news/pipeline_headlines.snapshot.json
scripts/plugins/live-news.js
scripts/plugins/newspaper-v9-5-1.js
scripts/plugins/newspaper-v9-7.js
styles/v9-21.css
tests/check_v9_21.mjs
tests/run_v9_21.sh
)
REMOVED_FROM_PARENT=(
tests/check_v9_20.mjs
tests/run_v9_20.sh
)
is_listed() {
local needle="$1"; shift
for entry in "$@"; do [[ "$entry" == "$needle" ]] && return 0; done
return 1
}
walk() { find "$1" -type f -not -path '*/__pycache__/*' -not -name '*.pyc' -not -path '*/node_modules/*' | sort; }
while IFS= read -r file; do
relative="${file#$PARENT/}"
is_listed "$relative" "${CHANGED_FROM_PARENT[@]}" && continue
if is_listed "$relative" "${REMOVED_FROM_PARENT[@]}"; then
test ! -e "$RELEASE/$relative" || { echo "should not be copied: $relative" >&2; exit 1; }
continue
fi
cmp -s "$file" "$RELEASE/$relative" || { echo "inherited file differs from parent: $relative" >&2; exit 1; }
done < <(walk "$PARENT")
while IFS= read -r file; do
relative="${file#$RELEASE/}"
is_listed "$relative" "${CHANGED_FROM_PARENT[@]}" && continue
test -e "$PARENT/$relative" || { echo "unlisted new file: $relative" >&2; exit 1; }
done < <(walk "$RELEASE")
for relative in "${CHANGED_FROM_PARENT[@]}"; do
test -f "$RELEASE/$relative" || { echo "listed but missing: $relative" >&2; exit 1; }
if [[ -f "$PARENT/$relative" ]] && cmp -s "$PARENT/$relative" "$RELEASE/$relative"; then
echo "listed as changed but identical to parent: $relative" >&2; exit 1
fi
done
# The register is the parent's: contract, spine and interconnector product byte for byte.
cmp -s "$PARENT/contracts/release.v9.1.json" "$RELEASE/contracts/release.v9.1.json"
grep -q "\"identity_fixture\": \"uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/2026q3/project_identity_2026q3.json\"" "$RELEASE/contracts/release.v9.1.json"
diff -r "$PARENT/data/v9.1" "$RELEASE/data/v9.1"
diff -r "$PARENT/data/v9.8" "$RELEASE/data/v9.8"
# Spine and interconnector product rebuilt in a scratch root that holds this version
# and, at the fixture owner's path, only the two fixtures the contract binds. They
# must reproduce the committed bytes.
SROOT="$SCRATCH/root"
COPY="$SROOT/uk_renewables_pipeline/$ID"
mkdir -p "$SROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures"
cp -a "$ROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/2026q3" "$SROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/"
cp -a "$RELEASE" "$COPY"
rm -rf "$COPY/data/v9.1"
PYTHONDONTWRITEBYTECODE=1 python3 "$COPY/scripts/data/build_v9_1_spine.py"
diff -r "$RELEASE/data/v9.1" "$COPY/data/v9.1"
node "$COPY/scripts/build/interconnectors-v9-8.mjs" >/dev/null
diff -r "$RELEASE/data/v9.8" "$COPY/data/v9.8"
node "$HERE/check_v9_21.mjs"
node "$HERE/check_map_contract_all_rows.mjs"
while IFS= read -r source; do
node --check "$source"
done < <(find "$RELEASE/scripts" -type f \( -name '*.js' -o -name '*.mjs' \) -print | sort)
echo "V9.21 ($ID) validation suite: PASS ($ROOT)"V9 22
A style sheet in the styles folder of GlobalGrid2050.
renderglobalgrid2050 / uk_renewables_pipeline/202611151300/styles/v9-22.css · lines 1–27 of 27 · version 2026-11-15 13:00 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 — UK Renewables Pipeline Page (globalgrid2050, https://globalgrid2050.com/uk_renewables_pipeline/202611280922/). Reached from 4 other entry points, including GlobalGrid2050 Pipeline Legal Evidence Workflow (globalgrid2050); V923 Public Readback Workflow (neural-link-between-agents); A4 Legal Model (globalgrid2050).
- What it achieves
- V9.22 staging: accessible source-health states and 44px desktop MAP hit targets.
- Why it matters
- Loaded by the UK Renewables Pipeline page at https://globalgrid2050.com/uk_renewables_pipeline/202611280922/.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611151300/styles · style sheet
- Uses
- none found
- Used by
- loaded by GlobalGrid2050 — UK Renewables Pipeline Page (stylesheet)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611151300/styles/v9-22.css:1-27 · blob f04ea6121e759486344d5a5f5a52d2c2158e2ed1 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* V9.22 staging: accessible source-health states and 44px desktop MAP hit targets.
The mobile 44px target was inherited; desktop was not and failed real Chromium. */
#newsStatus[data-state="partial"],
#newsStatus[data-state="overdue-partial"],
#newsStatus[data-state="failed"] { color: var(--bess, #ffae00); }
.ln-empty {
margin: 0;
padding: 16px 14px;
color: var(--muted, #a6adbb);
font-size: 12px;
line-height: 1.5;
}
.project-actions .action-link,
.project-actions .action-disabled,
.project-actions .copy-id {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 44px;
min-height: 44px;
box-sizing: border-box;
}
.project-actions a:focus-visible,
.project-actions button:focus-visible {
outline: 2px solid var(--accent, #0ff);
outline-offset: 2px;
}Browser Stage Agent7
A JavaScript module in the tests folder of GlobalGrid2050 that tests receivers and the Renewable Energy Planning Database (REPD) register, and uses data from the ventus-grid-engine and GridAtlas repositories.
testglobalgrid2050 / uk_renewables_pipeline/202611151300/tests/browser_stage_agent7.mjs · lines 1–163 of 163 · version 2026-11-15 13:00 · Entry point · pattern parseCsv (shared by 8 files)
- What it does
- It tests receivers and the REPD register. Defines parseCsv. Uses libraries node:assert/strict, node:fs/promises, node:path, node:url, node:module. Side effects: changes the web page (DOM); reads or writes files.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: the REPD register.
- Inputs & outputs
- In: data source: ventus-grid-engine data; data source: gridatlas data; JSON file build_manifest.json; JSON file receivers.json.
- Downstream impact
- Used directly by 2 files: GlobalGrid2050 Agent7 V922 CI Workflow (globalgrid2050); GlobalGrid2050 Deploy Pages Workflow (globalgrid2050).
- What it achieves
- It parses CSV (`parseCsv`). Agent 7 actual Chromium STAGING preflight (not public served-byte or engine QA).
- Why it matters
- Run by GlobalGrid2050 Agent7 V922 CI Workflow and GlobalGrid2050 Deploy Pages Workflow.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611151300/tests · JavaScript module
- Uses
- GridAtlas — Atlas Page (estate URL), node:assert/strict, node:fs/promises, node:path, node:url, node:module, playwright
- Used by
- run by GlobalGrid2050 Agent7 V922 CI Workflow (workflow run), run by GlobalGrid2050 Deploy Pages Workflow (workflow run)
- Produces
- parseCsv
- Defines here
- parseCsv
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611151300/tests/browser_stage_agent7.mjs:1-163 · blob 448547605c241e8f282afa27582c7844c3eeccb9 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* Agent 7 actual Chromium STAGING preflight (not public served-byte or engine QA).
* Real local 390px phone and 1440px desktop page, search/table, CSV and MAP
* hit-target checks. Does NOT treat a syntactically valid MAP link as a
* successful GridAtlas receiver/engine calculation. No fake remote engine.
*/
import assert from 'node:assert/strict';
import { readFile, mkdir } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { createRequire } from 'node:module';
const require = createRequire(new URL('../package.json', import.meta.url));
const { chromium, webkit } = require('playwright');
const HERE = dirname(fileURLToPath(import.meta.url));
const ROOT = join(HERE, '..');
const ORIGIN = process.env.V9_BASE_URL ||
'http://127.0.0.1:8765/uk_renewables_pipeline/202611151300/';
const OUT = process.env.AGENT7_SCREENSHOT_DIR || '/tmp/agent7-staging';
const manifest = JSON.parse(await readFile(join(ROOT, 'data/v9.1/build_manifest.json'), 'utf8'));
assert.equal(manifest.project_count, 7775);
const expectedRefs = new Set();
for (const part of manifest.project_partitions) {
const data = JSON.parse(await readFile(join(ROOT, part.path), 'utf8'));
for (const project of data.projects) {
const ref = String(project.repd_ref);
assert.ok(!expectedRefs.has(ref), 'duplicate canonical REPD Ref ' + ref);
expectedRefs.add(ref);
}
}
assert.equal(expectedRefs.size, 7775);
/* RFC4180-style CSV rows, tolerating quoted commas, escaped quotes and CRLF. */
function parseCsv(value) {
value = value.replace(/^\uFEFF/, '');
let rows = [], row = [], cell = '', quoted = false;
for (let i = 0; i < value.length; i++) {
const c = value[i];
if (c === '"') {
if (quoted && value[i + 1] === '"') { cell += '"'; i++; }
else quoted = !quoted;
} else if (!quoted && c === ',') {
row.push(cell); cell = '';
} else if (!quoted && (c === '\n' || c === '\r')) {
if (c === '\r' && value[i + 1] === '\n') i++;
row.push(cell); rows.push(row); row = []; cell = '';
} else cell += c;
}
assert.equal(quoted, false, 'CSV ends inside quoted cell');
if (row.length || cell) { row.push(cell); rows.push(row); }
return rows;
}
const feed = {
schema: 'globalgrid2050.news.pipeline-headlines.v1', status: 'ok',
generated_at: new Date().toISOString(),
items: [], counts: { feeds_ok: 50, feeds_failed: 0 },
scope: 'Headlines only. No confirmed REPD project associations.',
};
const browser = await chromium.launch({ headless: true });
const webkitBrowser = await webkit.launch({ headless: true });
await mkdir(OUT, { recursive: true });
let passed = 0;
try {
for (const width of [390, 393, 1440]) {
// 393px runs through WebKit to catch iOS-browser layout regressions.
// 390px and 1440px retain the existing Chromium reference tests.
const engine = width === 393 ? webkitBrowser : browser;
const context = await engine.newContext({
viewport: { width, height: 900 }, acceptDownloads: true,
isMobile: width < 600, hasTouch: width < 600,
});
const page = await context.newPage();
// Chart.js is an optional CDN dependency; substitute a stub while verifying
// the independent table, news, CSV and MAP interactions offline.
await page.addInitScript(() => {
window.Chart = class ChartStub {
constructor(_canvas, config) { this.data = config.data; }
update() {}
};
});
const errors = [];
page.on('pageerror', e => errors.push(e.message));
await page.route('https://cdn.jsdelivr.net/**', route =>
route.fulfill({ status: 200, contentType: 'application/javascript', body: '' }));
await page.route('https://raw.githubusercontent.com/Ventusltd/globalgrid2050/pipeline-news-data/**',
route => route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(feed),
headers: { 'access-control-allow-origin': '*' } }));
// Exercise the compiled receiver fallback without inventing remote engine execution.
await page.route('https://ventusltd.github.io/ventus-grid-engine/deeplink/receivers.json',
route => route.abort('failed'));
await page.goto(ORIGIN, { waitUntil: 'domcontentloaded', timeout: 60000 });
await page.waitForFunction(() => (
document.getElementById('tbody')?.dataset.total === '7775'
&& document.getElementById('newsStatus')?.dataset.state === 'live'
&& document.getElementById('liveNews')?.textContent
.includes('No headlines currently meet the feed criteria.')
), null, { timeout: 90000 });
const totals = await page.evaluate(() => ({
total: document.getElementById('tbody').dataset.total,
rows: document.querySelectorAll('#tbody tr').length,
news: document.getElementById('liveNews').textContent,
status: document.getElementById('newsStatus').textContent,
pageScroll: document.documentElement.scrollWidth,
pageWidth: document.documentElement.clientWidth,
}));
assert.equal(totals.total, '7775');
assert.ok(totals.rows > 0 && totals.rows <= 20);
assert.match(totals.news, /No headlines currently meet/);
assert.ok(totals.pageScroll <= totals.pageWidth + 1,
width + 'px page overflows horizontally by ' + (totals.pageScroll - totals.pageWidth));
const mapAnchor = page.locator('#tbody tr .atlaslink').first();
await mapAnchor.waitFor({ state: 'visible' });
await mapAnchor.scrollIntoViewIfNeeded();
const map = await mapAnchor.evaluate((a) => {
const r = a.getBoundingClientRect();
const hit = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2);
return { url: a.href, rect: { left: r.left, right: r.right,
width: r.width, height: r.height },
hit: hit === a || a.contains(hit),
viewport: document.documentElement.clientWidth,
};
});
assert.ok(map.url.startsWith('https://ventusltd.github.io/gridatlas/atlas/?'), map.url);
assert.ok(new URL(map.url).searchParams.get('repd_ref'), 'missing MAP REPD identity');
assert.ok(map.rect.left >= 0 && map.rect.right <= map.viewport + 1,
width + 'px MAP is off viewport: ' + JSON.stringify(map.rect));
assert.ok(map.hit, width + 'px MAP centre is obscured');
assert.ok(map.rect.width >= 44 && map.rect.height >= 44,
width + 'px MAP hit target <44px');
await page.screenshot({ path: join(OUT, 'v922-' + width + '.png'), fullPage: false });
assert.deepEqual(errors, [], width + 'px application JS errors');
if (width === 1440) {
const [download] = await Promise.all([
page.waitForEvent('download', { timeout: 30000 }),
page.locator('#exportInline').click(),
]);
const csv = await readFile(await download.path(), 'utf8');
const records = parseCsv(csv);
assert.equal(records.length, 7776, 'CSV header + 7775 REPD rows expected');
const ix = records[0].indexOf('REPD Ref');
assert.ok(ix >= 0, 'CSV missing canonical REPD Ref column: ' + records[0].join('|'));
const refs = records.slice(1).map(row => {
assert.equal(row.length, records[0].length, 'CSV row width inconsistent');
return row[ix];
});
const exportedRefs = new Set(refs);
assert.equal(exportedRefs.size, 7775, 'CSV duplicate REPD identity');
assert.deepEqual([...exportedRefs].sort(), [...expectedRefs].sort(),
'CSV REPD identity set not equal to source partitions');
console.log('CSV verified 7,775/7,775 unique exact REPD refs against Q3 partitions');
}
passed++;
console.log(width + 'px actual ' + (width === 393 ? 'WebKit' : 'Chromium') + ' staging: PASS; MAP href + hit target checked, '
+ 'Grid Engine execution NOT checked');
await context.close();
}
} finally {
await browser.close();
await webkitBrowser.close();
}
assert.equal(passed, 3);
console.log('Agent8 cross-browser STAGING PASS at Chromium 390/1440 and WebKit 393; NOT public served-byte or engine acceptance');Check V9 22
A JavaScript module in the tests folder of GlobalGrid2050 that tests major project news, interconnectors and the Renewable Energy Planning Database (REPD) register, using SHA-256.
testglobalgrid2050 / uk_renewables_pipeline/202611151300/tests/check_v9_22.mjs · lines 1–113 of 113 · version 2026-11-15 13:00
- What it does
- It tests major project news, interconnectors and the REPD register. Defines text, json, sha256, fmt. Uses libraries node:assert/strict, node:crypto, node:fs/promises, node:url, node:path. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: interconnectors, the REPD register.
- Inputs & outputs
- In: JSON file release.v9.1.json; JSON file release.v9.5.1.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json; JSON file interconnectors.v9.8.json; JSON file interconnectors.json; JSON file interconnectors_manifest.json.
- Downstream impact
- Used directly by 1 file: Run V9 22 (globalgrid2050). Reached from 1 other entry point, including GlobalGrid2050 Agent7 V922 CI Workflow (globalgrid2050).
- What it achieves
- It is built from the text step (`text`), the JSON step (`json`) and the sha256 step (`sha256`). Pipeline News V9.22, proven from the bytes and through the page's OWN loaders (the pattern of `check_v9_13.mjs`).
- Why it matters
- Checked by Run V9 22.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611151300/tests · JavaScript module
- Uses
- Canonical Projects V9 5 1 (new URL import.meta.url), node:assert/strict, node:crypto, node:fs/promises, node:url, node:path
- Used by
- run by Run V9 22 (script call)
- Produces
- text, json, sha256, fmt
- Defines here
- text, json, sha256, fmt
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611151300/tests/check_v9_22.mjs:1-113 · blob dc9d60f7a0123547cd1d5988f699c9c8cb4cada9 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* check_v9_22.mjs - Pipeline News V9.22, proven from the bytes and through the
* page's OWN loaders (the pattern of check_v9_13.mjs).
*
* 1. The contracts bind the fixtures held by 202611132345 by path and sha256.
* 2. The page's own loader chain is imported unmodified and executed against the
* files in this folder; every invariant the browser asserts is asserted here.
* 3. The spine partitions are what the manifest says (sha256 and counts).
* 4. The UK newspaper feed is unchanged and Beacon Fen still resolves.
* 5. The interconnector product and contract are the parent's, byte for byte.
* 6. The page states its own identity and version label.
*
* Run: node tests/check_v9_22.mjs
*/
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { basename, dirname, join } from "node:path";
const HERE = dirname(fileURLToPath(import.meta.url));
const RELEASE = join(HERE, "..");
const ID = basename(RELEASE);
const ROOT = join(RELEASE, "..", "..");
const VERSION = "9.22";
const STATE = "BUILD";
const PARENT_ID = "202611141017";
const FIXTURE_OWNER = "202611132345";
const PARENT = join(RELEASE, "..", PARENT_ID);
const text = (p) => readFile(p, "utf8");
const json = async (p) => JSON.parse(await text(p));
const sha256 = (b) => createHash("sha256").update(b).digest("hex");
const NEWS_FEED_SHA256 = "cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd";
// 1. contracts bind fixtures
const c91 = await json(join(RELEASE, "contracts", "release.v9.1.json"));
const c951 = await json(join(RELEASE, "contracts", "release.v9.5.1.json"));
assert.equal(c91.source.dataset, "DESNZ Renewable Energy Planning Database Q3 2026");
for (const [pathKey, shaKey] of [["identity_fixture", "identity_fixture_sha256"], ["coordinate_fixture", "coordinate_fixture_sha256"]]) {
const rel = c91.source[pathKey];
assert.ok(rel.startsWith(`uk_renewables_pipeline/${FIXTURE_OWNER}/fixtures/`), `${pathKey} must be the fixture owner's: ${rel}`);
assert.equal(sha256(await readFile(join(ROOT, rel))), c91.source[shaKey], `${pathKey} bytes`);
}
const coords = await json(join(ROOT, c91.source.coordinate_fixture));
assert.equal(coords.source_workbook_sha256, c91.source.workbook_sha256, "coordinate fixture names the contract workbook");
const identity = await json(join(ROOT, c91.source.identity_fixture));
assert.equal(identity.schema, "globalgrid2050.project-identity.v6");
assert.equal(identity.records.length, identity.raw_record_count);
assert.equal(coords.source_records, identity.raw_record_count, "workbook and identity hold the same refs");
// 2. the page's own loader, unmodified, against these bytes
const ORIGIN = "http://release.invalid";
const BASE = `${ORIGIN}/uk_renewables_pipeline/${ID}/`;
globalThis.window = { location: { origin: ORIGIN, href: BASE } };
globalThis.fetch = async (path) => {
const url = new URL(path, BASE);
assert.ok(url.pathname.startsWith(`/uk_renewables_pipeline/${ID}/`), `loader fetched outside the release: ${url}`);
const file = join(RELEASE, decodeURIComponent(url.pathname.slice(`/uk_renewables_pipeline/${ID}/`.length)));
const body = await text(file);
return { ok: true, status: 200, url: url.href, json: async () => JSON.parse(body) };
};
const loader = await import(new URL("../scripts/data/canonical-projects-v9-5-1.js", import.meta.url).href);
const model = await loader.loadCanonicalProjectsV9_5_1();
assert.equal(model.projects.length, c951.expected.project_count);
assert.equal(Math.round(model.metadata.capacity_mw), c951.expected.displayed_capacity_mw);
// 3. partitions are the manifest's bytes
const manifest = await json(join(RELEASE, "data", "v9.1", "build_manifest.json"));
for (const part of [...manifest.project_partitions, ...manifest.atlas_partitions]) {
assert.equal(sha256(await readFile(join(RELEASE, part.path))), part.sha256, `${part.path} hash`);
}
const atlasFeatures = manifest.atlas_partitions.reduce((n, p) => n + p.feature_count, 0);
assert.equal(atlasFeatures, manifest.geometry_count, "atlas features = valid geometries");
for (const key of Object.keys(c91.expected)) assert.equal(manifest[key], c91.expected[key], `manifest ${key}`);
assert.equal(manifest.source_dataset, c91.source.dataset);
assert.equal(manifest.source_record_count, identity.raw_record_count);
// 4. the newspaper: unchanged Q2 feed, every bound ref still resolves
const feedBytes = await readFile(join(ROOT, "dist", "major_project_news_v9_5_1.json"));
assert.equal(sha256(feedBytes), NEWS_FEED_SHA256, "dist/major_project_news_v9_5_1.json must not be rebuilt by this release");
const feed = JSON.parse(feedBytes);
const byRef = new Map(model.projects.map((p) => [p.repd_ref, p]));
const boundRefs = new Set(feed.canonical_items.map((item) => String(item.repd_ref)));
const unresolved = [...boundRefs].filter((ref) => !byRef.has(ref));
const beacon = byRef.get(feed.beacon_fen_contract.repd_ref);
assert.ok(beacon, "Beacon Fen must be in the spine");
assert.equal(beacon.capacity_mw, feed.beacon_fen_contract.official_capacity_mw, "Beacon Fen official capacity");
// 5. interconnectors are the parent's
for (const rel of ["contracts/interconnectors.v9.8.json", "data/v9.8/interconnectors.json", "data/v9.8/interconnectors_manifest.json"]) {
assert.equal(sha256(await readFile(join(RELEASE, rel))), sha256(await readFile(join(PARENT, rel))), `${rel} is the parent's`);
}
// 6. page identity
const fmt = (n) => n.toLocaleString("en-GB");
const html = await text(join(RELEASE, "index.html"));
assert.ok(html.includes(`UK RENEWABLES PIPELINE ${ID}`), "index.html h1 names this release");
assert.ok(new RegExp(`Canonical DESNZ REPD Q3 2026[^<]*${fmt(manifest.project_count)} solar, BESS and wind records`).test(html), "index.html states the Q3 register count");
assert.ok(!html.includes("REPD Q2 2026: 7,680"), "index.html must not claim the Q2 register");
assert.ok(html.includes("scripts/app-v9-8.js"), "index.html loads the v9.8 app");
assert.ok(html.includes("MAP ON A PHONE:") && html.includes("not available grid capacity"), "mobile GridAtlas result-card presentation and screening limits must be disclosed");
const label = html.slice(html.indexOf("<body>"), html.indexOf('<section class="newspaper">'));
assert.ok(!/CANDIDATE/.test(label.replaceAll("RELEASE CANDIDATE", "")), "brand, nav, h1 and meta carry no candidate label other than this version's own state");
assert.ok(label.includes(`<small>UK RENEWABLES PIPELINE · V${VERSION}</small>`), "brand names the version");
assert.ok(label.includes(`<a class="active" href="#">V${VERSION} ${STATE} · REPD Q3 2026</a>`), "nav names the version");
assert.ok(label.includes(`<a href="../${PARENT_ID}/">`), "nav links back to the parent");
assert.ok(label.includes('<a href="../versions.html">'), "nav links to the list of all versions");
assert.ok(new RegExp(`<strong>V${VERSION.replace(".", "\\.")} · REPD OCTOBER 2026 \\(Q3\\) · [^<]+ · ${STATE} · \\d+ November 2026</strong>`).test(label), "meta line names the version and its date");
assert.ok(html.includes(`<title>GlobalGrid2050 | UK Renewables Pipeline ${ID}</title>`), "title names this release");
console.log(`check_v9_22: ${ID} loader PASS - ${fmt(model.projects.length)} records, ${model.metadata.capacity_mw.toLocaleString("en-GB", { minimumFractionDigits: 2 })} MW, `
+ `${manifest.geometry_count} with geometry / ${manifest.missing_geometry_count} without; news feed unchanged, `
+ `${boundRefs.size - unresolved.length}/${boundRefs.size} bound refs resolve${unresolved.length ? ` (unresolved: ${unresolved.join(", ")})` : ""}`);Live News Regression V9 22
A JavaScript module in the tests folder of GlobalGrid2050 that tests solar. It is built from the node step (`node`), the fixture step (`fixture`) and the doc step (`doc`).
testglobalgrid2050 / uk_renewables_pipeline/202611151300/tests/live_news_regression_v9_22.mjs · lines 1–117 of 117 · version 2026-11-15 13:00 · Entry point · pattern headline (shared by 4 files)
- What it does
- It tests solar. Defines node, fixture, doc, headline. Uses libraries node:assert/strict, node:fs, node:path, node:url, node:vm. Side effects: changes the web page (DOM); reads or writes files.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'renewables'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: solar.
- Downstream impact
- Used directly by 2 files: Run V9 22 (globalgrid2050); GlobalGrid2050 Agent7 V922 CI Workflow (globalgrid2050).
- What it achieves
- V9.22 reader behaviour: real JS executed in an isolated DOM fixture; no network.
- Why it matters
- Run by GlobalGrid2050 Agent7 V922 CI Workflow. Checked by Run V9 22.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611151300/tests · JavaScript module
- Uses
- node:assert/strict, node:fs, node:path, node:url, node:vm, node:test
- Used by
- run by Run V9 22 (script call), run by GlobalGrid2050 Agent7 V922 CI Workflow (workflow run)
- Produces
- node, fixture, doc, headline
- Defines here
- node, fixture, doc, headline
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611151300/tests/live_news_regression_v9_22.mjs:1-117 · blob 610f4d954421c0d77578e9120165e0c9128d5a07 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* V9.22 reader behaviour: real JS executed in an isolated DOM fixture; no network. */
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { runInNewContext } from 'node:vm';
import test from 'node:test';
const HERE = dirname(fileURLToPath(import.meta.url));
const source = readFileSync(join(HERE, '../scripts/plugins/live-news.js'), 'utf8');
const NOW = Date.parse('2026-11-15T12:00:00Z');
function node(tag) {
const n = { tagName: tag, children: [], parentNode: null, attrs: {}, _text: '', open: false,
setAttribute(name, value) { this.attrs[name] = value; },
appendChild(child) { child.parentNode = this; this.children.push(child); return child; },
insertBefore(child, anchor) {
child.parentNode = this;
const pos = anchor ? this.children.indexOf(anchor) : -1;
this.children.splice(pos < 0 ? this.children.length : pos, 0, child);
return child;
},
removeChild(child) {
const pos = this.children.indexOf(child);
if (pos >= 0) this.children.splice(pos, 1);
child.parentNode = null;
},
addEventListener() {},
};
Object.defineProperty(n, 'textContent', {
get() { return this._text; },
set(value) { this._text = String(value); this.children = []; },
});
return n;
}
function fixture() {
const elements = { newsStatus: node('span'), liveNews: node('div'), newsArchive: node('details') };
const document = {
readyState: 'loading',
createElement: node,
getElementById: (id) => elements[id] || null,
addEventListener() {},
};
const window = {};
runInNewContext(source, { document, window, Date, setTimeout: () => 1,
clearTimeout() {}, AbortController: undefined, console });
return { api: window.pipelineHeadlines, elements };
}
function doc(status = 'ok', items = [], extra = {}) {
return { schema: 'globalgrid2050.news.pipeline-headlines.v1',
status, items, generated_at: '2026-11-15T11:00:00Z',
counts: { feeds_ok: 50, feeds_failed: 0 }, scope: 'Headlines only; no verified REPD binding.', ...extra };
}
function headline(date = '2026-11-08T12:00:00Z') {
return { title: 'Planning decision on solar farm', date,
first_seen: '2026-11-15T11:00:00Z', source: 'Example Publisher',
link: 'https://publisher.example/article', category: 'planning_decision',
technology: 'solar', possible_match: null };
}
test('healthy empty response is accepted, not treated as outage or snapshot', () => {
const { api, elements } = fixture();
assert.equal(api.valid(doc()), true);
api.render(doc(), 'live', NOW);
assert.equal(elements.newsStatus.attrs['data-state'], 'live');
assert.match(elements.liveNews.children[0].textContent, /No headlines currently meet the feed criteria/);
assert.doesNotMatch(elements.newsStatus.textContent, /Headlines updated|verified/i);
});
test('partial 49/50 feeds renders usable results and discloses failure', () => {
const { api, elements } = fixture();
api.render(doc('partial', [headline()], { counts: { feeds_ok: 49, feeds_failed: 1 } }), 'live', NOW);
assert.equal(elements.newsStatus.attrs['data-state'], 'partial');
assert.match(elements.newsStatus.textContent, /49 sources succeeded, 1 failed/);
assert.equal(elements.liveNews.children[0].tagName, 'div');
});
test('partial healthy-empty response still shows genuine empty state', () => {
const { api, elements } = fixture();
api.render(doc('partial', [], { counts: { feeds_ok: 49, feeds_failed: 1 } }), 'live', NOW);
assert.equal(elements.newsStatus.attrs['data-state'], 'partial');
assert.match(elements.liveNews.children[0].textContent, /No headlines currently/);
});
test('invalid JSON schema remains unavailable, not healthy-empty', () => {
const { api, elements } = fixture();
const broken = doc('ok', [], { schema: 'wrong' });
assert.equal(api.valid(broken), false);
api.render(broken, 'none', NOW);
assert.equal(elements.newsStatus.attrs['data-state'], 'unavailable');
assert.equal(elements.newsArchive.open, true);
});
test('failed collection is distinct from a saved fallback snapshot', () => {
const { api, elements } = fixture();
api.render(doc('failed', [headline()]), 'live', NOW);
assert.equal(elements.newsStatus.attrs['data-state'], 'failed');
assert.match(elements.newsStatus.textContent, /collection failed/i);
api.render(doc('ok', [headline()]), 'snapshot', NOW);
assert.equal(elements.newsStatus.attrs['data-state'], 'snapshot');
assert.match(elements.newsStatus.textContent, /saved snapshot/i);
});
test('recent refresh does not claim eight-day-old article is new', () => {
const { api, elements } = fixture();
api.render(doc('ok', [headline('2026-11-07T13:00:00Z')]), 'live', NOW);
assert.match(elements.newsStatus.textContent, /Feed checked/);
assert.doesNotMatch(elements.newsStatus.textContent, /Headlines updated|new verified/i);
assert.match(elements.liveNews.children[0].children[0].textContent, /PUBLISHER DATE 7 NOV 2026/);
});
test('stale partial collection reports both partial and overdue', () => {
const { api, elements } = fixture();
api.render(doc('partial', [headline()], { generated_at: '2026-11-12T12:00:00Z',
counts: { feeds_ok: 49, feeds_failed: 1 } }), 'live', NOW);
assert.equal(elements.newsStatus.attrs['data-state'], 'overdue-partial');
assert.match(elements.newsStatus.textContent, /refresh is overdue/);
});
test('missing publisher date uses first-collected not event-effective date', () => {
const { api, elements } = fixture();
api.render(doc('ok', [headline(null)]), 'live', NOW);
assert.match(elements.liveNews.children[0].children[0].textContent, /FIRST COLLECTED/);
});