In this section
- Verify Nearest test · grid-distance-maths / test/verify_nearest.mjs lines 1–171
- Verify Parity test · grid-distance-maths / test/verify_parity.py lines 1–299
- Verify Placement test · grid-distance-maths / test/verify_placement.mjs lines 1–92
- Build Verify Publish Atlas V9 automation · gridatlas / .github/workflow-archive/202608301321-hostile-amnesia/202608291430-build-verify-publish-atlas-v9.yml lines 1–23
- Promote Root Current automation · gridatlas / .github/workflow-archive/202608301321-hostile-amnesia/202608291742-promote-root-current.yml lines 1–23
- V9 Transfer Closure automation · gridatlas / .github/workflow-archive/202608301321-hostile-amnesia/202608291742-v9-transfer-closure.yml lines 1–23
Verify Nearest
A JavaScript module in the test folder of Grid Distance Maths that works with via index (`viaIndex`).
testgrid-distance-maths / test/verify_nearest.mjs · lines 1–171 of 171 · Not reached from any entry point (candidate for review) · pattern sweep (shared by 9 files)
- What it does
- It tests its inputs. Defines check, rand, brute, viaIndex, sweep. Side effects: starts processes.
- Why it exists in the grid workflow
- README: "That formulation has now been ported here, so the library is at least as good as the code it is meant to replace, and `verify_nearest.mjs` holds the line with 20,000 randomised layouts across the UK latitude band rather than one fixture."
- What it achieves
- It is built from the check step (`check`), the rand step (`rand`) and the brute step (`brute`). Adversarial verification of the nearest-feature search.
- Why it matters
- No other file in the estate was found to import it.
- Application
- grid-distance-maths · test · JavaScript module
- Uses
- Geodesy (import)
- Used by
- none found
- Produces
- check, rand, brute, viaIndex, sweep
- Defines here
- check, rand, brute, viaIndex, sweep
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- grid-distance-maths@8e91b07d8312acca5bcaef43e839f06a3b1d642a test/verify_nearest.mjs:1-171 · blob d2c841d8a3cbdda9b60a9580a3978724f52bca4f · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: unreached_review
/**
* Adversarial verification of the nearest-feature search.
*
* WHY THIS FILE EXISTS
* --------------------
* verify.mjs already asserted "spatial index finds the same nearest as a
* brute-force sweep". It passed. The search was still wrong in about one query
* in nine, because that assertion used a single hand-made fixture whose layout
* happened not to trip the defect.
*
* A fixture proves the code runs. Only a randomised sweep against exhaustive
* truth proves the code is right, so this generates thousands of layouts across
* the whole UK latitude band and fails on ANY disagreement.
*
* The two defects it was written to catch, both since fixed:
*
* 1. The stop test converted cells to km with ky, the latitude scale, on both
* axes. A cell is `cell` DEGREES on both axes, but a degree of longitude is
* shorter than a degree of latitude and narrows towards the pole -- 0.588
* of it at 54N, 0.500 at 60N. Using ky permitted stopping up to twice as
* early as the swept box justified. Measured before the fix: 657 of 6,000
* queries wrong, worst case a circuit 35.79 km away reported as 65.42 km.
*
* 2. addSegment registered only the two endpoint cells, so a segment crossing
* a cell without ending in it was invisible from that cell.
*
* Both failures overstate distance, never understate it, which is what makes
* them dangerous: a project reads as further from the network than it is, and
* nothing about the output looks wrong.
*
* node test/verify_nearest.mjs
*/
import {
SpatialIndex, distanceToSegmentKm, localScaleKm,
} from "../src/geodesy.mjs";
let passed = 0;
const failures = [];
function check(label, condition, detail = "") {
if (condition) { passed += 1; console.log(` [PASS] ${label}${detail ? ` ${detail}` : ""}`); }
else { failures.push(`${label}${detail ? ` -- ${detail}` : ""}`); console.log(` [FAIL] ${label} ${detail}`); }
}
// A deterministic generator, so a failure is reproducible rather than a story
// about a run nobody can repeat.
let rng = 20260831;
const rand = () => { rng = (rng * 1103515245 + 12345) & 0x7fffffff; return rng / 0x7fffffff; };
const brute = (lon, lat, features) => {
let best = null;
features.forEach((f, id) => {
const km = distanceToSegmentKm(lon, lat, f[0], f[1], f[2], f[3]).km;
if (best === null || km < best.km) best = { id, km };
});
return best;
};
const viaIndex = (lon, lat, features, cell) => {
const index = new SpatialIndex(cell);
features.forEach((f, id) => index.addSegment(id, f[0], f[1], f[2], f[3]));
return index.nearest(lon, lat, (id) => {
const f = features[id];
return distanceToSegmentKm(lon, lat, f[0], f[1], f[2], f[3]).km;
});
};
function sweep(label, { trials, cell, spread, segment, latLo, latHi }) {
let misses = 0;
let worst = { over: 0, truth: 0, got: 0, lat: 0 };
for (let t = 0; t < trials; t += 1) {
const lat = latLo + rand() * (latHi - latLo);
const lon = -7 + rand() * 9;
const n = 2 + Math.floor(rand() * 5);
const features = [];
for (let i = 0; i < n; i += 1) {
const flon = lon + (rand() - 0.5) * spread;
const flat = lat + (rand() - 0.5) * spread;
features.push([flon, flat, flon + (rand() - 0.5) * segment, flat + (rand() - 0.5) * segment]);
}
const truth = brute(lon, lat, features);
const got = viaIndex(lon, lat, features, cell);
if (!truth || !got) continue;
if (Math.abs(truth.km - got.km) > 1e-9) {
misses += 1;
if (got.km - truth.km > worst.over) worst = { over: got.km - truth.km, truth: truth.km, got: got.km, lat };
}
}
check(label, misses === 0,
misses === 0 ? `${trials} layouts, exhaustive agreement`
: `${misses}/${trials} wrong, worst ${worst.truth.toFixed(2)} km reported as ${worst.got.toFixed(2)} km at ${worst.lat.toFixed(1)}N`);
}
console.log("\nrandomised sweeps against exhaustive truth\n");
sweep("short segments, default 0.1 deg cells", { trials: 6000, cell: 0.1, spread: 2.0, segment: 0.02, latLo: 50, latHi: 61 });
sweep("far north, where a degree of longitude is narrowest", { trials: 3000, cell: 0.1, spread: 2.0, segment: 0.02, latLo: 58, latHi: 61 });
sweep("coarse 0.5 deg cells", { trials: 3000, cell: 0.5, spread: 4.0, segment: 0.05, latLo: 50, latHi: 61 });
sweep("fine 0.02 deg cells", { trials: 3000, cell: 0.02, spread: 0.5, segment: 0.01, latLo: 50, latHi: 61 });
sweep("long segments that cross whole cells", { trials: 3000, cell: 0.1, spread: 2.0, segment: 0.9, latLo: 50, latHi: 61 });
sweep("widely scattered features, sparse buckets", { trials: 2000, cell: 0.1, spread: 8.0, segment: 0.02, latLo: 50, latHi: 61 });
console.log("\nthe specific defects, as direct assertions\n");
// 1. A segment that crosses a cell without ending in it must still be found.
{
const cell = 0.1;
const index = new SpatialIndex(cell);
// Spans four cells of longitude; neither end is in the middle two.
index.addSegment(0, -1.35, 54.0, -0.95, 54.0);
const hit = index.nearest(-1.15, 54.005, (id) =>
distanceToSegmentKm(-1.15, 54.005, -1.35, 54.0, -0.95, 54.0).km);
const truth = distanceToSegmentKm(-1.15, 54.005, -1.35, 54.0, -0.95, 54.0).km;
check("a segment crossing a cell is findable from inside that cell",
hit !== null && Math.abs(hit.km - truth) < 1e-9,
hit === null ? "not found at all" : `${hit.km.toFixed(4)} km`);
}
// 2. The stop test must never claim more clearance than the box provides.
{
const cell = 0.1;
const index = new SpatialIndex(cell);
for (const lat of [50, 54, 58, 60, 61]) {
for (const lonOffset of [0.001, 0.037, 0.099]) {
const lon = -1 + lonOffset;
const { ky } = localScaleKm(lat);
for (const ring of [1, 2, 5]) {
const claimed = index.sweptClearanceKm(lon, lat, ring);
// Re-derive the box edges independently and take the true distance to
// the nearest one, on the narrower scale for the east-west pair.
const ci = Math.floor(lat / cell);
const cj = Math.floor(lon / cell);
const latLo = (ci - ring) * cell; const latHi = (ci + ring + 1) * cell;
const lonLo = (cj - ring) * cell; const lonHi = (cj + ring + 1) * cell;
const kx = localScaleKm(Math.min(Math.max(Math.abs(latLo), Math.abs(latHi)), 89.9)).kx;
const actual = Math.min((lat - latLo) * ky, (latHi - lat) * ky,
(lon - lonLo) * kx, (lonHi - lon) * kx);
check(`clearance at ${lat}N ring ${ring} lon+${lonOffset} does not exceed the swept box`,
claimed <= actual + 1e-9, `claims ${claimed.toFixed(3)} km, box gives ${actual.toFixed(3)} km`);
}
}
}
check("clearance is zero before any ring is complete", index.sweptClearanceKm(-1, 54, 0) === 0);
}
// 3. Every miss this class of defect produces overstates. Prove the direction.
{
const cell = 0.1;
let understated = 0;
for (let t = 0; t < 2000; t += 1) {
const lat = 50 + rand() * 11;
const lon = -7 + rand() * 9;
const features = [];
for (let i = 0; i < 5; i += 1) {
const flon = lon + (rand() - 0.5) * 3;
const flat = lat + (rand() - 0.5) * 3;
features.push([flon, flat, flon + 0.01, flat + 0.01]);
}
const truth = brute(lon, lat, features);
const got = viaIndex(lon, lat, features, cell);
if (got && truth && got.km < truth.km - 1e-9) understated += 1;
}
check("the index never returns a distance shorter than the true nearest",
understated === 0, `${understated} understatements`);
}
console.log(`\n${passed}/${passed + failures.length} checks passed`);
if (failures.length) {
console.error("\nFAILURES");
for (const f of failures) console.error(" " + f);
process.exit(1);
}Verify Parity
A Python command-line tool in the test folder of Grid Distance Maths that tests solar.
testgrid-distance-maths / test/verify_parity.py · lines 1–299 of 299 · Entry point · pattern _measure (shared by 2 files)
- What it does
- It tests solar. Defines 6 functions or classes, including add, close, measure, _rand, _measure. Uses libraries json, math, os, subprocess, sys. Side effects: starts processes.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (voltage levels 132kV (all 132kV or above)): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: solar, 132kV.
- Inputs & outputs
- Voltage levels named: 132kV.
- Downstream impact
- It is itself an entry point (Python CLI); no other file was found loading it.
- What it achieves
- It is built from the add step (`add`), the close step (`close`) and the measure step (`measure`). Prove `src/geodesy.py` and `src/geodesy.mjs` are the same mathematics. Its code works with 132 kV.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- grid-distance-maths · test · Python CLI
- Uses
- Geodesy (sys.path import), Parity Driver (script call), json, math, os, subprocess, sys
- Used by
- none found
- Produces
- add, close, main
- Defines here
- add, close, measure, _rand, _measure, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- grid-distance-maths@8e91b07d8312acca5bcaef43e839f06a3b1d642a test/verify_parity.py:1-299 · blob 2f2a4d369371d5bdf1458202a493a96eecf2c565 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
"""Prove src/geodesy.py and src/geodesy.mjs are the same mathematics.
The Python twin exists so that a payload built by a script and a panel drawn in
a browser agree by construction. That claim is only worth anything if something
checks it, so this does: it builds a case list, runs it through both
implementations, and fails on any disagreement larger than floating-point noise.
python test/verify_parity.py
Pure stdlib on the Python side; the JavaScript side is `node test/parity_driver.mjs`,
which does nothing but dispatch into src/geodesy.mjs.
Tolerance is 1e-9 relative for distances (nanometre-scale on a kilometre) and
exact for the caveat strings, because a consumer that shows a differently worded
caveat in one runtime than the other is a real defect, not a rounding one.
"""
import json
import math
import os
import subprocess
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(HERE)
sys.path.insert(0, os.path.join(ROOT, "src"))
import geodesy as G # noqa: E402
REL_TOL = 1e-9
ABS_TOL = 1e-12
# A spread of real UK grid geometry plus the awkward cases: the equator, a
# meridian crossing, a pole-adjacent pair, and a zero-length segment.
SITES = [
("Thorpe Marsh BESS", -1.085062, 53.580258),
("Crimscote Solar", -1.663000, 52.140000),
("Beinn an Tuirc", -5.585000, 55.560000),
("Cleve Hill Solar", 0.900000, 51.340000),
("Dogger Bank A", 1.900000, 54.750000),
("Lands End", -5.716000, 50.066000),
("Unst", -0.850000, 60.760000),
]
CASES = []
EXPECT = []
def add(op, args, py):
CASES.append({"op": op, "args": args})
EXPECT.append(py)
def close(a, b, label, path=""):
"""Structural comparison. Numbers within tolerance, everything else exact."""
if isinstance(a, dict) and isinstance(b, dict):
# Key names differ by language convention (primeVertical / prime_vertical),
# so compare by position-independent normalised key.
na = {k.replace("_", "").lower(): v for k, v in a.items()}
nb = {k.replace("_", "").lower(): v for k, v in b.items()}
if set(na) != set(nb):
return f"{label}{path}: key mismatch {sorted(na)} vs {sorted(nb)}"
for k in na:
bad = close(na[k], nb[k], label, f"{path}.{k}")
if bad:
return bad
return None
if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)):
if len(a) != len(b):
return f"{label}{path}: length {len(a)} vs {len(b)}"
for i, (x, y) in enumerate(zip(a, b)):
bad = close(x, y, label, f"{path}[{i}]")
if bad:
return bad
return None
if isinstance(a, bool) or isinstance(b, bool):
return None if a == b else f"{label}{path}: {a!r} vs {b!r}"
if isinstance(a, (int, float)) and isinstance(b, (int, float)):
if math.isnan(a) and math.isnan(b):
return None
if math.isclose(a, b, rel_tol=REL_TOL, abs_tol=ABS_TOL):
return None
return f"{label}{path}: {a!r} vs {b!r} (delta {abs(a - b):.3e})"
if a is None and b is None:
return None
return None if a == b else f"{label}{path}: {a!r} vs {b!r}"
# ---- build the case list -------------------------------------------------
add("constants", {},
{"R_ATLAS": G.R_ATLAS, "R_MEAN": G.R_MEAN, "R_UK": G.R_UK})
add("caveat", {}, G.STRAIGHT_LINE_CAVEAT)
for name, lon, lat in SITES:
add("curvature", {"lat": lat}, G.curvature_km(lat))
add("localScale", {"lat": lat}, G.local_scale_km(lat))
# Every ordered site pair, on all three radii.
for i, (n1, lo1, la1) in enumerate(SITES):
for j, (n2, lo2, la2) in enumerate(SITES):
if i == j:
continue
for r in (G.R_ATLAS, G.R_MEAN, G.R_UK):
add("distance",
{"lon1": lo1, "lat1": la1, "lon2": lo2, "lat2": la2, "radius": r},
G.distance_km(lo1, la1, lo2, la2, r))
ell = G.distance_ellipsoidal_km(lo1, la1, lo2, la2)
add("ellipsoidal", {"lon1": lo1, "lat1": la1, "lon2": lo2, "lat2": la2},
None if math.isnan(ell) else ell)
add("bearing", {"lon1": lo1, "lat1": la1, "lon2": lo2, "lat2": la2},
G.initial_bearing_deg(lo1, la1, lo2, la2))
# Degenerate and boundary distances.
for args in [
{"lon1": 0.0, "lat1": 0.0, "lon2": 0.0, "lat2": 0.0}, # identical
{"lon1": -0.001, "lat1": 51.5, "lon2": 0.001, "lat2": 51.5}, # metres apart
{"lon1": -179.9, "lat1": 0.0, "lon2": 179.9, "lat2": 0.0}, # antimeridian
{"lon1": 0.0, "lat1": 89.9, "lon2": 180.0, "lat2": 89.9}, # over the pole
]:
add("distance", args,
G.distance_km(args["lon1"], args["lat1"], args["lon2"], args["lat2"]))
# Point-to-segment, including the zero-length segment and both clamped ends.
SEGMENTS = [
(-1.09, 53.57, -1.07, 53.59),
(-1.09, 53.58, -1.09, 53.58), # zero length
(-2.00, 53.00, -1.00, 54.00),
(0.90, 51.34, 0.91, 51.35),
]
for name, lon, lat in SITES:
for (a_lon, a_lat, b_lon, b_lat) in SEGMENTS:
py = G.distance_to_segment_km(lon, lat, a_lon, a_lat, b_lon, b_lat)
add("segment", {"lon": lon, "lat": lat, "aLon": a_lon, "aLat": a_lat,
"bLon": b_lon, "bLat": b_lat},
{"km": py["km"], "foot": py["foot"], "t": py["t"]})
# A 132 kV-shaped polyline, measured from every site.
LINE = [[-1.20, 53.50], [-1.15, 53.55], [-1.10, 53.58], [-1.02, 53.61], [-0.95, 53.66]]
for name, lon, lat in SITES:
py = G.distance_to_line_km(lon, lat, LINE)
add("line", {"lon": lon, "lat": lat, "coords": LINE},
{"km": py["km"], "foot": py["foot"], "t": py["t"],
"segmentIndex": py["segment_index"]})
add("pathLength", {"coords": LINE}, G.path_length_km(LINE))
add("pathLength", {"coords": [[0.0, 0.0]]}, G.path_length_km([[0.0, 0.0]]))
for v in (8, 24, 64, 128):
add("circleError", {"vertices": v}, G.circle_approximation_error(v))
for name, lon, lat in SITES[:3]:
for km in (0.5, 10.0, 50.0):
add("circle", {"lon": lon, "lat": lat, "radiusKm": km, "vertices": 24},
G.geodesic_circle(lon, lat, km, 24))
for brg in (0.0, 47.5, 180.0, 359.9):
add("destination", {"lon": lon, "lat": lat, "km": km, "bearing": brg},
G.destination_point(lon, lat, km, brg))
RING = G.geodesic_circle(-1.085062, 53.580258, 3.0, 64)
add("polygon", {"coords": RING}, G.polygon_area_km2(RING))
add("polygon", {"coords": [[-1.1, 53.5], [-1.0, 53.5], [-1.0, 53.6], [-1.1, 53.6]]},
G.polygon_area_km2([[-1.1, 53.5], [-1.0, 53.5], [-1.0, 53.6], [-1.1, 53.6]]))
add("areaUnits", {"areaKm2": 12.3456}, G.area_units(12.3456))
# Nearest-feature search, including the isolated feature many rings out that
# the bounded-search defect used to miss.
FEATURES = [
[-1.20, 53.50, -1.15, 53.55],
[-1.10, 53.58, -1.02, 53.61],
[0.90, 51.34, 0.91, 51.35],
[-5.60, 55.55, -5.58, 55.57],
[-0.85, 60.75, -0.84, 60.77],
]
for name, lon, lat in SITES:
index = G.SpatialIndex(0.1)
for i, f in enumerate(FEATURES):
index.add_segment(i, f[0], f[1], f[2], f[3])
def measure(i, lon=lon, lat=lat):
f = FEATURES[i]
return G.distance_to_segment_km(lon, lat, f[0], f[1], f[2], f[3])["km"]
hit = index.nearest(lon, lat, measure)
add("nearest", {"lon": lon, "lat": lat, "features": FEATURES, "cell": 0.1},
None if hit is None else {"id": hit["id"], "km": hit["km"]})
# Randomised nearest-search layouts, including the shapes that exposed the
# bounded-search defect: high latitudes where a degree of longitude is narrow,
# and long segments that cross whole cells without ending in them.
#
# Parity alone would not have caught that defect -- both implementations were
# wrong in the same way, so they agreed. test/verify_nearest.mjs is what proves
# the JavaScript correct against exhaustive truth; these cases are what carry
# that guarantee across to the Python twin.
_rng = 20260831
def _rand():
global _rng
_rng = (_rng * 1103515245 + 12345) & 0x7FFFFFFF
return _rng / 0x7FFFFFFF
for cell, spread, seg, lat_lo, lat_hi in [
(0.1, 2.0, 0.02, 50, 61),
(0.1, 2.0, 0.02, 58, 61),
(0.5, 4.0, 0.05, 50, 61),
(0.1, 2.0, 0.90, 50, 61),
]:
for _ in range(30):
q_lat = lat_lo + _rand() * (lat_hi - lat_lo)
q_lon = -7 + _rand() * 9
feats = []
for _f in range(2 + int(_rand() * 5)):
f_lon = q_lon + (_rand() - 0.5) * spread
f_lat = q_lat + (_rand() - 0.5) * spread
feats.append([f_lon, f_lat,
f_lon + (_rand() - 0.5) * seg,
f_lat + (_rand() - 0.5) * seg])
idx = G.SpatialIndex(cell)
for fid, f in enumerate(feats):
idx.add_segment(fid, f[0], f[1], f[2], f[3])
def _measure(fid, lon=q_lon, lat=q_lat, feats=feats):
f = feats[fid]
return G.distance_to_segment_km(lon, lat, f[0], f[1], f[2], f[3])["km"]
h = idx.nearest(q_lon, q_lat, _measure)
add("nearest", {"lon": q_lon, "lat": q_lat, "features": feats, "cell": cell},
None if h is None else {"id": h["id"], "km": h["km"]})
# And the Python side must agree with exhaustive truth, not merely with
# the JavaScript.
truth = min(
({"id": i, "km": _measure(i)} for i in range(len(feats))),
key=lambda r: r["km"])
if h is None or abs(h["km"] - truth["km"]) > 1e-9:
raise SystemExit(
"python nearest disagrees with brute force at %.5f,%.5f: "
"index %r, truth %r" % (q_lon, q_lat, h, truth))
# ---- run the JavaScript side and compare ---------------------------------
def main():
driver = os.path.join(HERE, "parity_driver.mjs")
try:
proc = subprocess.run(
["node", driver], input=json.dumps(CASES).encode("utf-8"),
stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
except FileNotFoundError:
print("SKIP node is not on PATH; parity cannot be checked")
return 2
except subprocess.CalledProcessError as exc:
print("FAIL parity driver did not run")
print(exc.stderr.decode("utf-8", "replace"))
return 1
js = json.loads(proc.stdout.decode("utf-8"))
if len(js) != len(EXPECT):
print("FAIL case count mismatch: python %d, javascript %d"
% (len(EXPECT), len(js)))
return 1
failures = []
by_op = {}
for case, py, jsv in zip(CASES, EXPECT, js):
bad = close(py, jsv, case["op"])
by_op.setdefault(case["op"], [0, 0])
by_op[case["op"]][0] += 1
if bad:
failures.append(bad)
else:
by_op[case["op"]][1] += 1
width = max(len(k) for k in by_op)
for op in sorted(by_op):
total, passed = by_op[op]
mark = "PASS" if passed == total else "FAIL"
print(" [%s] %-*s %d/%d" % (mark, width, op, passed, total))
print()
if failures:
print("%d of %d parity checks FAILED" % (len(failures), len(CASES)))
for f in failures[:25]:
print(" " + f)
if len(failures) > 25:
print(" ... and %d more" % (len(failures) - 25))
return 1
print("%d/%d parity checks passed - geodesy.py and geodesy.mjs agree"
% (len(CASES), len(CASES)))
return 0
if __name__ == "__main__":
sys.exit(main())Verify Placement
A JavaScript module in the test folder of Grid Distance Maths that works with js rows (`jsRows`). It is built from the js rows helper (`jsRows`).
testgrid-distance-maths / test/verify_placement.mjs · lines 1–92 of 92 · Not reached from any entry point (candidate for review)
- What it does
- It tests its inputs. Defines jsRows. Uses libraries node:child_process. Side effects: starts processes.
- What it achieves
- Holds `placement.mjs` to `placement.py`. Neither is authoritative.
- Why it matters
- No other file in the estate was found to import it.
- Application
- grid-distance-maths · test · JavaScript module
- Uses
- Placement (script call), node:child_process
- Used by
- none found
- Produces
- jsRows
- Defines here
- jsRows
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- grid-distance-maths@8e91b07d8312acca5bcaef43e839f06a3b1d642a test/verify_placement.mjs:1-92 · blob 78a38feeb7afe86ed7190e7cd7f159f8845f7656 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: unreached_review
/* Holds placement.mjs to placement.py. Neither is authoritative.
*
* node test/verify_placement.mjs
*
* It writes the JavaScript answers, runs the Python half over the same inputs,
* and compares. A check that reached nothing FAILS: if the Python side does
* not run, or if either side produced no rows, this exits non-zero rather than
* reporting agreement over an empty set.
*/
import { execFileSync } from "node:child_process";
import { GOLDEN, golden, hilbert, hilbertOrder, lattice, morph } from "../src/placement.mjs";
const TOL = 1e-12;
const ORDER = 6; // 64 x 64 = 4096 points
const KEYS = 4096;
const RADICES = [3, 6, 15, 17, 101];
function jsRows() {
const rows = [];
for (let k = 0; k < KEYS; k++) {
const [gx, gy] = golden(k, 1.7);
const [hx, hy] = hilbert(k, ORDER);
const lat = lattice(k, RADICES);
const [mx, my] = morph([gx, gy], [hx, hy], (k % 11) / 10);
rows.push([gx, gy, hx, hy, ...lat, mx, my]);
}
return rows;
}
const PY = `
import json, sys
sys.path.insert(0, "src")
from placement import golden, hilbert, lattice, morph
ORDER, KEYS = ${ORDER}, ${KEYS}
RAD = ${JSON.stringify(RADICES)}
out = []
for k in range(KEYS):
g = golden(k, 1.7)
h = hilbert(k, ORDER)
lat = lattice(k, RAD)
m = morph(g, h, (k % 11) / 10)
out.append([g[0], g[1], h[0], h[1], *lat, m[0], m[1]])
print(json.dumps(out))
`;
const js = jsRows();
let py;
try {
py = JSON.parse(execFileSync("python", ["-c", PY], {
encoding: "utf8", maxBuffer: 1 << 28,
}));
} catch (err) {
console.error("FAIL: the Python half did not run, so nothing was compared.");
console.error("A check that reached nothing is not a pass.");
console.error(String(err.message).slice(0, 400));
process.exit(1);
}
if (js.length === 0 || py.length === 0) {
console.error("FAIL: one side produced no rows (js %d, py %d).", js.length, py.length);
process.exit(1);
}
if (js.length !== py.length) {
console.error("FAIL: row counts differ (js %d, py %d).", js.length, py.length);
process.exit(1);
}
let worst = 0, worstAt = -1, differ = 0;
for (let i = 0; i < js.length; i++) {
if (js[i].length !== py[i].length) {
console.error("FAIL: row %d has different widths.", i);
process.exit(1);
}
for (let c = 0; c < js[i].length; c++) {
const d = Math.abs(js[i][c] - py[i][c]);
if (d > worst) { worst = d; worstAt = i; }
if (d > TOL) differ += 1;
}
}
console.log("placement parity");
console.log(" rows compared %d, of %d columns each", js.length, js[0].length);
console.log(" golden angle %s", GOLDEN.toPrecision(12));
console.log(" hilbert order %d (side %d)", ORDER, 1 << ORDER);
console.log(" values over %s %d", TOL, differ);
console.log(" worst difference %s (row %d)", worst.toExponential(3), worstAt);
if (differ > 0) {
console.error("FAIL: the two implementations disagree.");
process.exit(1);
}
console.log("PASS: placement.mjs and placement.py agree on every value.");Build Verify Publish Atlas V9
A configuration file in the workflow archive folder of GridAtlas. Runs by hand.
automationgridatlas / .github/workflow-archive/202608301321-hostile-amnesia/202608291430-build-verify-publish-atlas-v9.yml · lines 1–23 of 23 · version 2026-08-29 14:30 · Not reached from any entry point (candidate for review)
- 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.
- What it achieves
- Named “Legacy staged publication archive”.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · .github/workflow-archive/202608301321-hostile-amnesia · configuration
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- 202608291430 Legacy staged publication archive
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 .github/workflow-archive/202608301321-hostile-amnesia/202608291430-build-verify-publish-atlas-v9.yml:1-23 · blob 664b1aa4a365d17147e22b75d81a141e5d5f0ecd · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: none found · domain stage: experimental · users: none · canonical: unreached_review
name: 202608291430 Legacy staged publication archive
run-name: Read archived 202608291430 publication status
on:
workflow_dispatch:
permissions: {}
jobs:
archived:
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
- name: Record retirement boundary
run: |
{
echo '## Archived 202608291430 workflow'
echo
echo '- Automatic state-pointer and release-path triggers were retired on 29 August 2026.'
echo '- The immutable 202608291430 release remains preserved.'
echo '- The active successor is the map-ready comparator-gated 202608292126 release programme.'
echo '- No repository mutation is performed here.'
} >> "$GITHUB_STEP_SUMMARY"Promote Root Current
A configuration file in the workflow archive folder of GridAtlas. Runs by hand.
automationgridatlas / .github/workflow-archive/202608301321-hostile-amnesia/202608291742-promote-root-current.yml · lines 1–23 of 23 · version 2026-08-29 17:42 · Not reached from any entry point (candidate for review)
- 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.
- What it achieves
- Named “Legacy root promotion archive”.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · .github/workflow-archive/202608301321-hostile-amnesia · configuration
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- 202608291742 Legacy root promotion archive
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 .github/workflow-archive/202608301321-hostile-amnesia/202608291742-promote-root-current.yml:1-23 · blob 37be64ca76ecfdd19a0a354f601aa5d8ebdf5e80 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: none found · domain stage: experimental · users: none · canonical: unreached_review
name: 202608291742 Legacy root promotion archive
run-name: Read archived root promotion status
on:
workflow_dispatch:
permissions: {}
jobs:
archived:
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
- name: Record retirement boundary
run: |
{
echo '## Archived root promotion workflow'
echo
echo '- Automatic workflow-run promotion was retired on 29 August 2026.'
echo '- It could otherwise restore the obsolete 202608291430 pointer.'
echo '- The successor workflow performs comparator-gated promotion of 202608292126-atlas-v9.'
echo '- No repository mutation is performed here.'
} >> "$GITHUB_STEP_SUMMARY"V9 Transfer Closure
A configuration file in the workflow archive folder of GridAtlas. Runs by hand.
automationgridatlas / .github/workflow-archive/202608301321-hostile-amnesia/202608291742-v9-transfer-closure.yml · lines 1–23 of 23 · version 2026-08-29 17:42 · Not reached from any entry point (candidate for review)
- 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.
- What it achieves
- Named “Legacy V9 transfer closure archive”.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · .github/workflow-archive/202608301321-hostile-amnesia · configuration
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- 202608291742 Legacy V9 transfer closure archive
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 .github/workflow-archive/202608301321-hostile-amnesia/202608291742-v9-transfer-closure.yml:1-23 · blob ffc8bada8211496f04dddf2a10fd619ee5c14f11 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: none found · domain stage: experimental · users: none · canonical: unreached_review
name: 202608291742 Legacy V9 transfer closure archive
run-name: Read archived V9 transfer closure status
on:
workflow_dispatch:
permissions: {}
jobs:
archived:
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
- name: Record retirement boundary
run: |
{
echo '## Archived closure workflow'
echo
echo '- Automatic schedule and release-path triggers were retired on 29 August 2026.'
echo '- This workflow was bound to the obsolete 202608291430 release contract.'
echo '- The successor authority is 202608292206 Build verify and promote map-ready V9.'
echo '- No repository mutation is performed here.'
} >> "$GITHUB_STEP_SUMMARY"