Default applications.moduleLoader to vm-current-context#1248
Open
kriszyp wants to merge 1 commit into
Open
Conversation
Switch the default application module loader from `vm` to
`vm-current-context`. In current-context mode applications share JavaScript
intrinsics with Harper, which avoids the cross-realm compatibility problems
that a separate per-application context can cause (most commonly `instanceof`
and other identity checks failing for values that cross the app/Harper
boundary). Scope-specific values (`logger`, `config`, `server`, the `harper`
API) remain available via `import ... from 'harper'` / `require('harper')`.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This was referenced Jun 11, 2026
This comment has been minimized.
This comment has been minimized.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
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.
Summary
Flip the default
applications.moduleLoaderfromvmtovm-current-context.components/ApplicationScope.ts— fallback when the config param is unset is nowvm-current-context.static/defaultConfig.yaml— shipped default updated to match.Purpose
Under
vmmode each application gets its own context with separate JavaScript intrinsics (Object,Array,Promise, …). That is a recurring source of subtle cross-realm bugs — most commonlyinstanceofand other identity checks failing for values that cross the application/Harper boundary.vm-current-contextruns the VM loader in Harper's own context, so intrinsics are shared, while still giving each application its own module cache and a scopedharpermodule (taggedlogger, per-appconfig, etc.).Application-specific values remain available exactly as before via
import ... from 'harper'/require('harper')— only the realm changes, not the scoped-export mechanism.Where to look
vmremains fully available for anyone who needs separate intrinsics or the SES-constrainedfetch(which only applies invmmode).require('harper')already resolves to the scoped exports, and wrapper-param injection collides with the canonicalconst harper = require('harperdb')pattern.Generated with assistance from Claude (Opus 4.7); reviewed by Kris.