Build standard: a Broadband: IPv6-only row, rolled out by the button and the intern (#150)

The owed follow-up to IPv6-only broadband (next-session item 4). A new POP
target, v6, shown and planned only while IPv4 is scarce (rule ip4): bstdPlan()
makes a job per broadband city still on dual stack (ip6Todo()), the most
dual-stack homes first (the most behind CGNAT, the most addresses freed), each
calling ACT.ip6Go(). Its price is the whole swap (ip6Cost(), the city panel's
own figure); its mo is the IPv4 bill's change, counted one city after another
on a copy so the sum is all of them done.

ip6Go() pays nothing at the start (the routers are paid day by day), so these
jobs are marked later: the button and the std order start one only with the
whole swap in hand on top of what the swaps under way still owe (ip6Owed(),
X.can's new owed argument for the floor), and the order counts the whole swap
against its month's budget (not in what the shift paid up front). The button's
toast counts started swaps whole, as the quote did.

The sheet shows the row and a note only while ip4On(); bstdLine() counts it;
the MCP docs (bstdSet, bstdApply, popStd) name it. Strings in all six
dictionaries. Tests: tests/bstd-ipv6-only.test.js (order and price, the
button, budget and floor, rule off, saves, the sheet at 360 px portrait and
landscape in every language).
This commit is contained in:
jvanvik 2026-11-09 22:56:42 +01:00
parent 02b6c24d7b
commit 417160f383
16 changed files with 215 additions and 18 deletions

View file

@ -9,6 +9,7 @@ All notable changes to this project are documented here. The project follows
- Linking to an island or remote town where no subsea cable lands, like Iqaluit or Adamstown, now says that a satellite can get there too. Each of your teleports that reaches it gets a button to its order sheet; without one, the window says where a teleport would have to go (#83). - Linking to an island or remote town where no subsea cable lands, like Iqaluit or Adamstown, now says that a satellite can get there too. Each of your teleports that reaches it gets a button to its order sheet; without one, the window says where a teleport would have to go (#83).
- IPv4 notices in the NOC's notifications, like "Your IPv4 is full", now have an Open button that takes you to the bank's Address space, as the notice's own button does (#150). - IPv4 notices in the NOC's notifications, like "Your IPv4 is full", now have an Open button that takes you to the bank's Address space, as the notice's own button does (#150).
- In dark mode, red warning text is now a lighter red that reads well on the dark panels, and the capacity market's Hot and Cool tags take the night colours instead of staying bright pastel chips (#80). - In dark mode, red warning text is now a lighter red that reads well on the dark panels, and the capacity market's Hot and Cool tags take the night colours instead of staying bright pastel chips (#80).
- The build standard has a new target while IPv4 is scarce, Broadband: IPv6-only: every broadband city still on dual stack swaps its home routers for 464XLAT ones, the cities with the most dual-stack homes first. "Bring everything up now" and your intern's Keep to the build standard order start a city's swap only with all of it to spare, on top of what the swaps under way still owe, and the intern counts it against the order's monthly budget (#150).
- "Bring everything up now" in the build standard no longer takes a fiber dark for a day while a customer's alien or managed wave rides it. Such a fiber keeps its line system and the sheet says why; the upgrade button on the fiber itself still does it when you choose. Your intern waits for those fibers too, but no longer skips fibers that only carry leased pairs or IRUs, which a line system swap never touches. - "Bring everything up now" in the build standard no longer takes a fiber dark for a day while a customer's alien or managed wave rides it. Such a fiber keeps its line system and the sheet says why; the upgrade button on the fiber itself still does it when you choose. Your intern waits for those fibers too, but no longer skips fibers that only carry leased pairs or IRUs, which a line system swap never touches.
- The NOC dashboard's connections list no longer breaks when one of your fabric ports is already at 400G, the biggest a fabric port gets: it offers a LAG member instead of an upgrade. - The NOC dashboard's connections list no longer breaks when one of your fabric ports is already at 400G, the biggest a fabric port gets: it offers a LAG member instead of an upgrade.
- Broadband cities can now go IPv6-only with 464XLAT, a second way to save IPv4 next to CGNAT. Start it from a city's Home broadband, which also says what it does to your monthly IPv4 bill: its home routers are swapped over a month or more, paid as each one goes in (new homes there get one too, at the same price), and the homes then need no IPv4 address of their own, only a share of a NAT64 pool at up to 256 homes per address, with fewer refunds than CGNAT at the same ratio. The bank's Address space section shows your homes as public, behind CGNAT and IPv6-only, with the NAT64 ratio next to the CGNAT one, and says which of the two to stretch when space runs out. - Broadband cities can now go IPv6-only with 464XLAT, a second way to save IPv4 next to CGNAT. Start it from a city's Home broadband, which also says what it does to your monthly IPv4 bill: its home routers are swapped over a month or more, paid as each one goes in (new homes there get one too, at the same price), and the homes then need no IPv4 address of their own, only a share of a NAT64 pool at up to 256 homes per address, with fewer refunds than CGNAT at the same ratio. The bank's Address space section shows your homes as public, behind CGNAT and IPv6-only, with the NAT64 ratio next to the CGNAT one, and says which of the two to stretch when space runs out.

View file

@ -421,6 +421,7 @@
"bstd.cost_mo":"Laufende Kosten", "bstd.cost_mo":"Laufende Kosten",
"bstd.cost_now":"Um jetzt alles hochzuziehen", "bstd.cost_now":"Um jetzt alles hochzuziehen",
"bstd.edit":"Build-Standard bearbeiten", "bstd.edit":"Build-Standard bearbeiten",
"bstd.every_bb_city":"In jeder Breitband-Stadt",
"bstd.every_exchange":"Wo es einen IX gibt", "bstd.every_exchange":"Wo es einen IX gibt",
"bstd.fastest":"Die schnellste, die reicht", "bstd.fastest":"Die schnellste, die reicht",
"bstd.fiber_note_two":"Ein Line-System-Tausch legt die Glasfaser einen Tag dunkel. Der Button macht das nur bei ruhiger Faser oder wenn ein paralleler Link ihre Last trägt; dein Praktikant nur, wenn der ganze Verkehr um die Faser herumkommt.", "bstd.fiber_note_two":"Ein Line-System-Tausch legt die Glasfaser einen Tag dunkel. Der Button macht das nur bei ruhiger Faser oder wenn ein paralleler Link ihre Last trägt; dein Praktikant nur, wenn der ganze Verkehr um die Faser herumkommt.",
@ -440,6 +441,7 @@
"bstd.l_pni":"PNIs pro Netz", "bstd.l_pni":"PNIs pro Netz",
"bstd.l_site2":"Zweites Gebäude", "bstd.l_site2":"Zweites Gebäude",
"bstd.l_split":"LAGs aufteilen", "bstd.l_split":"LAGs aufteilen",
"bstd.l_v6":"Breitband: nur IPv6",
"bstd.left":{"one":"Noch eine Sache liegt darunter und wartet auf Geld, eine ruhige Glasfaser oder eine Erweiterung.","other":"Noch {n} Sachen liegen darunter und warten auf Geld, eine ruhige Glasfaser oder eine Erweiterung."}, "bstd.left":{"one":"Noch eine Sache liegt darunter und wartet auf Geld, eine ruhige Glasfaser oder eine Erweiterung.","other":"Noch {n} Sachen liegen darunter und warten auf Geld, eine ruhige Glasfaser oder eine Erweiterung."},
"bstd.n_more_targets":{"one":"{n} weiteres Ziel","other":"{n} weitere Ziele"}, "bstd.n_more_targets":{"one":"{n} weiteres Ziel","other":"{n} weitere Ziele"},
"bstd.new_pops_note":"Ein neuer POP bekommt das sofort, solange er noch leer ist: kein Wartungsfenster. Reicht das Geld nicht, bekommt er, was passt. Ein noch gesperrtes Modell heißt: das beste freigeschaltete darunter.", "bstd.new_pops_note":"Ein neuer POP bekommt das sofort, solange er noch leer ist: kein Wartungsfenster. Reicht das Geld nicht, bekommt er, was passt. Ein noch gesperrtes Modell heißt: das beste freigeschaltete darunter.",
@ -450,6 +452,7 @@
"bstd.second_building":"zweites Gebäude", "bstd.second_building":"zweites Gebäude",
"bstd.tagline":"Ein Design fürs ganze Netz: was jeder POP, Port und jede Glasfaser haben soll. Neue POPs bekommen den POP-Teil am Tag der Eröffnung; dein Praktikant oder der Button unten zieht den Rest nach.", "bstd.tagline":"Ein Design fürs ganze Netz: was jeder POP, Port und jede Glasfaser haben soll. Neue POPs bekommen den POP-Teil am Tag der Eröffnung; dein Praktikant oder der Button unten zieht den Rest nach.",
"bstd.title":"Build-Standard", "bstd.title":"Build-Standard",
"bstd.v6_note":"Nur IPv6 tauscht die Heimrouter jeder Breitband-Stadt, zuerst dort, wo die meisten Dual-Stack-Haushalte sind. Der Preis ist der ganze Tausch, bezahlt beim Einbau, und eine Stadt startet erst, wenn alles davon übrig ist.",
"businesses.a_free_pni_with_voda_phony":"Ein kostenloser PNI mit Voda-Phony. Hardware: Absolute-Unit-3.2T-Router, 3.2T-Ports und 12.8T-Waves.", "businesses.a_free_pni_with_voda_phony":"Ein kostenloser PNI mit Voda-Phony. Hardware: Absolute-Unit-3.2T-Router, 3.2T-Ports und 12.8T-Waves.",
"businesses.agi_lab_allegedly":"AGI-Labor (angeblich)", "businesses.agi_lab_allegedly":"AGI-Labor (angeblich)",
"businesses.agi_labs_allegedly_wanting_ai_wans":"AGI-Labore (angeblich), die KI-WANs mit 12,8 bis 25,6 Tbps wollen, und kostenlose PNIs mit Du-opoly und Ooh-redoo. Hardware: Mikrowtik-CCR-3.2T-Router.", "businesses.agi_labs_allegedly_wanting_ai_wans":"AGI-Labore (angeblich), die KI-WANs mit 12,8 bis 25,6 Tbps wollen, und kostenlose PNIs mit Du-opoly und Ooh-redoo. Hardware: Mikrowtik-CCR-3.2T-Router.",

View file

@ -419,6 +419,7 @@
"bstd.cost_mo":"Costes mensuales", "bstd.cost_mo":"Costes mensuales",
"bstd.cost_now":"Para ponerlo todo al día ahora", "bstd.cost_now":"Para ponerlo todo al día ahora",
"bstd.edit":"Editar el estándar de red", "bstd.edit":"Editar el estándar de red",
"bstd.every_bb_city":"En cada ciudad con banda ancha",
"bstd.every_exchange":"Donde haya un IX", "bstd.every_exchange":"Donde haya un IX",
"bstd.fastest":"La más rápida que llegue", "bstd.fastest":"La más rápida que llegue",
"bstd.fiber_note_two":"Cambiar el sistema de línea deja la fibra apagada un día. El botón solo lo hace si va tranquila o un enlace paralelo lleva su carga; tu becario, solo si todo el tráfico puede rodear la fibra.", "bstd.fiber_note_two":"Cambiar el sistema de línea deja la fibra apagada un día. El botón solo lo hace si va tranquila o un enlace paralelo lleva su carga; tu becario, solo si todo el tráfico puede rodear la fibra.",
@ -438,6 +439,7 @@
"bstd.l_pni":"PNI por red", "bstd.l_pni":"PNI por red",
"bstd.l_site2":"Segundo edificio", "bstd.l_site2":"Segundo edificio",
"bstd.l_split":"Repartir los LAG", "bstd.l_split":"Repartir los LAG",
"bstd.l_v6":"Banda ancha: solo IPv6",
"bstd.left":{"one":"Queda una cosa por debajo, esperando dinero, una fibra tranquila o que llegue una ampliación.","other":"Quedan {n} cosas por debajo, esperando dinero, una fibra tranquila o que llegue una ampliación."}, "bstd.left":{"one":"Queda una cosa por debajo, esperando dinero, una fibra tranquila o que llegue una ampliación.","other":"Quedan {n} cosas por debajo, esperando dinero, una fibra tranquila o que llegue una ampliación."},
"bstd.n_more_targets":{"one":"{n} objetivo más","other":"{n} objetivos más"}, "bstd.n_more_targets":{"one":"{n} objetivo más","other":"{n} objetivos más"},
"bstd.new_pops_note":"Un POP nuevo recibe esto enseguida, mientras sigue vacío: sin ventana de mantenimiento. Si falta dinero, recibe lo que alcance. Un modelo aún bloqueado significa el mejor desbloqueado por debajo.", "bstd.new_pops_note":"Un POP nuevo recibe esto enseguida, mientras sigue vacío: sin ventana de mantenimiento. Si falta dinero, recibe lo que alcance. Un modelo aún bloqueado significa el mejor desbloqueado por debajo.",
@ -448,6 +450,7 @@
"bstd.second_building":"segundo edificio", "bstd.second_building":"segundo edificio",
"bstd.tagline":"Un solo diseño para toda la red: lo que debe tener cada POP, puerto y fibra. Los POP nuevos reciben la parte del POP el día que abren; tu becario, o el botón de abajo, pone el resto al día.", "bstd.tagline":"Un solo diseño para toda la red: lo que debe tener cada POP, puerto y fibra. Los POP nuevos reciben la parte del POP el día que abren; tu becario, o el botón de abajo, pone el resto al día.",
"bstd.title":"Estándar de red", "bstd.title":"Estándar de red",
"bstd.v6_note":"Solo IPv6 cambia los routers domésticos de cada ciudad con banda ancha, primero donde hay más hogares en doble pila. Su precio es el cambio entero, pagado a medida que se instalan, y una ciudad empieza solo cuando te sobra todo.",
"businesses.a_free_pni_with_voda_phony":"Un PNI gratis con Voda-Phony. Equipo: routers Absolute Unit 3.2T, puertos de 3.2T y ondas de 12.8T.", "businesses.a_free_pni_with_voda_phony":"Un PNI gratis con Voda-Phony. Equipo: routers Absolute Unit 3.2T, puertos de 3.2T y ondas de 12.8T.",
"businesses.agi_lab_allegedly":"Laboratorio de AGI (supuestamente)", "businesses.agi_lab_allegedly":"Laboratorio de AGI (supuestamente)",
"businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratorios de AGI (supuestamente) que quieren WAN de IA de 12.8 a 25.6 Tbps, y PNIs gratis con Du-opoly y Ooh-redoo. Equipo: routers Mikrowtik CCR 3.2T.", "businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratorios de AGI (supuestamente) que quieren WAN de IA de 12.8 a 25.6 Tbps, y PNIs gratis con Du-opoly y Ooh-redoo. Equipo: routers Mikrowtik CCR 3.2T.",

View file

@ -419,6 +419,7 @@
"bstd.cost_mo":"Coûts mensuels", "bstd.cost_mo":"Coûts mensuels",
"bstd.cost_now":"Pour tout mettre à niveau maintenant", "bstd.cost_now":"Pour tout mettre à niveau maintenant",
"bstd.edit":"Modifier le standard réseau", "bstd.edit":"Modifier le standard réseau",
"bstd.every_bb_city":"Dans chaque ville avec du haut débit",
"bstd.every_exchange":"Partout où il y a un IX", "bstd.every_exchange":"Partout où il y a un IX",
"bstd.fastest":"La plus rapide qui porte", "bstd.fastest":"La plus rapide qui porte",
"bstd.fiber_note_two":"Changer le système de ligne éteint la fibre pendant un jour. Le bouton ne le fait que si elle est calme ou qu’un lien parallèle porte sa charge ; ton stagiaire, seulement si tout le trafic peut contourner la fibre.", "bstd.fiber_note_two":"Changer le système de ligne éteint la fibre pendant un jour. Le bouton ne le fait que si elle est calme ou qu’un lien parallèle porte sa charge ; ton stagiaire, seulement si tout le trafic peut contourner la fibre.",
@ -438,6 +439,7 @@
"bstd.l_pni":"PNI par réseau", "bstd.l_pni":"PNI par réseau",
"bstd.l_site2":"Second bâtiment", "bstd.l_site2":"Second bâtiment",
"bstd.l_split":"Répartir les LAG", "bstd.l_split":"Répartir les LAG",
"bstd.l_v6":"Haut débit : IPv6 uniquement",
"bstd.left":{"one":"Encore un élément en dessous : il attend de l’argent, une fibre calme ou une extension.","other":"Encore {n} éléments en dessous : ils attendent de l’argent, une fibre calme ou une extension."}, "bstd.left":{"one":"Encore un élément en dessous : il attend de l’argent, une fibre calme ou une extension.","other":"Encore {n} éléments en dessous : ils attendent de l’argent, une fibre calme ou une extension."},
"bstd.n_more_targets":{"one":"{n} autre objectif","other":"{n} autres objectifs"}, "bstd.n_more_targets":{"one":"{n} autre objectif","other":"{n} autres objectifs"},
"bstd.new_pops_note":"Un nouveau POP reçoit tout ça d’un coup, tant qu’il est vide : pas de fenêtre de maintenance. Si l’argent manque, il reçoit ce qui rentre. Un modèle pas encore débloqué veut dire le meilleur débloqué en dessous.", "bstd.new_pops_note":"Un nouveau POP reçoit tout ça d’un coup, tant qu’il est vide : pas de fenêtre de maintenance. Si l’argent manque, il reçoit ce qui rentre. Un modèle pas encore débloqué veut dire le meilleur débloqué en dessous.",
@ -448,6 +450,7 @@
"bstd.second_building":"second bâtiment", "bstd.second_building":"second bâtiment",
"bstd.tagline":"Un seul design pour tout le réseau : ce que chaque POP, port et fibre doit avoir. Les nouveaux POP reçoivent la partie POP le jour de leur ouverture ; ton stagiaire, ou le bouton plus bas, met le reste à niveau.", "bstd.tagline":"Un seul design pour tout le réseau : ce que chaque POP, port et fibre doit avoir. Les nouveaux POP reçoivent la partie POP le jour de leur ouverture ; ton stagiaire, ou le bouton plus bas, met le reste à niveau.",
"bstd.title":"Standard réseau", "bstd.title":"Standard réseau",
"bstd.v6_note":"IPv6 uniquement remplace les box de chaque ville avec du haut débit, en commençant par celles qui ont le plus de foyers en double pile. Son prix est le remplacement entier, payé au fil de la pose, et une ville ne commence que si tu as tout en réserve.",
"businesses.a_free_pni_with_voda_phony":"Un PNI gratuit avec Voda-Phony. Matos : routeurs Absolute Unit 3.2T, ports 3.2T et longueurs d’onde 12.8T.", "businesses.a_free_pni_with_voda_phony":"Un PNI gratuit avec Voda-Phony. Matos : routeurs Absolute Unit 3.2T, ports 3.2T et longueurs d’onde 12.8T.",
"businesses.agi_lab_allegedly":"Labo d’AGI (soi-disant)", "businesses.agi_lab_allegedly":"Labo d’AGI (soi-disant)",
"businesses.agi_labs_allegedly_wanting_ai_wans":"Des labos d’AGI (soi-disant) qui veulent des WAN IA de 12,8 à 25,6 Tbps, et des PNI gratuits avec Du-opoly et Ooh-redoo. Matos : routeurs Mikrowtik CCR 3.2T.", "businesses.agi_labs_allegedly_wanting_ai_wans":"Des labos d’AGI (soi-disant) qui veulent des WAN IA de 12,8 à 25,6 Tbps, et des PNI gratuits avec Du-opoly et Ooh-redoo. Matos : routeurs Mikrowtik CCR 3.2T.",

View file

@ -419,6 +419,7 @@
"bstd.cost_mo":"Costi mensili", "bstd.cost_mo":"Costi mensili",
"bstd.cost_now":"Per portare tutto a standard ora", "bstd.cost_now":"Per portare tutto a standard ora",
"bstd.edit":"Modifica lo standard di rete", "bstd.edit":"Modifica lo standard di rete",
"bstd.every_bb_city":"In ogni città con banda larga",
"bstd.every_exchange":"Ovunque ci sia un IX", "bstd.every_exchange":"Ovunque ci sia un IX",
"bstd.fastest":"La più veloce che arriva", "bstd.fastest":"La più veloce che arriva",
"bstd.fiber_note_two":"Cambiare il sistema di linea spegne la fibra per un giorno. Il pulsante lo fa solo se è tranquilla o se un link parallelo ne regge il carico; il tuo stagista solo se tutto il traffico può aggirare la fibra.", "bstd.fiber_note_two":"Cambiare il sistema di linea spegne la fibra per un giorno. Il pulsante lo fa solo se è tranquilla o se un link parallelo ne regge il carico; il tuo stagista solo se tutto il traffico può aggirare la fibra.",
@ -438,6 +439,7 @@
"bstd.l_pni":"PNI per rete", "bstd.l_pni":"PNI per rete",
"bstd.l_site2":"Secondo edificio", "bstd.l_site2":"Secondo edificio",
"bstd.l_split":"Dividi i LAG", "bstd.l_split":"Dividi i LAG",
"bstd.l_v6":"Banda larga: solo IPv6",
"bstd.left":{"one":"Resta una cosa sotto lo standard: aspetta soldi, una fibra tranquilla o un ampliamento.","other":"Restano {n} cose sotto lo standard: aspettano soldi, una fibra tranquilla o un ampliamento."}, "bstd.left":{"one":"Resta una cosa sotto lo standard: aspetta soldi, una fibra tranquilla o un ampliamento.","other":"Restano {n} cose sotto lo standard: aspettano soldi, una fibra tranquilla o un ampliamento."},
"bstd.n_more_targets":{"one":"{n} altro obiettivo","other":"altri {n} obiettivi"}, "bstd.n_more_targets":{"one":"{n} altro obiettivo","other":"altri {n} obiettivi"},
"bstd.new_pops_note":"Un POP nuovo riceve tutto subito, finché è vuoto: niente finestra di manutenzione. Se mancano i soldi, riceve quello che ci sta. Un modello non ancora sbloccato vuol dire il migliore sbloccato sotto di lui.", "bstd.new_pops_note":"Un POP nuovo riceve tutto subito, finché è vuoto: niente finestra di manutenzione. Se mancano i soldi, riceve quello che ci sta. Un modello non ancora sbloccato vuol dire il migliore sbloccato sotto di lui.",
@ -448,6 +450,7 @@
"bstd.second_building":"secondo edificio", "bstd.second_building":"secondo edificio",
"bstd.tagline":"Un solo design per tutta la rete: cosa deve avere ogni POP, porta e fibra. I POP nuovi ricevono la parte POP il giorno in cui aprono; il tuo stagista, o il pulsante qui sotto, porta il resto a standard.", "bstd.tagline":"Un solo design per tutta la rete: cosa deve avere ogni POP, porta e fibra. I POP nuovi ricevono la parte POP il giorno in cui aprono; il tuo stagista, o il pulsante qui sotto, porta il resto a standard.",
"bstd.title":"Standard di rete", "bstd.title":"Standard di rete",
"bstd.v6_note":"Solo IPv6 sostituisce i router di casa di ogni città con banda larga, prima dove ci sono più case in dual stack. Il prezzo è l’intera sostituzione, pagata man mano che i router vengono installati, e una città parte solo quando hai tutto da parte.",
"businesses.a_free_pni_with_voda_phony":"Un PNI gratuito con Voda-Phony. Gear: router Absolute Unit 3.2T, porte 3.2T e wave 12.8T.", "businesses.a_free_pni_with_voda_phony":"Un PNI gratuito con Voda-Phony. Gear: router Absolute Unit 3.2T, porte 3.2T e wave 12.8T.",
"businesses.agi_lab_allegedly":"Laboratorio AGI (a sentir loro)", "businesses.agi_lab_allegedly":"Laboratorio AGI (a sentir loro)",
"businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratori AGI (a sentir loro) che vogliono AI WAN da 12.8 a 25.6 Tbps, e PNI gratuiti con Du-opoly e Ooh-redoo. Gear: router Mikrowtik CCR 3.2T.", "businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratori AGI (a sentir loro) che vogliono AI WAN da 12.8 a 25.6 Tbps, e PNI gratuiti con Du-opoly e Ooh-redoo. Gear: router Mikrowtik CCR 3.2T.",

View file

@ -419,6 +419,7 @@
"bstd.cost_mo":"Custos mensais", "bstd.cost_mo":"Custos mensais",
"bstd.cost_now":"Para colocar tudo no padrão agora", "bstd.cost_now":"Para colocar tudo no padrão agora",
"bstd.edit":"Editar o padrão de rede", "bstd.edit":"Editar o padrão de rede",
"bstd.every_bb_city":"Em cada cidade com banda larga",
"bstd.every_exchange":"Onde houver um IX", "bstd.every_exchange":"Onde houver um IX",
"bstd.fastest":"A mais rápida que alcança", "bstd.fastest":"A mais rápida que alcança",
"bstd.fiber_note_two":"Trocar o sistema de linha apaga a fibra por um dia. O botão só faz isso quando ela está tranquila ou um link paralelo leva a carga; seu estagiário só quando todo o tráfego consegue contornar a fibra.", "bstd.fiber_note_two":"Trocar o sistema de linha apaga a fibra por um dia. O botão só faz isso quando ela está tranquila ou um link paralelo leva a carga; seu estagiário só quando todo o tráfego consegue contornar a fibra.",
@ -438,6 +439,7 @@
"bstd.l_pni":"PNIs por rede", "bstd.l_pni":"PNIs por rede",
"bstd.l_site2":"Segundo prédio", "bstd.l_site2":"Segundo prédio",
"bstd.l_split":"Dividir LAGs", "bstd.l_split":"Dividir LAGs",
"bstd.l_v6":"Banda larga: só IPv6",
"bstd.left":{"one":"Ainda falta uma coisa abaixo do padrão, esperando dinheiro, uma fibra tranquila ou uma ampliação.","other":"Ainda faltam {n} coisas abaixo do padrão, esperando dinheiro, uma fibra tranquila ou uma ampliação."}, "bstd.left":{"one":"Ainda falta uma coisa abaixo do padrão, esperando dinheiro, uma fibra tranquila ou uma ampliação.","other":"Ainda faltam {n} coisas abaixo do padrão, esperando dinheiro, uma fibra tranquila ou uma ampliação."},
"bstd.n_more_targets":{"one":"mais {n} meta","other":"mais {n} metas"}, "bstd.n_more_targets":{"one":"mais {n} meta","other":"mais {n} metas"},
"bstd.new_pops_note":"Um POP novo recebe isso na hora, enquanto ainda está vazio: sem janela de manutenção. Se faltar dinheiro, recebe o que couber. Um modelo ainda bloqueado significa o melhor desbloqueado abaixo dele.", "bstd.new_pops_note":"Um POP novo recebe isso na hora, enquanto ainda está vazio: sem janela de manutenção. Se faltar dinheiro, recebe o que couber. Um modelo ainda bloqueado significa o melhor desbloqueado abaixo dele.",
@ -448,6 +450,7 @@
"bstd.second_building":"segundo prédio", "bstd.second_building":"segundo prédio",
"bstd.tagline":"Um só design para a rede toda: o que cada POP, porta e fibra deve ter. POPs novos recebem a parte do POP no dia em que abrem; seu estagiário, ou o botão abaixo, coloca o resto no padrão.", "bstd.tagline":"Um só design para a rede toda: o que cada POP, porta e fibra deve ter. POPs novos recebem a parte do POP no dia em que abrem; seu estagiário, ou o botão abaixo, coloca o resto no padrão.",
"bstd.title":"Padrão de rede", "bstd.title":"Padrão de rede",
"bstd.v6_note":"Só IPv6 troca os roteadores domésticos de cada cidade com banda larga, primeiro onde há mais casas em pilha dupla. O preço é a troca inteira, paga conforme os roteadores são instalados, e uma cidade só começa quando sobra tudo isso.",
"businesses.a_free_pni_with_voda_phony":"Um PNI grátis com a Voda-Phony. Gear: routers Absolute Unit 3.2T, portas 3.2T e waves de 12.8T.", "businesses.a_free_pni_with_voda_phony":"Um PNI grátis com a Voda-Phony. Gear: routers Absolute Unit 3.2T, portas 3.2T e waves de 12.8T.",
"businesses.agi_lab_allegedly":"Laboratório de AGI (supostamente)", "businesses.agi_lab_allegedly":"Laboratório de AGI (supostamente)",
"businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratórios de AGI (supostamente) querendo AI WANs de 12.8 a 25.6 Tbps, e PNIs grátis com a Du-opoly e a Ooh-redoo. Gear: routers Mikrowtik CCR 3.2T.", "businesses.agi_labs_allegedly_wanting_ai_wans":"Laboratórios de AGI (supostamente) querendo AI WANs de 12.8 a 25.6 Tbps, e PNIs grátis com a Du-opoly e a Ooh-redoo. Gear: routers Mikrowtik CCR 3.2T.",

View file

@ -446,12 +446,12 @@ const API_CMD={
popStdClear:{args:[],watch:['popStd'], popStdClear:{args:[],watch:['popStd'],
doc:'Clear the whole build standard; new POPs go back to one basic router.'}, doc:'Clear the whole build standard; new POPs go back to one basic router.'},
bstdSet:{args:[['k','bstdKey'],['v','string',false]],watch:['popStd'], bstdSet:{args:[['k','bstdKey'],['v','string',false]],watch:['popStd'],
doc:'Set one target of the build standard: g router model, rt routers, site2 second building, gen generator, lag LAG members on transit, IX and PNI ports, split LAGs across both buildings, ix an IX port wherever the city has an exchange, pni PNIs per network in at least that many cities, sys line system, opt fastest optics, wv waves at least that size. g and sys are also what the intern\'s routers and optup orders standardize on. Without v it steps to the next value; with v (a position in the list the sheet shows, 0 first, "keep" first) it picks that one.'}, doc:'Set one target of the build standard: g router model, rt routers, site2 second building, gen generator, v6 every broadband city IPv6-only (ip6Go, only while IPv4 is scarce: rule ip4), lag LAG members on transit, IX and PNI ports, split LAGs across both buildings, ix an IX port wherever the city has an exchange, pni PNIs per network in at least that many cities, sys line system, opt fastest optics, wv waves at least that size. g and sys are also what the intern\'s routers and optup orders standardize on. Without v it steps to the next value; with v (a position in the list the sheet shows, 0 first, "keep" first) it picks that one.'},
bstdApply:{args:[['quote','string',false],['q','shownTotal',false]],watch:['pops','transit','pni','ixp','ixn','ixSite','links','spares'], bstdApply:{args:[['quote','string',false],['q','shownTotal',false]],watch:['pops','transit','pni','ixp','ixn','ixSite','links','spares'],
quote:a=>{const q=bstdQuote(false),nm=w=>w.split('|').map(c=>CITY[c].name).join('–');return {setup:q.cost,monthly:q.mo,key:bstdPlanKey(bstdPlan(false)), quote:a=>{const q=bstdQuote(false),nm=w=>w.split('|').map(c=>CITY[c].name).join('–');return {setup:q.cost,monthly:q.mo,key:bstdPlanKey(bstdPlan(false)),
blocked:[...q.wait.map(w=>nm(w)+': its line system waits until the fiber is quiet or a parallel link can carry its load for the day it goes dark'), blocked:[...q.wait.map(w=>nm(w)+': its line system waits until the fiber is quiet or a parallel link can carry its load for the day it goes dark'),
...q.wv.map(w=>nm(w)+': its line system waits: a customer\'s wave rides it and would go dark with it for the day (upSys on the fiber still swaps it)')]};}, ...q.wv.map(w=>nm(w)+': its line system waits: a customer\'s wave rides it and would go dark with it for the day (upSys on the fiber still swaps it)')]};},
doc:'Bring everything up to the build standard now, the busiest first, while cash lasts: routers, buildings, generators, LAG members, IX ports, PNIs, line systems, optics and waves. A line-system swap waits unless the fiber is quiet or a parallel link carries its load, and while a customer\'s alien or managed wave rides the fiber (leased pairs and IRUs do not count: they are glass): such a fiber gets the best optics its line system takes, and the quote lists it under blocked. The quote is the whole bill. quote and q (optional): the plan\'s key and the total you were shown; another plan, or a total more than 1% away, is refused and the sheet shown again.'}, doc:'Bring everything up to the build standard now, the busiest first, while cash lasts: routers, buildings, generators, IPv6-only swaps (the cities with the most dual-stack homes first; each priced as its whole swap, paid as the routers go in, and started only with that much cash on top of what the swaps under way still owe), LAG members, IX ports, PNIs, line systems, optics and waves. A line-system swap waits unless the fiber is quiet or a parallel link carries its load, and while a customer\'s alien or managed wave rides the fiber (leased pairs and IRUs do not count: they are glass): such a fiber gets the best optics its line system takes, and the quote lists it under blocked. The quote is the whole bill. quote and q (optional): the plan\'s key and the total you were shown; another plan, or a total more than 1% away, is refused and the sheet shown again.'},
/* ---------- utilities ---------- */ /* ---------- utilities ---------- */
utilityRouteServers:{args:[['city','cityId',false]],watch:['rs'], utilityRouteServers:{args:[['city','cityId',false]],watch:['rs'],
doc:'Join the route server at every IX you have a port at. One call does what the button does.'}, doc:'Join the route server at every IX you have a port at. One call does what the button does.'},

View file

@ -62,7 +62,7 @@ const API_STATE_DOC={
core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'}, core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'},
ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'}, ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'},
ip4:{type:'map',doc:'IPv4 address space (rule ip4): b, the blocks, at most 256 (len: prefix length 16-24, k: rir from the registry, buy bought, in leased in; d: the day it last moved, out: leased out, mo: the monthly fee or income), nat: homes per address behind CGNAT, n64: IPv6-only homes per address in the NAT64 pool, w: which warnings were shown. What customers use is derived from their kind and size.'}, ip4:{type:'map',doc:'IPv4 address space (rule ip4): b, the blocks, at most 256 (len: prefix length 16-24, k: rir from the registry, buy bought, in leased in; d: the day it last moved, out: leased out, mo: the monthly fee or income), nat: homes per address behind CGNAT, n64: IPv6-only homes per address in the NAT64 pool, w: which warnings were shown. What customers use is derived from their kind and size.'},
popStd:{type:'map',doc:'The build standard, or null for none. g router model (an RG index), rt routers, then only the targets that are set: site2, gen (true), lag (2 or 4 members), split, ix (true), pni (2 or 3 cities per network), sys (roadm, cl), opt (fast), wv (an LT index). New POPs get g, rt, site2 and gen at once; the std standing order and bstdApply bring the rest up. g and sys are also the model the routers order and the line system the optup order standardize on.'}, popStd:{type:'map',doc:'The build standard, or null for none. g router model (an RG index), rt routers, then only the targets that are set: site2, gen, v6 (true; v6: every broadband city goes IPv6-only, only while rule ip4 is on), lag (2 or 4 members), split, ix (true), pni (2 or 3 cities per network), sys (roadm, cl), opt (fast), wv (an LT index). New POPs get g, rt, site2 and gen at once; the std standing order and bstdApply bring the rest up (v6 with ip6Go, city by city). g and sys are also the model the routers order and the line system the optup order standardize on.'},
mp:{type:'map',doc:'Multiplayer, only in a self-hosted copy with a session server: the session code, your player id, the AS number and seed the session gave you, its rules preset, your colour, its title and the last save number the server holds; null in every other game.'}, mp:{type:'map',doc:'Multiplayer, only in a self-hosted copy with a session server: the session code, your player id, the AS number and seed the session gave you, its rules preset, your colour, its title and the last save number the server holds; null in every other game.'},
demo:{type:'map',doc:'Vendor demo units on order, by "kind:id" → ready day.'}, demo:{type:'map',doc:'Vendor demo units on order, by "kind:id" → ready day.'},
seatOff:{type:'map',doc:'The pending consortium-cable seat offer: landings, km, name, expiry day.'}, seatOff:{type:'map',doc:'The pending consortium-cable seat offer: landings, km, name, expiry day.'},

View file

@ -25,6 +25,11 @@ function ip6Free(c){const p=ip6Pop(c);if(!p||!p.bb)return 0;return ip4Use(ip6If(
/* And what it does to the month's IPv4 bill, counted the same way (eye: what broadband earns a month): NAT64 gateways and /* And what it does to the month's IPv4 bill, counted the same way (eye: what broadband earns a month): NAT64 gateways and
refunds against the CGNAT boxes and refunds it saves. While no home is behind CGNAT it only adds. */ refunds against the CGNAT boxes and refunds it saves. While no home is behind CGNAT it only adds. */
function ip6Mo(c,eye){const p=ip6Pop(c);if(!p||!p.bb)return 0;const m=b=>b.box+b.box64+b.refund;return m(ip4Bill(eye,ip6If(c,p)))-m(ip4Bill(eye));} function ip6Mo(c,eye){const p=ip6Pop(c);if(!p||!p.bb)return 0;const m=b=>b.box+b.box64+b.refund;return m(ip4Bill(eye,ip6If(c,p)))-m(ip4Bill(eye));}
// A city the build standard's IPv6-only row would start (bstdPlan()): broadband with dual-stack homes, no swap running.
const ip6Todo=c=>{const p=ip6Pop(c);return !!p&&!!p.bb&&!p.bb.v6e&&!(p.bb.v6>=1)&&ip6Homes(p)>0;};
// What the swaps under way still have to pay for, router by router: the build standard starts another only with that
// much on top of its own price above the cash floor, since a swap pays as it goes and the cash has not moved yet.
const ip6Owed=()=>{let n=0;for(const c in S.pops){const b=S.pops[c].bb;if(b&&b.v6e)n+=ip6Homes(S.pops[c])*IP6_CPE;}return n;};
// Why this city cannot start a swap now ('' when it can). // Why this city cannot start a swap now ('' when it can).
function ip6Why(c){const p=ip6Pop(c);if(!ip4On())return tr('ip4.off');if(!p||!p.bb)return tr('ip6.no_bb');if(p.bb.v6e)return tr('ip6.busy');if(p.bb.v6>=1)return tr('ip6.already');return '';} function ip6Why(c){const p=ip6Pop(c);if(!ip4On())return tr('ip4.off');if(!p||!p.bb)return tr('ip6.no_bb');if(p.bb.v6e)return tr('ip6.busy');if(p.bb.v6>=1)return tr('ip6.already');return '';}
// Today's routers: an even share of what is left, so the swap ends on its day however the city grows meanwhile. // Today's routers: an even share of what is left, so the swap ends on its day however the city grows meanwhile.

View file

@ -129,9 +129,10 @@ function opsQuiet(fn){const a=after,t=toast,s=sfx,f=floater,sel=UI.sel,cf=UI.con
function opsShift(){const r=new Map(),broke=new Set(); function opsShift(){const r=new Map(),broke=new Set();
return {r,broke,dirty:false,up:0,mo:0,dk:{n:0,t:0},fib:new Map(),did(k,w){this.dirty=true;const x=r.get(k)||{n:0,w:[]};x.n++;if(w&&x.w.length<3&&!x.w.includes(w))x.w.push(w);r.set(k,x);}, return {r,broke,dirty:false,up:0,mo:0,dk:{n:0,t:0},fib:new Map(),did(k,w){this.dirty=true;const x=r.get(k)||{n:0,w:[]};x.n++;if(w&&x.w.length<3&&!x.w.includes(w))x.w.push(w);r.set(k,x);},
// A job that costs nothing up front still has to pass the cash floor if it adds to the monthly bill. // A job that costs nothing up front still has to pass the cash floor if it adds to the monthly bill.
// quiet: only asking, so a no is not logged as the budget running out. // quiet: only asking, so a no is not logged as the budget running out. owed: money already promised that has not
can(k,cost,mo=0,quiet){const O=S.ops,cap=opsCap(k);if(cost<=0&&!(mo>0))return true; // left yet (IPv6-only swaps under way), which the floor has to hold too.
if(S.cash-Math.max(0,cost)<O.floor||(cap&&(OPSK[k].mo?(O.addMo[k]||0)+mo:(O.spent[k]||0)+cost)>cap)){if(!quiet)broke.add(k);return false;}return true;}, can(k,cost,mo=0,quiet,owed=0){const O=S.ops,cap=opsCap(k);if(cost<=0&&!(mo>0))return true;
if(S.cash-Math.max(0,cost)-owed<O.floor||(cap&&(OPSK[k].mo?(O.addMo[k]||0)+mo:(O.spent[k]||0)+cost)>cap)){if(!quiet)broke.add(k);return false;}return true;},
book(k,d,dm){const O=S.ops;if(d>0){this.up+=d;if(OPSK[k].cap)O.spent[k]=(O.spent[k]||0)+d;}if(dm){this.mo+=dm;O.addMo[k]=(O.addMo[k]||0)+dm;}}, book(k,d,dm){const O=S.ops;if(d>0){this.up+=d;if(OPSK[k].cap)O.spent[k]=(O.spent[k]||0)+d;}if(dm){this.mo+=dm;O.addMo[k]=(O.addMo[k]||0)+dm;}},
// Run a click and book what it really cost; false when the action refused (no ports, no cash, a quote changed). // Run a click and book what it really cost; false when the action refused (no ports, no cash, a quote changed).
pay(k,fn){const c0=S.cash,m0=opsMoNow(),x=fn();this.book(k,c0-S.cash,opsMoNow()-m0);return x===undefined?c0-S.cash>0:x;}};} pay(k,fn){const c0=S.cash,m0=opsMoNow(),x=fn();this.book(k,c0-S.cash,opsMoNow()-m0);return x===undefined?c0-S.cash>0:x;}};}

View file

@ -4,12 +4,14 @@
system, the optics and the waves. A new POP gets its POP part at once, while the box is still idle (no maintenance system, the optics and the waves. A new POP gets its POP part at once, while the box is still idle (no maintenance
window). The rest is brought up by the intern's "Keep to the build standard" order, or in one tap from the sheet. */ window). The rest is brought up by the intern's "Keep to the build standard" order, or in one tap from the sheet. */
// Every target, with the values its list offers ("keep" first: no target) and its default. Saved sparse: a target left // Every target, with the values its list offers ("keep" first: no target) and its default. Saved sparse: a target left
// at its default is not in the save, so an old {g, rt} standard is exactly the routers it always was. // at its default is not in the save, so an old {g, rt} standard is exactly the routers it always was. on: only then is
// the target in the sheet and in the plan (IPv6-only broadband needs scarce IPv4, rule ip4).
const BSTD=[ const BSTD=[
{k:'g',grp:'pop',l:N_('bstd.l_model'),d:'keep',v:()=>['keep',...RG.map((r,i)=>i).sort((a,b)=>RG[a].cls-RG[b].cls||RG[a].cap-RG[b].cap||a-b)],ok:v=>v==='keep'||(Number.isInteger(v)&&!!RG[v])}, {k:'g',grp:'pop',l:N_('bstd.l_model'),d:'keep',v:()=>['keep',...RG.map((r,i)=>i).sort((a,b)=>RG[a].cls-RG[b].cls||RG[a].cap-RG[b].cap||a-b)],ok:v=>v==='keep'||(Number.isInteger(v)&&!!RG[v])},
{k:'rt',grp:'pop',l:N_('common.routers'),d:1,v:()=>[1,2,3,4,6,8,12,16],ok:v=>Number.isInteger(v)&&v>=1&&v<=RMAX}, {k:'rt',grp:'pop',l:N_('common.routers'),d:1,v:()=>[1,2,3,4,6,8,12,16],ok:v=>Number.isInteger(v)&&v>=1&&v<=RMAX},
{k:'site2',grp:'pop',l:N_('bstd.l_site2'),d:false,v:()=>[false,true]}, {k:'site2',grp:'pop',l:N_('bstd.l_site2'),d:false,v:()=>[false,true]},
{k:'gen',grp:'pop',l:N_('common.backup_generator'),d:false,v:()=>[false,true]}, {k:'gen',grp:'pop',l:N_('common.backup_generator'),d:false,v:()=>[false,true]},
{k:'v6',grp:'pop',l:N_('bstd.l_v6'),d:false,v:()=>[false,true],on:()=>ip4On()},
{k:'lag',grp:'port',l:N_('bstd.l_lag'),d:1,v:()=>[1,2,4]}, {k:'lag',grp:'port',l:N_('bstd.l_lag'),d:1,v:()=>[1,2,4]},
{k:'split',grp:'port',l:N_('bstd.l_split'),d:false,v:()=>[false,true]}, {k:'split',grp:'port',l:N_('bstd.l_split'),d:false,v:()=>[false,true]},
{k:'ix',grp:'port',l:N_('bstd.l_ix'),d:false,v:()=>[false,true]}, {k:'ix',grp:'port',l:N_('bstd.l_ix'),d:false,v:()=>[false,true]},
@ -19,7 +21,7 @@ const BSTD=[
{k:'wv',grp:'fiber',l:N_('common.waves'),d:'keep',v:()=>['keep',...LT.map((x,i)=>i).filter(i=>i>0&&waveShown(i))],ok:v=>v==='keep'||(Number.isInteger(v)&&v>0&&!!LT[v])}, {k:'wv',grp:'fiber',l:N_('common.waves'),d:'keep',v:()=>['keep',...LT.map((x,i)=>i).filter(i=>i>0&&waveShown(i))],ok:v=>v==='keep'||(Number.isInteger(v)&&v>0&&!!LT[v])},
]; ];
const BSTDK=Object.fromEntries(BSTD.map(x=>[x.k,x])),BSTD_MAX=16,BSTD_SYS={lite:0,roadm:1,cl:2}; const BSTDK=Object.fromEntries(BSTD.map(x=>[x.k,x])),BSTD_MAX=16,BSTD_SYS={lite:0,roadm:1,cl:2};
const bstdOk=(x,v)=>x.ok?x.ok(v):x.v().includes(v); const bstdOk=(x,v)=>x.ok?x.ok(v):x.v().includes(v),bstdOn=x=>!x.on||x.on();
// The whole standard, every target filled in. d: a saved one (untrusted: anything odd reads as "keep"). // The whole standard, every target filled in. d: a saved one (untrusted: anything odd reads as "keep").
function bstd(d=S&&S.popStd){const o={},ob=d&&typeof d==='object'&&!Array.isArray(d)?d:{}; function bstd(d=S&&S.popStd){const o={},ob=d&&typeof d==='object'&&!Array.isArray(d)?d:{};
for(const x of BSTD){const v=ob[x.k];o[x.k]=x.k==='rt'?(own(ob,'rt')?int(v,1,RMAX,1):1):own(ob,x.k)&&bstdOk(x,v)?v:x.d;}return o;} for(const x of BSTD){const v=ob[x.k];o[x.k]=x.k==='rt'?(own(ob,'rt')?int(v,1,RMAX,1):1):own(ob,x.k)&&bstdOk(x,v)?v:x.d;}return o;}
@ -67,8 +69,8 @@ function popStdHtml(c){const p=S.pops[c];if(!p||pzOn())return '';const D=bstd(),
return `<div class="kv"><span>${tr('bstd.title')}</span><b>${on?esc(bstdLine(D)):tr('pop_std.none')}</b></div><div class="btns">${btn(tr('bstd.edit'),'bstdOpen',{},'sm')}${same?'':btn(tr('pop_std.make_this_the_standard'),'popStdSet',{city:c},'ghost sm')}${on?btn(tr('pop_std.clear'),'popStdClear',{},'ghost sm'):''}</div>`;} return `<div class="kv"><span>${tr('bstd.title')}</span><b>${on?esc(bstdLine(D)):tr('pop_std.none')}</b></div><div class="btns">${btn(tr('bstd.edit'),'bstdOpen',{},'sm')}${same?'':btn(tr('pop_std.make_this_the_standard'),'popStdSet',{city:c},'ghost sm')}${on?btn(tr('pop_std.clear'),'popStdClear',{},'ghost sm'):''}</div>`;}
// "2 × Absolute Unit 3.2T, second building, generator": the POP part, what a new POP gets. // "2 × Absolute Unit 3.2T, second building, generator": the POP part, what a new POP gets.
function bstdPopParts(D){const a=[];if(D.g!=='keep'||D.rt>1)a.push(`${D.rt} × ${D.g==='keep'?tr('bstd.any_model'):RG[D.g].n}`);if(D.site2)a.push(tr('bstd.second_building'));if(D.gen)a.push(tr('bstd.generator'));return a;} function bstdPopParts(D){const a=[];if(D.g!=='keep'||D.rt>1)a.push(`${D.rt} × ${D.g==='keep'?tr('bstd.any_model'):RG[D.g].n}`);if(D.site2)a.push(tr('bstd.second_building'));if(D.gen)a.push(tr('bstd.generator'));return a;}
// The POP part first, then how many other targets. // The POP part first, then how many other targets (IPv6-only broadband is not part of a new POP: it has no homes yet).
function bstdLine(D){const a=bstdPopParts(D),n=['lag','split','ix','pni','sys','opt','wv'].filter(k=>D[k]!==BSTDK[k].d).length;if(n)a.push(trn('bstd.n_more_targets',n));return a.join(', ')||tr('pop_std.none');} function bstdLine(D){const a=bstdPopParts(D),n=['v6','lag','split','ix','pni','sys','opt','wv'].filter(k=>D[k]!==BSTDK[k].d&&bstdOn(BSTDK[k])).length;if(n)a.push(trn('bstd.n_more_targets',n));return a.join(', ')||tr('pop_std.none');}
/* What the standard still asks for, as jobs in the order they get done: POPs busiest first, then ports hottest first, /* What the standard still asks for, as jobs in the order they get done: POPs busiest first, then ports hottest first,
then fiber and waves hottest first. Pure: it reads S and R and changes nothing. Each job is priced with the game's then fiber and waves hottest first. Pure: it reads S and R and changes nothing. Each job is priced with the game's
@ -101,6 +103,14 @@ function bstdPlan(intern){const J=[];J.held=[];J.wv=[];if(!S||!S.popStd||pzOn())
if(D.site2&&!p.site2)s2=job('pop','site2','s:'+c,c,SITE2_COST,SITE2_MO,()=>{ACT.addSite({city:c});return !!S.pops[c].site2;},{c}); if(D.site2&&!p.site2)s2=job('pop','site2','s:'+c,c,SITE2_COST,SITE2_MO,()=>{ACT.addSite({city:c});return !!S.pops[c].site2;},{c});
if(D.gen&&!p.gen&&!bstdNoGen())job('pop','gen','e:'+c,c,GEN_COST,GEN_MO,()=>{if(bstdNoGen())return false;ACT.addGen({city:c});return !!S.pops[c].gen;},{c}); if(D.gen&&!p.gen&&!bstdNoGen())job('pop','gen','e:'+c,c,GEN_COST,GEN_MO,()=>{if(bstdNoGen())return false;ACT.addGen({city:c});return !!S.pops[c].gen;},{c});
V[c]={g,rt,site2:!!p.site2||D.site2,sw,s2};} V[c]={g,rt,site2:!!p.site2||D.site2,sw,s2};}
// Broadband IPv6-only: every city still on dual stack starts its home-router swap (ACT.ip6Go()), the most dual-stack
// homes first: those are the most behind CGNAT, and free the most addresses. Its price is the whole swap, paid as the
// routers go in (ip6Day()): later, so the shift and the button keep it, and the swaps still running, above the floor.
// mo: what it does to the month's IPv4 bill, counted one city after another on a copy, so the sum is all of them done.
if(D.v6&&ip4On()){const v6=cs.filter(ip6Todo).sort((a,b)=>ip6Homes(S.pops[b])-ip6Homes(S.pops[a])||(a<b?-1:1));
const eye=(R.rev&&R.rev.eyeballs)||0,m=b=>b.box+b.box64+b.refund,s={ip4:S.ip4,biz:S.biz,pops:{...S.pops}};let b0=v6.length?m(ip4Bill(eye,s)):0;
for(const c of v6){const p=S.pops[c];s.pops[c]={...p,bb:{...p.bb,v6:1}};const b1=m(ip4Bill(eye,s)),mo=b1-b0;b0=b1;
job('pop','v6','6:'+c,c+' IPv6',ip6Cost(c),mo,()=>{if(!ip6Todo(c))return false;ACT.ip6Go({city:c});return !!S.pops[c].bb.v6e;},{c,later:true,price:()=>ip6Cost(c)});}}
// Ports: LAG members up to the standard, then the members split over both buildings. // Ports: LAG members up to the standard, then the members split over both buildings.
if(D.lag>1||D.split){const P=[]; if(D.lag>1||D.split){const P=[];
for(const t of S.transit)if(S.pops[t.city]&&here(t.city))P.push({k:'t',c:t.city,id:t.id,o:t,n:t.n||1,tier:t.tier,u:(R.useT[t.id]||0)/lagCap(PORT[t.tier].g,t.n)}); for(const t of S.transit)if(S.pops[t.city]&&here(t.city))P.push({k:'t',c:t.city,id:t.id,o:t,n:t.n||1,tier:t.tier,u:(R.useT[t.id]||0)/lagCap(PORT[t.tier].g,t.n)});
@ -237,7 +247,10 @@ const bstdFast=()=>!!(S.popStd&&opsHired()&&S.ops.on.std&&bstd().opt==='fast');
is its own until tomorrow (X.fib: that order and decom leave it alone). The plan is made once a shift, and the shift is its own until tomorrow (X.fib: that order and decom leave it alone). The plan is made once a shift, and the shift
rests between jobs: a POP decommissioned or a link given up meanwhile is not worked on (the links last: a walk of them, rests between jobs: a POP decommissioned or a link given up meanwhile is not worked on (the links last: a walk of them,
only for a job the budget lets through). */ only for a job the budget lets through). */
// An IPv6-only swap (j.later) pays nothing today: the whole swap counts against the month's budget when it starts, and
// the cash floor holds it on top of what the swaps under way still owe (ip6Owed()). Not in what the shift paid up front.
function* bstdShift(X){const mine=j=>(!j.c||!!S.pops[j.c])&&(!j.l||(X.fib.get(j.l.id)||'std')==='std'); function* bstdShift(X){const mine=j=>(!j.c||!!S.pops[j.c])&&(!j.l||(X.fib.get(j.l.id)||'std')==='std');
yield* bstdRun(bstdPlan(true),j=>mine(j)&&X.can('std',bstdPrice(j),j.mo)&&(!j.l||S.links.includes(j.l)),j=>X.pay('std',()=>j.go())&&(X.did('std',j.w),true), yield* bstdRun(bstdPlan(true),j=>mine(j)&&X.can('std',bstdPrice(j),j.mo,false,j.later?ip6Owed():0)&&(!j.l||S.links.includes(j.l)),
j=>{const k=j.later?bstdPrice(j):0;if(!X.pay('std',()=>j.go()))return false;if(k)S.ops.spent.std=(S.ops.spent.std||0)+k;X.did('std',j.w);return true;},
function*(j){const l=j.l;if(OPTUP_NO.get(l.id)>S.day||!opsDarkRoom(X))return false;const ok=yield* opsDark(l,X);if(!ok)OPTUP_NO.set(l.id,S.day+OPTUP_WAIT);return ok;}, function*(j){const l=j.l;if(OPTUP_NO.get(l.id)>S.day||!opsDarkRoom(X))return false;const ok=yield* opsDark(l,X);if(!ok)OPTUP_NO.set(l.id,S.day+OPTUP_WAIT);return ok;},
(j,first)=>{if(j.l)X.fib.set(j.l.id,'std');if(first)X.dk.n++;},BSTD_MAX);} (j,first)=>{if(j.l)X.fib.set(j.l.id,'std');if(first)X.dk.n++;},BSTD_MAX);}

View file

@ -14,9 +14,11 @@ Object.assign(ACT,{
// (quoteNear), or nothing left to do is shown again, not built. // (quoteNear), or nothing left to do is shown again, not built.
bstdApply:({quote,q}={})=>{if(!S||pzOn()||!S.popStd)return;const J=bstdPlan(false); bstdApply:({quote,q}={})=>{if(!S||pzOn()||!S.popStd)return;const J=bstdPlan(false);
if((quote!==undefined||q!==undefined)&&(!J.length||(quote!==undefined&&String(quote)!==bstdPlanKey(J))||(q!==undefined&&!quoteNear(+q,bstdSum(J))))){bstdModal(tr('utilities.quote_changed'));sfx('err');return;} if((quote!==undefined||q!==undefined)&&(!J.length||(quote!==undefined&&String(quote)!==bstdPlanKey(J))||(q!==undefined&&!quoteNear(+q,bstdSum(J))))){bstdModal(tr('utilities.quote_changed'));sfx('err');return;}
if(!J.length)return;const c0=S.cash;let n=0; if(!J.length)return;const c0=S.cash;let n=0,later=0;
opsQuiet(()=>{n=bstdDo(J,j=>{const c=bstdPrice(j);return c<=0||S.cash>=c;},j=>!!j.go()).length;}); // An IPv6-only swap pays as its routers go in: it starts with the whole swap in hand, on top of what those running
// owe, and the toast counts it whole, as the quote did.
opsQuiet(()=>{const did=bstdDo(J,j=>{const c=bstdPrice(j);return c<=0||S.cash-(j.later?ip6Owed():0)>=c;},j=>!!j.go());n=did.length;for(const j of did)if(j.later)later+=j.cost;});
after();const z=bstdQuote(false),left=z.pops+z.ports+z.links; after();const z=bstdQuote(false),left=z.pops+z.ports+z.links;
toast((n?trn('bstd.applied',n,{cost:fmt$(c0-S.cash)}):tr('bstd.applied_none'))+(left?' '+trn('bstd.left',left):''),n?'good':'bad');sfx(n?'build':'err'); toast((n?trn('bstd.applied',n,{cost:fmt$(c0-S.cash+later)}):tr('bstd.applied_none'))+(left?' '+trn('bstd.left',left):''),n?'good':'bad');sfx(n?'build':'err');
if(bstdShown())bstdModal();}, if(bstdShown())bstdModal();},
}); });

View file

@ -8,6 +8,7 @@ function bstdVal(k,v){if(v===BSTDK[k].d&&k!=='rt')return tr('bstd.keep');
switch(k){case 'g':return RG[v].n+(rgOpen(v)?'':' '+tr('bstd.from_level',{lv:RG[v].lvl})); switch(k){case 'g':return RG[v].n+(rgOpen(v)?'':' '+tr('bstd.from_level',{lv:RG[v].lvl}));
case 'rt':return v>1?tr('bstd.at_least_n',{n:v}):tr('bstd.keep'); case 'rt':return v>1?tr('bstd.at_least_n',{n:v}):tr('bstd.keep');
case 'site2':case 'gen':return tr('bstd.at_every_pop'); case 'site2':case 'gen':return tr('bstd.at_every_pop');
case 'v6':return tr('bstd.every_bb_city');
case 'lag':return tr('bstd.at_least_n',{n:v}); case 'lag':return tr('bstd.at_least_n',{n:v});
case 'split':return tr('bstd.both_buildings'); case 'split':return tr('bstd.both_buildings');
case 'ix':return tr('bstd.every_exchange'); case 'ix':return tr('bstd.every_exchange');
@ -21,8 +22,8 @@ const bstdShown=()=>!!$('modal')&&!$('modal').hidden&&!!$('modalCard').querySele
function bstdModal(msg){if(!S||pzOn())return;const D=bstd(),q=bstdQuote(false),hired=opsHired(),on=hired&&S.ops.on.std; function bstdModal(msg){if(!S||pzOn())return;const D=bstd(),q=bstdQuote(false),hired=opsHired(),on=hired&&S.ops.on.std;
let h=`<div data-sheet="bstd" style="display:flex;align-items:center"><div><div class="eyebrow">${tr('ops.ops')}</div><h2 style="font-size:26px">${tr('bstd.title')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div> let h=`<div data-sheet="bstd" style="display:flex;align-items:center"><div><div class="eyebrow">${tr('ops.ops')}</div><h2 style="font-size:26px">${tr('bstd.title')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
<p class="tagline">${tr('bstd.tagline')}</p>${typeof msg==='string'&&msg?`<p class="why">${esc(msg)}</p>`:''}`; <p class="tagline">${tr('bstd.tagline')}</p>${typeof msg==='string'&&msg?`<p class="why">${esc(msg)}</p>`:''}`;
for(const [g,lab] of BSTD_GRP)h+=`<section><h3>${tr(lab)}</h3><div class="ops-p">${BSTD.filter(x=>x.grp===g).map(x=>opsSel(tr(x.l),'bstdSet',{k:x.k},bstdOpts(x.k),D[x.k],v=>bstdVal(x.k,v))).join('')}</div> for(const [g,lab] of BSTD_GRP)h+=`<section><h3>${tr(lab)}</h3><div class="ops-p">${BSTD.filter(x=>x.grp===g&&bstdOn(x)).map(x=>opsSel(tr(x.l),'bstdSet',{k:x.k},bstdOpts(x.k),D[x.k],v=>bstdVal(x.k,v))).join('')}</div>
<p class="note">${g==='pop'?tr('bstd.new_pops_note'):g==='port'?tr('bstd.port_note'):tr('bstd.fiber_note_two')}</p></section>`; <p class="note">${g==='pop'?tr('bstd.new_pops_note')+(bstdOn(BSTDK.v6)?' '+tr('bstd.v6_note'):''):g==='port'?tr('bstd.port_note'):tr('bstd.fiber_note_two')}</p></section>`;
// What is below it today, and what bringing it all up costs: a quote, nothing changes until the button. A fiber whose // What is below it today, and what bringing it all up costs: a quote, nothing changes until the button. A fiber whose
// line system has to wait is below it too, but not on the bill. // line system has to wait is below it too, but not on the bill.
const n={pop:q.pops,port:q.ports,fiber:q.links},w=q.held.length; const n={pop:q.pops,port:q.ports,fiber:q.links},w=q.held.length;

View file

@ -420,6 +420,7 @@
"bstd.cost_mo":"Running costs", "bstd.cost_mo":"Running costs",
"bstd.cost_now":"To bring it all up now", "bstd.cost_now":"To bring it all up now",
"bstd.edit":"Edit the build standard", "bstd.edit":"Edit the build standard",
"bstd.every_bb_city":"In every broadband city",
"bstd.every_exchange":"Wherever there is an IX", "bstd.every_exchange":"Wherever there is an IX",
"bstd.fastest":"Fastest that reaches", "bstd.fastest":"Fastest that reaches",
"bstd.fiber_note_two":"A line system swap takes the fiber dark for a day. The button does it only on a quiet fiber or where a parallel link carries its load; your intern only where all the traffic gets around the fiber.", "bstd.fiber_note_two":"A line system swap takes the fiber dark for a day. The button does it only on a quiet fiber or where a parallel link carries its load; your intern only where all the traffic gets around the fiber.",
@ -439,6 +440,7 @@
"bstd.l_pni":"PNIs per network", "bstd.l_pni":"PNIs per network",
"bstd.l_site2":"Second building", "bstd.l_site2":"Second building",
"bstd.l_split":"Split LAGs", "bstd.l_split":"Split LAGs",
"bstd.l_v6":"Broadband: IPv6-only",
"bstd.left":{"one":"One thing is still below it, waiting for cash, a quiet fiber or an augment to land.","other":"{n} things are still below it, waiting for cash, a quiet fiber or an augment to land."}, "bstd.left":{"one":"One thing is still below it, waiting for cash, a quiet fiber or an augment to land.","other":"{n} things are still below it, waiting for cash, a quiet fiber or an augment to land."},
"bstd.n_more_targets":{"one":"{n} more target","other":"{n} more targets"}, "bstd.n_more_targets":{"one":"{n} more target","other":"{n} more targets"},
"bstd.new_pops_note":"A new POP gets these at once, while it is still empty: no maintenance window. Short on cash, it gets what fits. A model you have not unlocked yet means the best unlocked one below it.", "bstd.new_pops_note":"A new POP gets these at once, while it is still empty: no maintenance window. Short on cash, it gets what fits. A model you have not unlocked yet means the best unlocked one below it.",
@ -449,6 +451,7 @@
"bstd.second_building":"second building", "bstd.second_building":"second building",
"bstd.tagline":"One design for the whole network: what every POP, port and fiber should have. New POPs get the POP part the day they open; your intern, or the button below, brings the rest up to it.", "bstd.tagline":"One design for the whole network: what every POP, port and fiber should have. New POPs get the POP part the day they open; your intern, or the button below, brings the rest up to it.",
"bstd.title":"Build standard", "bstd.title":"Build standard",
"bstd.v6_note":"IPv6-only swaps the home routers of every broadband city, the most dual-stack homes first. Its price is the whole swap, paid as the routers go in, and a city starts only with all of it to spare.",
"businesses.a_free_pni_with_voda_phony":"A free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.", "businesses.a_free_pni_with_voda_phony":"A free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.",
"businesses.agi_lab_allegedly":"AGI lab (allegedly)", "businesses.agi_lab_allegedly":"AGI lab (allegedly)",
"businesses.agi_labs_allegedly_wanting_ai_wans":"AGI labs (allegedly) wanting AI WANs of 12.8 to 25.6 Tbps, and free PNIs with Du-opoly and Ooh-redoo. Gear: Mikrowtik CCR 3.2T routers.", "businesses.agi_labs_allegedly_wanting_ai_wans":"AGI labs (allegedly) wanting AI WANs of 12.8 to 25.6 Tbps, and free PNIs with Du-opoly and Ooh-redoo. Gear: Mikrowtik CCR 3.2T routers.",

View file

@ -0,0 +1,155 @@
// The build standard's "Broadband: IPv6-only" row (96-pop-standard.js, the swap itself in 34-ipv6-only.js): every
// broadband city still on dual stack starts its home-router swap, the most dual-stack homes first, priced as the city
// panel prices it (the whole swap, paid as the routers go in), from the sheet's button or the intern's standing order,
// within the order's budget and the cash floor. Only while IPv4 is scarce (rule ip4).
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const { lit } = require('../scripts/lib/js-literal');
// On-call (IPv4 is scarce), plenty of cash, nothing breaking. Broadband in Amsterdam (3,000 homes), Frankfurt (1,300) and
// Paris (500): their swaps cost $12k, $5.2k and $2k.
const BASE = "ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.rules=makeRules('oncall');S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=9;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.offers=[];S.biz=[];" +
"ACT.launchBB({city:'fra'});S.pops.fra.rgen=3;ACT.buyTransit({city:'fra',net:'lvl',tier:3});for(const c of ['ams','par']){ACT.buildPop({city:c});ACT.launchBB({city:c});}" +
"S.pops.fra.bb.d=130;S.pops.ams.bb.d=300;S.pops.par.bb.d=50;compute()";
function game(t, opts) {
const h = load(opts);
t.after(() => h.dom.window.close());
h.ev(BASE);
return h;
}
const J = (ev, x) => JSON.parse(ev(`JSON.stringify(${x})`));
const std = (ev, d) => ev(`S.popStd=${lit(d)}`);
const v6 = (ev, plan = 'bstdPlan(false)') => J(ev, `${plan}.filter(j=>j.k==='v6').map(j=>[j.c,j.cost])`);
const swapping = ev => J(ev, "['ams','fra','par'].filter(c=>S.pops[c].bb.v6e)");
const COST = { ams: 12000, fra: 5200, par: 2000 };
test('the row: every dual-stack broadband city, the most homes first, at the swap\'s own price and its IPv4 bill', (t) => {
const h = game(t, { agent: true });
const { ev, errors } = h;
assert.equal(ev('ip4On()'), true);
assert.deepEqual(J(ev, "['ams','fra','par'].map(ip6Cost)"), [COST.ams, COST.fra, COST.par]);
assert.deepEqual(v6(ev), [], 'no standard, no jobs');
std(ev, { v6: true });
assert.deepEqual(v6(ev), [['ams', COST.ams], ['fra', COST.fra], ['par', COST.par]], 'Amsterdam first: the most homes behind CGNAT');
assert.equal(ev('bstdLine(bstd())'), '1 more target');
// The plan's running costs are the IPv4 bill with every city done, against today's.
const want = ev("(()=>{const eye=(R.rev&&R.rev.eyeballs)||0,m=b=>b.box+b.box64+b.refund,s={ip4:S.ip4,biz:S.biz,pops:{...S.pops}};for(const c of ['ams','fra','par'])s.pops[c]={...S.pops[c],bb:{...S.pops[c].bb,v6:1}};return m(ip4Bill(eye,s))-m(ip4Bill(eye));})()");
const q = J(ev, 'bstdQuote(false)');
assert.deepEqual([q.pops, q.n, q.cost], [3, 3, COST.ams + COST.fra + COST.par]);
assert.equal(q.mo, Math.round(want));
// A city already swapping, one done, one with no homes yet: nothing to do there.
ev("S.pops.ams.bb.v6e=S.day+40;S.pops.par.bb.v6=1;ACT.buildPop({city:'lon'});ACT.launchBB({city:'lon'});S.pops.lon.bb.d=0;compute()");
assert.deepEqual(v6(ev), [['fra', COST.fra]]);
// A POP the intern is told to leave alone keeps its routers as they are.
ev("ACT.opsHire({id:'annie'});closeModal();S.ops.skip.fra=['std']");
assert.deepEqual(v6(ev, 'bstdPlan(true)'), []);
assert.deepEqual(v6(ev), [['fra', COST.fra]], 'the button is not the intern');
// The MCP tools: the target and the quote.
ev("S.popStd=null;apiRun('bstdSet',{k:'v6'})");
assert.deepEqual(J(ev, 'S.popStd'), { rt: 1, v6: true });
assert.equal(J(ev, "apiRun('bstdApply',{},{dryRun:true})").quote.setup, COST.fra);
assert.deepEqual(errors, []);
});
test('the button starts every swap it can pay in full, on top of what the swaps under way still owe', (t) => {
const { ev, dom, errors } = game(t);
std(ev, { v6: true });
// Enough for Amsterdam and Paris, not for Frankfurt as well: the busiest first, then whatever still fits.
ev(`S.cash=${COST.ams + COST.fra - 1};ACT.bstdOpen()`);
const btn = dom.window.document.querySelector('#modalCard [data-act="bstdApply"]');
assert.equal(btn.textContent, `Bring everything up now · ${ev(`fmt$(${COST.ams + COST.fra + COST.par})`)}`);
btn.click();
assert.deepEqual(swapping(ev), ['ams', 'par']);
assert.equal(ev('S.cash'), COST.ams + COST.fra - 1, 'nothing paid yet: the routers are paid as they go in');
assert.equal(ev('ip6Owed()'), COST.ams + COST.par);
const said = `2 jobs done for the build standard, ${ev(`fmt$(${COST.ams + COST.par})`)}.`;
assert.ok(dom.window.document.getElementById('toasts').textContent.includes(said), 'the toast counts the swaps whole, as the quote did');
// Day by day the swaps pay what the button counted, and Frankfurt waits for the money.
ev('for(let i=0;i<60;i++){S.day++;ip4Day(S.day);}compute()');
assert.deepEqual(J(ev, "['ams','par'].map(c=>S.pops[c].bb.v6)"), [1, 1]);
assert.ok(Math.abs(ev('S.cash') - (COST.fra - 1 - COST.par)) < 1e-6, 'the swaps cost what the button counted: ' + ev('S.cash'));
assert.deepEqual(v6(ev), [['fra', COST.fra]]);
assert.deepEqual(errors, []);
});
test("the intern rolls it out within the order's budget and the cash floor, and the shift log names the cities", (t) => {
const { ev, errors } = game(t);
std(ev, { v6: true });
ev("ACT.opsHire({id:'annie'});closeModal();S.ops.on.std=true;S.ops.floor=0;S.ops.cap.std=OPS_CAPS[0]");
// A $10k month: Amsterdam's $12k swap never fits it; Frankfurt and Paris do.
const c0 = ev('S.cash');
ev('opsDay(S.day)');
assert.deepEqual(swapping(ev), ['fra', 'par']);
assert.equal(ev('S.ops.spent.std'), COST.fra + COST.par, 'the whole swaps count against the month');
assert.equal(ev('S.cash'), c0, 'and are paid as the routers go in');
const e = J(ev, 'S.ops.log[0]');
assert.equal(e.up, undefined, 'nothing paid up front');
assert.ok(e.r.some(x => x[0] === 'broke'), 'Amsterdam waits for the budget');
assert.match(ev('opsLine(S.ops.log[0])'), /did 2 jobs for the build standard \(Frankfurt IPv6, Paris IPv6\)/);
assert.equal(ev('S.ops.log[0].r.find(x=>x[0]===\'std\')[2].every(opsWhereOk)'), true, 'the log survives a save');
// No budget, a $50k floor and $15k above it: Amsterdam starts; Frankfurt does not fit on top of what Amsterdam owes,
// Paris does.
ev("for(const c of ['fra','par']){delete S.pops[c].bb.v6e;delete S.pops[c].bb.v6;}S.ops.cap.std=0;S.ops.floor=50000;S.cash=50000+15000;S.day++;compute();opsDay(S.day)");
assert.deepEqual(swapping(ev), ['ams', 'par']);
assert.equal(ev('S.cash'), 65000);
// Paid down, the next shift starts Frankfurt.
ev('for(let i=0;i<60;i++){S.day++;ip4Day(S.day);}S.cash=1e6;compute();opsDay(S.day)');
assert.deepEqual(swapping(ev), ['fra']);
assert.deepEqual(errors, []);
});
test('only while IPv4 is scarce: no row, no jobs and no count in the gentler rules; saves keep the target', (t) => {
const { ev, dom, errors } = game(t);
std(ev, { v6: true });
ev("S.rules=makeRules('freeze');compute()");
assert.equal(ev('ip4On()'), false);
assert.deepEqual(v6(ev), []);
assert.equal(ev('bstdLine(bstd())'), 'None');
ev('ACT.bstdOpen()');
const sel = [...dom.window.document.querySelectorAll('#modalCard select[data-chg="bstdSet"]')].map(s => JSON.parse(s.dataset.args).k);
assert.ok(sel.length > 0 && !sel.includes('v6'), 'no IPv6-only list');
assert.doesNotMatch(dom.window.document.getElementById('modalCard').textContent, /IPv6/);
// The target stays in the standard: back on scarce IPv4 it is there again.
ev("closeModal();S.rules=makeRules('oncall');compute()");
assert.deepEqual(v6(ev).map(x => x[0]), ['ams', 'fra', 'par']);
// Saves: the target round-trips; an old standard has none; junk is no target.
const rt = d => J(ev, `(()=>{const s={popStd:${lit(d)}};popStdSanitize(s);return s.popStd;})()`);
assert.deepEqual(rt({ rt: 1, v6: true }), { rt: 1, v6: true });
assert.deepEqual(rt({ g: 1, rt: 2 }), { g: 1, rt: 2 });
assert.equal(rt({ rt: 1, v6: 'yes' }), null);
assert.deepEqual(J(ev, 'migrate(JSON.parse(JSON.stringify(S))).popStd'), { rt: 1, v6: true });
assert.deepEqual(errors, []);
});
test('the sheet at 360 px, portrait and landscape, in every language: the row, its note and what is below it', () => {
for (const lang of ['en', 'de', 'es', 'fr', 'it', 'pt']) {
const { ev, dom, errors } = load(lang === 'en' ? {} : { lang });
ev(BASE);
const doc = dom.window.document;
for (const [w, hgt] of [[360, 740], [740, 360]]) {
ev(`window.innerWidth=${w};window.innerHeight=${hgt};S.popStd=null;closeModal();ACT.bstdOpen()`);
assert.equal(ev('isPhone()'), true, lang);
const sel = () => [...doc.querySelectorAll('#modalCard select[data-chg="bstdSet"]')].find(s => JSON.parse(s.dataset.args).k === 'v6');
let s = sel();
assert.ok(s && s.closest('.ops-sel'), lang + ': two to a row with the other POP targets');
s.value = String(s.options.length - 1);
s.dispatchEvent(new dom.window.Event('change', { bubbles: true }));
assert.equal(ev('bstd().v6'), true, lang);
assert.ok(ev('bstdShown()'), lang);
s = sel();
assert.equal(s.options[s.selectedIndex].textContent, ev("tr('bstd.every_bb_city')"), lang);
const txt = doc.getElementById('modalCard').textContent;
assert.ok(txt.includes(ev("tr('bstd.v6_note')")), lang + ': the note');
assert.ok(txt.includes(ev(`fmt$(${COST.ams + COST.fra + COST.par})`)), lang + ': the bill');
assert.doesNotMatch(txt, /\b(bstd|ops|pop_std|common|ip6)\.[a-z_0-9]+/, lang + ': a raw label');
assert.doesNotMatch(txt, /\{[a-z]\w*\}|undefined|NaN/, lang);
for (const b of doc.querySelectorAll('#modalCard button.b')) assert.ok(b.closest('.btns') || b.closest('.ops-h'), lang + ': ' + b.textContent);
}
// The city panel's line counts it.
ev("closeModal();selectCity('fra');ACT.tab({t:'links'})");
assert.ok(doc.getElementById('panelBody').textContent.includes(ev("trn('bstd.n_more_targets',1)")), lang);
assert.deepEqual(errors, [], lang);
dom.window.close();
}
});

View file

@ -480,8 +480,9 @@ test('the sheet at 360 px in every language: every list works by changing it, fr
doc.querySelector('#modalCard [data-act="bstdOpen"]').click(); doc.querySelector('#modalCard [data-act="bstdOpen"]').click();
assert.ok(ev('bstdShown()'), lang + ': from the menu'); assert.ok(ev('bstdShown()'), lang + ': from the menu');
leaks(); leaks();
// Every target is a list; pick its last value and the standard follows, the sheet stays open and in focus. // Every target is a list; pick its last value and the standard follows, the sheet stays open and in focus. (IPv6-only
const keys = JSON.parse(ev('JSON.stringify(BSTD.map(x=>x.k))')); // broadband is a target only while IPv4 is scarce, not in Change Freeze: tests/bstd-ipv6-only.test.js.)
const keys = JSON.parse(ev('JSON.stringify(BSTD.filter(bstdOn).map(x=>x.k))'));
assert.equal(doc.querySelectorAll('#modalCard select[data-chg="bstdSet"]').length, keys.length); assert.equal(doc.querySelectorAll('#modalCard select[data-chg="bstdSet"]').length, keys.length);
for (const k of keys) { for (const k of keys) {
const s = [...doc.querySelectorAll('#modalCard select[data-chg="bstdSet"]')].find(x => JSON.parse(x.dataset.args).k === k); const s = [...doc.querySelectorAll('#modalCard select[data-chg="bstdSet"]')].find(x => JSON.parse(x.dataset.args).k === k);