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

Creating a product through the web interface creates a product with a schema mismatch #3459

Open
andrewg-spectra opened this issue Oct 20, 2021 · 3 comments
Labels
CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands server 🖥️ web 🌍 Related to the web app

Comments

@andrewg-spectra
Copy link

Describe the bug
Creating a product through the web interface
image

creates a product with a schema mismatch
image

The server produces the following output:

codechecker-codechecker-1  | [INFO 2021-10-20 18:07] - [::ffff:192.168.22.114]:57194 -- [Anonymous] POST /v6.43/Products@addProduct
codechecker-codechecker-1  | [INFO 2021-10-20 18:07] - User requested add product 'test'
codechecker-codechecker-1  | [INFO 2021-10-20 18:07] - Disconnecting product 'test'
codechecker-codechecker-1  | [INFO 2021-10-20 18:07] - [::ffff:192.168.22.114]:57196 -- [Anonymous] POST /v6.43/Products@getProducts

CodeChecker version
v6.17.0

To Reproduce
Create a codechecker-web server with a PostgreSQL database. I use something similar to this sample compose file.
Using the web interface create a new product (see image above).

Expected behaviour
I expect the new product to be created without a schema mismatch.

Desktop (please complete the following information)

  • OS: Linux
  • Browser:Chrome
  • Version: 94.0.4606.81

Additional context
Using the command CodeChecker cmd products add test --url <server_url> will create a product without displaying the schema mismatch error.

@csordasmarton
Copy link
Contributor

@andrewg-spectra By default in case of Sqlite if you start a CodeChecker server to an empty workspace directory (CodeChecker server -w ~/workspace/my_empty_dir) it will create a config database under this directory and also a separate database for the Default product:

  • ~/workspace/my_empty_dir/config.sqlite
  • ~/workspace/my_empty_dir/Default.sqlite

In case of PostgreSQL the default configuration database name is config (See: CodeChecker server --help):

  --dbname DBNAME, --db-name DBNAME
                        Name of the database to use. (default: config)

So I think you tried to create a product with a wrong and already existing database.

@whisperity whisperity added CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands server 🖥️ web 🌍 Related to the web app labels Oct 26, 2021
@andrewg-spectra
Copy link
Author

andrewg-spectra commented Oct 26, 2021

@csordasmarton The UX here is confusing because "Database Name" on the web form or dbname/db-name in the CLI could be referring to:

  • The product database (which should not exist yet), or
  • The config database where a list of all the products are stored.

I think the correct answer is the latter. When I specify the name of a new database that does not exist, I get this error:

image

codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - Server waiting for client requests on [[::]:8001]
codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - [::ffff:172.19.0.1]:55426 -- [Anonymous] POST /v6.43/Configuration@getNotificationBannerText
codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - [::ffff:172.19.0.1]:55428 -- [Anonymous] POST /v6.43/ServerInfo@getPackageVersion
codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - [::ffff:172.19.0.1]:55434 -- [Anonymous] POST /v6.43/Authentication@getAuthParameters
codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - [::ffff:172.19.0.1]:55436 -- [Anonymous] POST /v6.43/Authentication@hasPermission
codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - [::ffff:172.19.0.1]:55438 -- [Anonymous] POST /v6.43/Products@getProducts
codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - [::ffff:172.19.0.1]:55442 -- [Anonymous] POST /v6.43/Products@addProduct
codechecker-codechecker-1  | [INFO 2021-10-26 16:56] - User requested add product 'test'
codechecker-db-1           | 2021-10-26 16:56:53.454 UTC [43] FATAL:  database "test" does not exist
codechecker-codechecker-1  | [ERROR 2021-10-26 16:56] - The database for product 'test' cannot be connected to.

Honestly, as a user, I don't even want to be exposed to the db internals of CodeChecker. That's just my own personal thoughts though and not the issue I want to raise here. Overall I am very happy with CodeChecker have a workaround to this issue by using the CLI.

@detuur
Copy link

detuur commented Mar 18, 2022

Correct UX would be catching that the user is trying to use the CodeChecker config database, and explaining that they need to make a separate database for every product that they're adding.

Even better UX would be to automatically create a database, instead of having the end-user do it first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands server 🖥️ web 🌍 Related to the web app
Projects
None yet
Development

No branches or pull requests

4 participants