Skip to content

feat: use Bazel target label as codeowners fallback path#1116

Open
dfrankland wants to merge 1 commit into
mainfrom
dylan/bazel-label-codeowners-fallback
Open

feat: use Bazel target label as codeowners fallback path#1116
dfrankland wants to merge 1 commit into
mainfrom
dylan/bazel-label-codeowners-fallback

Conversation

@dfrankland
Copy link
Copy Markdown
Member

Summary

  • Adds --use-bazel-target-for-codeowners flag (env: TRUNK_CODEOWNERS_USE_BAZEL_TARGET, default false) to opt into using the Bazel label as a fallback for CODEOWNERS association
  • When enabled and a test case has no file/filepath XML attribute, the package portion of the Bazel label (//pkg/path:targetpkg/path) is used as the lookup path against CODEOWNERS
  • Adds bazel_label: Option<&str> parameter to into_test_case_runs; a bazel_label_to_package_path helper handles the conversion and returns None for root-level targets (//:target)
  • Both BEP paths in generate_internal_file_from_bep and the non-BEP path in generate_internal_file respect the flag

Test plan

  • Unit tests for bazel_label_to_package_path covering standard labels, root-level targets, and labels without //
  • Two new e2e tests in cli/tests/upload.rs using a BEP fixture with no file attributes:
    • upload_bundle_using_bep_with_bazel_label_codeowners_fallback — flag on, asserts codeowners populated from label package path
    • upload_bundle_using_bep_without_bazel_label_codeowners_fallback — flag off (default), asserts codeowners empty

🤖 Generated with Claude Code

When a JUnit XML produced by Bazel has no `file` or `filepath` attribute,
there's no source path to use for CODEOWNERS association. The Bazel label
(e.g. `//pkg/path:target`) is available from the BEP and its package
component (`pkg/path`) maps directly to a repo directory that CODEOWNERS
patterns can match against.

Adds `--use-bazel-target-for-codeowners` (env: `TRUNK_CODEOWNERS_USE_BAZEL_TARGET`,
default false) to opt into this fallback. When enabled, `into_test_case_runs`
derives the lookup path from the label if no file attr is present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Jun 6, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@trunk-staging-io
Copy link
Copy Markdown

trunk-staging-io Bot commented Jun 6, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
variant_quarantine_test should be quarantined when run with variant A test expected the sum of 2 + 2 to be 5, but it was actually 4, indicating a failing assertion. Logs ↗︎

View Full Report ↗︎Docs

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 6, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.40%. Comparing base (6a65cdb) to head (11af418).

Files with missing lines Patch % Lines
cli/src/context.rs 50.00% 6 Missing ⚠️
context/src/junit/parser.rs 97.91% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1116      +/-   ##
==========================================
+ Coverage   82.14%   82.40%   +0.25%     
==========================================
  Files          69       69              
  Lines       15243    15291      +48     
==========================================
+ Hits        12522    12601      +79     
+ Misses       2721     2690      -31     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Jun 6, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants