Skip to content

fix(ai): the gateway sweep's URL error names no credential - #2400

Merged
dan-petty merged 2 commits into
mainfrom
test/909-gateway-bench-stdlib
Oct 28, 2026
Merged

dan-petty merged 2 commits into
mainfrom
test/909-gateway-bench-stdlib

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

_validate_http_url in src/devops_cli/ai/gateway_bench.py raised a ValueError that held the full URL. run_level writes the text of that error into last_error, and the sweep's JSON and the stored run of devops ai gateway tune hold it. A backend URL with userinfo or a query token thus put its credential into the benchmark output.

  • The error text is now fixed: "Backend URL is not an http or https URL with a host." It names no part of the URL, and not the scheme either, because urlparse("user:pass@host") returns user as the scheme.
  • A comment above the raise says why the module raises the standard library's ValueError and not InvalidURLError: the module runs in a python:3.14-slim container without devops_cli, and _get_text and run_level catch the error.
  • A new test sends ftp://user:s3cr3t@example.com/x?token=t0k3n to run_level and asserts that last_error holds neither credential.
  • The existing test_gateway_bench_imports_only_standard_library already holds the module to the standard library, so the change adds no second test for that rule.

Closes #909

Change: openspec/changes/archive/2026-10-28-909-gateway-bench-stdlib/

`_validate_http_url` in `gateway_bench.py` raised a `ValueError` that
held the full URL. `run_level` writes the error text into `last_error`,
so a backend URL with userinfo or a query token put its credential into
the sweep's JSON. The error text is now fixed and names no part of the
URL. A comment says why the module raises the standard library's
`ValueError`: it runs in a container without `devops_cli`.
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence:

  • uv run devops ci fail-to-pass --base origin/main: 1 failed on base. TestBench::test_refused_backend_url_reaches_the_sweep_without_its_credentials failed with assert (1, True, True, True) == (1, True, False, False), so last_error held both credentials. The other 35 tests in tests/test_ai_gateway_tune.py passed on base.
  • On the branch: uv run pytest tests/test_ai_gateway_tune.py: 36 passed.
  • Mutation check of the existing stdlib test: a copy of gateway_bench.py with from devops_cli.exceptions import InvalidURLError made test_gateway_bench_imports_only_standard_library fail with assert ['devops_cli'] == [].

Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).

@dan-petty
dan-petty marked this pull request as ready for review October 28, 2026 13:58
@dan-petty
dan-petty merged commit 2e6f1fd into main Oct 28, 2026
16 checks passed
@dan-petty
dan-petty deleted the test/909-gateway-bench-stdlib branch October 28, 2026 14:01
dan-petty pushed a commit that referenced this pull request Oct 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.8.3](v0.8.2...v0.8.3)
(2026-10-28)


### Bug Fixes

* **ai:** the gateway sweep's URL error names no credential
([#2400](#2400))
([2e6f1fd](2e6f1fd)),
closes [#909](#909)
* **config:** exit 1 when audit-keys finds a plaintext secret
([#2401](#2401))
([ad0114f](ad0114f)),
closes [#1469](#1469)
* **security:** drop the Go ignores that the pinned gh build does not
need ([#2402](#2402))
([6052083](6052083)),
closes [#1492](#1492)
* **security:** refuse every loader and shell key that loads code into a
child ([#2405](#2405))
([86d5bce](86d5bce)),
closes [#2205](#2205)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.

test(ai): the gateway sweep script imports only the standard library

1 participant