d464459838
Ten agents wrote this in parallel against CONTRACT.md, which exists because the five design agents before them collided on fifteen blocking points — four files specified twice with incompatible contents, three separate backends for one box, and `Environment` exported twice meaning different things. What landed: a Stage owning only the renderer and the loop, with the city and an office as two scenes over it. They cannot share one — San Francisco is ~94 m per scene unit with 3.6x vertical exaggeration and an office is 1 unit = 1 m — and the city is paused rather than disposed on the way in, because rebuilding its 336,864-point heightfield costs about a second on the way back out. Offices are data. `src/offices/lumbridge-hq.ts` is fifteen rooms and seventy-six seats, and it is the file a self-hoster copies. Walls are a segment list with 1-D openings, so doors and windows are holes punched in a wall rather than placed objects, and the pass that splits a wall around its openings hands the walk-mode collider its segments for free. The sun is real. `solar.ts` is a NOAA/Meeus implementation with no imports at all — not even three.js — so time of day keeps working on a laptop in a field. Verified against known values: 75.45 degrees at the June solstice in SF, 28.79 at December, sunset at 03:15Z. The first screenshot after wiring it was a black rectangle, which turned out to be correct: it was midnight in San Francisco. Presence binds to a seat id and never to a coordinate. The pack knows where `eng-04` is; who is sitting in it is private data behind an API. Same shape as the marker rule, one level in. Two corrections to ARCHITECTURE.md are in here. Containment does not discharge ODbL — publishing OSM-derived coordinates is Public Use of a Derivative Database wherever the rows live, so the rule is about the geocoder (US Census, public domain) and not the storage. And a person at a desk is not a Marker; markers are geographic. One contract gap surfaced only in a screenshot: two agents read `height` on a viewpoint differently, so the establishing shot aimed at empty air fourteen metres above the roof. It now means what the same field means for a city. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
81 lines
2.9 KiB
TypeScript
81 lines
2.9 KiB
TypeScript
/**
|
|
* The provenance gate, which is the sharpest correction in CONTRACT.md and the
|
|
* one with an actual licence behind it.
|
|
*
|
|
* The row that must be refused is the one that looks completely fine: correct
|
|
* fields, plausible coordinates, and a provenance of `nominatim`. Serving it
|
|
* would make this endpoint a Publicly Used Derivative Database and pull ODbL
|
|
* §4.3 and §4.4 onto everything served next to it. See CONTRACT.md §8.
|
|
*/
|
|
|
|
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
import { DEFAULT_PROVENANCE_ALLOWLIST } from "../config.ts";
|
|
import { assertPublicShape } from "../markers/gate.ts";
|
|
|
|
const good = {
|
|
id: "acme-hq",
|
|
label: "Acme",
|
|
colorKey: "sector.industrial",
|
|
lat: 37.79,
|
|
lng: -122.4,
|
|
provenance: "us-census",
|
|
};
|
|
|
|
describe("the public-shape gate", () => {
|
|
it("accepts a US Census row", () => {
|
|
const { accepted, refused } = assertPublicShape([good], DEFAULT_PROVENANCE_ALLOWLIST);
|
|
assert.equal(accepted.length, 1);
|
|
assert.deepEqual(refused, []);
|
|
assert.equal(accepted[0]?.provenance, "us-census");
|
|
});
|
|
|
|
it("refuses an OSM-derived row that is otherwise perfect", () => {
|
|
const row = { ...good, provenance: "nominatim" };
|
|
const { accepted, refused } = assertPublicShape([row], DEFAULT_PROVENANCE_ALLOWLIST);
|
|
assert.equal(accepted.length, 0);
|
|
assert.equal(refused.length, 1);
|
|
assert.match(refused[0]?.reason ?? "", /allowlist/);
|
|
});
|
|
|
|
it("refuses a row with no provenance at all", () => {
|
|
const { provenance: _omitted, ...row } = good;
|
|
const { accepted } = assertPublicShape([row], DEFAULT_PROVENANCE_ALLOWLIST);
|
|
assert.equal(accepted.length, 0);
|
|
});
|
|
|
|
it("refuses commercial geocoders too — 'not OSM' is not the test", () => {
|
|
for (const provenance of ["google", "mapbox", "here"]) {
|
|
const { accepted } = assertPublicShape(
|
|
[{ ...good, provenance }],
|
|
DEFAULT_PROVENANCE_ALLOWLIST,
|
|
);
|
|
assert.equal(accepted.length, 0, `${provenance} must not pass`);
|
|
}
|
|
});
|
|
|
|
it("refuses the whole row when it carries a field nobody reviewed", () => {
|
|
const row = { ...good, ownerEmail: "someone@example.com" };
|
|
const { accepted, refused } = assertPublicShape([row], DEFAULT_PROVENANCE_ALLOWLIST);
|
|
assert.equal(accepted.length, 0);
|
|
assert.match(refused[0]?.reason ?? "", /unknown field "ownerEmail"/);
|
|
});
|
|
|
|
it("refuses malformed coordinates", () => {
|
|
const rows = [
|
|
{ ...good, lat: 200 },
|
|
{ ...good, lng: "west" },
|
|
{ ...good, id: "" },
|
|
];
|
|
const { accepted } = assertPublicShape(rows, DEFAULT_PROVENANCE_ALLOWLIST);
|
|
assert.equal(accepted.length, 0);
|
|
});
|
|
|
|
it("aggregates refusals so a broken sync is one line, not ten thousand", () => {
|
|
const rows = Array.from({ length: 500 }, () => ({ ...good, provenance: "osm" }));
|
|
const { refused } = assertPublicShape(rows, DEFAULT_PROVENANCE_ALLOWLIST);
|
|
assert.equal(refused.length, 1);
|
|
assert.equal(refused[0]?.count, 500);
|
|
});
|
|
});
|