GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / pipelinenews / archive/202608261547-pipelinenews/tests

Build Release and 7 more files

A JavaScript module in the tooling folder of PipelineNews that reads regional news, major project news and cumulative intelligence, using SHA-256.

676 lines of JavaScript and Shell from pipelinenews, in 8 files. Topic: Electricity markets and data pipelines. Section 994 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. Check Frozen Release Trees test · pipelinenews / archive/202608261547-pipelinenews/tests/check-frozen-release-trees.sh lines 1–36
  2. Check Official Source V3 test · pipelinenews / archive/202608261547-pipelinenews/tests/check-official-source-v3.mjs lines 1–179
  3. Check Official Source V4 test · pipelinenews / archive/202608261547-pipelinenews/tests/check-official-source-v4.mjs lines 1–49
  4. Run Current Timestamp Release test · pipelinenews / archive/202608261547-pipelinenews/tests/run-current-timestamp-release.sh lines 1–22
  5. Build Release automation · pipelinenews / archive/202608261547-pipelinenews/tooling/build-202608251929-release.mjs lines 1–266
  6. Build Current Discovery Release automation · pipelinenews / archive/202608261547-pipelinenews/tooling/build-current-discovery-release.mjs lines 1–80
  7. Build Evidence Release automation · pipelinenews / archive/202608261547-pipelinenews/tooling/build-evidence-release.mjs lines 1–20
  8. Build Official Frontier Release automation · pipelinenews / archive/202608261547-pipelinenews/tooling/build-official-frontier-release.mjs lines 1–24

Check Frozen Release Trees

A shell script in the tests folder of PipelineNews that checks git object (`check_git_object`) and sha256 (`check_sha256`).

testpipelinenews / archive/202608261547-pipelinenews/tests/check-frozen-release-trees.sh · lines 1–36 of 36 · version 2026-08-26 15:47 · Entry point

What it does
It tests its inputs. Defines check_git_object, check_sha256. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
It is itself an entry point (shell script); no other file was found loading it.
What it achieves
Its name says it checks frozen release trees. Defines `check_git_object` and `check_sha256`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
pipelinenews · archive/202608261547-pipelinenews/tests · shell script
Uses
none found
Used by
none found
Produces
check_git_object, check_sha256
Defines here
check_git_object, check_sha256
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tests/check-frozen-release-trees.sh:1-36 · blob 1ec3be759388c321bc4ed6c4e89167986f172628 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: experimental · users: none · canonical: production_core
#!/usr/bin/env bash
set -euo pipefail

check_git_object() {
  local path="$1"
  local expected="$2"
  local actual
  actual="$(git rev-parse "HEAD:${path}")"
  test "$actual" = "$expected" || {
    printf 'FROZEN_OBJECT_MISMATCH %s\n' "$path" >&2
    exit 1
  }
}

check_sha256() {
  local path="$1"
  local expected="$2"
  local actual
  actual="$(sha256sum "$path" | cut -d' ' -f1)"
  test "$actual" = "$expected" || {
    printf 'FROZEN_SHA256_MISMATCH %s\n' "$path" >&2
    exit 1
  }
}

check_git_object newsv1 2d6247c067aa5fad49995dcb9029d6cdb9898994
check_git_object newsv7 5a59a926d0688d05c08c5ecc008c174133728007
check_git_object 202608251701-pipelinenews 84b748df685b9306ce232e415531ee4eca05b4d6
check_git_object 202608251750-pipelinenews 8a86c549b14a104b247aaadfc522644155b22ddb
check_git_object releases/202608251701-pipelinenews.json 0823bf04096d74d4627b9d1e8d6f1d513f1c6eb4
check_git_object releases/202608251750-pipelinenews.json 5d9d31c801b1a9de328a5fe975daac4c8e2a67c2

check_sha256 newsv7/dist/major_project_news_v9_5_1.json cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd
check_sha256 newsv7/data/newsv7/cumulative_intelligence.json 65767316a618b6ed8048e34b805168ea431f27ea666d89b02971586bfef9f05b

printf 'FROZEN RELEASE OBJECTS: PASS\n'

Check Official Source V3

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

testpipelinenews / archive/202608261547-pipelinenews/tests/check-official-source-v3.mjs · lines 1–179 of 179 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review) · pattern compact (shared by 10 files)

What it does
It tests official collisions and the REPD register. Defines json, compact, groupFor, independentlySafe, authority. Uses libraries node:assert/strict, node:fs/promises. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: the REPD register.
Inputs & outputs
In: JSON file current.json; JSON file official-source-v3-collisions.json.
What it achieves
It is built from the group for helper (`groupFor`), the independently safe helper (`independentlySafe`) and the authority step (`authority`). Its name says it checks official source. Defines `json`, `compact`, `groupFor` and 2 more.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tests · JavaScript module
Uses
node:assert/strict, node:fs/promises
Used by
none found
Produces
json, compact, groupFor, independentlySafe, authority
Defines here
json, compact, groupFor, independentlySafe, authority
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tests/check-official-source-v3.mjs:1-179 · blob b3be47c8f7a16407894a75439a7f471b22443d1a · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";

const root = new URL("../", import.meta.url);
const json = async (path) => JSON.parse(await readFile(new URL(path, root), "utf8"));
const compact = (value) => String(value ?? "").normalize("NFKC").toUpperCase().replace(/[^A-Z0-9]/gu, "");

const pointer = await json("releases/current.json");
const manifest = await json(pointer.manifest);
const fixture = await json("tests/fixtures/official-source-v3-collisions.json");
const engineDescriptor = manifest.objects.modules.find((item) =>
  ["authority_safe_frontier_engine", "official_frontier_engine"].includes(item.role)
  && item.path.includes("/sha256/"));
assert.ok(engineDescriptor, "current release must expose the content-addressed v3 frontier engine");

const {
  POLICY_ID,
  buildReferenceGroups,
  normalisePlanningReference,
  resolvePlanningBinding,
} = await import(new URL(engineDescriptor.path, root));
assert.equal(POLICY_ID, "PN-OFFICIAL-FRONTIER-V3-AUTHORITY-SAFE");
assert.equal(fixture.schema, "pipelinenews.official-source-v3-collision-fixture.v1");

const expectedCaseIds = [
  "little-kilmain-authority-positive",
  "north-ray-authority-positive",
  "east-pye-name-positive",
  "cricket-st-thomas-bradford-negative",
  "minch-moor-bolsover-negative",
  "falahill-bedford-negative",
  "dogger-bank-duplicate-negative",
  "capacity-only-negative",
  "authority-substring-negative",
];
assert.deepEqual(fixture.cases.map((item) => item.case_id), expectedCaseIds);

function groupFor(projects) {
  const groups = buildReferenceGroups(projects);
  assert.equal(groups.length, 1, "each collision fixture must describe one planning-reference group");
  return groups[0];
}

