Skip to content

fix(tests): the qdrant telemetry test reads the real branch name #4358

Closed

Description

@dan-petty

Problem Description

tests/ai/rag/test_qdrant_request_telemetry.py::test_upsert_span_names_the_server_by_host_and_port fails on a topic branch whose name holds the text "secret", "token" or "user". The test reads the real branch of the checkout, so its result depends on the branch name.

Reproduction Steps

  1. In a checkout, create the branch fix/9999-push-secrets-example.
  2. Run uv run pytest tests/ai/rag/test_qdrant_request_telemetry.py.

Expected vs Actual Behavior

Expected: the test gives the same result on every branch.

Actual: six cases fail with assert not ['fix/9999-push-secrets-example', 'fix/9999-push-secrets-example']. The tracer (src/devops_cli/telemetry/tracer.py, _read_git_head_ref) puts the branch of the checkout into span attributes. The test then looks for the words "secret", "token", "user", "/prefix" and "://" in every attribute value, and finds them in the branch name. The failure is a false alarm: the branch name holds no credential. A branch named after a fix for a secret or a token is common in this project.

Environment Diagnostics

devops-cli 0.107.0, a worktree on a topic branch.

Logs, Traces, or Terminal Output

See the assertion text above.

Proposed fix

Let the test run with a fixed git directory or branch, or test only the attributes that the Qdrant client sets. Do not skip the check.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Proposed design

Problem statement

The Qdrant request telemetry test fails on a topic branch whose name holds secret, token or user. The test scans every span attribute value, and the tracer copies the real branch name into the span. The test must use fixed ambient metadata so it gives the same result on every branch.

Acceptance criteria

Requirement: Fixed ambient metadata

The Qdrant telemetry test SHALL replace the checkout's VCS and Kubernetes metadata with fixed values before it records the upsert span.

Scenario: Topic branch with sensitive words

  • WHEN pytest runs the test on branch fix/9999-push-secrets-example
  • THEN the test passes and the span attributes hold the fixed branch name, not the checkout branch name.

Requirement: Credential leak assertion

The test SHALL assert that no span attribute value holds a credential, a URL path fragment or a URL scheme separator from the Qdrant URL.

Scenario: Userinfo and path in URL

  • WHEN the upsert uses http://user:secret@example.com:6333/prefix/path
  • THEN the span attributes hold none of secret, token, user, /prefix or ://.

Requirement: Active check

The test SHALL keep the credential leak assertion active and MUST NOT skip it.

Scenario: Test result

  • WHEN pytest runs the test
  • THEN pytest reports the test as passed, not skipped.

Existing Tool Considered

No alternatives check has run. pytest's built-in monkeypatch fixture covers the need: it replaces _detect_vcs_metadata and _detect_k8s_context with fixed values. It lacks a Git metadata fake, so the test must supply the fixed return values. No new library is needed.

Key questions

  • Where does the real branch name enter the span attributes?: _enrich_span_attributes calls _detect_vcs_metadata, which calls _read_git_head_ref and sets vcs.ref.name and vcs.branch from the checkout HEAD. [sources: src/devops_cli/telemetry/tracer.py:593, src/devops_cli/telemetry/tracer.py:652]
  • Which assertion makes the test depend on the branch name?: The test scans every span attribute value for secret, token, user, /prefix and ://. A branch name that holds one of these words fails the assertion. [sources: tests/ai/rag/test_qdrant_request_telemetry.py]
  • How should the test isolate the span from the checkout's branch name?: Stub _detect_vcs_metadata and _detect_k8s_context with a pytest fixture that returns fixed values. Keep the broad attribute check. (best practice) [sources: tests/telemetry/test_telemetry.py:454, src/devops_cli/telemetry/tracer.py:652]
    • Chosen: Monkeypatch the metadata detectors. It removes the real branch and Kubernetes values without file system setup and keeps the broad leak check.
    • Rejected: Use a temporary git directory. It tests Git file parsing that this test does not need, and it adds setup and cleanup.
    • Rejected: Restrict the assertion to Qdrant attributes. It loses the check of all span attributes and needs a maintained attribute list.
    • Rejected: Skip the check. The issue forbids it and it removes the leak check.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/tests
    status/new
    value/low
    effort/low
    on Nov 10, 2026
  2. dan-petty commented on Nov 10, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/tests. The (tests) scope of the title gives the scope.
    • Priority: P3-Low. A test fails on specific branch names; it does not affect production behaviour or users.
    • Value: Low. It removes a false-alarm test failure on common branch names but has no user-facing effect.
    • Effort: Low. The fix is to mock the git directory or limit the attributes the test checks, a small change to one test.
    • Possible duplicate: fix(tests): a branch name with a secret word fails a span test #3638, which may ask for the same change. The model names fix the Qdrant upsert span test so it does not fail when the checkout branch name contains 'secret', 'token', or 'user' as the change that both ask for. Both items ask for the same fix: stop the Qdrant upsert span test from reading the real branch name and triggering the secret-word check on it. A person closes one of the two if that is so.
  3. added
    priority/p3-low
    on Nov 10, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 1ca0133 (see proposed design in issue body).

  6. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 10, 2026
  7. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p3-lowscope/testssource/agenttype/bugvalue/low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions