[SDTEST-3761] Propagate TIA tests skipping tag#240
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b711b59808
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
E2E Test Report: PARTIAL VERIFICATION
|
| Span level | Has tag? | Value |
|---|---|---|
| Session | ✅ 1/1 | true |
| Suite | ✅ 362/362 | true |
| Test | ❌ 0/1040 | — |
Suite-level propagation works — every suite span carries test.itr.tests_skipping.enabled=true via the new `testSuiteWillEnd` hook at `Sources/DatadogSDKTesting/TestImpactAnalysis/TestImpactAnalysis.swift:93-98`. ✅
Test-level propagation does NOT appear on test spans in real XCTest export, despite the new `test.set(tag: ..., value: isSkippingEnabled)` call at `TestImpactAnalysis.swift:127`. ❌
Likely cause
The code paths for
- `Suite.set(tag:value:)` (`DDTestSuite.swift:133`) writes directly via `value.spanAttribute` — works.
- `Test.set(tag:value:)` (`DDTest.swift:121`) routes through `setTag(key:value:Any) → span.setAttribute(key:, value: AttributeValue(value))`. The OpenTelemetry `AttributeValue.init?(_:Any)` is failable; when the value arrives boxed as `any SpanAttributeConvertible` wrapping a `Bool`, the `case let val as Bool` pattern may not match through the existential, the failable init returns `nil`, and the attribute is silently dropped.
Supporting evidence:
- `test.skip_reason` (a `String`) set via the same `set(tag:)` call DOES land on test spans (2 spans in this run).
- `test.is_ui_test` is set as the literal string `"true"`/`"false"`, not as a `Bool` (see `DDTest.swift:28`).
- The PR's unit tests pass because `Mocks.Runner` records tags directly without routing through `AttributeValue.init?(Any)`, so the Bool path is exercised only in real XCTest.
Suggested fix
Either:
- Pass the value as a string at line 127 (consistent with `test.is_ui_test`):
```swift
test.set(tag: DDTestSessionTags.testSkippingEnabled, value: isSkippingEnabled ? "true" : "false")
``` - Or align `Test.set(tag:value:)` with the suite implementation, using `value.spanAttribute` directly so the protocol existential is unboxed.
Test methodology
- Cloned the PR branch into the SwiftLint playground via `crook --dep dd-sdk-swift-testing=anmarchenko/tests_skipped_tag_propagation`.
- Built the SDK XCFramework from source, then ran SwiftLint's XCTest suite (892 tests) with auto-instrumentation.
- Captured all CI Visibility events into mockdog (`itr-enabled` scenario).
- Queried mockdog's parsed JSONL spans (`tests.jsonl`, `test_suites.jsonl`, `test_sessions.jsonl`) for the new tag.
This E2E test was performed by Shepherd — autonomous QA agent for Datadog Test Optimization.
|
Fixed the e2e failure in 485f3c2. The internal Added a real-span regression test covering Bool tag conversion on test spans. Verified with: Result: 356 XCTest tests passed, plus the Swift Testing run passed with known issues only. |
Summary:
Tests: