In this section
- PipelineNews Live News Discovery Workflow automation · pipelinenews / .github/workflows/202608270844-live-news-discovery.yml lines 1–409
PipelineNews Live News Discovery Workflow
A GitHub Actions workflow that builds and publishes the site. Runs on push and by hand.
automationpipelinenews / .github/workflows/202608270844-live-news-discovery.yml · lines 1–409 of 409 · version 2026-08-27 08:44 · Entry point
- What it does
- It builds and publishes its content. Side effects: reads or writes files; makes network requests; starts processes.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (repository name word 'pipelinenews'): 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 current.json; JSON file candidate.json; JSON file scope-proof.json; JSON file live-collector-health.json; JSON file live-candidate-ledger.json; JSON file compiler-pass-a.json; JSON file compiler-pass-b.json; JSON file determinism-proof.json. Out: GitHub Pages deployment; commits pushed to the repository.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- Publishes to GitHub Pages.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- pipelinenews · .github/workflows · workflow
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- Build PipelineNews Live News Discovery
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 .github/workflows/202608270844-live-news-discovery.yml:1-409 · blob 797972de7af1cc8c2454a7aea349359b51e399f6 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem, network, process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
name: Build PipelineNews Live News Discovery
on:
workflow_dispatch:
inputs:
live_collect:
description: Run the bounded live collector and retain its health ledger as an artifact
required: false
default: true
type: boolean
provider:
description: Live discovery provider
required: false
default: bing
type: choice
options: [bing, brave, google, serper]
push:
branches: [main]
paths:
- ".github/workflows/202608270844-live-news-discovery.yml"
- "index/202608270844-compile-v8-live-news.mjs"
- "build/javascript/202608270844-verify-v8-live-news-contract.mjs"
- "build/javascript/202608270844-verify-v8-live-news-browser.mjs"
- "ui/javascript/202608270844-v8-live-news-runtime.js"
- "data/news-discovery/202608270844-*.json"
- "discovery/javascript/202608270844-*.mjs"
- "discovery/tests/202608270844-*.mjs"
- "discovery/fixtures/202608270844-*"
permissions:
contents: write
concurrency:
group: build-pipelinenews-live-news-discovery-202608270844
cancel-in-progress: false
env:
LIVE_NEWS_GENERATION: "202608270844"
LIVE_NEWS_PARENT: "77bda8c3809d02550d06a1c4154315f56d1120fb"
LIVE_NEWS_SOURCE: "e6205f02ff34ea877fc529361f69c0c6b80b1c1d"
LIVE_NEWS_WORK_ROOT: "work/202608270844-live-news-discovery"
jobs:
build-gate-record:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout exact source commit
uses: actions/checkout@v5
with:
ref: ${{ env.LIVE_NEWS_SOURCE }}
fetch-depth: 0
- name: Configure Node
uses: actions/setup-node@v5
with:
node-version: "22"
- name: Prove source lineage and PipelineNews-only scope
shell: bash
run: |
set -euo pipefail
git cat-file -e "$GITHUB_SHA^{commit}" 2>/dev/null || git fetch --no-tags origin "$GITHUB_SHA"
test "$(git rev-parse HEAD)" = "$LIVE_NEWS_SOURCE"
test "$GITHUB_REF" = "refs/heads/main"
test "$(git rev-parse "$LIVE_NEWS_SOURCE^")" = "$LIVE_NEWS_PARENT"
test "$(git rev-parse "$GITHUB_SHA^")" = "$LIVE_NEWS_SOURCE"
test "$(git diff --name-only "$LIVE_NEWS_SOURCE" "$GITHUB_SHA")" = ".github/workflows/202608270844-live-news-discovery.yml"
git diff --quiet "$LIVE_NEWS_PARENT" "$LIVE_NEWS_SOURCE" -- \
atman/202608262014-build-pages.py \
.github/workflows/pages.yml \
.github/workflows/authorise-v8-fast-pages.yml \
archive/202608261547-pipelinenews/releases/current.json
mkdir -p "$LIVE_NEWS_WORK_ROOT/evidence"
git show -s --format='%H%n%P%n%T%n%ct' "$LIVE_NEWS_SOURCE" > "$LIVE_NEWS_WORK_ROOT/evidence/source-record.txt"
git show -s --format='%H%n%P%n%T%n%ct' "$GITHUB_SHA" > "$LIVE_NEWS_WORK_ROOT/evidence/workflow-recovery-record.txt"
git diff --name-only "$LIVE_NEWS_PARENT" "$LIVE_NEWS_SOURCE" > "$LIVE_NEWS_WORK_ROOT/evidence/source-paths.txt"
node --input-type=module <<'NODE'
import assert from "node:assert/strict";
import { readFile, writeFile } from "node:fs/promises";
const filename = process.env.LIVE_NEWS_WORK_ROOT + "/evidence/source-paths.txt";
const paths = (await readFile(filename, "utf8")).trim().split("\n").filter(Boolean);
assert.ok(paths.length >= 10, "timestamped source closure is incomplete");
assert.ok(paths.every((relative) => relative.includes("202608270844")), "every successor source file must carry the 202608270844 stamp");
for (const forbidden of [
"releases/current.json",
"releases/candidate.json",
".github/workflows/pages.yml",
".github/workflows/authorise-v8-fast-pages.yml",
]) assert.ok(!paths.includes(forbidden), `protected path changed: ${forbidden}`);
assert.ok(paths.every((relative) => !/(^|\/)(?:companies|globalgrid2050)(?:\/|$)/iu.test(relative)), "foreign repository material entered PipelineNews");
assert.ok(paths.every((relative) => !relative.includes("202608270055")), "rollback generation was modified");
await writeFile(
process.env.LIVE_NEWS_WORK_ROOT + "/evidence/scope-proof.json",
JSON.stringify({
schema: "pipelinenews.live-news-source-scope-proof.v1",
source_commit: process.env.LIVE_NEWS_SOURCE,
protected_parent: process.env.LIVE_NEWS_PARENT,
workflow_recovery_commit: process.env.GITHUB_SHA,
workflow_recovery_paths: [".github/workflows/202608270844-live-news-discovery.yml"],
changed_paths: paths,
pipeline_news_only: true,
rollback_untouched: true,
deployment_authorised: false,
}, null, 2) + "\n",
);
NODE
- name: Reject an existing immutable generation
shell: bash
run: |
set -euo pipefail
test ! -e "build/$LIVE_NEWS_GENERATION-v8-fast-site-manifest.json"
test ! -e "releases/$LIVE_NEWS_GENERATION-v8-fast-candidate.html"
test ! -e "releases/javascript/$LIVE_NEWS_GENERATION-v8-fast-runtime.js"
test ! -e "releases/data/$LIVE_NEWS_GENERATION-v8-fast-registry.json"
test ! -e "data/news-discovery/$LIVE_NEWS_GENERATION-east-pye-evidence.json"
- name: Syntax-check timestamped source
shell: bash
run: |
set -euo pipefail
node --check "index/$LIVE_NEWS_GENERATION-compile-v8-live-news.mjs"
node --check "build/javascript/$LIVE_NEWS_GENERATION-verify-v8-live-news-contract.mjs"
node --check "build/javascript/$LIVE_NEWS_GENERATION-verify-v8-live-news-browser.mjs"
node --check "ui/javascript/$LIVE_NEWS_GENERATION-v8-live-news-runtime.js"
for source in discovery/javascript/$LIVE_NEWS_GENERATION-*.mjs discovery/tests/$LIVE_NEWS_GENERATION-*.mjs; do
node --check "$source"
done
- name: Run both deterministic discovery regressions
shell: bash
run: |
set -euo pipefail
test "$(find discovery/tests -maxdepth 1 -type f -name "$LIVE_NEWS_GENERATION-*.mjs" | wc -l)" -eq 2
find discovery/tests -maxdepth 1 -type f -name "$LIVE_NEWS_GENERATION-*.mjs" -print0 | sort -z | xargs -0 -n1 node | tee "$LIVE_NEWS_WORK_ROOT/evidence/discovery-tests.txt"
- name: Run bounded live acquisition
if: github.event_name == 'push' || inputs.live_collect == true
shell: bash
env:
LIVE_NEWS_PROVIDER: ${{ github.event_name == 'workflow_dispatch' && inputs.provider || 'bing' }}
BRAVE_SEARCH_API_KEY: ${{ secrets.BRAVE_SEARCH_API_KEY }}
GOOGLE_CSE_API_KEY: ${{ secrets.GOOGLE_CSE_API_KEY }}
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
SERPER_API_KEY: ${{ secrets.SERPER_API_KEY }}
run: |
set -euo pipefail
node "discovery/javascript/$LIVE_NEWS_GENERATION-live-news-runner.mjs" --collect --provider "$LIVE_NEWS_PROVIDER" --health-out "$LIVE_NEWS_WORK_ROOT/evidence/live-collector-health.json" --ledger-out "$LIVE_NEWS_WORK_ROOT/evidence/live-candidate-ledger.json"
- name: Compile two independent immutable candidates
shell: bash
run: |
set -euo pipefail
SOURCE_COMMIT="$LIVE_NEWS_SOURCE" GITHUB_RUN_ID="$GITHUB_RUN_ID" node "index/$LIVE_NEWS_GENERATION-compile-v8-live-news.mjs" --out-root "$LIVE_NEWS_WORK_ROOT/pass-a" | tee "$LIVE_NEWS_WORK_ROOT/evidence/compiler-pass-a.json"
SOURCE_COMMIT="$LIVE_NEWS_SOURCE" GITHUB_RUN_ID="$GITHUB_RUN_ID" node "index/$LIVE_NEWS_GENERATION-compile-v8-live-news.mjs" --out-root "$LIVE_NEWS_WORK_ROOT/pass-b" | tee "$LIVE_NEWS_WORK_ROOT/evidence/compiler-pass-b.json"
- name: Byte-compare compiler passes and materialise closure
shell: bash
run: |
set -euo pipefail
node --input-type=module <<'NODE'
import assert from "node:assert/strict";
import { constants } from "node:fs";
import { copyFile, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
import path from "node:path";
const root = process.cwd();
const work = process.env.LIVE_NEWS_WORK_ROOT;
const generation = process.env.LIVE_NEWS_GENERATION;
const passA = path.join(root, work, "pass-a");
const passB = path.join(root, work, "pass-b");
const manifestRelative = `build/${generation}-v8-fast-site-manifest.json`;
const manifest = JSON.parse(await readFile(path.join(passA, manifestRelative)));
assert.equal(manifest.source_commit, process.env.LIVE_NEWS_SOURCE);
assert.equal(manifest.deployment, "not-authorised");
assert.equal(manifest.outputs.length, 4);
const expected = [manifestRelative, ...manifest.outputs.map((record) => record.path)].sort();
async function walk(directory, base = directory) {
const files = [];
for (const entry of await readdir(directory, { withFileTypes: true })) {
const filename = path.join(directory, entry.name);
if (entry.isDirectory()) files.push(...await walk(filename, base));
else files.push(path.relative(base, filename).split(path.sep).join("/"));
}
return files.sort();
}
assert.deepEqual(await walk(passA), expected, "pass A has undeclared output");
assert.deepEqual(await walk(passB), expected, "pass B has undeclared output");
for (const relative of expected) {
const left = await readFile(path.join(passA, relative));
const right = await readFile(path.join(passB, relative));
assert.ok(left.equals(right), `independent compiler bytes differ: ${relative}`);
const target = path.join(root, relative);
await mkdir(path.dirname(target), { recursive: true });
await copyFile(path.join(passA, relative), target, constants.COPYFILE_EXCL);
}
await writeFile(
path.join(root, work, "evidence", "determinism-proof.json"),
JSON.stringify({
schema: "pipelinenews.live-news-determinism-proof.v1",
generation,
source_commit: process.env.LIVE_NEWS_SOURCE,
byte_identical_passes: true,
files: expected,
}, null, 2) + "\n",
);
NODE
- name: Verify compiled identity, data, performance and quarantine contract
shell: bash
run: |
set -euo pipefail
node "build/javascript/$LIVE_NEWS_GENERATION-verify-v8-live-news-contract.mjs" --root . --generation "$LIVE_NEWS_GENERATION" --source-manifest "build/$LIVE_NEWS_GENERATION-v8-fast-site-manifest.json" | tee "$LIVE_NEWS_WORK_ROOT/evidence/contract-proof.json"
- name: Prove the successor is excluded from Pages
shell: bash
run: |
set -euo pipefail
python3 - <<'PY' | tee "$LIVE_NEWS_WORK_ROOT/evidence/pages-boundary-proof.json"
import importlib.util
import json
import os
import subprocess
import tempfile
from pathlib import Path
root = Path.cwd().resolve()
module_path = root / "atman/202608262014-build-pages.py"
spec = importlib.util.spec_from_file_location("pipelinenews_pages_gate", module_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
successor_generation = os.environ["LIVE_NEWS_GENERATION"]
manifest_relative = f"build/{successor_generation}-v8-fast-site-manifest.json"
successor = json.loads((root / manifest_relative).read_text())
module.require(successor["schema"] == module.FAST_CANDIDATE_SCHEMA, "0844 candidate schema changed")
module.require(successor["generation"] == successor_generation, "0844 candidate generation changed")
module.require(successor["deployment"] == "not-authorised", "0844 candidate deployment state changed")
module.require(successor["source_commit"] == os.environ["LIVE_NEWS_SOURCE"], "0844 candidate source binding changed")
module.require(str(successor["github_run_id"]) == os.environ["GITHUB_RUN_ID"], "0844 candidate run binding changed")
module.require(isinstance(successor["cache_identity"], str) and module.SHA256_RE.fullmatch(successor["cache_identity"]), "0844 cache identity changed")
outputs = successor.get("outputs")
module.require(isinstance(outputs, list) and len(outputs) == 4, "0844 candidate output closure changed")
for index, record in enumerate(outputs):
module.require(isinstance(record, dict), f"0844 candidate output {index} is not an object")
module.require(set(record) == {"path", "bytes", "sha256"}, f"0844 candidate output {index} fields changed")
module.require(type(record["bytes"]) is int and record["bytes"] >= 0, f"0844 candidate output {index} bytes changed")
module.require(isinstance(record["sha256"], str) and module.SHA256_RE.fullmatch(record["sha256"]), f"0844 candidate output {index} SHA-256 changed")
expected = {
f"releases/{successor_generation}-v8-fast-candidate.html",
f"releases/javascript/{successor_generation}-v8-fast-runtime.js",
f"releases/data/{successor_generation}-v8-fast-registry.json",
f"releases/data/{successor_generation}-{successor['cache_identity'][:12]}-v8-fast-news.json",
}
module.require({record["path"] for record in outputs} == expected, "0844 candidate path closure changed")
for record in outputs:
relative = module.normalise_candidate_output_path(record["path"], "0844 candidate output")
module.require(Path(relative).name.startswith(successor_generation), f"0844 output generation changed: {relative}")
module.require_no_symlink_components(root, relative, "0844 candidate output path")
module.verify_record(root, record, "0844 candidate output")
archived = root / module.ARCHIVE / relative
module.require(not archived.exists() and not archived.is_symlink(), f"0844 candidate overlaps historical public path: {relative}")
authorisation_path = root / "build/authorisations" / f"{successor_generation}-v8-fast-pages-authorisation.json"
module.require(not authorisation_path.exists() and not authorisation_path.is_symlink(), "0844 Pages authorisation already exists")
governed_generation, _, release_manifest = module.select_release(root, "latest")
governed_release_path = f"releases/{governed_generation}-index.html"
governed = {"releases/current.json", "releases/candidate.json", governed_release_path}
governed.update(record["path"] for record in release_manifest["outputs"])
governed.update(record["path"] for record in release_manifest["inputs"] if record["path"].startswith("releases/"))
module.require(expected.isdisjoint(governed), "0844 candidate overlaps the governed release")
committed = set(subprocess.run(
["git", "ls-tree", "-r", "--name-only", os.environ["GITHUB_SHA"]],
cwd=root, check=True, capture_output=True, text=True,
).stdout.splitlines())
module.require(({manifest_relative} | expected).isdisjoint(committed), "0844 generated closure already exists in the recovery commit")
index = subprocess.run(["git", "diff", "--cached", "--quiet"], cwd=root, check=False)
module.require(index.returncode == 0, "index changed before verified closure staging")
workflow_source = subprocess.run(
["git", "show", f"{os.environ['GITHUB_SHA']}:.github/workflows/{successor_generation}-live-news-discovery.yml"],
cwd=root, check=True, capture_output=True, text=True,
).stdout
for forbidden in (
"actions/" + "upload-pages-artifact@",
"actions/" + "deploy-pages@",
"pages" + ": write",
"id-token" + ": write",
"/actions/workflows/" + "pages.yml/dispatches",
):
module.require(forbidden not in workflow_source, f"deployment capability entered 0844 workflow: {forbidden}")
with tempfile.TemporaryDirectory(prefix="0844-quarantine-") as temporary:
probe = Path(temporary)
staged_releases = probe / "releases"
module.copy_tree(root / module.ARCHIVE / "releases", staged_releases)
module.copy_release_tree(root / "releases", staged_releases, expected)
for relative in expected:
target = probe / relative
module.require(not target.exists() and not target.is_symlink(), f"0844 candidate entered quarantine probe: {relative}")
module.require(
(staged_releases / "current.json").read_bytes() == (root / module.ARCHIVE / "releases/current.json").read_bytes(),
"stable pointer changed during quarantine probe",
)
module.require(
(probe / governed_release_path).read_bytes() == (root / governed_release_path).read_bytes(),
"governed release changed during quarantine probe",
)
print(json.dumps({
"schema": "pipelinenews.v8.live-news-pages-boundary-proof.v1",
"generation": successor["generation"],
"deployment": successor["deployment"],
"successor_excluded_outputs": sorted(expected),
"successor_authorised_outputs": [],
"successor_authorisation_path_absent": True,
"quarantine_basis": "NO_GENERATION_AUTHORISATION_RECORD",
"governed_release_generation": governed_generation,
"governed_release_disjoint": True,
"candidate_quarantine_probe_passed": True,
"real_pages_gate_unchanged": True,
"full_pages_gate_invoked": False,
"pages_artifact_created": False,
"stable_route_changed": False,
"globalgrid_catalogue_changed": False,
}, indent=2))
PY
- name: Install pinned browser verifier
shell: bash
run: |
set -euo pipefail
npm install --no-save --no-package-lock playwright@1.55.0
npx playwright install --with-deps chromium
- name: Browser-proof desktop and mobile candidate
shell: bash
env:
FAST_SITE_URL: http://127.0.0.1:4173/releases/202608270844-v8-fast-candidate.html
run: |
set -euo pipefail
python3 -m http.server 4173 --bind 127.0.0.1 --directory . > "$RUNNER_TEMP/202608270844-live-news-http.log" 2>&1 &
server_pid="$!"
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
for attempt in {1..20}; do
if curl --fail --silent --show-error "$FAST_SITE_URL" >/dev/null; then break; fi
sleep 1
done
curl --fail --silent --show-error "$FAST_SITE_URL" >/dev/null
node "build/javascript/$LIVE_NEWS_GENERATION-verify-v8-live-news-browser.mjs" | tee "$LIVE_NEWS_WORK_ROOT/evidence/browser-proof.json"
- name: Stage only the verified immutable closure
shell: bash
run: |
set -euo pipefail
node --input-type=module <<'NODE'
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";
import { spawnSync } from "node:child_process";
import path from "node:path";
const generation = process.env.LIVE_NEWS_GENERATION;
const manifestPath = `build/${generation}-v8-fast-site-manifest.json`;
const manifest = JSON.parse(await readFile(manifestPath));
assert.equal(manifest.source_commit, process.env.LIVE_NEWS_SOURCE);
assert.equal(manifest.deployment, "not-authorised");
const declared = manifest.outputs.map((record) => record.path);
const expected = [manifestPath, ...declared].sort();
assert.equal(expected.length, 5);
assert.equal(new Set(expected).size, expected.length);
for (const record of manifest.outputs) {
const bytes = await readFile(record.path);
assert.equal(bytes.length, record.bytes);
assert.equal(createHash("sha256").update(bytes).digest("hex"), record.sha256);
}
const add = spawnSync("git", ["add", "--", ...expected], { encoding: "utf8" });
assert.equal(add.status, 0, add.stderr || add.stdout);
const diff = spawnSync("git", ["diff", "--cached", "--name-only", "-z"], { encoding: "buffer" });
assert.equal(diff.status, 0, diff.stderr.toString());
const staged = diff.stdout.toString("utf8").split("\0").filter(Boolean).sort();
assert.deepEqual(staged, expected, "staged paths differ from the declared closure");
const status = spawnSync("git", ["diff", "--cached", "--name-status"], { encoding: "utf8" });
assert.equal(status.status, 0, status.stderr);
assert.ok(status.stdout.trim().split("\n").every((line) => line.startsWith("A\t")), "immutable output would overwrite a path");
await writeFile(
path.join(process.env.LIVE_NEWS_WORK_ROOT, "evidence", "staged-closure.json"),
JSON.stringify({ generation, source_commit: process.env.LIVE_NEWS_SOURCE, files: expected }, null, 2) + "\n",
);
NODE
- name: Upload build and verification evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: pipelinenews-live-news-discovery-202608270844-${{ github.run_id }}
path: ${{ env.LIVE_NEWS_WORK_ROOT }}/evidence
if-no-files-found: error
retention-days: 30
- name: Commit only the green quarantined successor
shell: bash
run: |
set -euo pipefail
git fetch --no-tags origin refs/heads/main
test "$(git rev-parse HEAD)" = "$LIVE_NEWS_SOURCE"
test "$(git rev-parse FETCH_HEAD)" = "$GITHUB_SHA"
git switch --detach "$GITHUB_SHA"
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
test "$(git diff --cached --name-only | wc -l)" -eq 5
test -z "$(git diff --cached --name-only | grep -v "^\(build/$LIVE_NEWS_GENERATION-v8-fast-site-manifest.json\|releases/$LIVE_NEWS_GENERATION-v8-fast-candidate.html\|releases/javascript/$LIVE_NEWS_GENERATION-v8-fast-runtime.js\|releases/data/$LIVE_NEWS_GENERATION-.*-v8-fast-news.json\|releases/data/$LIVE_NEWS_GENERATION-v8-fast-registry.json\)$" || true)"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "v8: build Live News Discovery candidate $LIVE_NEWS_GENERATION"
git push origin HEAD:main