diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8fda4a9..03fea07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
+- A wave size that is sold out on a route can no longer be reached by upgrading a smaller wave on it (#201). The upgrade button says how long it is sold out, just like when buying.
- Choosing Both for a PNI with one member now really splits it: the second member arrives in the other building when the augment lands, instead of joining the first (#219).
## [2.0.0] — 2026-10-30
diff --git a/src/game/90-actions/60-links.js b/src/game/90-actions/60-links.js
index a564a7e..f9b7d87 100644
--- a/src/game/90-actions/60-links.js
+++ b/src/game/90-actions/60-links.js
@@ -1,5 +1,5 @@
Object.assign(ACT,{
- upLink:({id,tier})=>{tier=+tier;const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='wave'||!LT[tier]||tier<=l.tier)return;{const w=subWaveWhy(tier,l.km,l.sub);if(w){toast(tr('links.no_wave_waves_on_this_cable',{wave:LT[tier].n,why:esc(w)}),'bad');sfx('err');return;}}if(!waveOk(l.a,l.b,tier)){toast(tr('links.a_wave_wave_needs_need_at',{wave:LT[tier].n,need:esc(waveNeed(tier))}),'bad');sfx('err');return;}const nm=Math.round(waveMo(l.km,l.sub,tier)*(l.mult||1));if(!spend(nm))return;l.mo=nm;l.tier=tier;after();},
+ upLink:({id,tier})=>{tier=+tier;const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='wave'||!LT[tier]||tier<=l.tier)return;{const w=subWaveWhy(tier,l.km,l.sub);if(w){toast(tr('links.no_wave_waves_on_this_cable',{wave:LT[tier].n,why:esc(w)}),'bad');sfx('err');return;}}{const so=soldOut(l.a,l.b,tier,l.cable);if(so){toast(tr('links.no_wave_capacity_on_this_route',{wave:LT[tier].n,why:tr(so.why),n:Math.max(1,so.until-S.day)}),'bad');sfx('err');return;}}if(!waveOk(l.a,l.b,tier)){toast(tr('links.a_wave_wave_needs_need_at',{wave:LT[tier].n,need:esc(waveNeed(tier))}),'bad');sfx('err');return;}const nm=Math.round(waveMo(l.km,l.sub,tier)*(l.mult||1));if(!spend(nm))return;l.mo=nm;l.tier=tier;after();},
decomOpen:({city})=>{UI.decom=new Set(city&&S.pops[city]?[city]:[]);decomModal();},
decomToggle:({city})=>{if(!S.pops[city])return;UI.decom=UI.decom||new Set();if(UI.decom.has(city))UI.decom.delete(city);else UI.decom.add(city);decomModal();},
decomGo:()=>{const sel=[...(UI.decom||[])].filter(c=>S.pops[c]);if(!sel.length||sel.length>=Object.keys(S.pops).length)return;closeModal();UI.decom=null;UI.sel=null;decommission(sel);sfx('alert');after();},
diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js
index 47c95d0..2d85e75 100644
--- a/src/game/93-ui/70-link-panels.js
+++ b/src/game/93-ui/70-link-panels.js
@@ -136,7 +136,7 @@ function linkPanel(id){
h+=`${tr('common.capacity')}
${tr('link_panels.name_wave',{name:LT[l.tier].n})}${fmtG(load)} / ${fmtG(cap)}
${tr('common.latency')}${tr('common.ms_ms_one_way',{ms:linkLat(l).toFixed(1)})}
${l.cable?`${tr('common.cable_system')}${esc(CAB[l.cable].name)}
`:''}
${tr('common.wave_lease')}${tr('common.price_mo',{price:fmt$(l.mo)})}
${u>=0.9?`${tr('link_panels.congested_upgrade_it_or_add_a')}
`:''}
- ${LT.map((T,i)=>{const d=Math.round(waveMo(l.km,l.sub,i)*(l.mult||1)),sw=subWaveWhy(i,l.km,l.sub),ok=waveOk(l.a,l.b,i);return i>l.tier&&waveShown(i)?btn(`${T.n} ${sw?tr('common.too_far_for_this_cable'):ok?tr('common.price_mo',{price:fmt$(d)}):tr('link_panels.needs_what',{what:esc(waveNeed(i))})}`,'upLink',{id:l.id,tier:i},'sm',S.cash${tr('common.km_km_of_cable_carries_at',{km:Math.round(l.km).toLocaleString(),g:fmtCap(subCarrier(l.km))})}${l.tier>subMaxTier(l.km)?' '+tr('link_panels.your_wave_was_sold_before_the'):''}`:''}
+
${LT.map((T,i)=>{const d=Math.round(waveMo(l.km,l.sub,i)*(l.mult||1)),sw=subWaveWhy(i,l.km,l.sub),so=i>l.tier&&!sw&&soldOut(l.a,l.b,i,l.cable),ok=waveOk(l.a,l.b,i);return i>l.tier&&waveShown(i)?btn(`${T.n} ${sw?tr('common.too_far_for_this_cable'):so?tr('link_modal.sold_out_for_n_days',{n:Math.max(1,so.until-S.day)}):ok?tr('common.price_mo',{price:fmt$(d)}):tr('link_panels.needs_what',{what:esc(waveNeed(i))})}`,'upLink',{id:l.id,tier:i},'sm',S.cash${tr('common.km_km_of_cable_carries_at',{km:Math.round(l.km).toLocaleString(),g:fmtCap(subCarrier(l.km))})}${l.tier>subMaxTier(l.km)?' '+tr('link_panels.your_wave_was_sold_before_the'):''}`:''}
${tr('common.redundancy')}
${mates.length?trn('link_panels.shares_a_trench_with_n_other',mates.length):sib.length?tr('link_panels.runs_on_its_own_route_a'):tr('link_panels.this_is_the_only_link_between')}
${sib.map(x=>`${tr('link_panels.name_parallel_link',{name:capName(x)})} ${x.cut>S.day?''+tr('common.cut')+'':''}
${(x.trench||x.id)===trk?tr('common.same_trench'):tr('common.diverse_route')}
${btn(tr('common.open'),'selLink',{id:x.id},'ghost sm')}
`).join('')}
${btn(tr('link_panels.add_parallel_link'),'addParallel',{id:l.id},'pink sm')}
diff --git a/tests/pnis-and-sold-out.test.js b/tests/pnis-and-sold-out.test.js
index 485482f..88f5a1c 100644
--- a/tests/pnis-and-sold-out.test.js
+++ b/tests/pnis-and-sold-out.test.js
@@ -125,3 +125,22 @@ test('now and then a route is sold out of a wave size, for a while, and asking a
assert.match(ev("document.getElementById('toasts').textContent"), /No 400G capacity on this route/);
assert.deepEqual(errors, []);
});
+
+test('#201 a sold-out wave size cannot be reached by upgrading a smaller wave on the route', () => {
+ const { ev, errors } = load();
+ setup(ev);
+ ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=3;S.cash=1e9");
+ const day = ev("(()=>{for(let d=90;d<20000;d++){S.day=d;if(soldOut('fra','ams',2,null)&&!soldOut('fra','ams',1,null))return d;}return -1;})()");
+ assert.ok(day > 0, 'it happens');
+ ev(`S.day=${day};S.links.push({id:'upw',a:'fra',b:'ams',kind:'wave',tier:1,km:400,sub:false,cable:null,mo:1,mult:1,trench:'upw',cut:0,day:0})`);
+ const cash = ev('S.cash');
+ ev("ACT.upLink({id:'upw',tier:2})");
+ assert.equal(ev("S.links.find(l=>l.id==='upw').tier"), 1, 'still the old size');
+ assert.equal(ev('S.cash'), cash, 'nothing charged');
+ assert.match(ev("document.getElementById('toasts').textContent"), /No 400G capacity on this route/);
+ // the link panel's button for that size is disabled and says why
+ ev("UI.sel={type:'link',id:'upw'};renderPanel()");
+ const b = ev(`(()=>{const b=[...document.querySelectorAll('[data-act=upLink]')].find(x=>JSON.parse(x.dataset.args).tier===2);return b?b.disabled+':'+b.textContent:''})()`);
+ assert.match(b, /^true:.*sold out/i);
+ assert.deepEqual(errors, []);
+});