for (const item of fixture.cases) {
  const group = groupFor(item.projects);
  const decision = resolvePlanningBinding(item.record, group);
  assert.equal(decision.role, item.expected.role, item.case_id);
  if (item.expected.repd_ref) assert.equal(decision.repd_ref, item.expected.repd_ref, item.case_id);
  if (item.expected.method) assert.equal(decision.method, item.expected.method, item.case_id);
  if (item.expected.reason) assert.equal(decision.reason, item.expected.reason, item.case_id);
  if (item.expected.candidate_repd_refs) {
    assert.deepEqual(decision.candidate_repd_refs, item.expected.candidate_repd_refs, item.case_id);
  }

  const changedCapacityProjects = item.projects.map((project, index) => ({
    ...project,
    capacity_mw: index % 2 === 0 ? 0.001 : 999999,
  }));
  const changedCapacityDecision = resolvePlanningBinding(item.record, groupFor(changedCapacityProjects));
  assert.deepEqual(changedCapacityDecision, decision, `${item.case_id}: capacity changed identity decision`);
}

const capacityOnly = fixture.cases.find((item) => item.case_id === "capacity-only-negative");
assert.equal(resolvePlanningBinding(capacityOnly.record, groupFor(capacityOnly.projects)).role, "ABSTAIN");
const eastPye = fixture.cases.find((item) => item.case_id === "east-pye-name-positive");
assert.equal(resolvePlanningBinding(eastPye.record, groupFor(eastPye.projects)).gg_project_id, "GG2050-REPD-17494");
const dogger = fixture.cases.find((item) => item.case_id === "dogger-bank-duplicate-negative");
assert.equal(resolvePlanningBinding(dogger.record, groupFor(dogger.projects)).role, "ABSTAIN");

const projectDescriptors = manifest.objects.inputs
  .filter((item) => item.role.startsWith("canonical_projects_part_"))
  .sort((left, right) => left.role.localeCompare(right.role));
assert.equal(projectDescriptors.length, 16);
const projects = [];
for (const descriptor of projectDescriptors) {
  const payload = await json(descriptor.path);
  projects.push(...(Array.isArray(payload) ? payload : payload.projects || payload.items || []));
}
assert.equal(projects.length, 7680);

const rawDescriptor = manifest.objects.inputs.find((item) => item.role === "pinned_raw_official_snapshot");
const auditedDescriptor = manifest.objects.artifacts.find((item) => item.role === "authority_safe_audited_snapshot");
const contractDescriptor = manifest.objects.artifacts.find((item) => item.role === "authority_safe_frontier_contract");
assert.ok(rawDescriptor && auditedDescriptor && contractDescriptor);
const [raw, audited, contract] = await Promise.all([
  json(rawDescriptor.path),
  json(auditedDescriptor.path),
  json(contractDescriptor.path),
]);

const groups = buildReferenceGroups(projects);
const groupByReference = new Map(groups.map((group) => [group.normalised_reference, group]));
let retained = 0;
let rawPrimary = 0;
let primary = 0;
let abstain = 0;
let unsafePrimary = 0;

function independentlySafe(record, project) {
  const authorityAliases = new Map([
    ["ARGYLL", "ARGYLLANDBUTE"],
    ["BABERGHMIDSUFFOLK", "MIDSUFFOLK"],
    ["DUMFRIES", "DUMFRIESANDGALLOWAY"],
    ["SOUTHWESTDEVON", "WESTDEVON"],
  ]);
  const authority = (value) => {
    const normalised = compact(value);
    return authorityAliases.get(normalised) || normalised;
  };
  const exactName = compact(project.name).length >= 8
    && compact(`${record.name ?? ""} ${record.description ?? ""} ${record.applicant ?? ""}`).includes(compact(project.name));
  const observedAuthority = authority(record.area_name);
  const expectedAuthority = authority(project.planning_authority);
  const exactAuthority = observedAuthority.length >= 4
    && expectedAuthority.length >= 4
    && observedAuthority === expectedAuthority;
  return exactName || exactAuthority;
}

for (const [reference, entry] of Object.entries(raw.planit_by_reference || {})) {
  const group = groupByReference.get(reference);
  assert.ok(group, `raw snapshot reference missing from REPD: ${reference}`);
  const auditedEntry = audited.planit_by_reference[reference];
  assert.ok(auditedEntry, `audited snapshot omitted reference: ${reference}`);
  assert.equal(auditedEntry.records.length, entry.records.length, `record loss at ${reference}`);

  for (let index = 0; index < entry.records.length; index += 1) {
    const record = entry.records[index];
    retained += 1;
    if (record.binding?.role === "PRIMARY_MATCH") rawPrimary += 1;
    const decision = resolvePlanningBinding(record, group);
    assert.deepEqual(auditedEntry.records[index].binding, decision, `audited decision drift at ${reference}/${index}`);
    const recordRefs = [record.uid, record.reference, record.altid]
      .map(normalisePlanningReference)
      .filter(Boolean);
    if (decision.role === "PRIMARY_MATCH") {
      primary += 1;
      assert.equal(recordRefs.includes(reference), true, `non-exact primary reference at ${reference}/${index}`);
      const project = group.projects.find((candidate) => String(candidate.repd_ref) === decision.repd_ref);
      assert.ok(project, `primary project absent from reference group at ${reference}/${index}`);
      if (!independentlySafe(record, project)) unsafePrimary += 1;
    } else {
      abstain += 1;
      assert.equal(decision.role, "ABSTAIN", `unexpected non-primary action at ${reference}/${index}`);
    }
  }
}

assert.equal(retained, 128);
assert.equal(rawPrimary, 128);
assert.equal(primary, 23);
assert.equal(abstain, 105);
assert.equal(unsafePrimary, 0, "local-reference primary match escaped authority/name corroboration");
assert.deepEqual(audited.counts, {
  reference_groups: 48,
  records: 128,
  previous_primary_match: 128,
  authority_safe_primary_match: 23,
  exact_name_confirmed: 0,
  planning_authority_confirmed: 23,
  abstain: 105,
  abstain_by_reason: {
    PLANNING_AUTHORITY_OR_PROJECT_NAME_NOT_CONFIRMED: 103,
    PLANNING_REFERENCE_NOT_EXACT: 2,
  },
  changed_primary_to_abstain: 105,
});
assert.equal(contract.binding_gate.capacity_used_for_identity, false);
assert.equal(contract.binding_gate.ambiguous_action, "ABSTAIN");
assert.equal(manifest.acceptance.capacity_used_for_identity, false);
assert.equal(audited.policy.capacity_used_for_identity, false);

const pollerSource = await readFile(new URL("tooling/poll-official-sources-v3.mjs", root), "utf8");
assert.match(pollerSource, /altid: record\.altid \?\? null/u, "poller must preserve the alternate reference used by the matcher");
assert.match(pollerSource, /planit_last_good_at/u, "PlanIt health needs its own last-known-good clock");
assert.match(pollerSource, /govuk_last_good_at/u, "GOV.UK health needs its own last-known-good clock");
assert.doesNotMatch(pollerSource, /priorGoodAt: state\.last_good_at/u, "one adapter must not refresh the other's health");

