Skip to content

fix(tests): a branch name with a secret word fails a span test #3638

Closed as not planned

Description

@dan-petty

Problem

tests/ai/rag/test_rag_qdrant_span.py::test_upsert_span_names_the_server_by_host_and_port fails on a topic branch whose name holds one of the words secret, token or user.

The test checks that the span of qdrant.upsert_points leaks no part of the configured URL. It looks for those words in every value of the span attributes. The tracer adds the attributes vcs.ref.name and vcs.branch to each span. They hold the name of the git branch. So the check reads the branch name as if it were a leak.

Reproduction

  1. Create a checkout on a branch named fix/2613-prose-after-a-token-colon.
  2. Run uv run devops ci test tests/ai/rag/test_rag_qdrant_span.py.
  3. Six cases fail with assert not ['fix/2613-prose-after-a-token-colon', 'fix/2613-prose-after-a-token-colon'].

On a detached head, the six cases pass. The full gate uv run devops ci fails in the same way on such a branch.

Expected

The test passes on every branch name. It checks the attributes that name the server, and it ignores the attributes of the version control source.

Evidence

src/devops_cli/telemetry/tracer.py function _detect_vcs_metadata reads the branch from the git head file of the checkout, and _read_git_head_ref returns it. A branch name that follows <type>/<issue>-<slug> can hold any word, so the check fails for a branch about a token, a secret or a user.

