test: anchor both copies of the resolution policy to the published package - #60
Merged
Conversation
…ckage The rules exist twice here — moshpit-resolve.ts and a hand port of it into the extension, because the extension is plain JS and `pnpm build` is tsc, which compiles but does not bundle. A package cannot be imported at runtime from an unbundled extension, so the copies stay. moshpit.test.js compares those two against each other. That catches one of them drifting and misses both drifting together — which is the likely case, since the same person edits them in the same commit for the same reason. So this anchors each copy to @moshcoder/moshpit-resolve instead. The package is the reference; either copy leaving it is caught, including when they leave together. Verified that specifically: changing CONSOLE_LABEL in *both* copies identically fails six of these, where a copy-to-copy comparison stays green. Behaviour rather than bytes, because the copies legitimately differ — comments, TypeScript types, and the chrome-coupled config reader the package deliberately does not carry. There is a test for that last one too: if moshpitConfig ever appears in the package, it has stopped being usable outside a browser. A dev dependency, and apps/desktop is a pnpm workspace member, so the root install CI already runs reaches it and these actually execute rather than skip. 111 across the desktop suite. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
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 resolution rules exist twice here —
moshpit-resolve.tsand a hand port into the extension, because the extension is plain JS andpnpm buildistsc, which compiles but doesn't bundle. A package can't be imported at runtime from an unbundled extension, so the copies stay.What the existing test misses
moshpit.test.jscompares the two copies against each other. That catches one drifting and misses both drifting together — which is the likely case, since the same person edits them in the same commit for the same reason.This anchors each copy to @moshcoder/moshpit-resolve instead. The package is the reference; either copy leaving it is caught, including when they leave together.
Verified that specific gap
Changed
CONSOLE_LABELin both copies identically:A copy-to-copy comparison stays green on that.
Behaviour, not bytes
The copies legitimately differ — comments, TypeScript types, and the chrome-coupled config reader the package deliberately doesn't carry. There's a test for that last one too: if
moshpitConfigever appears in the package, it has stopped being usable outside a browser.Coverage: hostname parsing, gateway/parking URLs including a self-hosted pit, the console label,
decideResolutionacross the full cross-product of mode × clearnet-resolves × registry-answer, and the shared defaults.It actually runs
A dev dependency, and
apps/desktopis a pnpm workspace member — so the rootpnpm install --frozen-lockfileCI already runs reaches it. 111/111 desktop suite.🤖 Generated with Claude Code