console.log("PASS official-source v3: 128 retained; 23 authority-safe PRIMARY_MATCH; 105 ABSTAIN; zero unsafe primary; capacity independent");

Check Official Source V4

A JavaScript module in the tests folder of PipelineNews that uses SHA-256.

testpipelinenews / archive/202608261547-pipelinenews/tests/check-official-source-v4.mjs · lines 1–49 of 49 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review)

What it does
It tests its inputs. Defines json. Uses libraries node:assert/strict, node:fs/promises. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file current.json.
What it achieves
Its name says it checks official source. Defines `json`.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tests · JavaScript module
Uses
Official Frontier Engine V4 (import), node:assert/strict, node:fs/promises
Used by
none found
Produces
json
Defines here
json
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tests/check-official-source-v4.mjs:1-49 · blob b76f71ce79e02acf3fd9589a4deeb531ce4e15cd · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import {
  loadOfficialFrontierEngine,
  PINNED_AUTHORITY_SAFE_ENGINE,
  resolveOfficialFrontierEngine,
} from "../tooling/official-frontier-engine-v4.mjs";

const root = new URL("../", import.meta.url);
const json = async (path) => JSON.parse(await readFile(new URL(path, root), "utf8"));
const pointer = await json("releases/current.json");
const manifest = await json(pointer.manifest);

assert.equal(pointer.release_id, "202608251929-pipelinenews");
assert.equal(pointer.channel, "current");
assert.equal(Array.isArray(manifest.objects?.modules), false);
assert.deepEqual(resolveOfficialFrontierEngine(manifest), PINNED_AUTHORITY_SAFE_ENGINE);

const loaded = await loadOfficialFrontierEngine(manifest, root);
assert.deepEqual(loaded.descriptor, PINNED_AUTHORITY_SAFE_ENGINE);
assert.equal(loaded.module.POLICY_ID, "PN-OFFICIAL-FRONTIER-V3-AUTHORITY-SAFE");
for (const key of [
  "buildReferenceGroups",
  "normalisePlanningReference",
  "resolvePlanningBinding",
  "selectFrontier",
  "sourceHealth",
]) {
  assert.equal(typeof loaded.module[key], "function", key);
}

const legacyDescriptor = {
  ...PINNED_AUTHORITY_SAFE_ENGINE,
  role: "official_frontier_engine",
};
const legacyManifest = { objects: { modules: [legacyDescriptor] } };
assert.deepEqual(resolveOfficialFrontierEngine(legacyManifest), legacyDescriptor);

await assert.rejects(
  loadOfficialFrontierEngine({
    objects: {
      modules: [{ ...legacyDescriptor, sha256: "0".repeat(64) }],
    },
  }, root),
  /official_frontier_engine content hash mismatch/u,
);

console.log("PASS official-source v4: current and legacy manifest engine contracts resolve through verified bytes");

Run Current Timestamp Release

A shell script in the tests folder of PipelineNews.

testpipelinenews / archive/202608261547-pipelinenews/tests/run-current-timestamp-release.sh · lines 1–22 of 22 · version 2026-08-26 15:47 · Entry point

What it does
It tests its inputs. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
It is itself an entry point (shell script); no other file was found loading it.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
pipelinenews · archive/202608261547-pipelinenews/tests · shell script
Uses
none found
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tests/run-current-timestamp-release.sh:1-22 · blob aaf8112539b5fa3a3a9f514796bad109666149d1 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: experimental · users: none · canonical: production_core
#!/usr/bin/env bash
set -euo pipefail

REPOSITORY_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPOSITORY_ROOT"

node --check tooling/finalise-202608260159-release.mjs
node --check tooling/sanitise-202608260159-news.mjs
node --check tests/check-202608260159-pipelinenews.mjs
node --check tests/browser-202608260159-pipelinenews.mjs
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
  bash tests/check-frozen-release-trees.sh
fi
node tooling/finalise-202608260159-release.mjs
FIRST_SHA="$(sha256sum releases/202608260159-pipelinenews.json releases/candidate.json reports/202608260159-pipelinenews-proof.json reports/202608260159-pipelinenews-substitutions.json 202608260159-pipelinenews/index.html 202608260159-pipelinenews/readme.md 202608260159-pipelinenews/release.json)"
node tooling/finalise-202608260159-release.mjs
SECOND_SHA="$(sha256sum releases/202608260159-pipelinenews.json releases/candidate.json reports/202608260159-pipelinenews-proof.json reports/202608260159-pipelinenews-substitutions.json 202608260159-pipelinenews/index.html 202608260159-pipelinenews/readme.md 202608260159-pipelinenews/release.json)"
test "$FIRST_SHA" = "$SECOND_SHA"
node tests/check-current-timestamp-release.mjs
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
  test -z "$(git status --porcelain=v1 --untracked-files=all)"
fi

Build Release

A JavaScript module in the tooling folder of PipelineNews that reads regional news, major project news and cumulative intelligence, using SHA-256.

automationpipelinenews / archive/202608261547-pipelinenews/tooling/build-202608251929-release.mjs · lines 1–266 of 266 · version 2026-08-25 19:29 · Not reached from any entry point (candidate for review) · pattern gitBlobSha (shared by 3 files)

What it does
It loads regional news, major project news and cumulative intelligence. Defines 12 functions or classes, including sha256, gitBlobSha1, canonicalJson, abs, ensureWrite. Uses libraries node:crypto, node:fs/promises, node:path, node:url. Side effects: changes the web page (DOM); reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file candidate.json; JSON file 84f4c36bfd72ee0fd50d9002d54c79088444a8a8e777bff54112fa89b56bfe99.json; JSON file 1fb5ae0e8a7453315d568e7053c70237b6e054f82eac219cb3ac70c4eba5422c.json; JSON file build_manifest.json; JSON file regional_manifest.json; JSON file regional_news.json; JSON file major_project_news_v9_5_1.json; JSON file cumulative_intelligence.json.
What it achieves
It is built from the git blob sha1 helper (`gitBlobSha1`), the canonical JSON helper (`canonicalJson`) and the abs step (`abs`). Its name says it builds release. Defines `sha256`, `gitBlobSha1`, `canonicalJson` and 9 more. Its code works with 1 MW. It reads `newsv7/dist/major_project_news_v9_5_1.json`.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tooling · JavaScript module
Uses
GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL), node:crypto, node:fs/promises, node:path, node:url
Used by
none found
Produces
sha256, gitBlobSha1, canonicalJson, abs, ensureWrite, fileEntry, exists, projects, technology, sourceOrigin, evidenceRecord, sum
Defines here
sha256, gitBlobSha1, canonicalJson, abs, ensureWrite, fileEntry, exists, projects, technology, sourceOrigin, evidenceRecord, sum
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tooling/build-202608251929-release.mjs:1-266 · blob 0b64c79ccb4abe95d26a172ee2d708bde606f2b0 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem, process · domain stage: experimental · users: none · canonical: unreached_review
import { createHash } from "node:crypto";
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