Alternatives check of 2026-11-07: covers.
Tool: pytest (https://pypi.org/project/pytest), MIT, last activity 2026-10-27, maintained.

Proposed design

Problem statement

The span test fails on a branch whose name holds secret, token or user. The tracer copies the branch name into vcs.ref.name and vcs.branch. The leak scan reads every span attribute value, so it read the branch name as a leak. #4358 replaced the scanned words with the marker ..hidden and the text ://. Git refuses .. in a branch name, so no branch name can match. The module now passes on such a branch, and no code change remains. A person asks to close the item as not planned.

Acceptance criteria

Requirement: The span test passes on a branch name with a checked word

The test module SHALL pass on a checkout whose branch name holds secret, token or user.

Scenario: A branch name holds a checked word

  • WHEN The checkout is on the branch fix/2613-prose-after-a-token-colon and the test module runs.
  • THEN All nine cases pass and the leak scan reports no value.

Requirement: The leak scan looks for no word that a branch name can hold

The leak scan SHALL look for the marker ..hidden and the text ://, and for no word that a branch name can hold.

Scenario: The branch name holds tiktoken

  • WHEN A span attribute holds vcs.branch with the value fix/3828-plan-check-tiktoken-cache.
  • THEN The leak scan reports no value.

Requirement: A hidden part of the URL still fails the scan

The leak scan MUST report a span attribute value that holds ..hidden or ://.

Scenario: A span attribute holds the userinfo marker

  • WHEN A span attribute value holds https://[email protected].
  • THEN The leak scan reports that value.

Requirement: The server attributes stay asserted

The test SHALL keep the assertion that server.address and server.port equal the host and the port of the configured URL.

Scenario: Userinfo and path are stripped

  • WHEN The URL is http://login..hidden:[email protected]:6333/prefix..hidden/path.
  • THEN server.address is example.com and server.port is 6333.

Existing Tool Considered

pytest (https://pypi.org/project/pytest), MIT, last activity 2026-10-27, maintained, is the runner of the suite. It covers the need: it runs the seven parametrized URL cases and the two other tests of the module. It lacks a span-attribute filter and an assertion helper that names an offending value. The change builds no code, because #4358 already put the fix in the module. The written cost is zero tokens to build, keep and fix, and no elapsed time.

Key questions

  • The alternatives check found that pytest (https://pypi.org/project/pytest) covers this item. Adopt the tool, or keep the item and give the reason.: Adopt no tool and keep pytest as the runner. The person's reply records that fix(tests): the qdrant telemetry test reads the real branch name #4358 already replaced the word scan with a marker that no branch name can hold. The item needs no code change and closes as not planned. (best practice) [sources: tests/ai/rag/test_qdrant_request_telemetry.py:19, tests/ai/rag/test_qdrant_request_telemetry.py:88]
    • Chosen: Keep pytest and close the item as not planned. The person's reply records that fix(tests): the qdrant telemetry test reads the real branch name #4358 delivered the fix, so no code change remains and pytest stays the runner.
    • Rejected: Adopt pytest and add a scan helper. The scan reads values only and needs no filter, so a helper would add code that no failure needs.
    • Rejected: Add a span-attribute filtering library. The scan is one condition on a value, so a library would add a dependency for no gain.
  • Which test fails, and what does its leak scan read?: test_upsert_span_names_the_server_by_host_and_port in tests/ai/rag/test_qdrant_request_telemetry.py:78 holds seven parametrized URL cases, and the module holds nine cases in all. The scan at line 88 reports a value that holds HIDDEN (..hidden, line 19) or ://. The path tests/ai/rag/test_rag_qdrant_span.py of the issue body is not in the tree, and the body's six cases are seven. [sources: tests/ai/rag/test_qdrant_request_telemetry.py:19, tests/ai/rag/test_qdrant_request_telemetry.py:78, tests/ai/rag/test_qdrant_request_telemetry.py:88]
  • Has the fix already landed in the repository?: Yes, in fix(tests): the qdrant telemetry test reads the real branch name #4358. The module defines HIDDEN = "..hidden" and its docstring cites fix(tests): the qdrant telemetry test reads the real branch name #4358 and git check-ref-format. The archived change folder of fix(tests): the qdrant telemetry test reads the real branch name #4358 is in the tree. [sources: tests/ai/rag/test_qdrant_request_telemetry.py:19, tests/ai/rag/test_qdrant_request_telemetry.py:26, openspec/changes/archive/2026-11-11-4358-the-qdrant-telemetry-test-reads-the/proposal.md]
  • Why can a branch name no longer trip the leak scan?: Git refuses .. in a branch name, and the marker ..hidden holds ... The tracer reads the branch from the git HEAD file and copies it into vcs.ref.name and vcs.branch. The scan looks for ..hidden and :// only, so a branch name cannot match. [sources: tests/ai/rag/test_qdrant_request_telemetry.py:23, src/devops_cli/telemetry/tracer.py:656, src/devops_cli/telemetry/tracer.py:738]
  • Should the scan skip the vcs. attribute keys, as the earlier proposal said?: No. fix(tests): the qdrant telemetry test reads the real branch name #4358 removed the words that a branch name can hold, so the scan needs no key filter. A key filter would add code that no failure needs. (best practice) [sources: tests/ai/rag/test_qdrant_request_telemetry.py:19, tests/ai/rag/test_qdrant_request_telemetry.py:88]
    • Chosen: Keep the value-only scan with the ..hidden marker. The marker and :// cannot appear in a branch name, so the scan passes on every branch and still catches a hidden part of the URL.
    • Rejected: Skip every key that starts with vcs.. fix(tests): the qdrant telemetry test reads the real branch name #4358 removed the words that a branch name can hold, so the filter adds code that no failure needs.
    • Rejected: Extract a _leaked_values helper and add a negative test. The person's reply asks for no code change, because the module already passes on a branch with a checked word.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/tests
    status/new
    value/medium
    effort/low
    on Nov 5, 2026
  2. dan-petty commented on Nov 5, 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: P2-Medium. It blocks CI on branches whose names contain certain words but does not affect production.
    • Value: Medium. It unblocks CI for developers on affected branch names but only for a subset of branches.
    • Effort: Low. The fix filters VCS attributes from the span attribute check in one test.
    • Related: fix(rag): the Qdrant upsert span names its server by host and port, never by the full URL with its userinfo #2459, which asks for a different change. Both concern the qdrant.upsert_points span; #2459 fixes the span to use host:port, the candidate fixes the test that verifies it to ignore VCS attributes.
  3. added
    priority/p2-medium
    on Nov 5, 2026
  4. dan-petty commented on Nov 5, 2026

    @dan-petty
    OwnerAuthor

    The same failure showed again on 2026-11-05 for the branch fix/2662-mask-url-user-name-without-password (pull request #3676), at origin/main f6d57ecd. Six cases of test_upsert_span_names_the_server_by_host_and_port fail with the branch name in vcs.ref.name and vcs.branch, because the name holds the word user. They pass on a detached head. The full local uv run devops ci fails on such a branch, so a branch that is about a user name, a token or a secret cannot pass the gate on a local checkout.

  5. added
    status/ready
    and removed
    status/new
    on Nov 6, 2026
  6. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

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

  7. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    A branch name with the word "token" also fails this test. Branch fix/3828-plan-check-tiktoken-cache put "tiktoken" in the span attributes and failed the six cases of tests/ai/rag/test_rag_qdrant_span.py in a full devops ci run. I renamed the branch to avoid the word. The cause is still open here.

  8. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Alternatives check: covers

    Reason: Web search returned no results (the provider did not answer), so I read the facts of the tool the issue itself names: pytest, the runner the project's suite already uses. pytest covers the need, because the fix is an edit of one existing pytest test (parametrized cases, a monkeypatch for _detect_vcs_metadata) that adds no library, and the issue's proposed design reaches the same conclusion.

    Tool: pytest (https://pypi.org/project/pytest)

    • License: MIT
    • Last activity: 2026-10-27
    • Maintained: yes

    Covers:

    • Runs the six parameterized cases of test_upsert_span_names_the_server_by_host_and_port.
    • monkeypatch sets the branch name for the regression test on fix/2613-prose-after-a-token-colon without touching git.
    • parametrize keeps the URL variants and the server.address/server.port assertions in one test.

    Lacks:

    • It is a test runner, not a span-attribute filter: the vcs. prefix exclusion in the leak scan must be written by hand in the test.
    • It gives no assertion helper that names an offending attribute value; the failing value is surfaced by the plain assertion.

    Tools considered:

    Searches run:

    • pytest monkeypatch parametrize test fixture official docs, results: 0
    • pytest test filtering span attributes ignore prefix, results: 0
    • pytest framework, results: 0

    Sources:

    Checked on 2026-11-07. A person decides what this means for the item. The check changes no label and closes no issue.

  9. added
    status/new
    and removed
    status/ready
    on Nov 7, 2026
  10. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Status set back to New at 257cb46. Refine cannot set this item to Ready at 257cb46 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • The alternatives check found that https://pypi.org/project/pytest covers this item. Adopt the tool, or keep the item and give the reason. (a person decides)
  11. dan-petty commented on Nov 14, 2026

    @dan-petty
    OwnerAuthor

    Replaced by #4358: the leak scan in tests/ai/rag/test_qdrant_request_telemetry.py:88 no longer looks for the words secret, token or user. It looks for the marker '..hidden' and '://'. Git refuses '..' in a branch name, so no branch name can match. Evidence: on branch fix/3638-secret-word-span-test the test passes (9 passed in 0.97s). No code change is needed; close as not planned.

  12. added
    status/ready
    and removed
    status/new
    on Nov 14, 2026
  13. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

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

  14. dan-petty commented on Nov 17, 2026

    @dan-petty
    OwnerAuthor

    Issue #4358 already resolved this problem in tests/ai/rag/test_qdrant_request_telemetry.py.

    The test now uses the marker ..hidden and :// for URL parts that a span must not show. Git refuses .. in a branch name per git check-ref-format. Therefore, a branch name that holds secret, token, or user cannot match the marker. All 9 cases in tests/ai/rag/test_qdrant_request_telemetry.py pass.

    Closing as not planned per AGENTS.md Rule 2.

  15. removed
    status/ready
    on Nov 17, 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/p2-mediumscope/testssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions