Harden @Strategy/@StrategyConsumer annotations - #12475
Conversation
Mirror the shared skill plus Claude/Cursor links. Repo-specific overrides and the perf-review replacement land in the follow-up.
Repo-specific reviewer facts, AGENTS.md hook, llm-validation suite, and replace the retired perf-review skill. Stacked on the verbatim skill copy.
The previous commit copied .gitlab-ci.yml from the old combined branch and dropped unrelated master changes.
Bring in the portable gh --repo pin, optional repo-context, and .claude/.cursor instruction-only shortcut without tracer-specific edits.
Keep the stacked overrides branch on the latest verbatim skill copy.
Use the current platform SHA for the GitLab include and the job clone.
Load the data-not-instructions rule before repo-context.md.
Keep the stacked overrides branch on the latest verbatim skill copy.
Evaluate crash-handler ordering as a security-lens report, not the orchestrator's redacted output. Require firstSpanWritten to reset on the payload-flush hook, not at every map().
Scan PR title, labels, and commit subjects before printing, using the same SECRET_GREP path as the diffs.
Don't flag feature-flagging modules against an aspirational -lib split; point J1 at EscapeShapeBenchmark; make the HashMap fixture lookup-only. Also merge the skill-copy secret-scan sync.
…robertomonteromiguel/dd-apm-sdk-review-java-overrides
Auto-instrumentations still require InstrumenterModule; product transformers do not. The full-review fixture now states the J10/J12 preconditions the performance override already requires.
…, dispatch exemption - Switch retention from SOURCE to CLASS so a classfile-only checker on a dependent module can still see the markers; drop @inherited from Strategy since CLASS retention makes it invisible to reflection anyway and it never applies to interfaces, which is how Strategy is used here. - Document non-capturing lambda constants as an accepted (weaker, profile-dependent) alternative to a concrete-typed static final field, grounded in per-call-site inline-cache/type-profiling rather than global class-hierarchy analysis. - Add "Checker contract" Javadoc sections to both annotations, modeled on NoEscape, so a future checker or AI reviewer can apply the rule without re-deriving it from prose. - Add @Strategy.DynamicDispatch as a deliberate, reviewed exemption channel for fields/parameters that intentionally stay on dynamic dispatch, and apply it to FlatHashtable.StrategyHashIterator#hashStrat. - Mark D1#getOrCreate and D2#getOrCreate @StrategyConsumer: both call straight through to a @Strategy-typed create strategy.
This comment has been minimized.
This comment has been minimized.
🟢 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. |
LLM ValidationLLM Validation Gate — dd-apm-sdk-review🔴 FAIL
AnalysisChanged instruction file(s): Blocking — 1 case(s) regressed; the gate failed on the worst below.
Results
Cases
Per-dimension scores, token usage, latency, and estimated cost are in the CI job logs. |
What Does This Do
Follow-up review pass on the
@Strategy/@StrategyConsumerannotations (internal-api/src/main/java/datadog/trace/api/function/) and their one real production wearer,FlatHashtable:SOURCE→CLASSon both annotations, matching@NoEscape's existing rationale: a classfile-only checker on a dependent module still needs to see the marker on a type/method declared elsewhere, whichSOURCEretention hides.@Inheritedfrom@Strategy— it does nothing here:CLASSretention already makes it invisible to core reflection, and@Inheritednever applies when the annotated type is used on an interface (4 of 5 production sites are interfaces).static finalfield — grounded in the JIT's per-call-site inline-cache/type-profiling, not global class-hierarchy analysis.@NoEscape's existing pattern, so a future static checker or an AI reviewer can apply the rule without re-deriving it from prose.@Strategy.DynamicDispatch, a new nested exemption annotation for a field/parameter that deliberately stays on dynamic dispatch, and apply it toFlatHashtable.StrategyHashIterator#hashStrat.D1#getOrCreate/D2#getOrCreate@StrategyConsumer— both call straight through to a@Strategy-typed create strategy but weren't marked.Motivation
These two annotations pre-dated the "checker contract" documentation pattern established by
@NoEscape, and pre-dated any exemption channel for deliberate exceptions. This pass brings them into line with that precedent and closes gaps found during an 8-lensdd-apm-sdk-reviewaudit (Coherence, Correctness, Security, Design, Performance, Maintainability, Conventions, Cross-SDK) of the annotations and their usage inFlatHashtable.Additional Notes
Two findings from the audit are deliberately not addressed in this PR:
@Strategy'sPARAMETERtarget — expected to land with upcoming product uses, not manufactured here.FlatHashtableis out of scope for an annotation-review PR and will be tracked separately.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueJira ticket: [none]
🤖 Generated with Claude Code