Clean up AI generated code#11581
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea81579503
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "DATADOG,B3MULTI b3 trace out of range | [DATADOG, B3MULTI] | '1' | '2' | '18446744073709551616' | 'b' | | '1' | '2' | true | false | false | false ", | ||
| "DATADOG,B3MULTI b3 span out of range | [DATADOG, B3MULTI] | '1' | '2' | 'a' | '18446744073709551616' | | '1' | '2' | true | false | false | false ", | ||
| "NONE | [NONE] | '1' | '2' | | | | | | true | false | true | false ", | ||
| "DATADOG,TRACECONTEXT w3c override | [DATADOG, TRACECONTEXT] | '1' | '2' | | | 'W3C_TRACE_PARENT' | '1' | 'W3C_SPAN_ID_LSTR' | false | false | false | false ", |
There was a problem hiding this comment.
Convert W3C table constants before using them
These rows now pass symbolic values like 'W3C_TRACE_PARENT' and 'W3C_SPAN_ID_LSTR', but extractHttpHeadersUsingStyles still accepts plain String parameters without @ConvertWith(W3cConstantConverter.class). In the W3C override/extract-first scenarios, the extractor receives the literal invalid traceparent header W3C_TRACE_PARENT and the assertion later tries to parse W3C_SPAN_ID_LSTR as a span id, so these cases no longer exercise the W3C path and should fail at runtime.
Useful? React with 👍 / 👎.
|
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
dougqh
left a comment
There was a problem hiding this comment.
Code review comments from Claude (claude-sonnet-4-6) — correctness concerns identified during review.
| headers.put(SOME_HEADER, "my-interesting-info"); | ||
| // spotless:off | ||
| Map<String, String> headers = headers( | ||
| TRACE_ID_KEY, TRACE_ID_MAX_MINUS_1, |
There was a problem hiding this comment.
[Claude] This uses TRACE_ID_MAX_MINUS_1 (= 2^64 - 2, a valid uint64), but the test is named extractHttpHeadersWithOutOfRangeTraceId. The original code used TRACE_ID_MAX.add(ONE) (= 2^64, truly out-of-range). The PR description says this is a fix, but the change appears backwards — TRACE_ID_MAX_PLUS_1 should be used here to preserve the original intent. The test likely still passes only because Haystack expects UUID-format IDs, so any bare decimal string is rejected regardless of its numeric value.
| new LinkedHashSet<>(asList(DATADOG, TRACECONTEXT, BAGGAGE)); | ||
| static final Set<PropagationStyle> DEFAULT_PROPAGATION_STYLE = | ||
| new LinkedHashSet<>(asList(PropagationStyle.DATADOG)); | ||
| public static final boolean DEFAULT_PROPAGATION_B3_PADDING_ENABLED = true; |
There was a problem hiding this comment.
[Claude] All other constants in this class are package-private (static final). Making this one public is inconsistent. If tests in other packages need it, consider exposing it via Config instead, or document why this one constant needs broader visibility.
What Does This Do
Clean up AI generated code...
I keep focusing on cleaning up the propagation related tests. There is still a lot of duplication between the propagators but at least that should improve readability.
Motivation
Many details were lost. Intention were lost. Code got bloated on some parts.
Additional Notes
If it helps, here an short AI-generated summary of the changes:
does the same for W3C header constants. Both use
@ConvertWithsince tabletest bypasses@TypeConverterfor String parameters.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge. You can also:/merge --commit-message "..."/merge -c/merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)Jira ticket: [PROJ-IDENT]