Customers come and go: contracts, renewals at the market price, growth, haggles and leaving (#178)

Every customer now signs for a term (enterprise and hosting 1-3 years, wholesale and circuits 2-5,
fiber pairs 10-20). When it ends most renew at today's bandwidth price, happy ones often grow to
the next size, a few with competitors around ask for a discount 30 days ahead (match, meet halfway
or let go in Deals; no answer matches), and some leave: unhappy ones because of the service, others
acquired, bust, insourced, moved (they stay if you have a POP there), multihomed, project ended,
a cheaper bid, or now and then one of the odder reasons (never more than one every 60 days).

The bandwidth market is flat for six months, then about 10% cheaper a year, slowed by dearer
hardware, moving in a slow three-year cycle and pushed up during a shortage. New offers and
renewals are priced in it; one renewal moves a price at most 25% down or 10% up.

Nothing happens in a first term. Rolls are hashes of the customer and its term, never Math.random,
so seeded games keep their stream. Old saves get renewals spread over the next year. Happy
customers of a year or more send a referral about every six weeks. The dashboard's Customers tab
shows customers won and lost each month and why, renewals due and the market; customer rows show
the contract end.

The differential fuzz now leaves out state fields only this checkout has, so a new feature's state
does not fail the comparison with main while everything both games share must still match.
This commit is contained in:
Frederic Jung 2026-11-05 08:15:46 +01:00
parent b8d313b029
commit 8841fdacb9
No known key found for this signature in database
24 changed files with 859 additions and 19 deletions

View file

@ -154,8 +154,15 @@
return r + '\n' + fl + '\n' + pf;
};
const parts = () => { const o = {}; if (!R) return o; for (const k of Object.keys(R)) o[k] = JSON.stringify(R[k]); o.fl = R.fl ? JSON.stringify(R.fl) : ''; return o; };
const sDigest = () => JSON.stringify(S);
const sParts = () => { const o = {}; for (const k of Object.keys(S)) o[k] = JSON.stringify(S[k]); return o; };
// A field only this checkout's game has (a new feature's state, on S or on its customers and offers) cannot match main
// yet: the driver passes those (drop) and they are left out; every field both games have must still match.
const sKeys = () => ({ top: Object.keys(S), items: [...new Set([...(S.biz || []), ...(S.offers || [])].flatMap((x) => Object.keys(x)))] });
const sDrop = (drop) => { if (!drop || (!drop.top.length && !drop.items.length)) return S; const o = {};
for (const k of Object.keys(S)) if (!drop.top.includes(k)) o[k] = S[k];
for (const k of ['biz', 'offers']) if (Array.isArray(o[k])) o[k] = o[k].map((x) => { const y = {}; for (const f of Object.keys(x)) if (!drop.items.includes(f)) y[f] = x[f]; return y; });
return o; };
const sDigest = (drop) => JSON.stringify(sDrop(drop));
const sParts = (drop) => { const s = sDrop(drop), o = {}; for (const k of Object.keys(s)) o[k] = JSON.stringify(s[k]); return o; };
/* After a move: what the move routed (a), routing again from the same state (b: on this checkout's page the kept
tables are used), and routing from that state with the cache off (c: RC.on=false where there is an RC). b and c
route from the same previous R; c's R is kept, as a plain compute would. */
@ -170,5 +177,5 @@
if (keep) UI.rkR = R;
return { a, b, c };
};
window.__fz = { direct, lists, start, state, screen, press, close, poke, day, routing, parts, sDigest, sParts, check, errs, modalOpen };
window.__fz = { direct, lists, start, state, screen, press, close, poke, day, routing, parts, sKeys, sDigest, sParts, check, errs, modalOpen };
})();

View file

@ -78,8 +78,10 @@ function playGame(pages, seed, opts = {}) {
const [x, y] = both('check');
for (const k of ['a', 'b', 'c']) if (x[k] !== y[k]) { fail(where + ': routing (' + k + ') base vs head', { diff: firstDiff(base.call('parts'), head.call('parts')) }); return false; }
if (y.b !== y.c) { fail(where + ': head cached vs uncached', { diff: 'R from the kept tables differs from a fresh route' }); return false; }
const [s1, s2] = both('sDigest');
if (s1 !== s2) { fail(where + ': game state S', { diff: firstDiff(base.call('sParts'), head.call('sParts')) }); return false; }
// Fields only this checkout's game has are left out on both sides (see sKeys in fuzz-page.js).
const [k1, k2] = both('sKeys'), drop = { top: k2.top.filter((k) => !k1.top.includes(k)), items: k2.items.filter((k) => !k1.items.includes(k)) };
const [s1, s2] = both('sDigest', drop);
if (s1 !== s2) { fail(where + ': game state S', { diff: firstDiff(base.call('sParts', drop), head.call('sParts', drop)) }); return false; }
return true;
};