diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf3c82a..da113c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
+- Latency customers only ask for a ceiling something you can build meets. Before, a Mars ground station could ask for 4.3 ms between Pevek and Anadyr, where the only sea route takes 7.7 ms at best. (#273)
- Money now shows billions (`$1.20B`) and bandwidth shows petabits (`1.00 Pbps`) instead of running on in millions and terabits, including on the NOC graph and the fiber labels on the map.
- DE-Kicks ports stop getting dearer once they cost four times the list price. Before, the yearly price harmonisation kept compounding, so a long game ended up paying $100k a month for one port at Frankfurt or Mumbai.
- An exchange port, a transit port or a PNI can now be stepped down one size from its panel, so shrinking a port no longer means leaving and rejoining (a PNI cannot while an augment is on order).
diff --git a/src/game/80-simulation/80-geography-and-latency.js b/src/game/80-simulation/80-geography-and-latency.js
index 32173ba..f9c1adc 100644
--- a/src/game/80-simulation/80-geography-and-latency.js
+++ b/src/game/80-simulation/80-geography-and-latency.js
@@ -50,3 +50,15 @@ function viaSeg(a,b){const cabs=cablesOk(a,b),sub=isSub(a,b);if(!cabs.length)ret
const opts=(sub?[]:[{v:'land',l:`${tr('common.overland')} ${landMult(a,b)>1?landMult(a,b)+'× · ':''}${(kmBetween(a,b)*1.3/200).toFixed(1)} ms`}]).concat(cabs.map(c=>({v:c.cid,l:`${esc(CAB[c.cid].name)} ${CAB[c.cid].price}× · ${(c.km*(CAB[c.cid].lat||1)/200).toFixed(1)} ms${CAB[c.cid].age==='old'?' · '+tr('geography_and_latency.old_cuts_often'):''}`})));
return `
${tr('common.route')}
${opts.map(o=>btn(o.l,'via',{v:o.v},wr&&wr.via===o.v?'pink':'ghost')).join('')}
${wr&&wr.cab?`${esc(CAB[wr.cab].blurb)} ${tr('geography_and_latency.all_your_waves_on_one_cable')}
`:''}`;}
function bestLat(a,b,f){const ls=S.links.filter(l=>!linkDown(l)&&(!f||f(l)));const dist={[a]:0},done=new Set();for(;;){let u=null,ud=Infinity;for(const k in dist)if(!done.has(k)&&dist[k]LU.includes(x))?kmBetween(U.id,V.id)*1.1:Infinity;if(cw=3?0.65:0.3))reqs.push(pick(pool));
if(T.lv>=3&&Math.random()<0.35){const more=pool.filter(k=>!reqs.includes(k));if(more.length)reqs.push(pick(more));}
const r2=Math.round(rate*(1+reqs.reduce((a,k)=>a+REQS[k].bonus,0)));
- S.offers.push({id:uid(),city,city2,name,type:t,bw,rate:r2,reqs,latMax:T.lat?+(kmBetween(city,city2)/200*1.35).toFixed(1):null,exp:S.day+40});
+ // A latency ceiling must be one something you can build meets (#273), as diverse paths must be possible.
+ const latMax=T.lat?latMaxOf(city,city2):null;if(T.lat&&!(Math.min(latFloor(city,city2),bestLat(city,city2))<=latMax))return;
+ S.offers.push({id:uid(),city,city2,name,type:t,bw,rate:r2,reqs,latMax,exp:S.day+40});
}
diff --git a/tests/latency-offers.test.js b/tests/latency-offers.test.js
new file mode 100644
index 0000000..32f9e1f
--- /dev/null
+++ b/tests/latency-offers.test.js
@@ -0,0 +1,39 @@
+// #273: a latency offer only asks for a ceiling something you can build meets. Pevek–Anadyr is 635 km apart as the
+// crow flies, but only a 1,717 km sea route joins them, so a 4.3 ms ceiling can never be met.
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const { load } = require('./harness');
+
+// Spawn many mars offers from a network at Pevek and Anadyr only: most are between the two.
+const marsOnly = "eval('('+spawnOffer.toString().replace('const t=pick(types)',\"const t='mars'\")+')')";
+const spawn = (ev, n) => ev(`(()=>{S.offers=[];const f=${marsOnly};for(let i=0;i<${n};i++)f();return JSON.stringify(S.offers.map(o=>[o.city,o.city2,o.latMax]));})()`);
+const start = (ev, cities) => ev(`ACT.start({});S.cash=1e9;S.nextFail=1e9;S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;S.lvl=13;S.pops={};for(const c of ${JSON.stringify(cities)})S.pops[c]={day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};compute()`);
+
+test('#273 no latency offer between Pevek and Anadyr: no buildable path meets the straight-line ceiling', () => {
+ const { ev, errors } = load();
+ start(ev, ['pvs', 'dyr']);
+ assert.ok(ev('lvl()') >= 13, 'mars offers are unlocked');
+ assert.equal(ev("latMaxOf('pvs','dyr')"), 4.3);
+ const pair = o => [o[0], o[1]].sort().join('-') === 'dyr-pvs';
+ const offers = JSON.parse(spawn(ev, 60));
+ assert.ok(offers.length > 0, 'mars offers still spawn');
+ assert.deepEqual(offers.filter(pair), [], 'but none asks for 4.3 ms between Pevek and Anadyr');
+ assert.ok(!(ev("latFloor('pvs','dyr')") <= 4.3), 'nothing on the map gets there in 4.3 ms');
+ // Even with the player's own Low latency cable, 7.7 ms is the best there is.
+ ev("S.links.push({id:'own1',a:'pvs',b:'dyr',kind:'df',own:true,sub:true,seaDesign:'express',sys:'roadm',ch:[],km:1717,cable:null,mo:1,trench:'own:own1',cut:0,day:0,ready:0,pairs:1});compute()");
+ assert.ok(ev("bestLat('pvs','dyr')") > 4.3);
+ assert.deepEqual(JSON.parse(spawn(ev, 60)).filter(pair), []);
+ assert.deepEqual(errors, []);
+});
+
+test('#273 latency offers still come where a build meets the ceiling', () => {
+ const { ev, errors } = load();
+ start(ev, ['lon', 'nyc']);
+ const offers = JSON.parse(spawn(ev, 60));
+ assert.ok(offers.length > 0, 'London–New York has latency offers');
+ for (const [a, b, max] of offers) assert.ok(ev(`latFloor('${a}','${b}')`) <= max, `${a}–${b} within ${max} ms is buildable`);
+ // The floor is what bestLat() would read on the links it describes: a wave on the fastest London–New York cable.
+ const f = ev("latFloor('lon','nyc')"), c = ev("Math.min(...cablesFor('lon','nyc').map(c=>c.km*Math.min(0.9,CAB[c.cid].lat||1)))/200+0.05");
+ assert.ok(Math.abs(f - c) < 1e-9);
+ assert.deepEqual(errors, []);
+});