carloea2 opened a new pull request, #4263:
URL: https://github.com/apache/texera/pull/4263

   ### What changes were proposed in this PR?
   
   This PR fixes an issue in `amberHomePath` resolution where the previous 
implementation could select the wrong repo when multiple sibling directories 
under the same parent satisfied `isAmberHomePath(...)`.
   
   
https://github.com/apache/texera/blob/ac909a07dc656689a946fcc8cf08fbfe6b4595b5/amber/src/main/scala/org/apache/texera/amber/engine/common/Utils.scala#L39-L59
   
   Previously, if the current working directory was not itself recognized as 
the Amber home path, the code would walk the parent directory and return 
`findAny()` from matching paths. In environments with multiple Texera/Amber 
repos under the same parent, this could resolve to an unrelated sibling repo 
instead of the repo the process was launched from.
   
   This PR changes the logic to:
   
   * keep returning the current working directory immediately when it is 
already a valid Amber home path
   * guard against searching from filesystem root when there is no parent
   * prefer the closest valid match associated with the current working 
directory
   * fall back to any valid match only when no closer candidate is found
   * normalize returned paths with `toRealPath()`
   * close `Files.walk(...)` safely using `Using.resource(...)`
   
   This makes Amber home path detection more deterministic and prevents 
accidentally selecting the wrong engine/repo in multi-repo local setups.
   
   ### Any related issues, documentation, discussions?
   
   Closes #4262
   
   ### How was this PR tested?
   
   Manually tested with a local directory layout where multiple sibling repos 
satisfy `isAmberHomePath(...)`.
   
   Example setup:
   
   ```text
   E:\texera\
     ├─ texera\
     └─ a\
   ```


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