Skip to content

Port --traceResolutions #1537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Port --traceResolutions #1537

wants to merge 6 commits into from

Conversation

sheetalkamat
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings August 7, 2025 21:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ports the TypeScript --traceResolutions feature to the Go implementation, which provides detailed logging of module resolution steps during compilation. This feature is particularly useful for debugging module resolution issues.

Key changes:

  • Added trace resolution logging to the module resolution system
  • Implemented detailed resolution step tracking with conditional output
  • Updated baseline files to include new trace output format

Reviewed Changes

Copilot reviewed 300 out of 368 changed files in this pull request and generated no comments.

File Description
testdata/baselines/reference/submodule/conformance/*.trace.json Reference baseline files showing expected trace output
testdata/baselines/reference/submodule/conformance/*.trace.json.diff Diff files showing changes in trace output behavior between old and new implementations

File '/packages/main/node_modules/shared/index.d.ts' does not exist.
Directory '/packages/main/node_modules/@types' does not exist, skipping all lookups in it.
Directory '/packages/node_modules' does not exist, skipping all lookups in it.
+Directory '/packages/node_modules/@types' does not exist, skipping all lookups in it.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we are adding these extra lookups

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this caching was removed, because the FS itself caches. We just let the resolver go wild.

Directory '/node_modules/@types' does not exist, skipping all lookups in it.
-Resolving real path for '/packages/main/node_modules/shared/index.js', result '/packages/shared/index.js'.
-======== Module name 'shared' was successfully resolved to '/packages/shared/index.js' with Package ID 'shared/[email protected]'. ========
+======== Module name 'shared' was successfully resolved to '/packages/shared/index.js' with Package ID '[email protected]'. ========
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package id seems to be different

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this comes down us not having ported classic/node10 resolution

File '/node_modules/pkg/index.d.ts' exists - use it as a name resolution result.
Resolving real path for '/node_modules/pkg/index.d.ts', result '/node_modules/pkg/index.d.ts'.
======== Module name 'pkg' was successfully resolved to '/node_modules/pkg/index.d.ts'. ========
-File '/node_modules/pkg/package.json' does not exist according to earlier cached lookups.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didnt add traces for package .json lookups for file's metadata that we use to in strada as part of this PR

@jakebailey
Copy link
Member

I suspect diffing the resolutions won't be useful due to the things noted above; we don't have classic/node10 resolution and we removed all deduplication from the resolver because it was far faster to just let the FS cache things.

@sheetalkamat
Copy link
Member Author

tion from the resolver because it was far faster to just let the FS cache things.

So do we not want to diff with old but baseline trace.json

@jakebailey
Copy link
Member

I am not sure; I think we had been concerned about the output even being consistent given it's now happening concurrently. It implies that the resolutions can't be streamed to an output without being interleaved.

@sheetalkamat
Copy link
Member Author

I am not sure; I think we had been concerned about the output even being consistent given it's now happening concurrently. It implies that the resolutions can't be streamed to an output without being interleaved.

The way this is implemented it guaranetees the order of the trace
The output is always after the trace so shouldnt not interfere with that.

i am not sure if diffing with old is useful or not and who is looking at it so may be i will just skip that part but baseline the trace so we can detect the changes

@@ -42,7 +43,7 @@ func Run(t *testing.T, fileName string, actual string, opts Options) {
writeComparison(t, actual, localPath, referencePath, false)
}

if !opts.IsSubmodule {
if !opts.IsSubmodule || opts.SkipDiffWithOld {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? I think it's leftover now that the diffs were dropped.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to ensure that it does not diff with old
Should i be setting "submodule" as false instead but then the trace will go in different location compared to their emit and other stuff ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, you're right. I thought we had a way to do this before but I'm not seeing it anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants