Skip to content

test: consolidate qyl MCP and collector coverage - #367

Merged
github-actions[bot] merged 20 commits into
mainfrom
codex/mcp-collector-test-coverage
May 24, 2026
Merged

test: consolidate qyl MCP and collector coverage#367
github-actions[bot] merged 20 commits into
mainfrom
codex/mcp-collector-test-coverage

Conversation

@ANcpLua

@ANcpLua ANcpLua commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • consolidate WithQylTelemetry wrapping tests and keep emission coverage focused on observable behavior
  • expand MCP error formatting, collector helper, scope injection, and credential redaction tests
  • tighten GenAI metric assertion isolation for process-wide MeterListener captures

Verification

  • dotnet build tests/qyl.collector.tests/qyl.collector.tests.csproj --nologo
  • dotnet build tests/qyl.mcp.tests/qyl.mcp.tests.csproj --nologo
  • dotnet test --project tests/qyl.mcp.tests/qyl.mcp.tests.csproj --no-restore --no-build
  • dotnet test --project tests/qyl.collector.tests/qyl.collector.tests.csproj --no-restore --no-build
  • git diff --check HEAD~1..HEAD

Copilot AI review requested due to automatic review settings May 23, 2026 23:11
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 23, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Risk: Low — changes are confined to test code and primarily refactor/expand assertions for existing behaviors.

This PR consolidates and tightens test coverage across the qyl MCP and collector test suites, focusing assertions on observable behavior and improving isolation for process-wide telemetry listeners.

Changes:

  • Refactors MCP tests (credential redaction, scope injection, collector helper, error formatting) into more focused theory-driven coverage.
  • Consolidates WithQylTelemetry wrapping tests and keeps emission tests centered on emitted activities/tags.
  • Tightens GenAI metric selection to avoid cross-test interference when a process-wide MeterListener captures multiple measurements.

Blockers

  • None found.

Important issues

  • None found.

Minor / optional

  • None found.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/qyl.mcp.tests/Tools/SummaryCredentialRedactorTests.cs Splits redaction coverage into targeted theories for credential patterns, runner token literals, and non-credential passthrough.
tests/qyl.mcp.tests/Tools/CollectorHelperTests.cs Adds baseline success-path assertion; expands cancellation/timeout formatting and prefix behavior coverage.
tests/qyl.mcp.tests/Scoping/QylScopeInjectorTests.cs Refactors to concise tests verifying null passthrough, in-place mutation, caller precedence, and case-insensitive behavior.
tests/qyl.mcp.tests/Formatting/ErrorFormatterTests.cs Expands coverage for HTTP status categorization, transport-specific hints, cancellation vs timeout, and message leakage rules.
tests/qyl.collector.tests/Telemetry/GenAiMetricsTests.cs Narrows duration-metric selection to include key tags, improving isolation under shared metric capture.
tests/qyl.collector.tests/Instrumentation/WithQylTelemetryWrapTests.cs New consolidated tests for wrapping semantics and sensitive-data flag propagation.
tests/qyl.collector.tests/Instrumentation/WithQylTelemetryEmissionTests.cs Keeps emission assertions focused on activities and required tags; reduces coupling to fake response details.
tests/qyl.collector.tests/Instrumentation/GenAiInstrumentationTests.cs Removed in favor of consolidated WithQylTelemetryWrapTests.
tests/qyl.collector.tests/Instrumentation/ChatClientToolInstrumentationTests.cs Removed in favor of consolidated WithQylTelemetryWrapTests.
tests/qyl.collector.tests/Ingestion/OtlpConstantsTests.cs Refactors into parameterized expectations for OTLP path mapping and token-auth bypass defaults.

@ANcpLua

ANcpLua commented May 23, 2026

Copy link
Copy Markdown
Owner Author

Triage Bot report

  • thread es6EV1OO from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeChatClient' is cre

  • thread es6EV1OP from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'OpenTelemetryChatClien

  • thread es6EV1OQ from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'ToolDecoratingChatClie

  • thread es6EV1OR from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'OpenTelemetryChatClien

Threads marked needs-human stay unresolved and block auto-merge.

1 similar comment
@ANcpLua

ANcpLua commented May 23, 2026

Copy link
Copy Markdown
Owner Author

Triage Bot report

  • thread es6EV1OO from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeChatClient' is cre

  • thread es6EV1OP from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'OpenTelemetryChatClien

  • thread es6EV1OQ from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'ToolDecoratingChatClie

  • thread es6EV1OR from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'OpenTelemetryChatClien

Threads marked needs-human stay unresolved and block auto-merge.

Drop 438 lines of brittle markdown-cosmetic assertions and per-file
StubHttpMessageHandler boilerplate. Tests now pin the contract — URL
routing, POST payload shape, error-message mapping — via the shared
FakeHttpMessageHandler from ANcpLua.Agents.Testing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copilot AI review requested due to automatic review settings May 24, 2026 00:07
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs
Comment thread tests/qyl.mcp.tests/Tools/SummaryCredentialRedactorTests.cs Outdated
Comment thread tests/qyl.mcp.tests/Tools/AnomalyToolsTests.cs
Comment thread tests/qyl.collector.tests/Ingestion/OtlpConstantsTests.cs Outdated
Comment thread tests/qyl.mcp.tests/Tools/AnomalyToolsTests.cs Fixed
Comment thread tests/qyl.mcp.tests/Tools/AnomalyToolsTests.cs Fixed
Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs Fixed
Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs Fixed
Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs Fixed
Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs Fixed
Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs Fixed
Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs Fixed
@ANcpLua

ANcpLua commented May 24, 2026

Copy link
Copy Markdown
Owner Author

