Skip to content

Adding STS initialization logging#21482

Open
Benjin wants to merge 10 commits intomainfrom
dev/benjin/stsLogging
Open

Adding STS initialization logging#21482
Benjin wants to merge 10 commits intomainfrom
dev/benjin/stsLogging

Conversation

@Benjin
Copy link
Contributor

@Benjin Benjin commented Mar 6, 2026

Description

Improving STS initialization logging to capture startup behavior

Fixes #20635

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Copy link
Contributor

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 improves the STS (SQL Tools Service) initialization logging to better capture startup behavior, helping diagnose initialization failures like the one reported in issue #20635. The code is also refactored from nested Promise chains (then/catch/reject) to modern async/await syntax, improving readability and maintainability.

Changes:

  • Refactored initialize and initializeForPlatform in serviceclient.ts from Promise-chain style to async/await, and added a post-initialization log message summarizing the result.
  • Changed ServerInitializationResult in serverStatus.ts to use primitive boolean types instead of the boxed Boolean wrapper type.
  • Improved error logging in the catch block to use getErrorMessage(err) for better error message extraction.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
extensions/mssql/src/languageservice/serviceclient.ts Refactored initialize and initializeForPlatform to async/await, added post-init logging, and improved error message formatting.
extensions/mssql/src/languageservice/serverStatus.ts Changed Boolean (boxed) to boolean (primitive) for installedBeforeInitializing, isRunning, and the withRunning parameter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 6458 KB 6455 KB ⚪ -3 KB ( 0% )
sql-database-projects VSIX 7068 KB 7062 KB ⚪ -6 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 16.21622% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.24%. Comparing base (3af4db4) to head (958ea7b).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...ensions/mssql/src/languageservice/serviceclient.ts 15.49% 60 Missing ⚠️
...tensions/mssql/src/languageservice/serverStatus.ts 33.33% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (16.21%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #21482      +/-   ##
==========================================
- Coverage   73.24%   73.24%   -0.01%     
==========================================
  Files         328      328              
  Lines       99403    99399       -4     
  Branches     5644     5643       -1     
==========================================
- Hits        72808    72803       -5     
- Misses      26595    26596       +1     
Files with missing lines Coverage Δ
...tensions/mssql/src/languageservice/serverStatus.ts 96.72% <33.33%> (+7.67%) ⬆️
...ensions/mssql/src/languageservice/serviceclient.ts 42.47% <15.49%> (-0.98%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Benjin Benjin added this to the March 2026 Release milestone Mar 6, 2026
allancascante
allancascante previously approved these changes Mar 6, 2026
Copilot AI review requested due to automatic review settings March 7, 2026 00:19
Copy link
Contributor

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

Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

"assert": "^1.4.1",
"azdataGraph": "github:Microsoft/azdataGraph#0.0.137",
"chai": "^5.3.3",
"chai-as-promised": "^8.0.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this package is the only change here.

Copilot AI review requested due to automatic review settings March 7, 2026 02:07
Copy link
Contributor

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

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 23, 2026 23:05
Copy link
Contributor

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

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Comment on lines 17 to +18
public serverPath: string = undefined,
public message: string = undefined,
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

ServerInitializationResult can carry serverPath/message as undefined (e.g., failures before a path is resolved), but the constructor types them as string. This makes the API misleading and encourages callers to treat them as always present. Consider typing these as string | undefined (or optional) to match actual values being passed around.

Suggested change
public serverPath: string = undefined,
public message: string = undefined,
public serverPath: string | undefined = undefined,
public message: string | undefined = undefined,

Copilot uses AI. Check for mistakes.
serverPath,
);
} catch (err) {
this.logger.logDebug(Constants.serviceLoadingFailed + ": " + getErrorMessage(err));
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

In the catch block, getErrorMessage(err) only logs err.message for Error instances, which drops stack traces/context that are critical for diagnosing startup failures like TypeError ... (reading 'call'). Consider also logging err.stack when available (or a richer serialization) so the output channel/debug logs capture where initialization failed.

Suggested change
this.logger.logDebug(Constants.serviceLoadingFailed + ": " + getErrorMessage(err));
this.logger.logDebug(Constants.serviceLoadingFailed + ": " + getErrorMessage(err));
if (err instanceof Error && err.stack) {
this.logger.logDebug(err.stack);
}

Copilot uses AI. Check for mistakes.
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.

[Bug]: TypeError: Cannot read properties of undefined (reading 'call') When starting mssql extension v1.37 (v1.36 still works)

4 participants