Fixes to --generateTrace to make analyze-trace work#3703
Open
jakebailey wants to merge 4 commits intomainfrom
Open
Fixes to --generateTrace to make analyze-trace work#3703jakebailey wants to merge 4 commits intomainfrom
jakebailey wants to merge 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates --generateTrace output to be compatible with analyze-trace by adding a checkerId dimension and emitting concurrent duration events on separate synthetic thread IDs.
Changes:
- Add
checkerIdto trace legend records and propagate it through checker tracing calls. - Assign synthetic thread IDs based on event args so concurrent file/check events don’t overlap on the same thread.
- Update trace baselines and add a Go test ensuring per-thread nesting and separation invariants.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/baselines/reference/tsc/generateTrace/generateTrace-with-multiple-files-and-complex-types.js | Updates expected trace output (checkerId + synthetic tids) for multi-file scenario. |
| testdata/baselines/reference/tsc/generateTrace/generateTrace-generates-types-file.js | Updates expected trace output (checkerId + synthetic tids) for types-file generation scenario. |
| internal/tracing/tracing_test.go | Adds test asserting concurrent duration events use separate TIDs and are well-nested per thread. |
| internal/tracing/tracing.go | Implements synthetic thread ID assignment + adds checkerId to trace legend records. |
| internal/checker/tracer.go | Propagates checkerId into trace event args from checker tracer. |
Comment on lines
+30
to
+42
| if !separateBeginAndEnd { | ||
| return t.tracing.Push(phase, name, t.copyWithCheckerIndex(args), separateBeginAndEnd) | ||
| } | ||
|
|
||
| args, restore := t.temporarilyAddCheckerIndex(args) | ||
| pop := t.tracing.Push(phase, name, args, separateBeginAndEnd) | ||
| restore() | ||
|
|
||
| return func() { | ||
| _, restoreEndArgs := t.temporarilyAddCheckerIndex(args) | ||
| defer restoreEndArgs() | ||
| pop() | ||
| } |
Comment on lines
+335
to
+343
| tid := key.defaultThreadID() | ||
| for { | ||
| if existingKey, ok := tr.threadKeys[tid]; !ok || existingKey == key { | ||
| break | ||
| } | ||
| tid++ | ||
| } | ||
| tr.threadIDs[key] = tid | ||
| tr.threadKeys[tid] = key |
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.
Pairs with microsoft/typescript-analyze-trace#48