Skip to content
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

fix: source handling with remoteRoot #389

Merged
merged 3 commits into from
Mar 11, 2020

Conversation

connor4312
Copy link
Member

Fixes #383. There were a two things that caused issues attaching to
remote processes:

  1. We requested sourcemaps from their remote location, which doesn't
    exist locally. This PR rebases the path correctly.
  2. We used url length as the heuristic for which to narrow the 'correct'
    file at an absolute path. With a different remote root, though, the
    urls might be totally different. We now also check whether the
    original path is the sourcemap parent of the generated path. This was
    the problem in the linked issue, where ts-node was used.

Fixes #383. There were a two things that caused issues attaching to
remote processes:

1. We requested sourcemaps from their remote location, which doesn't
   exist locally. This PR rebases the path correctly.
2. We used url length as the heuristic for which to narrow the 'correct'
   file at an absolute path. With a different remote root, though, the
   urls might be totally different. We now also check whether the
   original path is the sourcemap parent of the generated path. This was
   the problem in the linked issue, where ts-node was used.
@connor4312 connor4312 force-pushed the fix/source-handling-in-remote branch from 74f7ec5 to 8c3cdb8 Compare March 10, 2020 18:02
@jasonwilliams
Copy link
Contributor

Should there be tests for this?
Btw thanks soo much for fixing it!

@connor4312
Copy link
Member Author

connor4312 commented Mar 10, 2020

Yea, I was thinking about how to do this, I think I can do it well enough by having a test with a duplicate of the workspace running the process out of os.tmpdir(). After booting the process it could wipe that tmpdir location which would trigger the first issue. Won't be able to test cross-platform things (e.g. Windows running Linux containers) but that would work for this, at least.

@jasonwilliams
Copy link
Contributor

jasonwilliams commented Mar 10, 2020

I think that should be good enough.
A test for this is certainly worth while as I’m not sure you would be aware if it broke unless you’re actively using it with containers.

@connor4312
Copy link
Member Author

Yep, good reasoning.

I unintentionally practiced proper TDD, by adding a test and not realizing I had changed back to master, then spending a while debugging why it was failing.

@connor4312 connor4312 merged commit 8abb618 into program-to-source-file Mar 11, 2020
@connor4312 connor4312 deleted the fix/source-handling-in-remote branch March 11, 2020 15:29
@jasonwilliams
Copy link
Contributor

Seems to be working great today :D
Thank you

@connor4312
Copy link
Member Author

Awesome thanks for confirming!

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.

3 participants