Skip to content

Conversation

@frenata
Copy link
Contributor

@frenata frenata commented Feb 10, 2026

No description provided.

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
bough/analyzer.py 89.79% <100.00%> (+0.21%) ⬆️

@frenata frenata requested a review from Copilot February 10, 2026 03:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the analyzer to ignore git-changed files that are outside the workspace root, preventing unrelated repo changes from triggering builds.

Changes:

  • Ignore changed files that cannot be made relative to the workspace root.
  • Add a parametrized test covering changed files outside the workspace.
  • Update ty dev dependency and add a ty ignore for a Hypothesis decorator.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

File Description
bough/analyzer.py Skips changed files outside the workspace when computing directly affected packages.
tests/test_complex_scenarios.py Adds coverage to ensure out-of-workspace changes produce no affected builds.
tests/test_formatters.py Adds a ty ignore comment for type-checking on Hypothesis decorator usage.
pyproject.toml Updates the ty dev dependency version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 170 to 173
except ValueError as e:
if "is not in the subpath" in str(e):
logger.debug("Ignoring file {file_path} outside of workspace")
continue
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Path(...).relative_to(...) raises ValueError for “not a subpath”, but this code only continues when the exception message matches a specific substring. If the message differs (Python version variation, different ValueError text), execution falls through with file_path_obj undefined, which can cause an UnboundLocalError later. Recommend avoiding message matching and branching explicitly (e.g., Path(file_path).is_relative_to(strip_prefix)), or catching ValueError and unconditionally skipping the file as “outside workspace” in this context.

Suggested change
except ValueError as e:
if "is not in the subpath" in str(e):
logger.debug("Ignoring file {file_path} outside of workspace")
continue
except ValueError:
logger.debug(f"Ignoring file {file_path} outside of workspace")
continue

Copilot uses AI. Check for mistakes.
file_path_obj = Path(file_path).relative_to(strip_prefix)
except ValueError as e:
if "is not in the subpath" in str(e):
logger.debug("Ignoring file {file_path} outside of workspace")
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This log line uses {file_path} but isn’t an f-string (and doesn’t use %s interpolation), so it will log the literal braces instead of the actual path. Use an f-string or logger-style parameterized formatting so the file path is included.

Suggested change
logger.debug("Ignoring file {file_path} outside of workspace")
logger.debug("Ignoring file %s outside of workspace", file_path)

Copilot uses AI. Check for mistakes.
Comment on lines +428 to +432
config_path = tmp_path / ".bough.yml"
config_path.write_text("""
buildable:
- "tools/*"
""")
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

write_text("""...""") includes a leading newline and relies on indentation/formatting of a triple-quoted string for YAML. Consider writing the YAML without the leading newline (or using textwrap.dedent(...).lstrip()), which makes the test fixture less fragile and easier to read.

Copilot uses AI. Check for mistakes.
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.

1 participant