const root = join(dirname(fileURLToPath(import.meta.url)), "..");
const releaseId = "202608251929-pipelinenews";
const inception = "2026-08-25T19:29:58+01:00";
const created = "2026-08-25T19:45:57+01:00";
const candidatePointerPath = "releases/candidate.json";
const officialSourcePinPath = "objects/source/sha256/84f4c36bfd72ee0fd50d9002d54c79088444a8a8e777bff54112fa89b56bfe99.json";
const cursorSourcePinPath = "objects/source/sha256/1fb5ae0e8a7453315d568e7053c70237b6e054f82eac219cb3ac70c4eba5422c.json";
const previewAttestationPath = `attestations/${releaseId}-preview.json`;
const pipelineAttestationPath = `attestations/${releaseId}-pipeline.json`;
const closurePath = `attestations/${releaseId}-closure.json`;
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
const gitBlobSha1 = (bytes) => createHash("sha1").update(`blob ${bytes.length}\0`).update(bytes).digest("hex");
const canonicalJson = (value) => `${JSON.stringify(value, null, 2)}\n`;
const abs = (path) => join(root, path);
const ensureWrite = async (path, bytes) => { await mkdir(dirname(path), { recursive: true }); await writeFile(path, bytes); };
const fileEntry = async (path) => { const bytes = await readFile(abs(path)); return { path, bytes: bytes.length, sha256: sha256(bytes) }; };
const exists = async (path) => { try { await access(abs(path)); return true; } catch { return false; } };

if (await exists(closurePath)) {
  const closure = JSON.parse(await readFile(abs(closurePath), "utf8"));
  if (closure.schema !== "pipelinenews.release-closure-attestation.v2" || closure.release_id !== releaseId) throw new Error("BUILD_CLOSURE_ATTESTATION_INVALID");
  process.stdout.write(`BUILD ${releaseId}: CLOSED · immutable release generation skipped\n`);
  process.exit(0);
}

const partPaths = Array.from({ length: 16 }, (_, index) => `newsv7/data/v9.1/projects/part-${String(index + 1).padStart(3, "0")}.json`);
const reusedPaths = [
  "newsv7/data/v9.1/build_manifest.json",
  ...partPaths,
  "newsv7/data/v9.7/regional_manifest.json",
  "newsv7/data/v9.7/regional_news.json",
  "newsv7/dist/major_project_news_v9_5_1.json",
  "newsv7/data/newsv7/cumulative_intelligence.json",
];
const proofPaths = [
  "tooling/build-202608251929-release.mjs",
  "tooling/templates/202608251929-app.js",
  "tooling/templates/202608251929-app.css",
  "tests/check-202608251929-pipelinenews.mjs",
  "tests/browser-live-202608251929.mjs",
  "tests/check-current-timestamp-release.mjs",
  "tests/check-frozen-release-trees.sh",
  "tests/run-current-timestamp-release.sh",
  ".github/workflows/pages.yml",
  ".github/workflows/timestamp-release.yml",
];
const publicationSupportPaths = ["README.md", "CHANGELOG.md", candidatePointerPath];

const projects = (await Promise.all(partPaths.map(async (path) => JSON.parse(await readFile(abs(path), "utf8"))))).flatMap((part) => part.projects);
const news = JSON.parse(await readFile(abs("newsv7/dist/major_project_news_v9_5_1.json"), "utf8"));
const regional = JSON.parse(await readFile(abs("newsv7/data/v9.7/regional_news.json"), "utf8"));
const cursorSourceBytes = await readFile(abs(await exists(cursorSourcePinPath) ? cursorSourcePinPath : "state/official-source-cursor.json"));
const officialSourceBytes = await readFile(abs(await exists(officialSourcePinPath) ? officialSourcePinPath : "data/official-source/latest.json"));
const cursor = JSON.parse(cursorSourceBytes.toString("utf8"));
const official = JSON.parse(officialSourceBytes.toString("utf8"));
const cumulative = JSON.parse(await readFile(abs("newsv7/data/newsv7/cumulative_intelligence.json"), "utf8"));
const changelog = await readFile(abs("CHANGELOG.md"));

