Skip to content

fix(moshpit): letters and digits only — no dashes, matching the registry - #66

Merged
ralyodio merged 1 commit into
mainfrom
no-dashes
Aug 1, 2026
Merged

fix(moshpit): letters and digits only — no dashes, matching the registry#66
ralyodio merged 1 commit into
mainfrom
no-dashes

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Draft: blocked on moshcoder/moshpit-resolve#3 publishing. See "CI will be red" below — that's the guard working, not a bug.

The change

Both local copies of the name grammar accepted a dash inside a label. The registry is dropping it (moshcoder/moshpit-name#6, moshcoder/moshcode#193), and a name accepted here but rejected there forwards the tab to a page saying it does not exist — worse than refusing it up front.

- const LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
+ const LABEL = /^[a-z0-9]{1,63}$/;

Changed in apps/desktop/src/moshpit-resolve.ts and extensions/ai-sidebar/moshpit.js together, since the extension is a hand port of the module.

Neither drift test would have caught this

This repo already has two, and both were blind to the exact rule in question:

test compares dashed cases it listed
moshpit.test.js extension port ↔ TS reference none
moshpit-drift.test.js both ↔ @moshcoder/moshpit-resolve none

Leading and trailing dashes were covered elsewhere from the start. A dash inside a label — the case this rule turns on — was covered nowhere. All three implementations could disagree and every assertion would still pass.

Both shared hostname lists now carry lazy-loaded, blue.lazy-loaded, register-me.eggs, a-b.c-d.

CI will be red until the package publishes

With the lists fixed, the anchor now fails against @moshcoder/moshpit-resolve@0.1.1 — and not merely on parsing. It's a behavioural difference:

blue.lazy-loaded → package 0.1.1: { use: 'park' }
                 → this branch:   { use: 'clearnet' }

A tab sent somewhere different. That's precisely what the anchor exists to catch.

To land: merge moshcoder/moshpit-resolve#3 → publish → bump @moshcoder/moshpit-resolve in apps/desktop/package.json → CI green → mark ready.

Six copies of one regex

For the record, this rule currently lives in: moshpit-name, moshpit-resolve, moshcode/apps/pwa, moshcode/src/dns.mjs, and both copies here. The packages can't be imported at runtime by the unbundled extension or by moshcode's tarball install, so the copies are deliberate — the drift tests are what make them safe, and on this rule none of them were.

Tests

65 tests pass in moshpit-resolve.test.ts + moshpit.test.js, including new coverage for the rule on both sides.

Release tagging (v*) is left alone — cut it from main after this merges.

🤖 Generated with Claude Code

Both local copies of the name grammar accepted a dash inside a label,
which the registry is dropping (moshcoder/moshpit-name#6,
moshcoder/moshcode#193). A name accepted here and rejected there forwards
the tab to a page saying it does not exist, which is a worse failure than
refusing it up front.

Neither drift test would have caught this. moshpit.test.js compares the
extension port against the TypeScript reference over a shared hostname
list, and moshpit-drift.test.js compares both against the published
package — and neither list contained a dash inside a label. Leading and
trailing dashes were covered from the start; the case the rule actually
turns on was covered nowhere, so all three implementations could disagree
and every assertion still passed.

Both lists now carry it, and the anchor consequently fails against
@moshcoder/moshpit-resolve 0.1.1 with a real behavioural difference:
blue.lazy-loaded decides 'park' against the package and 'clearnet' here.
That is the guard working. It goes green once moshcoder/moshpit-resolve#3
publishes and the devDependency is bumped.

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

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio marked this pull request as ready for review August 1, 2026 13:03
@ralyodio
ralyodio merged commit 1a33d38 into main Aug 1, 2026
6 of 7 checks passed
ralyodio added a commit that referenced this pull request Aug 1, 2026
Unblocks main, red since #66 merged.

#66 dropped dashes from both local copies of the name grammar while the
published package still allowed them, so moshpit-drift.test.js failed on
blue.lazy-loaded — and not merely on parsing: the two disagreed on where
a tab goes, 'park' against the package and 'clearnet' against the new
rule. That is the anchor earning its place.

0.1.2 carries the rule. The lockfile is the part that matters: CI installs
frozen, so the ^0.1.1 range never picked the new version up on its own.

Scoped to the one package deliberately. Doing this with `pnpm update
--latest` first pulled the whole tree forward — TypeScript 5.9.3 to 7.0.2,
eslint 9 to 10, babel 7 to 8, 3509 lines of lockfile — and broke Lint with
"typescript-eslint does not support TS 7.0". This touches 11 lines.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ralyodio added a commit that referenced this pull request Aug 1, 2026
Unblocks main, red since #66 merged.

#66 dropped dashes from both local copies of the name grammar while the
published package still allowed them, so moshpit-drift.test.js failed on
blue.lazy-loaded — and not merely on parsing: the two disagreed on where
a tab goes, 'park' against the package and 'clearnet' against the new
rule. That is the anchor earning its place.

0.1.2 carries the rule. The lockfile is the part that matters: CI installs
frozen, so the ^0.1.1 range never picked the new version up on its own.

Scoped to the one package deliberately. Doing this with `pnpm update
--latest` first pulled the whole tree forward — TypeScript 5.9.3 to 7.0.2,
eslint 9 to 10, babel 7 to 8, 3509 lines of lockfile — and broke Lint with
"typescript-eslint does not support TS 7.0". This touches 11 lines.

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