Skip to content

[debugger] Add Go repro tests for map lookups, static template errors and missing-key conditions - #8201

Draft
timsee wants to merge 6 commits into
mainfrom
timsee/di-el-bug-repros
Draft

timsee wants to merge 6 commits into
mainfrom
timsee/di-el-bug-repros

Conversation

@timsee

@timsee timsee commented Oct 27, 2026 •

Copy link
Copy Markdown

Motivation

Go's Dynamic Instrumentation gets three map expressions wrong in staging, and the existing tests don't catch any of them:

  1. Map lookups return unavailable. m["AAA"] names a key that exists, but the captured value is unavailable. The existing test_complex_capture_expressions only checks that the value has a type, so a not-captured marker still passes.
  2. Known-bad templates stay installed. A member access on a map (m.AAA), an unknown variable (nope_var) or a missing struct field (req.Nope) in a condition is rejected at install. The same expressions in a log template install fine and only print the error inside the log line.
  3. A missing-key condition fires. m["ZZZ"] == 1 fired as if true, with no error. A missing key in a map[string]int reads as 0, so the condition should be false.

Changes

  • test_complex_capture_expressions_dictionary_value: requires testStruct.Dictionary['two'] to capture 2.
  • Test_Debugger_Go_Static_Template_Error: templates using testStruct.Dictionary.two, an unknown variable, or a missing struct field must each reach ERROR, like the equivalent conditions.
  • Test_Debugger_Go_Missing_Map_Key_Condition: testStruct.Dictionary['nope'] == 1 must not produce a snapshot with captured data.

The two new classes are scoped to Go. Draft: opened to get Linux CI results, since Go DI can't run on a macOS Docker VM. Manifests will be updated with tickets once CI shows which tests fail.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/debugger/test_debugger_go_expression_errors.py                    @DataDog/debugger
tests/debugger/utils/probes/probe_missing_map_key_condition.json        @DataDog/debugger
tests/debugger/utils/probes/probe_static_template_error.json            @DataDog/debugger
manifests/dotnet.yml                                                    @DataDog/system-tests-reviewers
manifests/ruby.yml                                                      @DataDog/system-tests-reviewers
tests/debugger/test_debugger_capture_expressions.py                     @DataDog/debugger

@timsee timsee changed the title [debugger] Add repro tests for map index values and silent metric value errors [debugger] Add Go repro tests for map lookups, static template errors and missing-key conditions Oct 27, 2026
@datadog-official

datadog-official Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

✨ Unblock PR with BitsAI

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 24 Pipeline jobs failed

Testing the test | System Tests (golang, dev) / End-to-end #1 / chi 1 — ❌ 2 tests failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