if (projects.length !== 7680) throw new Error("BUILD_DATA_PROJECT_COUNT");
const totalCapacity = Math.round(projects.reduce((sum, row) => sum + row.capacity_mw, 0) * 100) / 100;
if (totalCapacity !== 356474.09) throw new Error("BUILD_DATA_CAPACITY");
if (news.all_items.length !== 133 || news.canonical_items.length !== 45) throw new Error("BUILD_NEWS_COUNTS");
if (!projects.some((row) => row.repd_ref === "13599") || !projects.some((row) => row.repd_ref === "17494")) throw new Error("BUILD_SENTINEL_IDENTITY");
const technology = (key) => {
  const rows = projects.filter((row) => row.technology === key);
  return { projects: rows.length, capacity_mw: Math.round(rows.reduce((sum, row) => sum + row.capacity_mw, 0) * 100) / 100 };
};
const planitRecords = Object.values(official.planit_by_reference).flatMap((group) => group.records || []);
const primary = planitRecords.filter((row) => row.binding?.role === "PRIMARY_MATCH").length;
const sentinelEvidence = cumulative.event_intelligence.find((row) => row.repd_ref === "13599")?.operator_labels?.[0]?.source_label;
if (!sentinelEvidence) throw new Error("BUILD_SENTINEL_ORGANISATION_EVIDENCE");
const sourceOrigin = (value) => {
  try {
    const url = new URL(String(value || ""));
    return ["http:", "https:"].includes(url.protocol) ? `${url.origin}/` : null;
  } catch {
    return null;
  }
};
const projectByRef = new Map(projects.map((row) => [String(row.repd_ref), row]));
const withheldSiteRefs = new Set(["10199", "5212"]);
const evidenceRecord = (item, index, domain) => {
  const rawUrl = String(item.url || item.source_url || "");
  const rank = index + 1;
  const regional = domain === "REGIONAL";
  const eligible = item.canonical_relevant === true && item.role === "PRIMARY_MATCH" && item.eligible_for_news_signal === true;
  const repdRef = item.repd_ref || item.primary_repd_ref || null;
  const project = eligible && repdRef ? projectByRef.get(String(repdRef)) : null;
  return {
    rank,
    evidence_id: item.gg_article_id || item.article_id || `GG2050-EVIDENCE-${domain}-${String(rank).padStart(3, "0")}`,
    source_origin: sourceOrigin(rawUrl),
    source_url_sha256: sha256(Buffer.from(rawUrl)),
    published: item.published || null,
    technology: item.canonical_technology || item.technology || "ENERGY",
    event: item.event || (regional ? "REGIONAL DISCOVERY" : "PROJECT UPDATE"),
    project_id: item.gg_project_id || item.gg_development_id || null,
    repd_ref: repdRef,
    site_label: project ? (withheldSiteRefs.has(String(project.repd_ref)) ? `SITE LABEL WITHHELD · ${project.gg_project_id}` : project.name) : null,
    official_status: project?.status || null,
    official_capacity_mw: project?.capacity_mw ?? null,
    geography: project ? ([project.county, project.region].filter(Boolean).join(" · ") || null) : (item.country || item.county || item.region || null),
    region: regional ? (item.region || "INTERNATIONAL_OTHER") : (item.canonical_relevant === true ? "UK" : "DISCOVERY"),
    eligible,
    confidence: Number(item.confidence || 0),
    restricted: regional ? item.article_id === "GG2050-REGION-52E7905F2C40D828" : [40, 71, 106].includes(rank),
  };
};
const safeEvidence = {
  schema: "pipelinenews.safe-evidence-ledger.v2",
  release_id: releaseId,
  base: news.all_items.map((item, index) => evidenceRecord(item, index, "BASE")),
  regional: regional.articles.map((item, index) => evidenceRecord(item, index, "REGIONAL")),
  raw_fields_republished: false,
  provenance: "Each record exposes a stable evidence identifier, source origin and SHA-256 of the exact frozen source URL. Raw URL paths remain only in the unchanged hash-pinned source ledger.",
};
const summary = {
  schema: "pipelinenews.safe-intelligence-summary.v2",
  release_id: releaseId,
  source_state: "PINNED_PREPUBLICATION",
  spine: { projects: projects.length, capacity_mw: totalCapacity, solar: technology("solar"), bess: technology("bess") },
  news: { base_ledger: news.all_items.length, governed_uk: news.canonical_items.length, regional_ledger: regional.articles.length },
  frontier: { cursor: cursor.next_index, total_groups: cursor.total_groups, records: planitRecords.length, primary_match: primary, abstain: planitRecords.length - primary, status: official.source_health.planit.status },
  connection: {
    when: "UNKNOWN",
    how: "UNKNOWN",
    next_gate: "Accepted connection offer, network register, energisation notice or exact official network document.",
  },
  sentinels: [
    { repd_ref: "13599", project_id: "GG2050-REPD-13599", result: "PASS", organisation_evidence: sentinelEvidence, evidence_class: "GOVERNED_NEWS_ASSOCIATION_NOT_OFFICIAL_REPD_OPERATOR" },
    { repd_ref: "17494", project_id: "GG2050-REPD-17494", result: "PASS", discovery_state: "FIXTURE_ONLY_NOT_CURRENT", connection_decision: "ABSTAIN", organisation_evidence: null },
  ],
  privacy: {
    raw_operator_labels_published: false,
    raw_headlines_or_summaries_published: false,
    operator_output_policy: "UNIVERSALLY_WITHHELD",
    restricted_operator_project_ids: ["17376", "17983", "1984", "1763", "1121", "1597", "4078", "1987", "2240", "1352", "2051"],
    restricted_site_project_ids: ["10199", "5212"],
    restricted_feed_ranks: [40, 71, 106],
    restricted_regional_ranks: [12],
    restricted_regional_items: ["GG2050-REGION-52E7905F2C40D828"],
  },
  publication_law: { official_news_separate: true, identity_rule_based: true, ambiguous_binding_abstains: true, optional_intelligence_blocks_core: false },
};

