Skip to content

fix: avoid host Git discovery in Bazel sandboxes - #705

Open
4og wants to merge 1 commit into
mainfrom
fix/avoid-sandbox-git-root
Open

fix: avoid host Git discovery in Bazel sandboxes#705
4og wants to merge 1 commit into
mainfrom
fix/avoid-sandbox-git-root

Conversation

@4og

@4og 4og commented Aug 10, 2026

Copy link
Copy Markdown
Member

Bazel sandboxed docs actions can walk out of execroot and discover a host Git worktree, causing ubproject.toml to be written outside the project. Stop Git-root discovery when the fallback working directory is inside execroot, and add a regression test. This intentionally relies on Bazel's execroot layout; it only covers the fallback path, while bazel run continues to use BUILD_WORKSPACE_DIRECTORY.

@github-actions

Copy link
Copy Markdown
Contributor

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //src:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: cef7bc59-ed46-4ea8-9197-48ea8a81fa1e
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
WARNING: Target pattern parsing failed.
ERROR: Skipping '//src:license-check': no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
Analyzing: 0 targets (1 packages loaded)
ERROR: no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
INFO: Elapsed time: 6.478s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-705: https://eclipse-score.github.io/docs-as-code/pr-705/

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Prevents Bazel sandbox builds from discovering host Git worktrees.

Changes:

  • Stops fallback Git discovery for paths containing execroot.
  • Adds a regression test for sandbox ancestor discovery.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/helper_lib/__init__.py Adds execroot-aware Git discovery behavior.
src/helper_lib/test_helper_lib.py Tests sandbox Git-root isolation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

start_path = find_ws_root()
if start_path is None:
start_path = Path.cwd()
if "execroot" in start_path.resolve().parts:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants