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

fix: use placeholders for data connectors #3483

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

lorenzo-cavazzi
Copy link
Member

This PR reverts the data connector option default values to the previous behavior.
It also prevents showing objects converted to strings as placeholders.

/deploy

@RenkuBot
Copy link
Contributor

You can access the deployment of this PR at https://renku-ci-ui-3483.dev.renku.ch

placeholder={option.convertedDefault?.toString() ?? ""}
placeholder={
option.convertedDefault &&
option.convertedDefault?.toString() !== "[object Object]"
Copy link
Member

Choose a reason for hiding this comment

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

Is there no type information to prevent this? This would also display unusable information when typeof option.convertedDefault === "function" or when typeof option.convertedDefault === "symbol".

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't find a good rule to generalize.
There are convoluted objects as defaults, but never functions nor symbols

Copy link
Member

Choose a reason for hiding this comment

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

Why not use typeof then? It would be more robust than checking string representation.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not that simple. convertedDefault already has a stringy version of the object.

Copy link
Member Author

Choose a reason for hiding this comment

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

What about merging this quick fix so we can include it in the release and then find a more sophisticated fix later?

Copy link
Member

Choose a reason for hiding this comment

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

Ok, but I'm not gonna appreciate it if this is not fixed asap.

Copy link
Member Author

Choose a reason for hiding this comment

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

The data quality we get from the storage_schema endpoint isn't great, and that's coming straight from Rclone (I guess multiple contributions from different people ended up in various attributes/formats for default values).
Harmonizing them all isn't worth the effort since we use them as placeholders, so a function deals with the most common defaults and converts them to numbers/booleans/strings.
Improving the situation here would require dealing with this issue in the first place. If you feel that's important, you are welcome to improve the code.

Copy link
Member

Choose a reason for hiding this comment

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

This is very different from understanding that comparing to [Object object] is not robust, because many objects have a different representation. The issue is that the convertedDefault variable is not robust and the code which creates it needs to be updated unless we want to deal with more bugs in the future.

Copy link
Member Author

@lorenzo-cavazzi lorenzo-cavazzi Jan 15, 2025

Choose a reason for hiding this comment

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

I understand very well the difference between testing myObject.toString() === "[object Object]" and typeof myObject === "object". And I understand the solution for convertedDefault isn't the best.
But I do not understand the request to convert a quick bugfix PR into overhauling the logic to handle non-standard values for cases that never appear.
Again, feel free to improve the logic whenever you have time. That's always welcome for every part of the code.

Copy link
Member

Choose a reason for hiding this comment

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

Because replacing buggy code with another buggy code is not going to be sustainable. Doing === "[object Object]" is a big code smell which indicates that there is a problem with the code and that should not happen. At the very least it should be tracked and solved quickly.

Copy link
Contributor

@andre-code andre-code left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this! The change makes sense, the default values now work as expected, and I've reviewed and tested the connection for both personal and shared Polybox, and it's still working well.

@lorenzo-cavazzi lorenzo-cavazzi linked an issue Jan 15, 2025 that may be closed by this pull request
@lorenzo-cavazzi lorenzo-cavazzi merged commit fd52fba into main Jan 15, 2025
19 checks passed
@lorenzo-cavazzi lorenzo-cavazzi deleted the lorenzo/data-connectors-default branch January 15, 2025 11:32
@RenkuBot
Copy link
Contributor

Tearing down the temporary RenkuLab deplyoment for this PR.

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.

Fix data connectors options with object-like default values
4 participants