bamaer opened a new pull request, #8301: URL: https://github.com/apache/hop/pull/8301
…onnection The linter reported CONNECTION_DOES_NOT_EXIST for database connections that were present in the project metadata all along. ReferencedDatabaseConnectionChecker asked the metadata serializer whether a connection existed and reported "does not exist" when that lookup *failed* as well as when it answered no. JsonMetadataSerializer.exists() throws whenever VFS cannot reach the metadata folder, so one unreachable folder turned into a warning on every connection in the project. There are now three distinct outcomes: - the connection is verified absent : CONNECTION_DOES_NOT_EXIST, at warning - the lookup failed, so nothing is known : CONNECTION_NOT_VERIFIED, at info, naming the root cause on a single line - whether the database can actually be reached is still never checked; this is an existence check that never opens a JDBC connection Staying silent on a failed lookup was not an option either: an unreadable metadata folder would then produce a clean report that means nothing. Because the save-time validator prompts on any remark, it now prompts only at warning level and above. Otherwise unreadable metadata would put its "save anyway?" dialog in front of every save. Two related hardenings: - HopVfs falls back when the VFS namespace bound to a thread has been closed underneath it. A closed DefaultFileSystemManager has dropped its providers, the local one included, so it reports an absolute path as "a relative path, and no base URI was provided". Executions take a namespace and release it, and the binding is inherited by threads created while it is held, so the linter's pool threads can outlive it. With one tenant the process wide manager is used; with several the namespace builds its own connections again rather than borrow another tenant's. - ProjectsGuiPlugin switches the VFS namespace before firing HopGuiProjectAfterEnabled, so a listener that starts background work is not handed a file system manager that is about to be closed. Tested: - ReferencedDatabaseConnectionCheckerTest: a lookup that throws is reported as CONNECTION_NOT_VERIFIED at info and its reason stays on one readable line, while a genuinely missing connection still warns. - ReferencedConnectionSaveValidatorTest: a connection that could not be checked does not interrupt a save, a missing one still does, and a real problem still gets through when mixed with unverifiable ones. - HopVfsClosedNamespaceTest: an absolute local path still resolves after the inherited namespace was closed, with and without variables, and a namespace is rebuilt rather than the process wide manager borrowed when tenants share the JVM. - integration-tests/lint: a new IT project runs hop lint over two workflows with a Check DB Connections action. Connections that exist produce no CONNECTION_DOES_NOT_EXIST finding; a connection that is absent still produces exactly one. Verified with run-tests-docker.sh PROJECT_NAME=lint. - Hop GUI: the info finding renders correctly in the Problems tab, a save is not interrupted by it, and a workflow whose connections all exist stays clean. **Please** add a meaningful description for your change here ------------------------ Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Run `mvn clean install apache-rat:check` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [x] If you have a group of commits related to the same change, please squash your commits into one and force push your branch using `git rebase -i`. - [x] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) you have to acknowledge this by using the following check-box. - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
