fix(install): survive npm override conflicts and bundle jsonc-parser - #1088
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(install): survive npm override conflicts and bundle jsonc-parser#1088posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Recover from EOVERRIDE npm install failures instead of aborting the run, and
bundle jsonc-parser from its ESM build so no runtime require survives into a
single-file build.
- installPackage retries a failed npm install once with --force when the error
is EOVERRIDE and the project declares a dependency override block, and records
the npm error code on new `package install failed` / `package install retried`
events so the failure class is countable.
- tsdown inlines jsonc-parser via its ESM entry, so the UMD `require('./impl/*')`
no longer reaches a downstream single-file build that crashes at boot.
Generated-By: PostHog Desktop
Task-Id: 8b4cf26f-9645-446e-8a97-6b0e0cff3062
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
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.
Problem
package.jsonpins a package in itsoverridesblock hitsnpm error code EOVERRIDE. The wizard had no handling for this — its only tolerance flag is--legacy-peer-depsfor React 19 — so the install aborted the whole run before the agent stage that opens the pull request. The npm error text was only written to a local log, never captured as an event property, so the failure class could not be sized.import * as jsonc from 'jsonc-parser'resolves to the package UMD entry, whoserequire('./impl/format')survives into a downstream single-filewizard.cjs. Inside Node's embedded runtime that require cannot resolve, so the wizard fails to start — not just the MCP step.Changes
installPackagenow runs the install through a helper, and on failure reads the npm error code. When the code isEOVERRIDE, the manager is npm, and the project declares an override block (overrides/resolutions/pnpm.overrides), it retries once with--forcerather than ending the run.package install failedevent witherror_code; each recovery attempt recordspackage install retriedwithrecovered.tsdown.config.tsaliasesjsonc-parserto its ESM entry and inlines it (deps.alwaysBundle). The bundler resolves every submodule at build time, so no runtimerequire('./impl/*')survives. Every other dependency stays external — verified by diffing the externalized imports before and after.Test plan
pnpm build && pnpm test— 1847 tests pass; build smoke tests pass.extractNpmErrorCodeandhasDependencyOverrides.dist/contains norequire("./impl/*")from jsonc-parser and that the diff of externalized imports before/after is exactlyjsonc-parsermoving from external to bundled.LLM context
Scope is the wizard repo only. The linked report also names a cloud-side change (
run_wizard.py,RetryPolicy(maximum_attempts=1)) in theposthog/posthogrepo that discards a failed run and its pull request; that softening lives in a separate repository and is not part of this PR. The report's first suggestion — importing jsonc-parser's ESM build directly — was rejected: the ESM build uses extensionless imports and the package has no"type": "module", so a plain deep import breaks the wizard's own Node runtime. Bundling the ESM build sidesteps that.Created with PostHog Desktop from this inbox report.