fix(gnss): separate GEV integrity classifier from GPSJAM aggregation; machine-readable provenance

Review on #855: the per-aircraft rule (NIC < 7 || NACp < 8, borrowed from
the US 14 CFR 91.227 ADS-B Out minima) is GEV-defined, not gpsjam's, and
gpsjam's map shows low navigation accuracy, not necessarily jamming.

- Primary cell state is now `navigation-integrity-anomaly` (medium/high) or
  `nominal`; `suspected-gnss-interference` is a secondary `interpretation`
  marked validated: false.
- GNSS_PROVENANCE / gnssProvenance({ windowMs }) records the classifier
  (gev-nic-nacp-v1, GEV, unvalidated), the gpsjam aggregation (formula,
  bands [0.02, 0.1], FAQ source) and the GEV 30-minute visited-view window,
  built from the constants the code applies. Exposed as layer.provenance
  and getStats().provenance; the proxy tags responses with `classifier`.
- Visible name "GNSS Integrity", legend "... low accuracy", blurb leads with
  low navigation accuracy and states the threshold is a GEV choice.
- Layer id `gnss-interference` and share token `0` unchanged.
- Voice aliases add "gnss integrity", "navigation integrity",
  "low navigation accuracy"; the interference aliases stay.
- Docs describe the method as GEV threshold + gpsjam aggregation.
- Tests: provenance object, renamed state/label, proxy classifier tag;
  qa-gnss asserts provenance and wording in the real app.

Hex project - Crew Leo Agile dev team.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Leo PechnickiandClaude Opus 5.5 authored and Mazeyar Moeini Feizabadi committed 2026-10-13 17:20:43 +02:00
1 parent 40b06a24d4
commit 6d4a2a02fe
16 files changed
+325 -67

No files matched your search

+43 -3
View File
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createGnssInterferenceLayer } from './index.js';
import { createGnssIntegrityLayer } from './index.js';
const row = (hex, lat, degraded) => ({
hex,
@@ -29,7 +29,7 @@ function harness(
};
let clock = 1_000;
const anchors = [];
const layer = createGnssInterferenceLayer({
const layer = createGnssIntegrityLayer({
source: { getSnapshot },
viewAnchor: () => {
anchors.push(anchor);
@@ -49,7 +49,7 @@ function harness(
}
test('the layer requires a snapshot source and cannot be initialized twice', () => {
assert.throws(() => createGnssInterferenceLayer({}), TypeError);
assert.throws(() => createGnssIntegrityLayer({}), TypeError);
const { layer } = harness(async () => ({ rows: [] }));
assert.throws(() => layer.init({ dataSources: { add() {} } }), /already/);
});
@@ -91,6 +91,46 @@ test('an enabled refresh bins the snapshot into coloured ground cells', async ()
assert.match(legend[0].blurb, /fewer than 3 aircraft are not drawn/);
});
test('the visible layer leads with low navigation accuracy and exposes its provenance', async () => {
const { layer } = harness(async () => ({ rows: [], stale: false }));
assert.equal(layer.id, 'gnss-interference', 'the share-link id is unchanged');
assert.equal(layer.name, 'GNSS Integrity');
assert.doesNotMatch(layer.name, /interference|jamming/i);
const { legend } = layer.getRowControls();
assert.deepEqual(
legend.map(({ label }) => label),
['Over 10% low accuracy', '2–10% low accuracy', 'Under 2% low accuracy'],
);
const { blurb } = legend[0];
assert.match(
blurb,
/^Share of ADS-B aircraft reporting low navigation accuracy/,
);
assert.match(blurb, /NIC < 7 or NACp < 8/);
assert.match(blurb, /GEV threshold/);
assert.match(blurb, /not a published interference test/);
assert.match(blurb, /gpsjam\.org's formula and 2% \/ 10% bands/);
assert.match(blurb, /navigation-integrity anomalies/);
// Interference appears only as the secondary, hedged reading.
assert.ok(
blurb.indexOf('navigation-integrity anomalies') <
blurb.indexOf('Suspected jamming or spoofing'),
);
assert.equal(layer.provenance.classifier.id, 'gev-nic-nacp-v1');
assert.equal(layer.provenance.classifier.definedBy, 'GEV');
assert.equal(layer.provenance.classifier.validated, false);
assert.equal(layer.provenance.aggregation.source, 'https://gpsjam.org/faq');
assert.deepEqual(layer.provenance.window, {
minutes: 30,
scope: 'visited-view',
cellDeg: 0.5,
minAircraft: 3,
definedBy: 'GEV',
});
assert.equal(layer.provenance.interpretation.validated, false);
assert.equal(layer.getStats().provenance, layer.provenance);
});
test('a failed refresh keeps the last cells and reports the error', async () => {
let fail = false;
const { layer, sources } = harness(async () => {