const objectSpecs = [
  ["modules", "modules", "js", await readFile(abs("tooling/templates/202608251929-app.js"))],
  ["css", "css", "css", await readFile(abs("tooling/templates/202608251929-app.css"))],
  ["data", "data", "json", Buffer.from(canonicalJson(summary))],
  ["evidence", "evidence", "json", Buffer.from(canonicalJson(safeEvidence))],
  ["docs", "docs", "md", Buffer.from(`# Pipeline News changelog state pin\n\nRelease: \`${releaseId}\`\n\nAuthoritative source: \`CHANGELOG.md\`\n\nSource SHA-256: \`${sha256(changelog)}\`\n\nState: the 17:01 and 17:50 timestamp candidates are rejected product baselines; their immutable bytes remain lineage evidence. This successor preserves the frozen NewsV7 data spine and restores its full inter  … [line shortened here: 452 characters; full line on GitHub]
];
const objects = {};
for (const [key, kind, extension, bytes] of objectSpecs) {
  const hash = sha256(bytes);
  const path = `objects/${kind}/sha256/${hash}.${extension}`;
  await ensureWrite(abs(path), bytes);
  objects[key] = { path, bytes: bytes.length, sha256: hash };
}
const sourcePins = [];
for (const [sourcePath, kind, bytes] of [
  ["data/official-source/latest.json", "official-frontier", officialSourceBytes],
  ["state/official-source-cursor.json", "official-cursor", cursorSourceBytes],
]) {
  const hash = sha256(bytes);
  const path = `objects/source/sha256/${hash}.json`;
  await ensureWrite(abs(path), bytes);
  sourcePins.push({ path, bytes: bytes.length, sha256: hash, source_path: sourcePath, source_commit: "92985c76eaa449a8960d7e1d6059d8ae26800a18", classification: kind });
}

const index = `<!doctype html>
<html lang="en" data-summary-object="../${objects.data.path}" data-evidence-object="../${objects.evidence.path}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Pipeline News ${releaseId}</title><link rel="stylesheet" href="../${objects.css.path}"></head><body><div class="layout">
<aside class="sidebar"><div class="brand"><strong>GLOBALGRID2050</strong><span>PIPELINE NEWS · ${releaseId}</span></div><nav><a href="../newsv7/">NEWS V7 FROZEN</a><a href="https://globalgrid2050.com/repd_grid_atlasv8/">MAP ATLAS</a><a href="../${objects.docs.path}">CHANGELOG STATE</a><a href="release.json">RELEASE CONTRACT</a><button id="exportCsv" type="button">EXPORT FILTERED CSV</button></nav>  … [line shortened here: 408 characters; full line on GitHub]
<main class="main"><header class="topline"><h1>UK RENEWABLES PIPELINE NEWS</h1><span class="status" id="projectStatus">LOADING OFFICIAL PROJECT SPINE…</span></header><div class="release-law"><strong>${releaseId}</strong><span>133-item evidence ledger · full ≥1 MW project spine</span><span>Official REPD facts remain separate from typed evidence signals.</span></div>
<section class="newspaper"><div class="masthead"><h2>GLOBALGRID2050 <span>ENERGY DAILY</span></h2><div class="strap"><span>SAFE TYPED EVIDENCE · SOURCE ORIGINS · HASH-PINNED RECORDS</span><span id="newsMeta">LOADING LEDGER…</span></div></div><div class="news-tools"><button class="active" data-news-mode="ALL">ALL</button><button data-news-mode="UK">UK</button><button data-news-mode="INTERNATIONAL">  … [line shortened here: 967 characters; full line on GitHub]
<section class="intelligence"><div class="section-head"><h2>CUMULATIVE GOVERNED INTELLIGENCE</h2><span id="intelligenceStatus">OPTIONAL SUMMARY PENDING · CORE BOOT CONTINUES</span></div><div class="intelligence-cards" id="intelligenceCards"><div class="empty">Loading safe typed summary…</div></div></section>
<section><div class="gauges"><article class="gauge"><span>FILTERED PROJECTS</span><strong id="filteredProjects">0</strong></article><article class="gauge"><span>FILTERED CAPACITY MW</span><strong id="filteredCapacity">0</strong></article><article class="gauge"><span>LARGEST SITE MW</span><strong id="largestProject">0</strong></article><article class="gauge"><span>SOLAR · PROJECTS / MWP</span><stro  … [line shortened here: 769 characters; full line on GitHub]
<div class="project-tools"><button class="active" data-technology="all">ALL TECH</button><button data-technology="solar">SOLAR</button><button data-technology="bess">BATTERY</button><button data-technology="wind_onshore">ONSHORE</button><button data-technology="wind_offshore">OFFSHORE</button><label>OFFICIAL STATUS<select id="statusFilter"><option value="All">ALL STATUS</option></select></label><l  … [line shortened here: 1,282 characters; full line on GitHub]
<div class="tablewrap" tabindex="0" aria-label="Scrollable 11-column project table"><table><thead><tr><th>SITE LABEL</th><th>REGION</th><th>OPERATOR</th><th>TECHNOLOGY</th><th>OFFICIAL REPD STATUS</th><th>OFFICIAL CAPACITY</th><th>REPD REF</th><th>GLOBALGRID REF</th><th>REPD UPDATED</th><th>CONNECTION / NEWS</th><th>ACTIONS</th></tr></thead><tbody id="projectRows"><tr><td colspan="11" class="empty  … [line shortened here: 621 characters; full line on GitHub]
<footer class="footer">Connection timing and method remain UNKNOWN unless exact official evidence proves them. Planning, proximity, capacity and headlines never establish a connection.</footer></main></div><script type="module" src="../${objects.modules.path}"></script></body></html>
`;
const releaseReadme = `# ${releaseId}\n\nManual recovery successor built from the frozen NewsV7 project and evidence ledgers. It restores the complete newspaper, 7,680-project table, filters, search, bidirectional sorting, 100-row pagination, CSV export, Atlas links and deliberate mobile horizontal scrolling. Raw operator labels, headlines and summaries are not republished. Connection timing and m  … [line shortened here: 461 characters; full line on GitHub]
const releaseShell = {
  schema: "pipelinenews.release-shell.v2", release_id: releaseId, status: "CANDIDATE_PREPUBLICATION",
  manifest: `../releases/${releaseId}.json`, preview_attestation: `../${previewAttestationPath}`, pipeline_attestation: `../${pipelineAttestationPath}`, closure_attestation: `../${closurePath}`,
  interface: { project_table_columns: 11, rows_per_page: 100, technology_gauges: 4, mobile_horizontal_scroll: true, raw_person_names_published: false },
};
const shellFiles = [
  [`${releaseId}/index.html`, Buffer.from(index)],
  [`${releaseId}/readme.md`, Buffer.from(releaseReadme)],
  [`${releaseId}/release.json`, Buffer.from(canonicalJson(releaseShell))],
];
for (const [path, bytes] of shellFiles) await ensureWrite(abs(path), bytes);

const pointer = { schema: "pipelinenews.release-pointer.v2", channel: "candidate", release_id: releaseId, manifest: `releases/${releaseId}.json`, updated_at: created, public_app_switched: false, rejected_predecessors: ["202608251701-pipelinenews", "202608251750-pipelinenews"] };
const pointerBytes = Buffer.from(canonicalJson(pointer));
await ensureWrite(abs(candidatePointerPath), pointerBytes);

const reused = [...await Promise.all(reusedPaths.map(fileEntry)), ...sourcePins];
const proof = await Promise.all(proofPaths.map(fileEntry));
const publicationSupport = await Promise.all(publicationSupportPaths.map(fileEntry));
const shell = await Promise.all(shellFiles.map(([path]) => fileEntry(path)));
const newObjects = Object.values(objects);
const sum = (rows) => rows.reduce((total, row) => total + row.bytes, 0);
const regressionMatrix = {
  newsv7: { classification: "FROZEN_BASELINE", visible_headlines: 133, project_count: 7680, capacity_mw: 356474.09, table_columns: 11, filters: { technology: true, status: true, county: true, region: false, capacity_range: false }, search: { news: true, projects: true }, sorting: { capacity_both_directions: true, repd_updated_both_directions: true }, pagination: { enabled: true, rows_per_page: 100  … [line shortened here: 762 characters; full line on GitHub]
  dashboard_v5: { classification: "REFERENCE_ONLY", visible_headlines: 125, project_count: 5210, capacity_mw: 262397, table_columns: 8, filters: { technology: true, status: true, county: true, region: false, capacity_range: false }, search: { news: "BASIC", projects: "BASIC" }, sorting: false, pagination: false, export: true, maps: "NO_PER_PROJECT_ATLAS", intelligence_panels: "BASIC_NEWS_SIGNAL",   … [line shortened here: 699 characters; full line on GitHub]
  "202608251701-pipelinenews": { classification: "REJECTED_PRODUCT_BASELINE", visible_headlines: 0, project_count: 0, capacity_mw: 0, table_columns: 0, filters: false, search: false, sorting: false, pagination: false, export: false, maps: false, intelligence_panels: "PROOF_METRICS_ONLY", mobile_scrolling: "NOT_APPLICABLE_NO_PRODUCT_TABLE", data_load: "THIN_SHELL_ONLY", console_errors: "NOT_RETESTE  … [line shortened here: 571 characters; full line on GitHub]
  "202608251750-pipelinenews": { classification: "REJECTED_PRODUCT_BASELINE", visible_headlines: 0, project_count: 0, capacity_mw: 0, table_columns: 0, filters: false, search: false, sorting: false, pagination: false, export: false, maps: false, intelligence_panels: "AUDIT_METRICS_ONLY", mobile_scrolling: "NOT_APPLICABLE_NO_PRODUCT_TABLE", data_load: "THIN_SHELL_ONLY", console_errors: "NOT_RETESTE  … [line shortened here: 569 characters; full line on GitHub]
  [releaseId]: { classification: "LOCAL_CANDIDATE", visible_headlines: 133, project_count: 7680, capacity_mw: 356474.09, table_columns: 11, filters: { technology: true, status: true, region: true, capacity_range: "INCLUSIVE" }, search: { news: true, projects: true }, sorting: { capacity_both_directions: true, repd_updated_both_directions: true }, pagination: { enabled: true, rows_per_page: 100, pa  … [line shortened here: 789 characters; full line on GitHub]
};
let manifestBytes = 0;
let reportBytes = 0;
let report;
let manifest;
for (let pass = 0; pass < 12; pass += 1) {
  const accounting = {
    lightweight_release_shell: { files: shell.length, bytes: sum(shell) },
    new_content_addressed: { files: newObjects.length, bytes: sum(newObjects) },
    reused_or_pinned: { files: reused.length, bytes: sum(reused) },
    proof_and_evidence: { files: proof.length, bytes: sum(proof) },
    publication_support: { files: publicationSupport.length, bytes: sum(publicationSupport) },
    report: { files: 1, bytes: reportBytes }, manifest: { files: 1, bytes: manifestBytes },
    minimum_pages_deployment_impact: { files: shell.length + newObjects.length + 3, bytes: sum(shell) + sum(newObjects) + reportBytes + manifestBytes + pointerBytes.length },
    total_closure: { files: shell.length + newObjects.length + reused.length + proof.length + publicationSupport.length + 2, bytes: sum(shell) + sum(newObjects) + sum(reused) + sum(proof) + sum(publicationSupport) + reportBytes + manifestBytes },
  };
  report = {
    schema: "pipelinenews.release-proof.v2", release_id: releaseId, status: "LOCAL_DETERMINISTIC_PASS_LIVE_UNVERIFIED",
    checks: { project_count: 7680, capacity_mw: totalCapacity, solar: summary.spine.solar, bess: summary.spine.bess, base_headlines: 133, governed_uk: 45, regional_headlines: 19, safe_evidence_records: 152, table_columns: 11, rows_per_page: 100, technology_gauges: 4, sentinel_13599: "PASS", sentinel_17494: "PASS", raw_operator_output: "WITHHELD", raw_unstructured_news_output: "WITHHELD", connectio  … [line shortened here: 538 characters; full line on GitHub]
    regression_matrix: regressionMatrix, browser: { desktop: "PENDING_LIVE_QA", mobile_390: "PENDING_LIVE_QA", script: "tests/browser-live-202608251929.mjs" }, byte_accounting: accounting,
  };
  const reportBuffer = Buffer.from(canonicalJson(report));
  const reportEntry = { path: `reports/${releaseId}-proof.json`, bytes: reportBuffer.length, sha256: sha256(reportBuffer) };
  manifest = {
    schema: "pipelinenews.timestamp-release-manifest.v2", release_id: releaseId, status: "CANDIDATE_PREPUBLICATION", immutable: true,
    timeline: {
      incepted_at: inception, created_at: created,
      committed_at: { value: null, status: "UNVERIFIED", attestation: `${pipelineAttestationPath}#/committed_at` },
      pipeline_pages_verified_at: { value: null, status: "UNVERIFIED", attestation: `${pipelineAttestationPath}#/pipeline_pages_verified_at` },
      catalogued_at: { value: null, status: "UNVERIFIED", attestation: `${closurePath}#/catalogued_at` },
      globalgrid_live_verified_at: { value: null, status: "UNVERIFIED", attestation: `${closurePath}#/globalgrid_live_verified_at` },
    },
    publication: { live: false, pipeline_pages: "UNVERIFIED", globalgrid_catalogue: "UNVERIFIED", rejected_predecessors: ["202608251701-pipelinenews", "202608251750-pipelinenews"] },
    attestations: { preview: previewAttestationPath, pipeline_pages: pipelineAttestationPath, closure: closurePath },
    interface: { table_columns: 11, rows_per_page: 100, technology_gauges: 4, project_count: 7680, capacity_mw: totalCapacity, full_newspaper_ledger: 133, safe_evidence_records: 152, capacity_filter_inclusive: true, mobile_horizontal_scroll: true, optional_intelligence_blocks_core: false },
    frozen_preservation: { newsv1_tree: "2d6247c067aa5fad49995dcb9029d6cdb9898994", newsv7_tree: "5a59a926d0688d05c08c5ecc008c174133728007", rejected_1701_tree: "84b748df685b9306ce232e415531ee4eca05b4d6", rejected_1750_tree: "8a86c549b14a104b247aaadfc522644155b22ddb", selected_newsv7_assets_rehashed: true, predecessor_release_bytes_written: false },
    objects, frozen_reused_assets: reused, proof: [...proof, reportEntry], publication_support: { lifecycle: "MUTABLE_ONLY_AFTER_CLOSURE_ATTESTATION", build_state: publicationSupport }, changelog_source: {
      path: "CHANGELOG.md",
      build_base: { commit: "92985c76eaa449a8960d7e1d6059d8ae26800a18", git_blob_sha1: "f79943be9e89a6aebf4deac668315abe5d753af9" },
      prospective_publication_state: { git_blob_sha1: gitBlobSha1(changelog), sha256: sha256(changelog), snapshot_object: objects.docs.path },
    }, byte_accounting: accounting,
  };
  const nextReportBytes = reportBuffer.length;
  const nextManifestBytes = Buffer.byteLength(canonicalJson(manifest));
  if (nextReportBytes === reportBytes && nextManifestBytes === manifestBytes) break;
  reportBytes = nextReportBytes;
  manifestBytes = nextManifestBytes;
}
await ensureWrite(abs(`reports/${releaseId}-proof.json`), canonicalJson(report));
await ensureWrite(abs(`releases/${releaseId}.json`), canonicalJson(manifest));
process.stdout.write(`BUILD ${releaseId}: PASS · ${projects.length} projects · ${news.all_items.length} evidence items\n`);

Build Current Discovery Release

A JavaScript module in the tooling folder of PipelineNews that verifies object (`verifyObject`) and writes immutable (`writeImmutable`), using SHA-256. It verifies object (`verifyObject`) and writes immutable (`writeImmutable`).

automationpipelinenews / archive/202608261547-pipelinenews/tooling/build-current-discovery-release.mjs · lines 1–80 of 80 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review) · pattern repoUrl (shared by 2 files)

What it does
It loads data. Defines sha256, repoUrl, json, verifyObject, writeImmutable. Uses libraries node:crypto, node:fs/promises. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file current.json; command-line arguments.
What it achieves
Its name says it builds current discovery release. Defines `sha256`, `repoUrl`, `json` and 2 more.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tooling · JavaScript module
Uses
node:crypto, node:fs/promises
Used by
none found
Produces
sha256, repoUrl, json, verifyObject, writeImmutable
Defines here
sha256, repoUrl, json, verifyObject, writeImmutable
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tooling/build-current-discovery-release.mjs:1-80 · blob 1be0a4b57050e0ac23787b9149edf7874e358917 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: experimental · users: none · canonical: unreached_review
import { createHash } from "node:crypto";
import { mkdir, open, readFile, rename, unlink } from "node:fs/promises";

const repositoryRoot = new URL("../", import.meta.url);
const pointerPath = process.argv[2] || "releases/current.json";
const sha256 = (value) => createHash("sha256").update(value).digest("hex");

function repoUrl(path) {
  if (typeof path !== "string" || path.startsWith("/") || path.split("/").includes("..")) {
    throw new Error(`unsafe repository path: ${path}`);
  }
  return new URL(path, repositoryRoot);
}

async function json(path) {
  return JSON.parse(await readFile(repoUrl(path), "utf8"));
}

async function verifyObject(object) {
  const bytes = await readFile(repoUrl(object.path));
  if (sha256(bytes) !== object.sha256) throw new Error(`SHA-256 mismatch: ${object.path}`);
  if (bytes.byteLength !== object.bytes) throw new Error(`byte-length mismatch: ${object.path}`);
  return bytes;
}

async function writeImmutable(path, bytes) {
  const target = repoUrl(path);
  try {
    const existing = await readFile(target);
    if (!existing.equals(bytes)) throw new Error(`refusing to overwrite immutable object: ${path}`);
    return;
  } catch (error) {
    if (error.code !== "ENOENT") throw error;
  }

  await mkdir(new URL("./", target), { recursive: true });
  const temporary = new URL(`${target.pathname}.tmp-${process.pid}`, target);
  let handle;
  try {
    handle = await open(temporary, "wx");
    await handle.writeFile(bytes);
    await handle.sync();
    await handle.close();
    handle = undefined;
    await rename(temporary, target);
  } catch (error) {
    if (handle) await handle.close();
    await unlink(temporary).catch(() => {});
    throw error;
  }
}

const pointer = await json(pointerPath);
if (pointer.schema !== "pipelinenews.release-pointer.v1") throw new Error("unexpected release pointer schema");
const manifest = await json(pointer.manifest);
if (pointer.release_id !== manifest.release_id) throw new Error("release pointer mismatch");
if (manifest.status !== "CANDIDATE") throw new Error("this builder admits candidate releases only");

const [inputBytes] = await Promise.all([
  verifyObject(manifest.objects.inputs[0]),
  ...manifest.objects.modules.map(verifyObject),
  ...manifest.objects.css.map(verifyObject),
  ...manifest.objects.parquet.map(verifyObject),
  ...manifest.objects.geojson.map(verifyObject),
  ...manifest.app.shell_files.map(verifyObject),
  verifyObject(manifest.build.architecture),
]);

const input = JSON.parse(inputBytes);
const moduleUrl = repoUrl(manifest.objects.modules[0].path);
const { buildDiscoveryLedger } = await import(moduleUrl.href);
const product = buildDiscoveryLedger(input);
const productBytes = Buffer.from(`${JSON.stringify(product, null, 2)}\n`);
const artifact = manifest.objects.artifacts[0];

if (sha256(productBytes) !== artifact.sha256) throw new Error("generated artifact SHA-256 mismatch");
if (productBytes.byteLength !== artifact.bytes) throw new Error("generated artifact byte-length mismatch");
await writeImmutable(artifact.path, productBytes);

console.log(`Built ${manifest.release_id}: ${product.counts.source_candidates} URL candidate; ${product.counts.promoted_articles} promoted articles`);

Build Evidence Release

A JavaScript module in the tooling folder of PipelineNews that uses SHA-256.

automationpipelinenews / archive/202608261547-pipelinenews/tooling/build-evidence-release.mjs · lines 1–20 of 20 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines sha256. Uses libraries node:crypto, node:fs/promises. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: command-line arguments.
What it achieves
Its name says it builds evidence release. Defines `sha256`.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tooling · JavaScript module
Uses
node:crypto, node:fs/promises
Used by
none found
Produces
sha256
Defines here
sha256
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tooling/build-evidence-release.mjs:1-20 · blob b32e6b121d5e3a8ca334ba0e084bec924fee410d · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import { createHash } from "node:crypto";
import { mkdir, readFile, writeFile } from "node:fs/promises";
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
const inputPath = process.argv[2];
const enginePath = process.argv[3];
if (!inputPath || !enginePath) throw new Error("usage: node staging/build-release.mjs INPUT ENGINE");
const input = JSON.parse(await readFile(inputPath, "utf8"));
const { buildEvidenceLedger } = await import(new URL(`../${enginePath}`, import.meta.url));
const bytes = Buffer.from(`${JSON.stringify(buildEvidenceLedger(input), null, 2)}\n`);
const digest = sha256(bytes);
const path = `objects/data/sha256/${digest}.json`;
await mkdir("objects/data/sha256", { recursive: true });
try {
  await writeFile(path, bytes, { flag: "wx" });
} catch (error) {
  if (error.code !== "EEXIST") throw error;
  const existing = await readFile(path);
  if (!existing.equals(bytes)) throw new Error(`refusing to overwrite immutable artifact: ${path}`);
}
console.log(JSON.stringify({ path, sha256: digest, bytes: bytes.byteLength }));

Build Official Frontier Release

A JavaScript module in the tooling folder of PipelineNews that uses SHA-256.

automationpipelinenews / archive/202608261547-pipelinenews/tooling/build-official-frontier-release.mjs · lines 1–24 of 24 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review)

What it does
It loads data. Uses libraries node:crypto, node:fs/promises. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: form fields (user input); command-line arguments.
What it achieves
Its name says it builds official frontier release.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tooling · JavaScript module
Uses
node:crypto, node:fs/promises
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tooling/build-official-frontier-release.mjs:1-24 · blob 47e358fd9d3ea91fa99e23f674f23686f4d817fe · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: experimental · users: none · canonical: unreached_review
import { createHash } from "node:crypto";
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";

const [inputPath, enginePath, outputPath] = process.argv.slice(2);
if (!inputPath || !enginePath || !outputPath) throw new Error("usage: node tooling/build-official-frontier-release.mjs <input> <engine> <output>");
const input = JSON.parse(await readFile(inputPath, "utf8"));
const { buildFrontierContract } = await import(new URL(`../${enginePath}`, import.meta.url));
const bytes = Buffer.from(`${JSON.stringify(buildFrontierContract(input), null, 2)}\n`);
const digest = createHash("sha256").update(bytes).digest("hex");
if (!outputPath.includes(digest)) throw new Error(`output path must contain generated SHA-256 ${digest}`);
const target = new URL(`../${outputPath}`, import.meta.url);
try {
  const existing = await readFile(target);
  if (!existing.equals(bytes)) throw new Error(`refusing to overwrite immutable object: ${outputPath}`);
  console.log(`Verified ${input.release_id}: ${digest}`);
  process.exit(0);
} catch (error) {
  if (error.code !== "ENOENT") throw error;
}
await mkdir(new URL("./", target), { recursive: true });
const temporary = new URL(`${target.pathname}.tmp-${process.pid}`, target);
await writeFile(temporary, bytes, { flag: "wx" });
await rename(temporary, target);
console.log(`Built ${input.release_id}: ${digest}`);