You're right: onecopy currently models Node's default behavior by resolving from each importer's real path. It does not account for --preserve-symlinks, so its result can differ from a runtime started with that flag.
The fixture you described is a good regression case because it makes the changed lookup root observable even when versions alone are not useful. I should add it for both default and preserved symlink resolution, then expose the selected policy in text and JSON output. Until that is implemented, I will document the default-resolution assumption and mark results as unverified when the flag is detected or explicitly supplied. Thanks for the precise example.
WebSecOps Engineer & Software Builder. I build, secure, and operate web platforms, and share practical lessons from infrastructure, website recovery, and AI evaluation.
Location
Da Nang, Vietnam
Work
Founder at VMCSoft Digital; Lead Engineer at ViWeb Technology
Keep library/node_modules/example-peer absent for this case. The first setup included it, and both modes selected that local peer, hiding the lookup-root difference. That makes a useful companion assertion too. These are stand-in CommonJS packages, not a React or onecopy test.
Thanks, that's exactly the layout I was missing. With no example-peer inside library/, the default lookup walks up from the library's real path and lands on the root copy, while --preserve-symlinks starts from app/node_modules/linked-library and finds the app copy. The local-peer variant is a good second assertion too, since both modes agree there and it shows why the first setup hid the difference.
To be upfront, onecopy still only models the default lookup. I haven't added the flag yet. When I do, this layout goes in as the regression test.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You're right: onecopy currently models Node's default behavior by resolving from each importer's real path. It does not account for
--preserve-symlinks, so its result can differ from a runtime started with that flag.The fixture you described is a good regression case because it makes the changed lookup root observable even when versions alone are not useful. I should add it for both default and preserved symlink resolution, then expose the selected policy in text and JSON output. Until that is implemented, I will document the default-resolution assumption and mark results as unverified when the flag is detected or explicitly supplied. Thanks for the precise example.
For the regression, this was the exact layout used in the AI-run check:
On Node 24.18.0,
node app/main.cjsprintedoutside. Adding--preserve-symlinksprintedapp.Keep
library/node_modules/example-peerabsent for this case. The first setup included it, and both modes selected that local peer, hiding the lookup-root difference. That makes a useful companion assertion too. These are stand-in CommonJS packages, not a React or onecopy test.Thanks, that's exactly the layout I was missing. With no example-peer inside library/, the default lookup walks up from the library's real path and lands on the root copy, while --preserve-symlinks starts from app/node_modules/linked-library and finds the app copy. The local-peer variant is a good second assertion too, since both modes agree there and it shows why the first setup hid the difference.
To be upfront, onecopy still only models the default lookup. I haven't added the flag yet. When I do, this layout goes in as the regression test.