mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge main into feat/shipwrecks; move shipwrecks to token 00
Main's wildlife-sightings layer took share-link token 9, so shipwrecks takes the next free token, 00. Locale, docs, format-scope and voice manifest conflicts keep both sides. Ledger and registry tests now model the ledger before shipwrecks took 00, and layer counts include both new layers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
096b3c85bf
202 files changed
+29339
-622
No files matched your search
@@ -203,8 +203,8 @@ function encode(state) {
|
||||
|
||||
test('production registry is exact, canonical, and rejects incomplete contracts', async () => {
|
||||
assert.equal(validateLayerStateRegistry(), true);
|
||||
assert.equal(REGISTERED_LAYER_IDS.length, 36);
|
||||
assert.equal(new Set(REGISTERED_LAYER_IDS).size, 36);
|
||||
assert.equal(REGISTERED_LAYER_IDS.length, 37);
|
||||
assert.equal(new Set(REGISTERED_LAYER_IDS).size, 37);
|
||||
assert.ok(REGISTERED_LAYER_IDS.includes('transit'));
|
||||
assert.deepEqual(REGISTERED_LAYER_IDS, [...REGISTERED_LAYER_IDS].sort());
|
||||
assert.deepEqual(LEGACY_LAYER_STATE_TOKENS, {
|
||||
@@ -243,17 +243,24 @@ test('production registry is exact, canonical, and rejects incomplete contracts'
|
||||
for (const [id, token] of Object.entries(LEGACY_LAYER_STATE_TOKENS)) {
|
||||
assert.equal(LAYER_STATE_TOKEN_RESERVATIONS[id], token);
|
||||
}
|
||||
assert.equal(nextLayerStateToken(), '00');
|
||||
assert.equal(nextLayerStateToken(), '01');
|
||||
// The allocation rules below start from the ledger as it stood before
|
||||
// shipwrecks took 00.
|
||||
const preShipwrecks = { ...LAYER_STATE_TOKEN_RESERVATIONS };
|
||||
delete preShipwrecks.shipwrecks;
|
||||
assert.equal(nextLayerStateToken(preShipwrecks), '00');
|
||||
assert.equal(
|
||||
nextLayerStateToken({
|
||||
...LAYER_STATE_TOKEN_RESERVATIONS,
|
||||
alpha: '00',
|
||||
bravo: '01',
|
||||
...preShipwrecks,
|
||||
alpha: '9',
|
||||
bravo: '00',
|
||||
}),
|
||||
'02',
|
||||
'01',
|
||||
);
|
||||
// shipwrecks took the last single digit, 9.
|
||||
const digitsExhausted = { ...LAYER_STATE_TOKEN_RESERVATIONS };
|
||||
const digitsExhausted = {
|
||||
...preShipwrecks,
|
||||
...Object.fromEntries([...'9'].map((digit) => [`prior-${digit}`, digit])),
|
||||
};
|
||||
assert.equal(nextLayerStateToken(digitsExhausted), '00');
|
||||
assert.equal(
|
||||
nextLayerStateToken({ ...digitsExhausted, retired: '00', used: '01' }),
|
||||
@@ -302,8 +309,8 @@ test('production registry is exact, canonical, and rejects incomplete contracts'
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
validateLayerStateAllocations(LAYER_STATE_TOKEN_RESERVATIONS, {
|
||||
...LAYER_STATE_TOKEN_RESERVATIONS,
|
||||
validateLayerStateAllocations(preShipwrecks, {
|
||||
...preShipwrecks,
|
||||
future: '00',
|
||||
next: '01',
|
||||
}),
|
||||
@@ -311,14 +318,15 @@ test('production registry is exact, canonical, and rejects incomplete contracts'
|
||||
);
|
||||
assert.throws(
|
||||
() =>
|
||||
validateLayerStateAllocations(LAYER_STATE_TOKEN_RESERVATIONS, {
|
||||
...LAYER_STATE_TOKEN_RESERVATIONS,
|
||||
validateLayerStateAllocations(preShipwrecks, {
|
||||
...preShipwrecks,
|
||||
future: '01',
|
||||
}),
|
||||
/next free token 00/,
|
||||
);
|
||||
const beforeLastDigit = { ...digitsExhausted };
|
||||
delete beforeLastDigit.shipwrecks;
|
||||
delete beforeLastDigit['prior-9'];
|
||||
delete beforeLastDigit['wildlife-sightings'];
|
||||
assert.equal(
|
||||
validateLayerStateAllocations(beforeLastDigit, {
|
||||
...beforeLastDigit,
|
||||
@@ -338,10 +346,10 @@ test('production registry is exact, canonical, and rejects incomplete contracts'
|
||||
assert.throws(
|
||||
() =>
|
||||
validateLayerStateAllocations(
|
||||
{ ...LAYER_STATE_TOKEN_RESERVATIONS, merged: '00' },
|
||||
{ ...LAYER_STATE_TOKEN_RESERVATIONS, merged: '00', competing: '00' },
|
||||
{ ...preShipwrecks, merged: '9' },
|
||||
{ ...preShipwrecks, merged: '9', competing: '9' },
|
||||
),
|
||||
/next free token 01/,
|
||||
/next free token 00/,
|
||||
);
|
||||
assert.throws(
|
||||
() => validateLayerStateAllocations({ future: '00' }, { future: '01' }),
|
||||
@@ -497,7 +505,7 @@ test('unknown enabled-layer tokens reject the payload instead of becoming an emp
|
||||
});
|
||||
|
||||
test('malformed enabled-layer lists reject the entire payload', () => {
|
||||
for (const value of ['.c', 'c.', 'c..e', 'c.c', '00', 'c.00']) {
|
||||
for (const value of ['.c', 'c.', 'c..e', 'c.c', '01', 'c.01']) {
|
||||
assert.equal(
|
||||
decodeLayerStateParams(new URLSearchParams(`v=2&l=${value}`)),
|
||||
null,
|
||||
@@ -2693,6 +2701,32 @@ test('the recent-imagery split is share-link only: never stored locally, and a s
|
||||
);
|
||||
});
|
||||
|
||||
test('wildlife confirmed and every taxa preset round-trip through the full share codec', () => {
|
||||
assert.equal(
|
||||
LAYER_STATE_REGISTRY.find(({ id }) => id === 'wildlife-sightings').token,
|
||||
'9',
|
||||
);
|
||||
for (const taxa of [
|
||||
'all',
|
||||
'Aves',
|
||||
'Mammalia',
|
||||
'whales',
|
||||
'Insecta',
|
||||
'Plantae',
|
||||
]) {
|
||||
const state = normalizeLayerState({
|
||||
enabledLayerIds: ['wildlife-sightings'],
|
||||
options: { 'wildlife-sightings': { confirmed: true, taxa } },
|
||||
});
|
||||
const encoded = encode(state);
|
||||
assert.doesNotMatch(encoded, /undefined/);
|
||||
assert.deepEqual(
|
||||
decodeLayerStateParams(new URLSearchParams(encoded)),
|
||||
state,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('drone restrictions uses digit 8 without colliding with fire perimeters', () => {
|
||||
const decoded = decodeLayerStateParams(new URLSearchParams('v=2&l=8.2'));
|
||||
assert.deepEqual(decoded.enabledLayerIds, [
|
||||
@@ -2709,22 +2743,6 @@ test('drone restrictions uses digit 8 without colliding with fire perimeters', (
|
||||
);
|
||||
});
|
||||
|
||||
test('shipwrecks uses digit 9 without colliding with drone restrictions', () => {
|
||||
const decoded = decodeLayerStateParams(new URLSearchParams('v=2&l=9.8'));
|
||||
assert.deepEqual(decoded.enabledLayerIds, [
|
||||
'drone-airspace',
|
||||
'shipwrecks',
|
||||
]);
|
||||
assert.equal(
|
||||
LAYER_STATE_REGISTRY.find(({ id }) => id === 'shipwrecks').token,
|
||||
'9',
|
||||
);
|
||||
assert.deepEqual(
|
||||
decodeLayerStateParams(new URLSearchParams(encode(decoded))),
|
||||
decoded,
|
||||
);
|
||||
});
|
||||
|
||||
test('GNSS interference uses digit 3 without colliding with other digit tokens', () => {
|
||||
const decoded = decodeLayerStateParams(new URLSearchParams('v=2&l=3.2.1'));
|
||||
assert.deepEqual(decoded.enabledLayerIds, [
|
||||
|
||||
Reference in new issue
Block a user