❌ tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Missing_Map_Key_Condition.test_missing_map_key_condition_does_not_fire[chi] from system_tests_suite
AssertionError: The probe emitted a snapshot with captured data, so the condition fired as if true. A missing key in a map[string]int reads as 0, and 0 == 1 is false.
assert not True
 +  where True = <function captures_contain_data at 0x7f07fb64d1c0>({'entry': {'arguments': {'d': {'address': '0x20bbb40', 'fields': {}, 'type': '*main.DebuggerController'}, 'r': {'addre...fields': {...}, 'type': '*github.com/go-chi/chi/v5/middleware.httpFancyWriter'}}, 'type': 'net/http.ResponseWriter'}}}})
 +    where <function captures_contain_data at 0x7f07fb64d1c0> = debugger.captures_contain_data
 +    and   {'entry': {'arguments': {'d': {'address': '0x20bbb40', 'fields': {}, 'type': '*main.DebuggerController'}, 'r': {'addre...fields': {...}, 'type': '*github.com/go-chi/chi/v5/middleware.httpFancyWriter'}}, 'type': 'net/http.ResponseWriter'}}}} = <built-in method get of dict object at 0x7f07dbfae2c0>('captures')
 +      where <built-in method get of dict object at 0x7f07dbfae2c0> = {'captures': {'entry': {'arguments': {'d': {'address': '0x20bbb40', 'fields': {}, 'type': '*main.DebuggerController'},... == 1", 'message': 'error evaluating condition'}], 'id': '7cdfc80f-1fe9-4e65-aec6-337fa06fb81e', 'language': 'go', ...}.get

self = <tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Missing_Map_Key_Condition object at 0x7f07fbea9010>

    def test_missing_map_key_condition_does_not_fire(self) -> None:
...
❌ tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Static_Template_Error.test_static_template_error_probe_rejected[chi] from system_tests_suite
AssertionError: Probe reached status 'EMITTING'; its template can never evaluate, so it must be rejected with status=ERROR like the equivalent condition.
assert 'EMITTING' == 'ERROR'
  - ERROR
  + EMITTING

self = <tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Static_Template_Error object at 0x7f07fbeaabd0>

    def test_static_template_error_probe_rejected(self) -> None:
        """Each template references something the system-probe resolves at install time and can't find.
    
...
Testing the test | System Tests (golang, dev) / End-to-end #1 / echo 1 — ❌ 2 tests failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

❌ tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Missing_Map_Key_Condition.test_missing_map_key_condition_does_not_fire[echo] from system_tests_suite
AssertionError: The probe emitted a snapshot with captured data, so the condition fired as if true. A missing key in a map[string]int reads as 0, and 0 == 1 is false.
assert not True
 +  where True = <function captures_contain_data at 0x7f6067db1440>({'entry': {'arguments': {'d': {'address': '0x217e560', 'fields': {}, 'type': '*main.DebuggerController'}, 'r': {'addre...a': {'address': '0xc91c620d860', 'fields': {...}, 'type': '*net/http.response'}}, 'type': 'net/http.ResponseWriter'}}}})
 +    where <function captures_contain_data at 0x7f6067db1440> = debugger.captures_contain_data
 +    and   {'entry': {'arguments': {'d': {'address': '0x217e560', 'fields': {}, 'type': '*main.DebuggerController'}, 'r': {'addre...a': {'address': '0xc91c620d860', 'fields': {...}, 'type': '*net/http.response'}}, 'type': 'net/http.ResponseWriter'}}}} = <built-in method get of dict object at 0x7f604890a5c0>('captures')
 +      where <built-in method get of dict object at 0x7f604890a5c0> = {'captures': {'entry': {'arguments': {'d': {'address': '0x217e560', 'fields': {}, 'type': '*main.DebuggerController'},... == 1", 'message': 'error evaluating condition'}], 'id': 'e8c5044e-6dd6-431a-bfbc-24f14d4fd127', 'language': 'go', ...}.get

self = <tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Missing_Map_Key_Condition object at 0x7f60747c8a40>

    def test_missing_map_key_condition_does_not_fire(self) -> None:
...
❌ tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Static_Template_Error.test_static_template_error_probe_rejected[echo] from system_tests_suite
AssertionError: Probe reached status 'EMITTING'; its template can never evaluate, so it must be rejected with status=ERROR like the equivalent condition.
assert 'EMITTING' == 'ERROR'
  - ERROR
  + EMITTING

self = <tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Static_Template_Error object at 0x7f60747c8110>

    def test_static_template_error_probe_rejected(self) -> None:
        """Each template references something the system-probe resolves at install time and can't find.
    
...
Testing the test | System Tests (golang, dev) / End-to-end #1 / fiber-v2-orchestrion 1 — ❌ 2 tests failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

❌ tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Missing_Map_Key_Condition.test_missing_map_key_condition_does_not_fire[fiber-v2-orchestrion] from system_tests_suite
AssertionError: The probe emitted a snapshot with captured data, so the condition fired as if true. A missing key in a map[string]int reads as 0, and 0 == 1 is false.
assert not True
 +  where True = <function captures_contain_data at 0x7f2d871253a0>({'entry': {'arguments': {'d': {'address': '0x242e8a0', 'fields': {}, 'type': '*main.DebuggerController'}, 'r': {'addre...'fields': {...}, 'type': '*github.com/valyala/fasthttp/fasthttpadaptor.writer'}}, 'type': 'net/http.ResponseWriter'}}}})
 +    where <function captures_contain_data at 0x7f2d871253a0> = debugger.captures_contain_data
 +    and   {'entry': {'arguments': {'d': {'address': '0x242e8a0', 'fields': {}, 'type': '*main.DebuggerController'}, 'r': {'addre...'fields': {...}, 'type': '*github.com/valyala/fasthttp/fasthttpadaptor.writer'}}, 'type': 'net/http.ResponseWriter'}}}} = <built-in method get of dict object at 0x7f2d66887380>('captures')
 +      where <built-in method get of dict object at 0x7f2d66887380> = {'captures': {'entry': {'arguments': {'d': {'address': '0x242e8a0', 'fields': {}, 'type': '*main.DebuggerController'},... == 1", 'message': 'error evaluating condition'}], 'id': 'cc4de381-d661-4e9b-ba43-84c811b50b4f', 'language': 'go', ...}.get

self = <tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Missing_Map_Key_Condition object at 0x7f2d8742b080>

    def test_missing_map_key_condition_does_not_fire(self) -> None:
...
❌ tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Static_Template_Error.test_static_template_error_probe_rejected[fiber-v2-orchestrion] from system_tests_suite
AssertionError: Probe reached status 'EMITTING'; its template can never evaluate, so it must be rejected with status=ERROR like the equivalent condition.
assert 'EMITTING' == 'ERROR'
  - ERROR
  + EMITTING

self = <tests.debugger.test_debugger_go_expression_errors.Test_Debugger_Go_Static_Template_Error object at 0x7f2d8742ae70>

    def test_static_template_error_probe_rejected(self) -> None:
        """Each template references something the system-probe resolves at install time and can't find.
    
...

View all 24 failed jobs.

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a121cd1 | Docs | View more details | Give us feedback!

This branch has not been deployed

No deployments
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