Skip to content

olsk-bundle's setup script races a second, un-awaited npm install against later steps #10

Description

@michielbdejong

Problem

Found while fixing #3 (PR #9). Once the Playwright Chromium-download hang is bypassed, npm run setup ("Install dependencies") now completes in ~3 minutes instead of hanging — but the subsequent "Build project" and "Test logic" steps then fail with two separate errors that weren't visible before because the pipeline never got past the hang:

  • Build: Error: Could not resolve '../OLSKUIAssets/_OLSKSharedReload.svg' from node_modules/OLSKAppToolbar/node_modules/OLSKReloadButton/main.svelte — this is exactly the import path package-postinstall.js's OLSKPostinstallHotfix() patches. The patch didn't take.
  • Test: Error: Cannot find module 'OLSKString' — required directly (unconditionally) from os-app/_shared/KVCTemplate/main.js.

Suspected root cause

this repo's "setup": "npm install --no-save && olsk-bundle"``. olsk-bundle's bin script (`node_modules/OLSKBundle/package-bin.js`, `LifecycleScriptDidLoad()`) does:

main.OLSKBundleClearPackageLock();
main.OLSKBundleCopyEnvSample();
require('child_process').spawn('npm', ['install', '--no-save'], { stdio: 'inherit' });

That spawn(...) is fired and not awaitedolsk-bundle (and therefore the whole setup script, and the "Install dependencies" CI step) can exit while this second npm install is still running in the background. If that second pass re-resolves/re-hoists dependencies differently than the first (which already ran the repo's own root postinstallpackage-postinstall.js, applying the Svelte-import patch and presumably having OLSKString resolvable at the time), it can silently undo the patch and change what's hoisted to root node_modules — while later CI steps ("Build project", "Test logic") start running against that still-changing tree.

This would explain why both failures are nondeterministic-looking (not reproducible locally under --ignore-scripts + a single clean install) but reproducible every time in real CI so far.

Suggested next steps

  • Confirm by instrumenting/timing: does the background npm install from olsk-bundle still show as running (or have changed node_modules/OLSKString, node_modules/OLSKAppToolbar/node_modules/OLSKReloadButton/main.svelte) after the "Install dependencies" step reports done?
  • If confirmed, this needs a fix upstream in OLSKBundle (await the spawned install, or don't spawn a redundant second install at all) — out of scope for a same-day fix in this repo alone.
  • Short-term mitigation to consider here: replace this repo's "setup" script so it doesn't rely on olsk-bundle's spawn-and-exit behavior (e.g. run the equivalent steps directly and synchronously), or add an explicit wait/retry before "Build project" runs.

https://claude.ai/code/session_01AcjKc8vk2fb84yYZsE8k5d

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions