Skip to content

Commit 5e6f5a1

Browse files
ralyodioclaude
andcommitted
pit: say "1k", not "1000"
The hint interpolates the ceiling, so raising it to 1000 made the line read "Up to 1000 at a time." A ceiling is a rough promise and should read like one. Only exact thousands are shortened. 1500 stays 1500, because "1.5k" reads as an approximation of a number that is exact, and the whole point of the line is telling someone where the limit actually is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 9d7286b commit 5e6f5a1

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

apps/pwa/src/lib/moshpit-name.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ export const MAX_BULK_TLDS = 1000;
136136
*/
137137
export const BULK_TIME_BUDGET_MS = 20_000;
138138

139+
/** 1000 -> "1k". A ceiling is a rough promise and should read like one. */
140+
export function shortCount(n) {
141+
return n >= 1000 && n % 1000 === 0 ? `${n / 1000}k` : String(n);
142+
}
143+
139144
/**
140145
* The most a child name may cost per year.
141146
*

apps/pwa/src/moshpit.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { get, all, run } from "./db.mjs";
1414
import { BULK_TIME_BUDGET_MS, MAX_BULK_TLDS, MAX_CHILD_PRICE_USD, normalizeLabel, normalizeTld, parseMoshpitName, parseTldList, tldRejection } from "./lib/moshpit-name.mjs";
1515

1616
export {
17-
RESERVED_TLDS, RESOLVE_MODES, MAX_BULK_TLDS, BULK_TIME_BUDGET_MS, DEFAULT_TLD_PRICE_USD, MAX_CHILD_PRICE_USD, normalizeLabel, normalizeTld, parseMoshpitName,
17+
RESERVED_TLDS, RESOLVE_MODES, MAX_BULK_TLDS, BULK_TIME_BUDGET_MS, shortCount, DEFAULT_TLD_PRICE_USD, MAX_CHILD_PRICE_USD, normalizeLabel, normalizeTld, parseMoshpitName,
1818
parseTldList, tldRejection, normalizeMode, resolutionPreference,
1919
} from "./lib/moshpit-name.mjs";
2020

apps/pwa/src/routes/moshpit.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import {
5454
setExempt,
5555
setNameTarget,
5656
setTldPrice,
57+
shortCount,
5758
summarizeBulkClaim,
5859
tldRejection,
5960
} from "../moshpit.mjs";
@@ -427,7 +428,7 @@ oranges, pears, plums
427428
# anything on a line beats the defaults below · # comments ignored"></textarea>
428429
${claimDefaults(req)}
429430
<p class="mono faint" style="font-size:.7rem;margin:8px 0 10px">
430-
Up to ${MAX_BULK_TLDS} at a time. Ones already taken are reported, not fatal —
431+
Up to ${shortCount(MAX_BULK_TLDS)} at a time. Ones already taken are reported, not fatal —
431432
the rest still land. The price and target below apply to every ending that
432433
lands, unless a line says otherwise.
433434
</p>

apps/pwa/test/moshpit-bulk-claim.test.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,14 @@ test("a paste bigger than one request can finish", { skip: installed ? false : "
398398
assert.match(m.summarizeBulkClaim(result), /2 not attempted paste them again/);
399399
});
400400
});
401+
402+
test("a ceiling reads like a rough promise", async () => {
403+
const { shortCount, MAX_BULK_TLDS } = await import("../src/lib/moshpit-name.mjs");
404+
assert.equal(shortCount(1000), "1k");
405+
assert.equal(shortCount(2000), "2k");
406+
assert.equal(shortCount(MAX_BULK_TLDS), "1k");
407+
// Anything not a round thousand stays exact — "1.2k" would be a lie about
408+
// where the ceiling actually is.
409+
assert.equal(shortCount(200), "200");
410+
assert.equal(shortCount(1500), "1500");
411+
});

0 commit comments

Comments
 (0)