test(profiling): fix the typing debt in test_product #22229
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 231 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.326
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #22229"
general
weight: 0.35
gyuheon0h
Description
Fixes the seven mypy errors in
tests/profiling/test_product.pythat exist onmaintip, so the file can be staged and type-checked cleanly. They surface only through the pre-commit mypy hook (CI typing coversddtrace/,ddtrace_commandsanddocspermypy.inifiles=), which is how #22195 hit them; that PR lists the module as a temporaryignore_errorsexclusion, which this PR makes unnecessary.Statement is unreachable: each test asserts the same expression withis Trueand lateris False(or the reverse); mypy narrows the member expression and the narrowing survives thecallback(...)calls in between, so the second assert is statically false and the rest of the function is dead code to mypy. The fix reads the value through a fresh local for the second assert (through the first where the narrowed value would otherwise flow into the binding).attr-defined:ddtrace.internal.profiling.productrenames itsprofiling_configimport, so accessing it through that module is an implicit re-export. Monkeypatch the module-level import from its origin instead — the same object.type: ignore[attr-defined]comments on_profiler.status, stale since the attribute became typed.Customer impact
None: test-only change.
Testing
scripts/lint typing -- tests/profiling/test_product.py: clean (was 7 errors).profiling::profilesuite, py3.9 (a9a4c7c1bb09): 133 passed — the full file.985b26efc887): 603 passed, 128 skipped, 6 xfailed acrosstests/profiling, including the full file.Risks
None: the locals bind the same values the asserts read, and the monkeypatch target is the same settings object.
Release Notes
No release note: test-only change (
testtype needs neither a note norchangelog/no-changelogperdocs/releasenotes.rst).