Skip to content

[api] Add timing collection and dump via environment variable - #64846

Merged
Andrew Branch (andrewbranch) merged 4 commits into
microsoft:mainfrom
andrewbranch:andrewbranch-api-timing-collection-dumps
Oct 16, 2026
Merged

Andrew Branch (andrewbranch) merged 4 commits into
microsoft:mainfrom
andrewbranch:andrewbranch-api-timing-collection-dumps

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Adds a TS_API_TIMING_DIR environment variable that causes the API client to collect timing info and write its results out to a file upon closing. I'm working on gathering an API benchmarking suite we can run on PRs with @typescript-bot api perf test this or something.

Write versioned per-client timing snapshots to TS_API_TIMING_DIR during sync and async disposal, fetching final server timing before connection cleanup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9920adc3-3fc7-4d27-8ec1-c9c4490b9cf9
Record final timing query errors in the dump without writing to stdio, and cover dump activation and lifecycle without duplicating the timing schema.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9920adc3-3fc7-4d27-8ec1-c9c4490b9cf9
Copilot AI balanced review requested due to automatic review settings October 16, 2026 17:54
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 16, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 16, 2026

This comment was marked as resolved.

Dispose disconnected JSON-RPC connections during final timing collection and preserve client-only measurements when server timing is disabled. Add focused regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9920adc3-3fc7-4d27-8ec1-c9c4490b9cf9

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues remain, and regression coverage addresses both client modes and server-timing failures.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Oct 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(automated local review)

The environment-controlled timing dumps work in both API modes, and the async disconnect/disabled-server fixes check out. I confirmed one remaining shutdown regression at packages/typescript/src/api/sync/client.ts:201: after a synchronous filesystem callback throws, the final timing request can block close() indefinitely, preventing both the dump and cleanup.

The PR's existing "sync: preserves a dump after a filesystem callback throws" test reproduces the hang on Windows. A standalone repro finishes on base and with dumping disabled. Remembering the unrecoverable callback error in SyncRpcChannel and rejecting further I/O resolves it; local fix commit c8b1982436e85f6fd85e96b931d85c4843b5b367 is available but not pushed.

With that fix, all 966 API tests pass, including the existing callback-error test. Final npx hereby validate --api completed lint/format/build/API checks, but exited 1 because two unchanged fswatch tests require Windows symlink privileges unavailable here. Compiler baselines were unchanged.

@RyanCavanaugh

Copy link
Copy Markdown
Member

The proposed change from the above comment is c8b1982

Remember callback failures before abandoning the response loop so final timing collection cannot block shutdown on a desynchronized channel.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9920adc3-3fc7-4d27-8ec1-c9c4490b9cf9

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

@andrewbranch

Andrew Branch (andrewbranch) commented Oct 16, 2026 •

Copy link
Copy Markdown
Member Author

Sorry I clicked the Jake button when I meant to click the Copilot button 😄

The Jake response time is much faster though

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No blocking issues remain, and regression tests cover the identified shutdown and disabled-server timing cases.

No open issues 🎉

Review effort: Balanced

@andrewbranch
Andrew Branch (andrewbranch) added this pull request to the merge queue Oct 16, 2026
Merged via the queue into microsoft:main with commit 39be28b Oct 16, 2026
29 checks passed
@andrewbranch
Andrew Branch (andrewbranch) deleted the andrewbranch-api-timing-collection-dumps branch October 16, 2026 22:51
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants