fix(reference): verify station coverage and rollback inputs
This commit is contained in:
@@ -13,7 +13,7 @@ try {
|
||||
assert.equal(names.get(34), 'Tritanium');
|
||||
assert.equal(names.get(587), 'Rifter');
|
||||
const counts: Record<string, number> = {};
|
||||
for (const table of ['types', 'blueprints', 'systems', 'gates', 'unresolved_references']) {
|
||||
for (const table of ['types', 'blueprints', 'systems', 'gates', 'stations', 'unresolved_references']) {
|
||||
const row = db.query<{ n: number }, []>(`SELECT COUNT(*) AS n FROM ${table}`).get();
|
||||
counts[table] = Number(row?.n);
|
||||
assert.equal(counts[table], manifest.active.counts[table], `${table} must match the published manifest`);
|
||||
@@ -22,6 +22,14 @@ try {
|
||||
assert(counts.systems > 5_000);
|
||||
assert(counts.blueprints > 0);
|
||||
assert(counts.gates > 0);
|
||||
const verifiedStations = Number((db.query<{ n: number }, []>('SELECT COUNT(*) AS n FROM stations WHERE source_verified = 1').get() as { n: number }).n);
|
||||
assert.equal(verifiedStations, manifest.active.counts.verified_stations, 'verified station count must match the published manifest');
|
||||
assert(verifiedStations > 0);
|
||||
const joinedStations = Number((db.query<{ n: number }, []>('SELECT COUNT(*) AS n FROM stations st JOIN systems s ON s.system_id = st.system_id JOIN constellations c ON c.constellation_id = s.constellation_id JOIN regions r ON r.region_id = c.region_id').get() as { n: number }).n);
|
||||
assert.equal(joinedStations, counts.stations, 'every station must join through system, constellation, and region');
|
||||
const verifiedStation = (await repository.stations({ limit: 1 })).find((station) => station.sourceVerified);
|
||||
assert(verifiedStation, 'reader must expose a verified station row');
|
||||
assert.deepEqual(await repository.stations([Number.MAX_SAFE_INTEGER]), [], 'unknown station IDs must remain absent rather than fabricated');
|
||||
const integrity = db.query<{ integrity_check: string }, []>('PRAGMA integrity_check').all();
|
||||
assert.deepEqual(integrity.map(row => row.integrity_check), ['ok']);
|
||||
assert.deepEqual(db.query('PRAGMA foreign_key_check').all(), []);
|
||||
|
||||
Reference in New Issue
Block a user