feat(moshpit): actually resolve Moshpit names in the browser, and park unpointed ones - #52
Merged
Conversation
…k unpointed ones The Moshpit settings on the options page were written to chrome.storage and never read by anything. The resolution policy lived in apps/desktop/src as TypeScript that the extension cannot import and that had no callers. So setting a registry did nothing and `california.oranges` died on ERR_NAME_NOT_RESOLVED — the feature was UI and dead code, end to end. - moshpit.js: a port of the policy into the extension (plain JS, no build step). moshpit-resolve.ts stays the reference implementation; a test runs BOTH over the same input space and requires identical answers, because a port that silently drifts is worse than no port. - background.js: two webNavigation hooks, because "does clearnet answer?" is only knowable at two moments. onErrorOccurred (DNS came up empty) is the backfill path and the only one active in the default mode, so nothing that already works is touched. onBeforeNavigate runs only in 'moshpit' mode, where a registered name is meant to beat clearnet. - Parking: a name in the namespace should not dead-end on a DNS error. Unclaimed, or claimed but not pointed at an address yet, now lands on moshcoding.com/parking?name=… — but only where clearnet has nothing, so a working domain is never replaced by a parking page. A registry that was unreachable still degrades to clearnet rather than lying with a parking page for a name it merely failed to look up. - Manifest: webNavigation permission, and a module service worker for the import. No redirect loops: every destination has three labels, so parseRegistryName rejects it on the way back through. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
Probing the live registry showed the payload is richer than the code assumed:
california.oranges -> {registered:true, name_registered:true, target:null,
resolved:'california.oranges', mode, prefer, aliased}
`resolved` echoes the name whether or not it points anywhere, so testing it
marked every claimed name as live — nothing would have parked, and the exact
case this was built for would have gone to the gateway. `target` is the
address, and null is what 'not pointed at an IP yet' actually looks like.
Also read name_registered (is THIS name claimed) in preference to registered
(is the TLD claimed), falling back for older registry builds.
Covered by a test using the verbatim california.oranges response.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Merged
ralyodio
added a commit
that referenced
this pull request
Jul 31, 2026
Ships Moshpit name resolution actually working in the browser (#52): the settings were written to storage and never read, and the policy module had no callers, so no registry setting could make california.oranges resolve. Unclaimed and unpointed names now park instead of dead-ending on a DNS error. Also mosh.<tld> opening the Pit for that TLD (#51). Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Moshpit was UI and dead code, end to end:
moshpitConfigtochrome.storage— nothing read it. Setting the registry topit.moshcode.shhad literally no effect.apps/desktop/src/moshpit-resolve.ts— TypeScript the extension cannot import (plain JS, no build step), with zero callers anywhere in the repo.So
https://california.oranges/died onERR_NAME_NOT_RESOLVED, and no setting could change that.What this adds
moshpit.js— the policy ported into the extension.moshpit-resolve.tsstays the reference implementation; a test runs both over the same input space and requires identical answers, because a port that silently drifts is worse than no port.background.js— twowebNavigationhooks, because "does clearnet answer for this name?" is only knowable at two moments:onErrorOccurredERR_NAME_NOT_RESOLVED)onBeforeNavigatemoshpitmode, where a registered name beats clearnetThe default mode never pre-empts a working domain, and never costs a registry round-trip on ordinary browsing.
Parking — a name inside the namespace shouldn't dead-end on a DNS error. Unclaimed, or claimed but not pointed at an address yet, now lands on
moshcoding.com/parking?name=….Two guardrails on it:
Manifest — adds
webNavigation, and makes the service worker a module for the import.No redirect loops: every destination (
pit.moshcode.sh/n/…,app.moshcode.sh/pit,moshcoding.com/parking) has three labels, soparseRegistryNamerejects it on the way back through. Explicitly tested.Assumption to confirm
The parking URL shape is
moshcoding.com/parking?name=<name>— from "at moshcoding.com parking". Query param over path segment so an endpoint that doesn't parse?name=still lands somewhere real. Say the word if the actual route differs.Verification
apps/desktop— 79 tests pass, incl. 11 cross-implementation parity tests and the new parking casespnpm -r build/pnpm -r test/pnpm lint— all exit 0Still missing (separate work)
This is browser-only. It cannot make
curl https://california.oranges/work on a VPS, because it's an extension redirecting tabs — not DNS. Serving these names to non-browser clients needs a real resolver on the machine (moshcodeCLI writing a systemd-resolved / dnsmasq stanza pointed atpit.moshcode.sh). Happy to take that next — it's a different layer, not an extension change.🤖 Generated with Claude Code