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

update azdata-test in notebooks extension #24984

Merged
merged 3 commits into from
Nov 30, 2023
Merged

Conversation

kisantia
Copy link
Contributor

@kisantia kisantia commented Nov 17, 2023

This updates the azdata-test dependency in the notebooks extension to fix this dependabot alert: https://github.com/microsoft/azuredatastudio/security/dependabot/603

There were a few updates that needed to be made since a few compilation errors started after the azdata-test package was bumped, since it also bumped several other dependencies. There were the errors:
image

The fix was to cast the result from those yaml.safeLoad() calls. It looks like the errors started showing up because the resolved version of @types/js-yaml went from 3.12.1 to 3.12.10 and the return type changed from any to string | object | undefined

3.12.1:
image
3.12.10
image

I also ran the notebook extension unit tests locally and confirmed that they're still passing. The extension unit tests aren't currently running in the pipelines, so that's what I'll look into enabling again next...

@@ -150,7 +150,7 @@ export class BookTocManager implements IBookTocManager {
}

for (const [key, value] of this.tocFiles.entries()) {
const yamlFile = await yaml.safeLoad(value);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this wasn't related to the package version update, but it was a red squiggly when I was in the file, so updated this while I was there

@@ -183,7 +183,7 @@ export class BookModel {
if (this._tableOfContentsPath) {
try {
let fileContents = await fsPromises.readFile(this._configPath, 'utf-8');
const config = yaml.safeLoad(fileContents.toString());
const config = yaml.safeLoad(fileContents.toString()) as JupyterBookSection;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@barbaravaldez could you double check if this cast and the one below in bookTocManager.ts are correct or should be changed? The variables in the tests have types specified, but wasn't sure about these

Copy link
Member

Choose a reason for hiding this comment

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

JupyterBookSection is the only class I'm seeing with a title field for this one, and the tableOfContents variable in bookTocManager already had a JupyterBookSection[] type. Looks good to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup! It looks good to me

@coveralls
Copy link

coveralls commented Nov 17, 2023

Pull Request Test Coverage Report for Build 7042003367

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 2 of 3 (66.67%) changed or added relevant lines in 2 files are covered.
  • 28 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 41.594%

Changes Missing Coverage Covered Lines Changed/Added Lines %
extensions/notebook/src/book/bookTocManager.ts 1 2 50.0%
Files with Coverage Reduction New Missed Lines %
src/sql/workbench/services/connection/browser/connectionDialogService.ts 11 79.2%
src/sql/workbench/contrib/commandLine/electron-sandbox/commandLine.ts 17 79.08%
Totals Coverage Status
Change from base Build 7038348309: 0.03%
Covered Lines: 30810
Relevant Lines: 69389

💛 - Coveralls

Copy link
Member

@cheenamalhotra cheenamalhotra left a comment

Choose a reason for hiding this comment

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

It should be safe IMO, but it looks like yarn.lock has a lot of package updates arriving with this PR..

@@ -691,7 +691,7 @@
"@types/request": "^2.48.1",
"@types/rimraf": "^2.0.2",
"@types/sinon": "^9.0.4",
"@types/tar": "^4.0.3",
"@types/tar": "^6.1.10",
Copy link
Contributor Author

@kisantia kisantia Nov 30, 2023

Choose a reason for hiding this comment

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

I had to update this version to get rid of the error when yarn npm-run-all -lp extensions-ci was getting run in the Compile & Hygiene step of the PR validation pipeline (example failure) .

The problem was that the type definition file for @types/minipass couldn't be located, but when I looked at the @types/minipass folder in notebooks node_modules folder, the readme said that minipass already includes it's types definition, so dependencies on @types/minipass are unnecessary and it's expected that there isn't an index.d.ts file. The @types/minipass package has been marked as deprecated, so it really shouldn't be used.

Version 4.0.3 of @types/tar has a dependency on @types/minipass, but the latest version has a dependency on minipass, so updating the version resolved the issue of the @types/minipass index.d.ts file not being found.

Copy link
Contributor

Choose a reason for hiding this comment

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

And we're using v6 of tar anyways, so this is the correct thing to do for that regardless! 😄

@kisantia kisantia merged commit 146ef3f into main Nov 30, 2023
12 checks passed
@kisantia kisantia deleted the kisantia/updateNotebooks branch November 30, 2023 19:34
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.

None yet

6 participants