Skip to content

Reach 100% patch coverage: CapturedContext & LogProbe#9696

Closed
albabn wants to merge 1 commit intojpbempel/capture-expressionsfrom
dd/add-tests-capturedcontext-logprobe-expressions
Closed

Reach 100% patch coverage: CapturedContext & LogProbe#9696
albabn wants to merge 1 commit intojpbempel/capture-expressionsfrom
dd/add-tests-capturedcontext-logprobe-expressions

Conversation

@albabn
Copy link
Copy Markdown

@albabn albabn commented Oct 8, 2025

PR by Bits for chat 18a24d28-a849-4b28-bcd7-db8d0cbfcacd.

You can ask for changes by mentioning @DataDog in a comment.

Feedback (especially what can be better) welcome in #code-gen-feedback!


What Does This Do

  • Adds unit tests to increase patch coverage to 100% for:
    • datadog.trace.bootstrap.debugger.CapturedContext (captureExpressions path)
    • com.datadog.debugger.probe.LogProbe (captureExpressions handling)
  • Tests added:
    • LogProbeCaptureExpressionsUndefinedTest: verifies that an undefined capture expression produces an EvaluationError with the correct expr and message.
    • CapturedContextCaptureExpressionsTest: verifies add/get behavior for captureExpressions and the freeze() behavior (serialization sets strValue and clears value) with a JsonSnapshotSerializer initialized.

Motivation

  • Ensure full patch coverage and prevent regressions in:
    • Error reporting when capture expressions evaluate to UNDEFINED.
    • Safe freezing/serialization of captureExpressions in CapturedContext.
  • Historically, gaps in tests around these paths could allow regressions where:
    • Undefined capture expressions fail to surface as errors in LogStatus.
    • CapturedContext.freeze() doesn’t exercise the captureExpressions branch or fails to serialize values properly without an initialized serializer.

Additional Notes

  • No production code changes; test-only additions.
  • The serializer is initialized in a @BeforeAll to avoid null serializer issues during freeze() and to validate strValue generation.
  • No public documentation or configuration flags are impacted.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

NOTE: some AI-generated links and images were removed to ensure safety.

Co-authored-by: albabn <198797721+albabn@users.noreply.github.com>
@albabn albabn requested a review from a team as a code owner October 8, 2025 09:08
@albabn albabn requested review from jpbempel and removed request for a team October 8, 2025 09:08
@datadog-official
Copy link
Copy Markdown
Contributor

Bits AI Dev Agent Status: ✅ Done [Fix CI Errors]

You can ask for changes by mentioning @DataDog in a comment.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 8, 2025

PR Blocked - Invalid Label

The pull request introduced unexpected labels:

  • Bits AI

This PR is blocked until:

  1. The invalid labels are deleted, and
  2. A maintainer deletes this comment to unblock the PR

Note: Simply removing labels from the pull request is not enough - a maintainer must remove the label and delete this comment to remove the block.

@albabn albabn closed this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant