Skip to content

Code review sweep (run 25154254051)#18441

Merged
trask merged 6 commits into
mainfrom
otelbot/code-review-sweep-25154254051
Apr 30, 2026
Merged

Code review sweep (run 25154254051)#18441
trask merged 6 commits into
mainfrom
otelbot/code-review-sweep-25154254051

Conversation

@otelbot

@otelbot otelbot Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Automated code review sweep walked the following modules in order
and stopped after accumulating at least 10 modified files:

  • jaxrs-1.0:javaagent
  • jaxrs-2.0-annotations:javaagent
  • jaxrs-2.0:jaxrs-2.0-arquillian-testing
  • jaxrs-2.0-common:javaagent
  • jaxrs-2.0-common:testing
  • jaxrs-2.0-cxf-3.2:javaagent
  • jaxrs-2.0-jersey-2.0:javaagent
  • jaxrs-2.0:jaxrs-2.0-payara-testing
  • jaxrs-2.0-resteasy-3.0:javaagent

Module: jaxrs-1.0:javaagent

Module path: instrumentation/jaxrs/jaxrs-1.0/javaagent

Summary

Applied safe review fixes in jaxrs-1.0 javaagent and committed them as e1445521. One broader experimental-test-task issue remains unresolved because the review instructions mark it as non-auto-fix.

Applied Changes

Build

File: build.gradle.kts:34
Change: Changed the single-test-task configuration from `tasks.withType<Test>().configureEach` to `tasks.test`.
Reason: `gradle-conventions.md` says single-test-task modules should use `tasks.test`; `withType<Test>().configureEach` is only justified when the module explicitly registers additional `Test` tasks.

Testing

File: JerseyTest.java:51
Change: Made JUnit lifecycle methods package-private and replaced `hasAttributesSatisfying(...)` with `hasAttributesSatisfyingExactly(...)`, enumerating the full expected server-span attribute set.
Reason: The style guide prefers package-private JUnit methods, and `testing-general-patterns.md` requires exact attribute assertions so unexpected attributes are not silently ignored.

Unresolved Items

File: build.gradle.kts
Reason: `otel.instrumentation.common.experimental.controller-telemetry.enabled=true` is still enabled on the default `test` task without a dedicated `testExperimental` task. The review instructions classify this as `Do not auto-fix`; next action is to split flag-on coverage into `testExperimental` and adjust default-test assertions for flag-off behavior.

Module: jaxrs-2.0-annotations:javaagent

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-annotations/javaagent

Summary

Applied 2 safe repository-guideline fixes for jaxrs-2.0-annotations javaagent and committed them in 2f6697b8.

Applied Changes

Build

File: build.gradle.kts:30
Change: Replaced `withType<Test>().configureEach` with `tasks.test` for the module’s single explicit test task while preserving the existing `jvmArgs` and `collectMetadata` settings.
Reason: `gradle-conventions.md` says single-test-task modules should use `tasks.test`; `withType<Test>().configureEach` is reserved for modules that explicitly register additional `Test` tasks, and `latestDepTest` does not count.

Style

File: DefaultRequestContextInstrumentation.java:30
Change: Reduced `DefaultRequestContextInstrumentation` from `public` to package-private.
Reason: The style guide requires minimal necessary visibility, and `javaagent/src/main` classes are internal implementation details rather than public API; this class is only instantiated from the same package.

Module: jaxrs-2.0:jaxrs-2.0-arquillian-testing

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing

Summary

No safe repository-guideline fixes were applied under instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing; the scoped files already conform to the reviewed style, testing, Gradle, and metadata-related guidelines.

Applied Changes

No safe automated changes were applied.

Module: jaxrs-2.0-common:javaagent

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/javaagent

Summary

No safe repository-guideline fixes were found in instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/javaagent; no source changes were applied.

Applied Changes

No safe automated changes were applied.

Module: jaxrs-2.0-common:testing

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing

Summary

No safe repository-guideline fixes were found in instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing; no files were changed.

Applied Changes

No safe automated changes were applied.

Module: jaxrs-2.0-cxf-3.2:javaagent

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-cxf-3.2/javaagent

Summary

Applied and committed safe test-pattern fixes for jaxrs-2.0-cxf-3.2 javaagent tests by hoisting inline experimental flag reads into per-class EXPERIMENTAL_ATTRIBUTES constants.

