Skip to content

Don't add database source archive folders by default#3047

Merged
shati-patel merged 9 commits intomainfrom
shati-patel/db-src-archive
Nov 13, 2023
Merged

Don't add database source archive folders by default#3047
shati-patel merged 9 commits intomainfrom
shati-patel/db-src-archive

Conversation

@shati-patel
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel commented Nov 1, 2023

No longer add the database source folder to the workspace by default (since this caused bugs in single-folder workspaces). If users want to keep the old behaviour of auto-adding DB source folders, they can set the addDatabaseSourceToWorkspace setting to true.

See internal linked issue for more details.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

Comment on lines 715 to 693
makeSelected,
false,
);
if (!addedDatabase) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I assume we no longer need to treat the model editor as a special case, so I've removed the argument here.

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.

I'm not sure about this change: if you are in the model editor and have the setting enabled, we would now suddenly reload when you try to model a dependency. I think this may be unexpected because the user might not know that the database gets added as a normal database.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right that this might be unexpected. Since it's less explicit that you're adding a database in this case, I'll keep the hard-coded "don't add source archive" setting! 👍🏽


const ADD_DATABASE_SOURCE_TO_WORKSPACE_SETTING = new Setting(
"addDatabaseSourceToWorkspace",
DATABASE_DOWNLOAD_SETTING,
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.

Is this correct to be under databaseDownload? This also applies to database manually added by adding a folder or adding an archive, so it does apply to non-downloaded databases as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point! I can rename the overall setting to something like "Adding databases" (instead of "Downloading databases")

Comment on lines 715 to 693
makeSelected,
false,
);
if (!addedDatabase) {
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.

I'm not sure about this change: if you are in the model editor and have the setting enabled, we would now suddenly reload when you try to model a dependency. I think this may be unexpected because the user might not know that the database gets added as a normal database.

@shati-patel shati-patel marked this pull request as draft November 7, 2023 13:42
@shati-patel
Copy link
Copy Markdown
Contributor Author

(Converting back to draft while we wait for docs to be published and for merging to be unlocked)

@shati-patel shati-patel force-pushed the shati-patel/db-src-archive branch from 2294d8c to 5b1f528 Compare November 13, 2023 10:36
@shati-patel shati-patel force-pushed the shati-patel/db-src-archive branch from 5b1f528 to c111a74 Compare November 13, 2023 10:37
@shati-patel shati-patel marked this pull request as ready for review November 13, 2023 11:22
@shati-patel
Copy link
Copy Markdown
Contributor Author

shati-patel commented Nov 13, 2023

Docs are in place, and I've had confirmation that this is good to merge! (Apologies for all the commit spam, I had a few conflicts to resolve...)

Comment on lines 383 to +387
"codeQL.databaseDownload.allowHttp": {
"type": "boolean",
"markdownDeprecationMessage": "**Deprecated**: Please use `#codeQL.addingDatabases.allowHttp#` instead.",
"deprecationMessage": "Deprecated: Please use codeQL.addingDatabases.allowHttp instead."
},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As mentioned offline, users who still use this old setting name will get a deprecation message:
image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the record: we will no longer support the old setting name. This isn't the "formal" way of deprecating a setting, but this is a sufficiently niche/insecure setting that it shouldn't have much user impact.

In the case where a user did have this setting enabled: If they try to download a DB from an http location, they'll get the error message "Must use https for downloading a database.", which should point them to check their settings.

Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull Nov 13, 2023

Choose a reason for hiding this comment

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

Discussed offline as well, but this should be fine. As said it's not the full proper way of renaming a setting, and we could aim to support both for a transition period, but we expect this setting to be almost (if not completely) unused. And as Shati points out, if someone is using this the error should point them towards checking their settings and seeing the deprecation notice. This along with a changelog entry should mean that anyone who is using it sees it and updates their settings.

Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @shati-patel for adding the changelog / deprecation notice.

@shati-patel shati-patel enabled auto-merge (squash) November 13, 2023 15:52
@shati-patel shati-patel merged commit 9e914c9 into main Nov 13, 2023
@shati-patel shati-patel deleted the shati-patel/db-src-archive branch November 13, 2023 16:04
@shati-patel shati-patel mentioned this pull request Nov 14, 2023
3 tasks
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