Triage Bot report

  • thread es6EV-Op from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    The success-path tests for ListMetrics/QueryMetrics no longer assert anything ab

  • thread es6EV-Ow from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    These redaction cases only assert that the secret substring is removed, but they

  • thread es6EV-Oy from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    This test is named "ForwardsCancellationToken" but it only asserts that the meth

  • thread es6EV-Oz from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    Test name reads oddly: "BypassMatchMappedOtlpPaths" looks like a missing word (e

  • thread es6EV-fM from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeChatClient' is cre

  • thread es6EV-fO from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeChatClient' is cre

  • thread es6EV-fQ from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fS from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fT from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fW from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fY from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fZ from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeHttpMessageHandler

  • thread es6EV-ff from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeHttpMessageHandler

  • thread es6EV-fg from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

Threads marked needs-human stay unresolved and block auto-merge.

1 similar comment
@ANcpLua

ANcpLua commented May 24, 2026

Copy link
Copy Markdown
Owner Author

Triage Bot report

  • thread es6EV-Op from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    The success-path tests for ListMetrics/QueryMetrics no longer assert anything ab

  • thread es6EV-Ow from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    These redaction cases only assert that the secret substring is removed, but they

  • thread es6EV-Oy from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    This test is named "ForwardsCancellationToken" but it only asserts that the meth

  • thread es6EV-Oz from @copilot-pull-request-reviewer: needs-human — no rule matched — keeping blocked for manual review

    Test name reads oddly: "BypassMatchMappedOtlpPaths" looks like a missing word (e

  • thread es6EV-fM from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeChatClient' is cre

  • thread es6EV-fO from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeChatClient' is cre

  • thread es6EV-fQ from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fS from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fT from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fW from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fY from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

  • thread es6EV-fZ from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeHttpMessageHandler

  • thread es6EV-ff from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable Disposable 'FakeHttpMessageHandler

  • thread es6EV-fg from @github-code-quality: needs-human — no rule matched — keeping blocked for manual review

    Missing Dispose call on local IDisposable

    Disposable 'FakeHttpMessageHand

Threads marked needs-human stay unresolved and block auto-merge.

@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copilot AI review requested due to automatic review settings May 24, 2026 00:16
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/e2e-docker.yml
Comment thread .github/workflows/e2e-docker.yml
Comment thread tests/qyl.mcp.tests/Tools/MetricsToolsTests.cs Outdated
22 source-generator snapshot tests each repeated the same 25-40 line
Preamble (using directives + Qyl.Instrumentation marker + all attribute
declarations) before its test-specific meter code. Pull the shared
boilerplate into MeterTestSources.{Preamble,InMyAppNamespace} and a
RunAndGetMeter() helper.

Per-test source code now shows only what's unique to that test —
the meter declaration and the instruments under test — instead of
drowning the eye in identical attribute prologues. The two outlier
tests (Private_Nested_Observable, Global_Namespace_Meter_Class) keep
their custom sources verbatim because they stub System.Diagnostics.Metrics
or live outside MyApp.

MeterEmitterTests.cs: 1420 -> 588 lines.
New MeterTestSources.cs: 100 lines.
Net: -732 lines, 21 tests preserved, identical generator coverage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

…n facts

6 [Fact] methods + 2 [Theory] methods (with 2 rows each) all followed
the same shape: POST a JSON body, expect 400, assert error-string
fragments. Collapse into one TheoryData<string, string[]> with 10
rows. Same coverage, but a new bound-check case fits on one new line
instead of 20.

967 -> 840 lines, all 79 functional tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 24, 2026 05:00
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Same pattern as the metrics consolidation: three functional endpoint
test files each had 2-3 isolated rejection facts (POST/GET with
different invalid payloads, all expecting 400 + an error-string
fragment). Collapse each cluster into one [Theory] with InlineData
rows.

- ObserveSubscriptionEndpointsTests: 3 facts -> 1 Theory(3) (-45 lines)
- SchemaPromotionEndpointsTests:     2 facts -> 1 Theory(2) (-17 lines)
- McpMetricsEndpointsTests:          2 facts -> 1 Theory(2) (-14 lines)

All 79 functional tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

AL0025 fires as a warning under default Test config but escalates to
error under Release because Directory.Build.props enables
TreatWarningsAsErrors. The configure lambdas in HappyPathConfigurations
and RejectionCases don't capture anything, so qualify them as static.

Fixes the docker-e2e Release Compile target that broke on the previous
otel.extensions consolidation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

1. e2e-docker.yml: grant `actions: write` so docker/build-push-action
   can actually export to GHA cache (type=gha silently no-ops without
   that scope, defeating the cache speedup we just landed).

2. e2e-docker.yml: include core/specs/** in the path filter — TypeSpec
   changes can ripple into generated outputs that the E2E images
   compile against, but with the old filter a pure spec PR wouldn't
   trigger this gate.

3. MetricsToolsTests: align the NotFound theory row's stubbed error
   body with the metric name the test queries (request_count, not
   missing_metric). The output formatter happened to interpolate the
   real name so the assertion still passed, but the inline data was
   confusing to read.

4. QylOpenTelemetryServiceCollectionExtensionsTests: re-add the
   explicit `using System.Diagnostics.Metrics;` for human readers.
   The Common.targets injects it as a global using, so the build
   was already green — but file-level reviewers (and Copilot) can't
   see the global and read the file as broken.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copilot AI review requested due to automatic review settings May 24, 2026 09:36
@ANcpLua
ANcpLua marked this pull request as ready for review May 24, 2026 09:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@github-actions
github-actions Bot enabled auto-merge (squash) May 24, 2026 09:36
@github-actions

Copy link
Copy Markdown

@coderabbitai autofix

@claude

claude Bot commented May 24, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@github-actions
github-actions Bot merged commit eb67391 into main May 24, 2026
13 of 14 checks passed
@ANcpLua
ANcpLua deleted the codex/mcp-collector-test-coverage branch May 24, 2026 14:55
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.

2 participants