Applied Changes

Testing

File: CxfHttpServerTest.java:21
Change: Added a private static final `EXPERIMENTAL_ATTRIBUTES` field and changed `testExperimental()` to return it.
Reason: `testing-experimental-flags.md` says module experimental flags should be read once into a per-class `EXPERIMENTAL_ATTRIBUTES` constant instead of calling `Boolean.getBoolean(...)` inline.

File: CxfJettyHttpServerTest.java:18
Change: Added a private static final `EXPERIMENTAL_ATTRIBUTES` field and changed `testExperimental()` to return it.
Reason: `testing-experimental-flags.md` says module experimental flags should be read once into a per-class `EXPERIMENTAL_ATTRIBUTES` constant instead of calling `Boolean.getBoolean(...)` inline.

Module: jaxrs-2.0-jersey-2.0:javaagent

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-jersey-2.0/javaagent

Summary

Applied safe test-guideline fixes in the jaxrs-2.0-jersey-2.0 javaagent module by hoisting repeated experimental flag reads into EXPERIMENTAL_ATTRIBUTES constants.

Applied Changes

Testing

File: JerseyHttpServerTest.java:23
Change: Added a private static `EXPERIMENTAL_ATTRIBUTES` constant and reused it from `testExperimental()`.
Reason: `testing-experimental-flags.md` requires module experimental flags such as `otel.instrumentation.jaxrs.experimental-span-attributes` to be read once into a per-class `EXPERIMENTAL_ATTRIBUTES` constant instead of inline `Boolean.getBoolean(...)` calls.

File: JerseyJettyHttpServerTest.java:15
Change: Added a private static `EXPERIMENTAL_ATTRIBUTES` constant and reused it from `testExperimental()`.
Reason: `testing-experimental-flags.md` requires module experimental flags such as `otel.instrumentation.jaxrs.experimental-span-attributes` to be read once into a per-class `EXPERIMENTAL_ATTRIBUTES` constant instead of inline `Boolean.getBoolean(...)` calls.

Module: jaxrs-2.0:jaxrs-2.0-payara-testing

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing

Summary

Applied one safe repository-guideline fix in jaxrs-2.0-payara-testing and committed it as c0825965.

Applied Changes

Build

File: build.gradle.kts:20
Change: Changed the experimental controller telemetry JVM argument configuration from `withType<Test>().configureEach` inside `tasks {}` to `tasks.test`.
Reason: `gradle-conventions.md` says single-test-task modules should prefer the simple `tasks.test` form; `withType<Test>().configureEach` is reserved for modules that explicitly register additional `Test` tasks.

Module: jaxrs-2.0-resteasy-3.0:javaagent

Module path: instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.0/javaagent

Summary

Applied and committed safe review fixes for jaxrs-2.0-resteasy-3.0 javaagent; one muzzle assertInverse guideline item remains unresolved because the deterministic fix failed local :muzzle configuration.

Applied Changes

Javaagent

File: Resteasy30Singletons.java:14
Change: Renamed the private singleton backing field from `INSTANCE` to `instrumenter` and kept `instrumenter()` returning that field.
Reason: `javaagent-singletons-patterns.md` says exported singleton accessors should use a lower-camel backing field with the same name as the accessor, while uppercase fields are reserved for constant-like values.

Testing

File: ResteasyHttpServerTest.java:19
Change: Hoisted the inline `Boolean.getBoolean("otel.instrumentation.jaxrs.experimental-span-attributes")` call into a per-class `EXPERIMENTAL_ATTRIBUTES` constant and returned that from `testExperimental()`.
Reason: `testing-experimental-flags.md` requires experimental flags to be read once into a per-class `EXPERIMENTAL_ATTRIBUTES` constant instead of duplicating inline property reads at call sites.

File: ResteasyJettyHttpServerTest.java:15
Change: Hoisted the inline `Boolean.getBoolean("otel.instrumentation.jaxrs.experimental-span-attributes")` call into a per-class `EXPERIMENTAL_ATTRIBUTES` constant and returned that from `testExperimental()`.
Reason: `testing-experimental-flags.md` requires experimental flags to be read once into a per-class `EXPERIMENTAL_ATTRIBUTES` constant instead of duplicating inline property reads at call sites.

