Skip to content

pit: let an ending be all digits - #147

Merged
ralyodio merged 1 commit into
mainfrom
fix/numeric-tlds
Jul 31, 2026
Merged

pit: let an ending be all digits#147
ralyodio merged 1 commit into
mainfrom
fix/numeric-tlds

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

.420, .187, .911 couldn't be claimed. normalizeTld refused any all-numeric ending as "ambiguous against an IPv4 literal" — which is true of a hostname and not of an ending. Nothing reads .420 on its own as an address.

The ambiguity is real, just one level up

Several parsers read a two-part dotted number as an abbreviated IPv4 — 192.168 is 192.0.0.168 to some of them. So 1.420 genuinely can't be told apart from an address, while blue.420 and 420.blue obviously can. It takes both halves being numbers to create the collision.

The check moved to parseMoshpitName and applies to the whole name:

normalizeTld(".420")        →  "420"                      ✓ claimable
parseMoshpitName("blue.420") → { label: "blue", tld: "420" }  ✓
parseMoshpitName("420.blue") → { label: "420", tld: "blue" }  ✓
parseMoshpitName("1.420")    →  null                       ✗ reads as an address
parseMoshpitName("192.168")  →  null                       ✗

A label could already be numeric; now an ending can be too, and only the pair is refused.

In a pasted list

The leading dot disambiguates: .187 is an ending to point at, 187 on its own is a price. Both were already true — they just matter now that numeric endings exist.

.187 .420   →  { tld: "187", aliasOf: "420" }
.911 $5     →  { tld: "911", priceUsd: 5 }

Tests

Three asserted the old rule and were rewritten, not deleted — the IPv4 case they were protecting is still tested, at the level where it's actually a problem.

279/279 pwa suite.

🤖 Generated with Claude Code

`.420`, `.187`, `.911` could not be claimed. normalizeTld refused any
all-numeric ending as "ambiguous against an IPv4 literal", which is true of a
hostname and not of an ending: nothing reads `.420` on its own as an address.

The ambiguity is real but belongs one level up. Several parsers read a
two-part dotted number as an abbreviated IPv4 — `192.168` is `192.0.0.168` to
some of them — so `1.420` genuinely cannot be told apart from an address while
`blue.420` and `420.blue` obviously can. It takes both halves being numbers to
create the collision.

So the check moves to parseMoshpitName and applies to the whole name. An
ending may be numeric, a label already could be, and only the pair is refused.

In a pasted list the leading dot does the disambiguating: `.187` is an ending
to point at, `187` on its own is a price. Both were already true; they just
matter now that numeric endings exist.

Three tests asserted the old rule and were rewritten rather than deleted —
the IPv4 case they were protecting is still tested, at the level where it is
actually a problem.

279 across the pwa suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit 1137e0a into main Jul 31, 2026
3 checks passed
@ralyodio
ralyodio deleted the fix/numeric-tlds branch July 31, 2026 11:58
@ralyodio ralyodio mentioned this pull request Jul 31, 2026
ralyodio added a commit that referenced this pull request Jul 31, 2026
* chore(release): v0.13.3

install.sh resolves releases/latest, so everything merged since v0.13.2 has
been sitting on main unreachable — `moshcode dns enable` exists in the source
and not in anyone's binary.

The headline is the DNS bridge (#141). Moshpit names now resolve for every
program on the machine, not just inside TronBrowser: each OS gets the mechanism
that routes ONE SUFFIX rather than the one that replaces the resolver —
/etc/resolver on macOS, systemd-resolved routing-only domains or dnsmasq on
Linux, an NRPT rule per namespace on Windows.

  moshcode dns enable / disable / status
  moshcode uninstall <engine|tool>          (#150, completion in #151)

The pit gained most of a namespace registry in between: key pins per name
(#137), pasted bulk claiming with per-line price and target (#138, #142, #143,
#146), all-numeric endings (#147), /n/<name> serving a name or a directory
(#145, #149), and Buy Now on an unclaimed name (#148).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore: restore the em-dash the version bump escaped

The bump rewrote package.json through a JSON serialiser that defaults to ASCII,
turning the em-dash in `description` into —. Valid JSON and the same string
once parsed, but a gratuitous diff in a commit that should touch one line.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant