carloea2 opened a new issue, #4262:
URL: https://github.com/apache/texera/issues/4262

   ### What happened?
   
   When Texera/Amber is launched from a nested directory, the current 
`amberHomePath` detection can pick the wrong repository if the parent folder 
contains multiple sibling repos that also satisfy `isAmberHomePath(...)`.
   
   
https://github.com/apache/texera/blob/ac909a07dc656689a946fcc8cf08fbfe6b4595b5/amber/src/main/scala/org/apache/texera/amber/engine/common/Utils.scala#L39-L59
   For example, if the working directory is:
   
   `E:\texera\texera`
   
   the old logic moves up to:
   
   `E:\texera`
   
   and then scans children up to depth 2 using `findAny()`. If there are 
multiple valid matches under `E:\texera`, such as:
   
   * `E:\texera\texera`
   * `E:\texera\a`
   
   the method may return a different matching repo instead of the one the 
process was launched from.
   
   This causes Amber home path resolution to be nondeterministic / incorrect 
depending on directory layout.
   
   ### How to reproduce?
   
   1. Create a parent directory containing multiple repos that satisfy 
`isAmberHomePath(...)`, for example:
   
      * `E:\texera\texera`
      * `E:\texera\a`
   2. Launch Texera/Amber with the working directory set to `E:\texera\texera`.
   3. Trigger code that evaluates `amberHomePath`.
   4. Observe that the previous implementation may resolve the home path to 
`E:\texera\a` instead of `E:\texera\texera`.
   
   **Root cause**
   The previous implementation does this:
   
   * if current working directory is not already the Amber home path
   * walk the parent directory to depth 2
   * return `.findAny()` match
   
   Because `.findAny()` does not prefer the current repo lineage, a sibling 
repo can be selected incorrectly.
   
   ### Version
   
   1.1.0-incubating (Pre-release/Master)
   
   ### Commit Hash (Optional)
   
   _No response_
   
   ### What browsers are you seeing the problem on?
   
   _No response_
   
   ### Relevant log output
   
   ```shell
   
   ```


-- 
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]

Reply via email to