Unresolved Items

File: build.gradle.kts
Reason: `gradle-conventions.md` says bounded muzzle `pass` ranges should include `assertInverse.set(true)`, but adding it to both split `resteasy-jaxrs` pass ranges failed `./gradlew :instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-resteasy-3.0:javaagent:muzzle` with duplicate generated `muzzle-AssertFail-org.jboss.resteasy-resteasy-jaxrs-2.3.6.Final` configuration; this needs broader Gradle/muzzle convention handling rather than a local safe fix.


Download code review diagnostics

otelbot Bot added 6 commits April 30, 2026 08:33
Automated code review of instrumentation/jaxrs/jaxrs-1.0/javaagent.
Automated code review of instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-annotations/javaagent.
Automated code review of instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-cxf-3.2/javaagent.
Automated code review of instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-jersey-2.0/javaagent.
Automated code review of instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing.
Automated code review of instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-resteasy-3.0/javaagent.
@otelbot otelbot Bot requested a review from a team as a code owner April 30, 2026 08:58
@trask trask closed this Apr 30, 2026
@trask trask reopened this Apr 30, 2026
@trask trask enabled auto-merge (squash) April 30, 2026 15:47
@trask trask merged commit 9097764 into main Apr 30, 2026
117 of 274 checks passed
@trask trask deleted the otelbot/code-review-sweep-25154254051 branch April 30, 2026 16:21
trask added a commit to trask/opentelemetry-java-instrumentation that referenced this pull request Apr 30, 2026
When a PR is created with `gh pr create --label ...` (via the otelbot app token in code-review-sweep.yml), GitHub fires `opened` and `labeled` pull_request events within the same second. Both runs land in the build-pull-request.yml concurrency group with cancel-in-progress, so the (skipped, label-not-build-relevant) labeled run cancels the real opened run, leaving the PR with no build and a failing required-status-check (see e.g. PR open-telemetry#18441).

Split into two steps: create the PR (otelbot app token, so the PR is authored by otelbot), then add the label as a separate step using the default GITHUB_TOKEN. GitHub's anti-recursion rule means actions taken with GITHUB_TOKEN don't trigger workflow events, so adding the label no longer fires a labeled pull_request event and the build for the PR is no longer cancelled.
trask added a commit to trask/opentelemetry-java-instrumentation that referenced this pull request Apr 30, 2026
GitHub evaluates a workflow's `concurrency:` group BEFORE its job-level `if:` filter. When a non-build-affecting label is added to a PR (e.g. `automated code review` from code-review-sweep, any auto-label from .github/labeler.yml, or any human/bot label-add), the resulting `pull_request labeled` run enters the shared per-PR group with cancel-in-progress, cancels the real in-progress build, and only then evaluates the `if:` and skips — leaving the PR with no build and a failing required-status-check (see PR open-telemetry#18441).

Route those irrelevant-label runs to a unique, per-run-id throwaway concurrency group so they neither cancel nor are cancelled by anything; the job's `if:` then skips them in ~1s. Build-affecting labels (`test native`, `test openj9`, `test windows`) and all other event types keep the shared per-PR group, preserving the existing cancel-and-rerun semantics. The fix is at the build workflow level, so it applies uniformly to every label-add source (humans, the labeler workflow, otelbot, dependabot, etc.).
trask added a commit to trask/opentelemetry-java-instrumentation that referenced this pull request Apr 30, 2026
Adds .github/workflows/test-on-comment.yml that handles three slash-commands on PR comments from OWNER/MEMBER/COLLABORATOR users:

  /test native    -- force-run native tests
  /test openj9    -- run the openj9 test variants
  /test windows   -- run the windows smoke tests

These replace the previous label-driven design (test native / test openj9 / test windows labels). Labels were removed because adding any label fires a pull_request labeled event, which entered the build's per-PR concurrency group BEFORE the job-level if: filter ran, cancelling the in-progress real build whenever any non-test label was added by code-review-sweep, dependabot, the labeler, or a human (see PR open-telemetry#18441). Even after a conditional concurrency-group fix, the labeled run's check_suite shadowed the in-progress real build's check_suite in the PR Checks UI, since GitHub keys that view by workflow file with the latest check_suite winning.

The new design:

* build-pull-request.yml only triggers on opened / synchronize / reopened. Its concurrency group is the simple per-PR one with cancel-in-progress, restoring the pre-bug push semantics for the regular event flow.
* The native-tests path filter formerly in .github/labeler.yml is moved inline as a resolve-native job that diffs the PR head against the base, eliminating the labeler-vs-build race entirely. .github/labeler.yml and .github/workflows/label.yml are deleted (the labeler rule was the only content in those files).
* build-pull-request.yml additionally accepts workflow_dispatch with explicit run-{native,openj9,windows-smoke}-tests inputs; test-on-comment.yml validates the commenter's association and dispatches it against the PR's head branch, so the resulting check_runs surface in the PR Checks tab and supersede prior runs in the same per-PR concurrency group.

Limitations:

* /test commands aren't supported for PRs from forks (workflow_dispatch can only target refs in the base repo). The comment workflow detects this and posts a brief explanation back.
* Native tests now run for any PR whose paths match the historical glob, regardless of whether a test native label was applied. This was already the intended behavior; the label was just an artifact of how the labeler implemented the path filter.
trask added a commit to trask/opentelemetry-java-instrumentation that referenced this pull request Apr 30, 2026
Adds .github/workflows/test-on-comment.yml that handles three slash-commands on PR comments from OWNER/MEMBER/COLLABORATOR users:

  /test native    -- force-run native tests
  /test openj9    -- run the openj9 test variants
  /test windows   -- run the windows smoke tests

These replace the previous label-driven design (test native / test openj9 / test windows labels). Labels were removed because adding any label fires a pull_request labeled event, which entered the build's per-PR concurrency group BEFORE the job-level if: filter ran, cancelling the in-progress real build whenever any non-test label was added by code-review-sweep, dependabot, the labeler, or a human (see PR open-telemetry#18441). Even after a conditional concurrency-group fix, the labeled run's check_suite shadowed the in-progress real build's check_suite in the PR Checks UI, since GitHub keys that view by workflow file with the latest check_suite winning.

The new design:

* build-pull-request.yml only triggers on opened / synchronize / reopened. Its concurrency group is the simple per-PR one with cancel-in-progress, restoring the pre-bug push semantics for the regular event flow.
* The native-tests path filter formerly in .github/labeler.yml is moved inline as a resolve-native job that diffs the PR head against the base, eliminating the labeler-vs-build race entirely. .github/labeler.yml and .github/workflows/label.yml are deleted (the labeler rule was the only content in those files).
* build-pull-request.yml additionally accepts workflow_dispatch with explicit run-{native,openj9,windows-smoke}-tests inputs; test-on-comment.yml validates the commenter's association and dispatches it against the PR's head branch, so the resulting check_runs surface in the PR Checks tab and supersede prior runs in the same per-PR concurrency group.

Limitations:

* /test commands aren't supported for PRs from forks (workflow_dispatch can only target refs in the base repo). The comment workflow detects this and posts a brief explanation back.
* Native tests now run for any PR whose paths match the historical glob, regardless of whether a test native label was applied. This was already the intended behavior; the label was just an artifact of how the labeler implemented the path filter.
trask added a commit to trask/opentelemetry-java-instrumentation that referenced this pull request Apr 30, 2026
Adds .github/workflows/test-on-comment.yml that handles three slash-commands on PR comments from OWNER/MEMBER/COLLABORATOR users:

  /test native    -- force-run native tests
  /test openj9    -- run the openj9 test variants
  /test windows   -- run the windows smoke tests

These replace the previous label-driven design (test native / test openj9 / test windows labels). Labels were removed because adding any label fires a pull_request labeled event, which entered the build's per-PR concurrency group BEFORE the job-level if: filter ran, cancelling the in-progress real build whenever any non-test label was added by code-review-sweep, dependabot, the labeler, or a human (see PR open-telemetry#18441). Even after a conditional concurrency-group fix, the labeled run's check_suite shadowed the in-progress real build's check_suite in the PR Checks UI, since GitHub keys that view by workflow file with the latest check_suite winning.

The new design:

* build-pull-request.yml only triggers on opened / synchronize / reopened. Its concurrency group is the simple per-PR one with cancel-in-progress, restoring the pre-bug push semantics for the regular event flow.
* The native-tests path filter formerly in .github/labeler.yml is moved inline as a resolve-native job that diffs the PR head against the base, eliminating the labeler-vs-build race entirely. .github/labeler.yml and .github/workflows/label.yml are deleted (the labeler rule was the only content in those files).
* build-pull-request.yml additionally accepts workflow_dispatch with explicit run-{native,openj9,windows-smoke}-tests inputs; test-on-comment.yml validates the commenter's association and dispatches it against the PR's head branch, so the resulting check_runs surface in the PR Checks tab and supersede prior runs in the same per-PR concurrency group.

Limitations:

* /test commands aren't supported for PRs from forks (workflow_dispatch can only target refs in the base repo). The comment workflow detects this and posts a brief explanation back.
* Native tests now run for any PR whose paths match the historical glob, regardless of whether a test native label was applied. This was already the intended behavior; the label was just an artifact of how the labeler implemented the path filter.
trask added a commit to trask/opentelemetry-java-instrumentation that referenced this pull request Apr 30, 2026
The labeled trigger caused two issues that combined into recurring CI breakage on PRs that received any label (renovate, dependabot, code-review-sweep, the labeler, or a human applied one):

* GitHub evaluates a workflow's `concurrency:` group before its job-level `if:` filter, so a labeled run cancelled the in-progress real build before being filtered out.
* Even after a conditional concurrency-group fix, the labeled run's check_suite displaced the in-progress real build's check_suite in the PR Checks UI (GitHub keys that view by workflow file, latest check_suite wins).

Concrete failure: PR open-telemetry#18441, run https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/runs/25156724872 — every job ended within ~2 seconds with no steps executed.

Fix: drop `labeled` from the trigger entirely. Read labels from `github.event.pull_request.labels` (which is present on every `pull_request` event) and gate optional jobs by `contains(...)`. Skipped jobs that are listed as required satisfy branch protection, so auto-merge still works.

* `test openj9` / `test windows` labels: still consulted, but only at the moments the build naturally runs (opened / synchronize / reopened). Applying a label after the last push no longer re-triggers the build; to pick up the label, close/reopen the PR or push another commit. This trade-off avoids the labeled-event race and the wasted reruns from non-test labels.
* `test native` is now detected inline from the PR's changed paths via a new `resolve-native` job that mirrors the former `.github/labeler.yml` `test native` rule. The label is no longer auto-applied; the manual label is still honored as a force-enable.
* `.github/labeler.yml` and `.github/workflows/label.yml` are deleted (the labeler's only rule was the `test native` one).
trask added a commit to trask/opentelemetry-java-instrumentation that referenced this pull request Apr 30, 2026
The labeled trigger caused two issues that combined into recurring CI breakage on PRs that received any label (renovate, dependabot, code-review-sweep, the labeler, or a human applied one):

* GitHub evaluates a workflow's `concurrency:` group before its job-level `if:` filter, so a labeled run cancelled the in-progress real build before being filtered out.
* Even after a conditional concurrency-group fix, the labeled run's check_suite displaced the in-progress real build's check_suite in the PR Checks UI (GitHub keys that view by workflow file, latest check_suite wins).

Concrete failure: PR open-telemetry#18441, run https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/runs/25156724872 — every job ended within ~2 seconds with no steps executed.

Fix: drop `labeled` from the trigger entirely. Read labels from `github.event.pull_request.labels` (which is present on every `pull_request` event) and gate optional jobs by `contains(...)`. Skipped jobs that are listed as required satisfy branch protection, so auto-merge still works.

* `test openj9` / `test windows` labels: still consulted, but only at the moments the build naturally runs (opened / synchronize / reopened). Applying a label after the last push no longer re-triggers the build; to pick up the label, close/reopen the PR or push another commit. This trade-off avoids the labeled-event race and the wasted reruns from non-test labels.
* `test native` is now detected inline from the PR's changed paths via a new `resolve-native` job that mirrors the former `.github/labeler.yml` `test native` rule. The label is no longer auto-applied; the manual label is still honored as a force-enable.
* `.github/labeler.yml` and `.github/workflows/label.yml` are deleted (the labeler's only rule was the `test native` one).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant