Repository navigation
chore(agents): add dd-trace-rb overrides for dd-apm-sdk-review #6307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
robertomonteromiguel
wants to merge
12
commits into
robertomonteromiguel/dd-apm-sdk-review-core-copy
from
robertomonteromiguel/dd-apm-sdk-review-rb-overrides
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7f1887a
chore(agents): add dd-trace-rb overrides for dd-apm-sdk-review
robertomonteromiguel e1fd6f3
fix(agents): align security PII and Time.now with AGENTS.md
robertomonteromiguel 781f6e7
chore(ci): pin llm-validation-platform to c33169664
robertomonteromiguel 0c51c34
Merge branch 'robertomonteromiguel/dd-apm-sdk-review-core-copy'
robertomonteromiguel 51575fd
chore(agents): merge skill-copy sync from core 8947af5
robertomonteromiguel 9f1d4ea
fix(agents): ground the conventions eval case in shipped code and AGE…
robertomonteromiguel e186296
chore(agents): merge skill-copy sync from core 3f41845
robertomonteromiguel 3b5f486
chore(agents): drop the security lens and the pre-push hook
robertomonteromiguel 4dbc2b0
fix(agents): scope Ruby conventions and keep agent files out of the gem
robertomonteromiguel a503bb3
chore(agents): sync the review skill and keep secrets out of PR text.
robertomonteromiguel be4208f
chore(agents): merge core-copy 749ff7a into overrides
robertomonteromiguel 8eb9c42
chore(agents): use NEVER for the lib/ scope prohibitions
robertomonteromiguel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Repo context — dd-trace-rb | ||
|
|
||
| Read only by the orchestrator (Step 0 of `SKILL.md`), not by individual reviewers. Repo-specific; not part of the shared core. This whole `.agents/dd-apm-sdk-review-overrides/` folder is owned by this repo — edit it freely, unlike `.agents/skills/dd-apm-sdk-review/`, which is a verbatim copy of the shared core. | ||
|
|
||
| ## Related skills in this repo | ||
|
|
||
| The other skills in this repo author specific things; this one is the general multi-perspective review. Cite them as authoritative for their own area, do not invoke them, and note they must not invoke this skill either: | ||
|
|
||
| - `write-comment` — when a comment earns its place. Defer for comment-only questions. | ||
| - `write-rbs` — RBS / Steep signatures. Defer for type-signature work. | ||
|
robertomonteromiguel marked this conversation as resolved.
|
||
|
|
||
| Cursor personas under `.cursor/rules/` (`code-style.mdc`, `testing.mdc`) are local editor guidance, not skills. Cite them when a conventions finding is really "the persona already said this." | ||
32 changes: 32 additions & 0 deletions
32
.agents/dd-apm-sdk-review-overrides/reviewers/conventions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| Override for `reviewers/conventions.md` (in the core skill folder) — read that file first, then this. | ||
|
|
||
| # Codebase conventions — dd-trace-rb specifics | ||
|
robertomonteromiguel marked this conversation as resolved.
|
||
|
|
||
| These addenda apply to `lib/**/*.rb` only. NEVER flag `ENV` or `Time.now` in | ||
| specs, `tasks/`, gemfiles, CI, or other non-library paths. | ||
|
|
||
| This file starts with one confirmed pattern and should grow — add the next | ||
| one you learn from review. Do not treat it as exhaustive. | ||
|
|
||
| The source of truth is [`AGENTS.md`](../../../AGENTS.md). Open that file for the topic under review; do not restate it here. | ||
|
|
||
| `DATADOG_ENV` vs `ENV` is already enforced by `CustomCops/EnvUsageCop` on | ||
| `lib/**/*` (see `.rubocop.yml`). Do not re-flag a direct `ENV` read that | ||
| RuboCop already covers. If RuboCop did not run, report `NOT VERIFIED` for | ||
| that check rather than inventing an ENV finding. | ||
|
|
||
| ## `Datadog::Core::Utils::Time.now`, never `Time.now` | ||
|
|
||
| The time provider is configurable (`Core::Utils::Time.now_provider=`). | ||
| `Time.now` in `lib/**/*.rb` is a conventions finding — tests cannot override | ||
| it. **P1**. NEVER flag `Time.now` outside `lib/`. | ||
|
|
||
| ## Mechanical checks — run these, don't eyeball them | ||
|
|
||
| Check-mode only. Anything that would rewrite files is the author's to run. | ||
|
|
||
| ```bash | ||
| bundle exec rake rubocop typecheck | ||
| ``` | ||
|
|
||
| If Bundler, RuboCop, or Steep is missing, report `NOT VERIFIED (<reason>)` rather than eyeballing format. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # LLM Validation — `dd-apm-sdk-review` | ||
|
|
||
| This folder is how we test the review skill. It is **not** an RSpec file. | ||
| The cases live here; the runner lives in [`ddoghq/llm-validation-platform`](https://github.com/ddoghq/llm-validation-platform). | ||
|
|
||
| It answers: *did an edit to a review rule make the agent better or worse?* | ||
|
|
||
| ## Add a rule (this is the whole contribution) | ||
|
|
||
| Overrides are owned by this repo. The shared core is not — never edit `.agents/skills/dd-apm-sdk-review/`. | ||
|
|
||
| 1. Create or extend a file under [`.agents/dd-apm-sdk-review-overrides/reviewers/`](../.agents/dd-apm-sdk-review-overrides/reviewers/). | ||
| Copy the shape of `conventions.md`: one pattern, why it matters, the fix. | ||
| 2. Add a case in [`suites/dd-apm-sdk-review.yaml`](./suites/dd-apm-sdk-review.yaml). Copy the starter case. | ||
| A good case is a 10-line snippet plus 2–3 `expected_criteria` that would fail if the rule disappeared. | ||
| 3. List the new case id under `presets.gate.cases` in [`config.yaml`](./config.yaml) if you want CI to run it. | ||
| 4. Open a PR. That is it. | ||
|
|
||
| The starter case in this folder is the example. Keep new ones that short. | ||
|
|
||
| ## Layout | ||
|
|
||
| | Path | Role | | ||
| |---|---| | ||
| | [`config.yaml`](./config.yaml) | Monitored instruction files, model, `--level` presets | | ||
| | [`suites/dd-apm-sdk-review.yaml`](./suites/dd-apm-sdk-review.yaml) | Cases (one file only — the CLI errors if `suites/` has more than one YAML) | | ||
|
|
||
| ## Run locally (Docker) | ||
|
|
||
| From the **`dd-trace-rb` repo root**: | ||
|
|
||
| ```bash | ||
| export LLMVAL_IMAGE=registry.ddbuild.io/ci/llm-validation-platform/llmval:latest | ||
| docker pull "$LLMVAL_IMAGE" | ||
|
|
||
| # Offline smoke — no gateway, no Claude (1 case) | ||
| docker run --rm -v "$PWD:/repo" "$LLMVAL_IMAGE" \ | ||
| --repo /repo --base-sha master --level minimum --fake | ||
|
|
||
| # Cheap real smoke — still 1 case | ||
| export LLMVAL_AUTH_HEADER="$(ddtool auth token rapid-ai-platform --datacenter us1.staging.dog --http-header)" | ||
| docker run --rm -e LLMVAL_AUTH_HEADER -v "$PWD:/repo" "$LLMVAL_IMAGE" \ | ||
| --repo /repo --base-sha master --level minimum --runs 1 | ||
|
|
||
| # Gate set | ||
| docker run --rm -e LLMVAL_AUTH_HEADER -v "$PWD:/repo" "$LLMVAL_IMAGE" \ | ||
| --repo /repo --base-sha master --level gate --runs 1 | ||
|
|
||
| # One named case | ||
| docker run --rm -e LLMVAL_AUTH_HEADER -v "$PWD:/repo" "$LLMVAL_IMAGE" \ | ||
| --repo /repo --base-sha master --case rb-conventions-time-now --runs 1 | ||
| ``` | ||
|
|
||
| `--level` picks **which cases** run (`minimum` = 1, `gate` = the starter case, `full` = every case). | ||
| `--runs` only repeats those cases. Needs `ddtool` on the host for a real (non-`--fake`) run. | ||
|
|
||
| CI includes the reusable `"llm validation"` job from the platform repo (see `.gitlab-ci.yml`). | ||
|
|
||
| ## What a pass means | ||
|
|
||
| This is an A/B comparison, not an absolute score: | ||
|
|
||
| - **Candidate** = the working tree. Uncommitted edits count. | ||
| - **Baseline** = `git show <base-sha>:<file>`. A file that is not on `master` yet is treated as added. | ||
|
|
||
| The gate fails only on a **confident regression**. Noisy changes WARN and do not block. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # LLM Validation Platform — dd-trace-rb config | ||
| # | ||
| # Starter suite for the dd-apm-sdk-review skill. One case on purpose: | ||
| # cheap enough to re-run while you add the next rule. | ||
| model: claude-sonnet-5 | ||
| runs: 2 | ||
|
|
||
| instruction_files: | ||
| - AGENTS.md | ||
| - .agents/skills/dd-apm-sdk-review/SKILL.md | ||
|
robertomonteromiguel marked this conversation as resolved.
|
||
| - .agents/skills/dd-apm-sdk-review/reviewers/_common.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/coherence.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/correctness.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/design.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/performance.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/maintainability.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/conventions.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/cross-sdk.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/report-template.md | ||
| - .agents/skills/dd-apm-sdk-review/review-without-harness.md | ||
| - .agents/dd-apm-sdk-review-overrides/repo-context.md | ||
| - .agents/dd-apm-sdk-review-overrides/reviewers/conventions.md | ||
|
|
||
| default_level: gate | ||
| presets: | ||
| gate: # The starter case. Add yours here when you want CI to run it. | ||
| cases: | ||
| - rb-conventions-time-now | ||
| runs: 2 | ||
| minimum: # Cheapest smoke — the conventions override. | ||
| cases: | ||
| - rb-conventions-time-now | ||
| runs: 2 | ||
| full: # Every case in suites/. | ||
| runs: 2 | ||
|
|
||
| policy: | ||
| noise_threshold: 1.0 | ||
| pairwise_win_floor: 0.45 | ||
| blocking_fail_floor: 0.45 | ||
| blocking_fail_ci_upper: 0.55 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: dd-apm-sdk-review | ||
| version: "0.1" | ||
|
|
||
| # One file on purpose: the platform CLI errors if suites/ has more than one YAML. | ||
| # One starter case. Copy the block to add the next one. | ||
| cases: | ||
| - id: rb-conventions-time-now | ||
| files: | ||
| - AGENTS.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/conventions.md | ||
| - .agents/skills/dd-apm-sdk-review/reviewers/_common.md | ||
| - .agents/dd-apm-sdk-review-overrides/reviewers/conventions.md | ||
| input: | | ||
| Apply this repo's conventions-review criteria (reviewers/conventions.md, its | ||
| .agents/dd-apm-sdk-review-overrides/reviewers/conventions.md override, _common.md, and | ||
| AGENTS.md) to the following code. No git checkout available — this snippet is the | ||
| entire change to review. Treat the snippet as | ||
| `lib/datadog/tracing/contrib/http/instrumentation.rb` starting at line 10 (shipped | ||
| code, not a spec). Direct `ENV` reads are out of scope for this lens: | ||
| CustomCops/EnvUsageCop already covers them. | ||
|
|
||
| ```ruby | ||
| def started_at | ||
| Time.now | ||
| end | ||
| ``` | ||
| expected_criteria: | ||
| - "Flags `Time.now` — shipped code under lib/ must use `Datadog::Core::Utils::Time.now` so tests can override the provider." | ||
| - "Names `Datadog::Core::Utils::Time.now` as the replacement, not a generic 'avoid Time.now'." | ||
| bad_signals: | ||
| - "Approves the `Time.now` call." | ||
| - "Treats it as a style nit with no repo-specific reason." | ||
| - "Invents a different time-wrapper name that this gem does not use." | ||
| - "Flags a direct ENV read even though this snippet has none and ENV is out of scope for this lens." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,7 @@ | |
| |\.agents | ||
| |\.claude | ||
| |\.cursor | ||
| |\.llm-validation | ||
| |\.github | ||
| |\.gitlab | ||
| |\.vscode | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.