In this section
- Compare Mobile UI storage · pipelinenews / atman/202608271656-compare-mobile-ui.mjs lines 701–927
- Mobile UI Invariants transform · pipelinenews / atman/202608271656-mobile-ui-invariants.mjs lines 1–236
Compare Mobile UI
A JavaScript module in the atman folder of PipelineNews that reads metrics and artifact, using SHA-256. It validates project posture (`validateProjectPosture`), hashes raw artifacts (`hashRawArtifacts`) and parses JSON (`parseJson`).
storagepipelinenews / atman/202608271656-compare-mobile-ui.mjs · lines 701–927 of 927 · version 2026-08-27 16:56 (continued from section 1001) · Not reached from any entry point (candidate for review) · pattern parseJson (shared by 2 files)
- What it does
- It loads metrics and artifact. Defines 41 functions or classes, including fail, requireSchema, validateProjectPosture, sha256, sourceCommit. Uses libraries node:child_process, node:crypto, node:fs/promises, node:path, node:url. Side effects: reads or writes files; 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 run.json; JSON file metrics.json; JSON file artifact-manifest.json. Out: JSON file metrics.json; JSON file artifact-manifest.json.
- What it achieves
- Defines `fail`, `requireSchema`, `validateProjectPosture` and 37 more.
- Why it matters
- No other file in the estate was found to import it.
- Application
- pipelinenews · atman · JavaScript module
- Uses
- Mobile UI Invariants (script call), node:child_process, node:crypto, node:fs/promises, node:path, node:url
- Used by
- none found
- Produces
- fail, requireSchema, validateProjectPosture, sha256, sourceCommit, jsonBytes, posix, inside, walkFiles, hashRawArtifacts, parseJson, targetId
- Defines here
- artifactIdentity, browserSummary, statusForReport, markdownTableForTarget, makeReport, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 atman/202608271656-compare-mobile-ui.mjs:701-927 · blob 9f18bbd154feede9757140d476d33d3bd8e4dd40 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
});
}
function artifactIdentity() {
const runId = process.env.GITHUB_RUN_ID || null;
const runAttempt = process.env.GITHUB_RUN_ATTEMPT || null;
if (process.env.GITHUB_ACTIONS === "true") {
requireSchema(/^\d+$/u.test(runId || ""), "GITHUB_RUN_ID is invalid");
requireSchema(/^\d+$/u.test(runAttempt || ""), "GITHUB_RUN_ATTEMPT is invalid");
}
const suffix = runId && runAttempt ? `${runId}-${runAttempt}` : null;
const defaultFull = suffix
? `pipelinenews-mobile-ui-${MODE}-${GENERATION}-${suffix}`
: null;
const defaultCompact = suffix
? `pipelinenews-mobile-ui-${MODE === "audit" ? "compact" : `${MODE}-compact`}-${GENERATION}-${suffix}`
: null;
return {
github_run_id: runId,
github_run_attempt: runAttempt,
full_artifact_name: process.env.MOBILE_UI_FULL_ARTIFACT_NAME || defaultFull,
compact_artifact_name: process.env.MOBILE_UI_COMPACT_ARTIFACT_NAME || defaultCompact,
retention_days: 30,
raw_artifact_expiry: "30 days",
};
}
function browserSummary(run) {
const browser = run?.browser && typeof run.browser === "object" ? run.browser : {};
return {
engine: browser.engine || CONTRACT.browser.engine,
playwright_version: browser.playwright_version || CONTRACT.browser.playwright_version,
chromium_version: browser.chromium_version || browser.version || null,
executable_sha256: browser.executable_sha256 || browser.browser_sha256 || null,
};
}
function statusForReport(matrix, observed, invariant, cell, target) {
const state = matrix[invariant][cell][target];
if (state !== "REPORT-ONLY") return state;
return `REPORT-ONLY (${observed[invariant][cell][target]})`;
}
function markdownTableForTarget(target, matrix, observed, cellIds) {
const lines = [
`### ${CONTRACT.targets.find(({ id }) => id === target)?.label || target}`,
"",
`| Invariant | ${cellIds.join(" | ")} |`,
`| --- | ${cellIds.map(() => "---").join(" | ")} |`,
];
for (const invariant of CONTRACT.invariants) {
const values = cellIds.map((cell) => statusForReport(matrix, observed, invariant.id, cell, target));
lines.push(`| ${invariant.id} ${invariant.name} | ${values.join(" | ")} |`);
}
return lines;
}
function makeReport(metrics, rawArtifactCount, rawArtifactBytes) {
const { verdict, prediction, matrix, observed } = metrics;
const cellIds = metrics.cells.map(({ id }) => id);
const browserHash = metrics.browser.executable_sha256 || "not reported";
const lines = [
"# PipelineNews mobile UI comparator",
"",
`Generation: \`${GENERATION}\` `,
`Candidate generation: \`${metrics.candidate_generation || "not reported"}\` `,
`Source commit: \`${metrics.source_commit}\` `,
`Mode: \`${MODE}\` `,
`Deployment: \`${CONTRACT.deployment}\``,
"",
"Project posture: **Ventus Ltd — non-commercial open source**. Publisher redistribution rights remain source-specific and are not inferred by this audit.",
"",
`The evidence producer completed: **${verdict.producer_status}**. The measured candidate gate is **${verdict.candidate_gate.status}**. Measured UI failures do not change the comparator process status.`,
"",
`Baseline characterisation: **${verdict.baseline_characterisation.status}**. Original context: **${verdict.original_context.status}** and never gated.`,
"",
`Expected L1-L4 I2/I3/I4 audit hypothesis: **${prediction.status}**. Contradictions are retained as evidence and never invalidate the run.`,
"",
"## Pinned browser",
"",
`Playwright \`${metrics.browser.playwright_version}\`; Chromium \`${metrics.browser.chromium_version || "not reported"}\`; executable SHA-256 \`${browserHash}\`.`,
"",
"## Candidate gate failures",
"",
];
if (verdict.candidate_gate.failures.length === 0) {
lines.push("None.");
} else {
lines.push("| Invariant | Cell |", "| --- | --- |");
for (const failure of verdict.candidate_gate.failures) lines.push(`| ${failure.invariant} | ${failure.cell} |`);
}
if (verdict.candidate_gate.excluded_report_only.length > 0) {
lines.push(
"",
`${verdict.candidate_gate.excluded_report_only.join(", ")} is report-only in ${MODE} mode and excluded from the candidate gate.`,
"",
);
}
lines.push("## Invariant matrix", "");
for (const target of CONTRACT.targets.map(({ id }) => id)) {
lines.push(...markdownTableForTarget(target, matrix, observed, cellIds), "");
}
lines.push("## Prediction check", "", "| Target | Cell | Invariant | Expected | Actual |", "| --- | --- | --- | --- | --- |");
for (const check of prediction.checks) {
lines.push(`| ${check.target} | ${check.cell} | ${check.invariant} | ${check.expected} | ${check.actual} |`);
}
lines.push(
"",
"## Evidence closure",
"",
`${rawArtifactCount} raw artifacts (${rawArtifactBytes} bytes), including screenshots, are SHA-256 indexed in \`artifact-manifest.json\`. Only this compact report, folded metrics and the hash manifest belong in the quarantine-proof commit.`,
"",
metrics.artifact_identity.full_artifact_name
? `Full evidence artifact: \`${metrics.artifact_identity.full_artifact_name}\` (retention: ${metrics.artifact_identity.retention_days} days).`
: "Full evidence artifact identity is assigned by GitHub Actions.",
"",
"No release, stable pointer, catalogue or Pages deployment is changed by this comparator.",
"",
);
return lines.join("\n");
}
async function main() {
requireSchema(Object.hasOwn(CONTRACT.modes, MODE), `unsupported comparator mode ${MODE}`);
requireSchema(CONTRACT.schema === "pipelinenews.mobile-ui-invariants.v1", "unexpected contract schema");
requireSchema(CONTRACT.generation === GENERATION, "contract generation differs from module generation");
validateProjectPosture(CONTRACT.project_posture, "contract");
const contractPath = path.join(ROOT, "atman", `${GENERATION}-mobile-ui-invariants.mjs`);
const contractBytes = await readFile(contractPath);
const source = sourceCommit();
const { artifacts, bytesByPath } = await hashRawArtifacts();
const { records, run } = parseRawEvidence(bytesByPath, artifacts);
validateMandatoryRecords(records);
validateRun(run, records, source);
validateRecordSourceBindings(records, source, run.candidate_generation);
const { cells, matrix, observed } = buildMatrix(records);
const verdict = buildVerdict(matrix, observed, cells, records);
const prediction = buildPrediction(observed);
const rawBytes = artifacts.reduce((total, artifact) => total + artifact.bytes, 0);
const rawClosureSha256 = sha256(Buffer.from(
artifacts.map((artifact) => `${artifact.path}\0${artifact.sha256}\0${artifact.bytes}\n`).join(""),
"utf8",
));
const identity = artifactIdentity();
const metrics = {
schema: OUTPUT_SCHEMA,
generation: GENERATION,
source_commit: source,
candidate_generation: run?.candidate_generation || null,
mode: MODE,
deployment: CONTRACT.deployment,
project_posture: CONTRACT.project_posture,
contract: {
path: `atman/${GENERATION}-mobile-ui-invariants.mjs`,
sha256: sha256(contractBytes),
},
browser: browserSummary(run),
targets: CONTRACT.targets.map(({ id, label, required, gated }) => ({ id, label, required, gated })),
cells: cells.map(({ id, width, height, dpr, orientation, represents }) => ({ id, width, height, dpr, orientation, represents })),
invariants: CONTRACT.invariants.map(({ id, name, applies_to }) => ({
id,
name,
applies_to,
mode: CONTRACT.invariants.find((item) => item.id === id)[MODE],
})),
matrix,
observed,
verdict,
prediction,
records: recordSummary(records),
measurement_excerpts: measurementExcerpts(records),
artifact_identity: identity,
raw_artifacts: {
count: artifacts.length,
bytes: rawBytes,
closure_sha256: rawClosureSha256,
},
};
const metricsBytes = jsonBytes(metrics);
const reportBytes = Buffer.from(makeReport(metrics, artifacts.length, rawBytes), "utf8");
if (reportBytes.length > MAX_REPORT_BYTES) fail("schema error", `report exceeds ${MAX_REPORT_BYTES} bytes`);
if (metricsBytes.length > MAX_METRICS_BYTES) fail("schema error", `metrics exceed ${MAX_METRICS_BYTES} bytes`);
const compactFiles = [
{ path: "report.md", sha256: sha256(reportBytes), bytes: reportBytes.length },
{ path: "metrics.json", sha256: sha256(metricsBytes), bytes: metricsBytes.length },
];
const artifactManifest = {
schema: ARTIFACT_SCHEMA,
generation: GENERATION,
source_commit: source,
candidate_generation: metrics.candidate_generation,
mode: MODE,
project_posture: CONTRACT.project_posture,
raw_root: "raw",
raw_closure_sha256: rawClosureSha256,
full_artifacts: artifacts,
compact_files: compactFiles,
artifact_identity: identity,
self_hash_excluded: true,
};
const artifactManifestBytes = jsonBytes(artifactManifest);
if (reportBytes.length + metricsBytes.length + artifactManifestBytes.length > MAX_COMPACT_BYTES) {
fail("schema error", `compact evidence exceeds ${MAX_COMPACT_BYTES} bytes`);
}
await mkdir(REPORT_DIR, { recursive: true });
await writeFile(path.join(REPORT_DIR, "report.md"), reportBytes);
await writeFile(path.join(REPORT_DIR, "metrics.json"), metricsBytes);
await writeFile(path.join(REPORT_DIR, "artifact-manifest.json"), artifactManifestBytes);
process.stdout.write(`${JSON.stringify({
schema: OUTPUT_SCHEMA,
generation: GENERATION,
source_commit: source,
mode: MODE,
producer_status: verdict.producer_status,
candidate_gate: verdict.candidate_gate.status,
baseline_characterisation: verdict.baseline_characterisation.status,
original_context: verdict.original_context.status,
prediction: prediction.status,
raw_artifacts: artifacts.length,
compact_files: compactFiles.map(({ path: name }) => name).concat("artifact-manifest.json"),
}, null, 2)}\n`);
}
main().catch((error) => {
process.stderr.write(`${error.stack || error.message}\n`);
process.exitCode = 1;
});Mobile UI Invariants
A JavaScript module in the atman folder of PipelineNews that works with deep freeze (`deepFreeze`). It is built from the deep freeze helper (`deepFreeze`).
transformpipelinenews / atman/202608271656-mobile-ui-invariants.mjs · lines 1–236 of 236 · version 2026-08-27 16:56 · pattern deepFreeze (shared by 25 files)
- What it does
- It calculates its inputs. Defines deepFreeze.
- 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.
- Downstream impact
- Used directly by 2 files: Compare Mobile UI (pipelinenews); Verify Mobile UI Browser (pipelinenews). Reached from 1 other entry point, including PipelineNews Mobile CSS Repair Workflow (pipelinenews).
- What it achieves
- Defines `deepFreeze`.
- Why it matters
- Imported by Verify Mobile UI Browser. Run by Compare Mobile UI.
- Application
- pipelinenews · atman · JavaScript module
- Uses
- Dashboard (estate URL)
- Used by
- run by Compare Mobile UI (script call), imported by Verify Mobile UI Browser (import)
- Produces
- GENERATION, CONTRACT
- Defines here
- deepFreeze
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 atman/202608271656-mobile-ui-invariants.mjs:1-236 · blob a644790b3f535980e8942801ca846369fb23236f · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
export const GENERATION = "202608271656";
const deepFreeze = (value) => {
if (value && typeof value === "object" && !Object.isFrozen(value)) {
Object.freeze(value);
for (const item of Object.values(value)) deepFreeze(item);
}
return value;
};
export const CONTRACT = deepFreeze({
schema: "pipelinenews.mobile-ui-invariants.v1",
generation: GENERATION,
title: "PipelineNews mobile orientation comparator",
deployment: "not-authorised",
project_posture: {
owner: "Ventus Ltd",
application: "non-commercial-open-source",
publisher_redistribution_rights: "source-specific-not-inferred",
},
modes: {
audit: {
candidate_gate: true,
safe_area: "report-only",
},
repair: {
candidate_gate: true,
safe_area: "gated",
},
},
targets: [
{
id: "candidate",
label: "V8 fast candidate 202608271524",
url: "http://127.0.0.1:4173/releases/202608271524-v8-fast-candidate.html",
required: true,
gated: true,
ready: "fast-1524",
},
{
id: "baseline",
label: "Trusted compiled V9.6.2",
url: "http://127.0.0.1:4173/releases/202608261927-index.html",
required: true,
gated: false,
ready: "trusted-v9-6-2",
},
{
id: "original",
label: "Original live dashboard",
url: "https://globalgrid2050.com/uk_renewables_pipeline/dashboard.html",
required: false,
gated: false,
ready: "original-context",
},
],
cells: [
{ id: "P1", width: 390, height: 844, dpr: 3, orientation: "portrait", represents: "iPhone 14/15 portrait" },
{ id: "P2", width: 375, height: 667, dpr: 2, orientation: "portrait", represents: "iPhone SE portrait" },
{ id: "L1", width: 844, height: 390, dpr: 3, orientation: "landscape", represents: "iPhone 14/15 landscape" },
{ id: "L2", width: 932, height: 430, dpr: 3, orientation: "landscape", represents: "iPhone Pro Max landscape" },
{ id: "L3", width: 667, height: 375, dpr: 2, orientation: "landscape", represents: "iPhone SE landscape" },
{ id: "L4", width: 852, height: 393, dpr: 3, orientation: "landscape", represents: "iPhone 16 landscape" },
{ id: "T1", width: 768, height: 1024, dpr: 2, orientation: "portrait", represents: "768px breakpoint boundary" },
],
rotate_cell: {
id: "R1",
dpr: 3,
targets: ["candidate", "baseline"],
sequence: [
{ width: 390, height: 844, orientation: "portrait" },
{ width: 844, height: 390, orientation: "landscape" },
{ width: 390, height: 844, orientation: "portrait" },
],
cycles: 3,
settle_ms: 250,
},
browser: {
engine: "chromium",
playwright_version: "1.55.0",
navigation_timeout_ms: 120000,
ready_timeout_ms: 120000,
request_timeout_ms: 120000,
},
selectors: {
internal_x_scroll_whitelist: [".tablewrap"],
panels: [".paper", ".tablewrap", ".gauges .card", ".nav"],
release_menu: ".nav",
release_menu_opener: "[popovertarget='releaseMenu'], [aria-controls='releaseMenu']",
controls: {
search: "#search",
technology: "#tech [data-technology='solar']",
status: "#status [data-official-status='Operational']",
sort: "#sortProjects",
},
interactives: "a[href],button,input,select,textarea,summary,[tabindex]:not([tabindex='-1'])",
table_wrap: ".tablewrap",
table: ".tablewrap table",
table_rows: "#tbody > tr",
body_copy: ".story p,.meta span,.strap span,.signal-note,.record-grid span,.results-meta,.export-meta",
},
thresholds: {
root_overflow_tolerance_px: 1,
body_scroll_probe_px: 200,
panel_viewport_height_ratio: 0.85,
sticky_viewport_height_ratio: 0.35,
primary_tap_target_px: 44,
exception_tap_target_px: 32,
rotation_node_delta_ratio: 0.05,
rotation_node_delta_floor: 1,
minimum_visible_table_rows: 3,
minimum_body_copy_px: 10,
maximum_control_scroll_actions: 1,
},
tap_target_exceptions: [
".tablewrap a.action-link",
".tablewrap button.copy-id",
".tablewrap details > summary",
".tablewrap #sortUpdated",
],
safe_area_insets_by_cell: {
P1: { top: 47, right: 0, bottom: 34, left: 0 },
P2: { top: 0, right: 0, bottom: 0, left: 0 },
L1: { top: 0, right: 47, bottom: 21, left: 47 },
L2: { top: 0, right: 59, bottom: 21, left: 59 },
L3: { top: 0, right: 0, bottom: 0, left: 0 },
L4: { top: 0, right: 59, bottom: 21, left: 59 },
T1: { top: 0, right: 0, bottom: 0, left: 0 },
},
invariants: [
{
id: "I1",
name: "NO-HORIZONTAL-TRAP",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "Root scroll width is at most viewport width plus one pixel; overflow is allowed only inside the contract whitelist.",
},
{
id: "I2",
name: "BODY-SCROLLABLE",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "When the document is taller than the viewport, a 200px document scroll changes scrollY.",
},
{
id: "I3",
name: "PANEL-FITS",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "No measured panel has a used fixed or minimum height above 85% of the viewport height.",
},
{
id: "I4",
name: "STICKY-BUDGET",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "The union of visible sticky and fixed vertical bands occupies at most 35% of the viewport height.",
},
{
id: "I5",
name: "CONTROLS-REACHABLE",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "Search, technology, status and sort controls are visible, enabled and hit-testable after at most one deliberate scroll-into-view action through the actual scroll chain.",
},
{
id: "I6",
name: "TAP-TARGETS",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "Visible interactive hit rectangles are at least 44 by 44 CSS pixels, or at least 32 by 32 only for an explicit exception.",
},
{
id: "I7",
name: "SAFE-AREA",
applies_to: "static",
audit: "report-only",
repair: "gated",
predicate: "No visible interactive hit rectangle intersects the emulated safe-area insets when viewport-fit=cover is active.",
},
{
id: "I8",
name: "MENU-BOUNDED",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "The release menu is viewport-bounded or internally scrollable; an overlay menu dismisses outside and prevents underlying scroll.",
},
{
id: "I9",
name: "NODE-STABILITY",
applies_to: "rotate",
audit: "gated",
repair: "gated",
predicate: "After three P1-L1-P1 cycles, connected elements and post-GC CDP DOM nodes return within five percent and final detached-tree retention does not exceed its baseline.",
},
{
id: "I10",
name: "TABLE-USABLE",
applies_to: "landscape",
audit: "gated",
repair: "gated",
predicate: "At least three project rows fit in the table pane and horizontal scrolling reaches the final column.",
},
{
id: "I11",
name: "TEXT-LEGIBLE",
applies_to: "static",
audit: "gated",
repair: "gated",
predicate: "Body copy is at least 10px, text-size adjustment is explicit, and visible text is not clipped to zero height.",
},
{
id: "I12",
name: "BASELINE-HONESTY",
applies_to: "comparison",
audit: "report-only",
repair: "report-only",
predicate: "Every applicable invariant is recorded for V9.6.2 while only the candidate determines the candidate gate.",
},
],
expected_audit: {
characterised_targets: ["candidate", "baseline"],
cells: ["L1", "L2", "L3", "L4"],
expected_failures: ["I2", "I3", "I4"],
note: "Predictions are hypotheses. Contradictions revise the study; they never invalidate captured evidence.",
},
});
export default CONTRACT;