address review findings on voice outlines

- remove the unused Nominatim reserve(); spacing tests now measure the
  actual transport start across processes
- start each queued building's 2 s ground-sampling budget when it
  reaches the head of the queue, and request a frame on promotion
- accept Nominatim and grounds outlines that cross the antimeridian
- let an unnamed school, university, hospital, cemetery, stadium or zoo
  area answer a grounds ask whose head noun names that kind, using only
  the part that holds the point; compare grounds names symmetrically
- charge shared OpenFreeMap consumers their own slice and keep the
  charged budget at the previous 64 MiB
- share one place-name fold, point-in-polygon, line stitching and
  nextTask helper instead of duplicates
- exclude Who's On First sources licensed only as "CC BY (equivalent)"
  or "CC0 (equivalent)"; rebuild the pack from the pinned archives
- whole-word neighbourhood alias guard; correct the outline size-limit
  comment
- restore DATA_SOURCES.md table formatting, keeping only real edits
- test behaviour instead of private engine fields
This commit is contained in:
manjunath committed 2026-10-30 20:47:20 +05:30
1 parent 5a1cfa6800
commit 2e82425d62
37 files changed
+921 -481

No files matched your search

+36 -21
View File
@@ -147,7 +147,7 @@ test('a sweep removes expired and corrupt entries, never ones it could not read'
);
});
test('processes sharing state reserve public spacing and cap atomically', async (t) => {
test('processes sharing state space public sends and cap atomically', async (t) => {
const dir = tempDir(t);
const module = new URL(
'../../server/providers/regional/nominatimGate.js',
@@ -157,12 +157,24 @@ test('processes sharing state reserve public spacing and cap atomically', async
const script = `
const { createGateStateStore } = await import(${JSON.stringify(module)});
const store = createGateStateStore({ file: ${JSON.stringify(file)} });
console.log(JSON.stringify(store.reserve('2026-09-29', {
now: 1000,
dailyCap: ${dailyCap},
minSpacingMs: 1100,
latestStartAt: 10000,
})));
const latestStartAt = Date.now() + 10000;
let sentAt = null;
for (;;) {
const result = store.dispatch(
'2026-09-29',
{ clock: Date.now, dailyCap: ${dailyCap}, minSpacingMs: 300, latestStartAt },
() => {
sentAt = Date.now();
return Promise.resolve();
},
);
if (result.status === 'wait') {
await new Promise((resolve) => setTimeout(resolve, result.waitMs));
continue;
}
console.log(JSON.stringify({ status: result.status, sentAt }));
break;
}
`;
return new Promise((resolve, reject) => {
const child = spawn(process.execPath, [
@@ -183,19 +195,22 @@ test('processes sharing state reserve public spacing and cap atomically', async
};
const spacedFile = path.join(dir, 'spaced.json');
const reservations = await Promise.all([
const sends = await Promise.all([
run(spacedFile, 3),
run(spacedFile, 3),
run(spacedFile, 3),
]);
assert.deepEqual(
reservations.map((result) => result.status),
['reserved', 'reserved', 'reserved'],
);
assert.deepEqual(
reservations.map((result) => result.startAt).sort((a, b) => a - b),
[1000, 2100, 3200],
sends.map((result) => result.status),
['started', 'started', 'started'],
);
// Spacing is measured between actual transport invocations.
const sentAt = sends.map((result) => result.sentAt).sort((a, b) => a - b);
for (let i = 1; i < sentAt.length; i += 1)
assert.ok(
sentAt[i] - sentAt[i - 1] >= 300,
`${sentAt[i] - sentAt[i - 1]}ms apart`,
);
assert.equal(
createGateStateStore({ file: spacedFile }).count('2026-09-29'),
3,
@@ -205,7 +220,7 @@ test('processes sharing state reserve public spacing and cap atomically', async
const capped = await Promise.all([run(cappedFile, 1), run(cappedFile, 1)]);
assert.deepEqual(capped.map((result) => result.status).sort(), [
'cap',
'reserved',
'started',
]);
assert.equal(
createGateStateStore({ file: cappedFile }).count('2026-09-29'),
@@ -427,12 +442,12 @@ test('parseable but invalid public usage state fails closed', async (t) => {
);
const migrated = createGateStateStore({ file });
assert.equal(
migrated.reserve('2026-09-30', {
now: 1000,
dailyCap: 50,
minSpacingMs: 1100,
}).status,
'reserved',
migrated.dispatch(
'2026-09-30',
{ clock: () => 1000, dailyCap: 50, minSpacingMs: 1100 },
() => Promise.resolve(),
).status,
'started',
'the original state format without nextStartAt remains supported',
);
});
+31 -25
View File
@@ -91,11 +91,12 @@ function contenderScript(stateFile, lockWaitMs) {
onError: () => {},
});
process.stdout.write('ATTEMPTING\\n', () => {
const result = store.reserve('2026-10-01', {
now: 1000,
dailyCap: 50,
minSpacingMs: 1100,
});
const result = store.dispatch(
'2026-10-01',
{ clock: () => 1000, dailyCap: 50, minSpacingMs: 1100 },
() => Promise.resolve(),
);
delete result.value;
process.stdout.write('RESULT:' + JSON.stringify(result) + '\\n');
});
`;
@@ -153,16 +154,14 @@ test('a crashed lock owner cannot delete or bypass a successor lock', async (t)
successorOwner.child.stdin.end('release\n');
await successorOwner.waitFor('RELEASED');
assert.equal((await successorOwner.exited).code, 0);
const afterRelease = createGateStateStore({ file: stateFile }).reserve(
const released = createGateStateStore({ file: stateFile });
const afterRelease = released.dispatch(
'2026-10-01',
{
now: 2200,
dailyCap: 50,
minSpacingMs: 1100,
},
{ clock: () => 2200, dailyCap: 50, minSpacingMs: 1100 },
() => Promise.resolve(),
);
assert.equal(afterRelease.status, 'reserved');
assert.equal(afterRelease.count, 1);
assert.equal(afterRelease.status, 'started');
assert.equal(released.count('2026-10-01'), 1);
assert.equal(fs.statSync(lockFile).ino, originalLock.ino);
});
@@ -211,22 +210,29 @@ test('a public pause stays authoritative while another process owns the lock', a
assert.equal((await owner.exited).code, 0);
const successor = createGateStateStore({ file: stateFile });
let sent = 0;
const send = () => {
sent += 1;
return Promise.resolve();
};
assert.deepEqual(
successor.reserve('2026-10-01', {
now: 1000,
dailyCap: 50,
minSpacingMs: 1100,
}),
successor.dispatch(
'2026-10-01',
{ clock: () => 1000, dailyCap: 50, minSpacingMs: 1100 },
send,
),
{ status: 'paused', retryAfterMs: 8000 },
'a fresh process observes the pending refusal pause',
);
const resumed = successor.reserve('2026-10-01', {
now: 9001,
dailyCap: 50,
minSpacingMs: 1100,
});
assert.equal(resumed.status, 'reserved');
assert.equal(resumed.count, 2);
assert.equal(sent, 0, 'a paused dispatch never starts the transport');
const resumed = successor.dispatch(
'2026-10-01',
{ clock: () => 9001, dailyCap: 50, minSpacingMs: 1100 },
send,
);
assert.equal(resumed.status, 'started');
assert.equal(sent, 1);
assert.equal(successor.count('2026-10-01'), 2);
assert.equal(
fs.readdirSync(dir).some((name) => name.startsWith('state.json.pause.')),
false,