Repository navigation
Description
What happened
Four tests of tests/commands/test_scan.py fail on main in the devcontainer, where the scanner tools are installed under the data directory of the user. The floor refuses a path of the host that no fake covers.
Evidence
On 2026-11-10 at commit 7029757, uv run pytest tests/commands/test_scan.py -n 0 gives 4 failed and 4 errors: test_scan_individual_tools, and test_scan_serialized_output_holds_status_reason_and_findings for trivy, secrets and sast. The messages are "host path reached without a fake" for the trivy and gitleaks binaries under the user data directory, and "process edge reached without a fake" for semgrep scan. The full uv run devops ci of #4308 shows the same 4 failures and 4 errors, with no change of that pull request near the scan code.
What should happen
The tests give the same result on a machine with the scanner tools installed and on one without. The ci-runs-in-devcontainer-and-github-runner rule needs it: every test works in both.
Acceptance criteria
-
uv run devops ci test tests/commands/test_scan.pypasses on a machine where the tools are installed. - The same tests pass on a machine where they are not installed.
Proposed design
Problem statement
Two tests in tests/commands/test_scan.py run the real scan commands without a fake for the scanner tools. test_scan_individual_tools and test_scan_serialized_output_holds_status_reason_and_findings (for trivy, secrets and sast) reach the trivy and gitleaks binaries under the user data directory and the semgrep scan process. The test floor refuses these host paths. The tests therefore fail where the tools are installed. They must give the same result on a machine with the tools and on one without.
Acceptance criteria
Requirement: Scan tool dispatch uses fakes
test_scan_individual_tools SHALL answer the trivy, gitleaks and semgrep calls with fakes and SHALL NOT reach a host path or a real process.
Scenario: Tools installed on the host
- WHEN the test runs on a machine where trivy, gitleaks and semgrep are installed under the user data directory
- THEN the test passes and the floor raises no "host path reached without a fake" or "process edge reached without a fake" error
Requirement: Serialized output tests use fakes
test_scan_serialized_output_holds_status_reason_and_findings SHALL answer the scanner call of each parameter trivy, secrets and sast with a fake.
Scenario: Serialized output with a faked scanner
- WHEN the test runs for
trivy,secretsandsastwith the tools scripted as clean runs - THEN the JSON and YAML output hold the keys
status,reasonandfindings, and the exit code is 0
Requirement: Same result without the tools
The tests of tests/commands/test_scan.py MUST give the same result on a machine where the scanner tools are not installed.
Scenario: Tools absent from the host
- WHEN
uv run devops ci test tests/commands/test_scan.pyruns on a machine with no scanner tools - THEN all tests pass, with the same count as on a machine with the tools
Existing Tool Considered
No new tool is needed. The project already holds the fakes ScannerFake and ProcessFake in tests/support/fakes, and test_scan_serialized_output_with_findings already uses ScannerFake. The change scripts these fakes in the two failing tests. The cost is small: one short edit of one test file and one test run in the devcontainer. No alternatives check has run.
Key questions
- Which fake does each failing test use to cover the scanner tools?: Use
scanner_fakefor the trivy and gitleaks results, astest_scan_serialized_output_with_findingsdoes. Useprocess_fakefor thesemgrep scanprocess, astest_scan_json_stdout_is_valid_jsondoes for zizmor. Script a clean result for each tool so that the output holdsstatus,reasonandfindings. (best practice) [sources: tests/commands/test_scan.py]- Chosen: Use the existing ScannerFake and ProcessFake. The project already has them and other tests in the same file use them.
- Rejected: Skip the tests when the tools are installed. The tests would not run on the machine of the issue, and the acceptance criteria need a pass on both machines.
- Rejected: Patch PATH or the data directory in the tests. The tests would still depend on the host and bypass the fakes that the floor requires.
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.(ci)scope of the title gives the scope.Failing tests block the full CI gate on main.Restores CI reliability but does not change user-facing behaviour.Adding test fakes for a small number of test cases.Make scan command tests in tests/commands/test_scan.py use fakes for scanner tools so they pass whether tools are installed or notas the change that both ask for.Both ask for fakes in test_scan.py so the tests do not reach host scanner tools and pass on any machine.A person closes one of the two if that is so.devops-cli-service commentedon Nov 10, 2026
Status set to Ready at ec160a2 (see proposed design in issue body).