Repository navigation
Description
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
- In a checkout, create the branch
fix/9999-push-secrets-example. - 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,/prefixor://.
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_attributescalls_detect_vcs_metadata, which calls_read_git_head_refand setsvcs.ref.nameandvcs.branchfrom 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,/prefixand://. 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_metadataand_detect_k8s_contextwith 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
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(tests)scope of the title gives the scope.A test fails on specific branch names; it does not affect production behaviour or users.It removes a false-alarm test failure on common branch names but has no user-facing effect.The fix is to mock the git directory or limit the attributes the test checks, a small change to one test.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.devops-cli-service commentedon Nov 10, 2026
Status set to Ready at 1ca0133 (see proposed design in issue body).