Skip to content

refactor(review): the review orchestrator and the scanners take the reviewed workspace from their caller, and no review or scanner module reads Path.cwd() #2098

Closed

Description

@dan-petty

Friction

Part 2 of the tracker #772. The review orchestrator and the scanners find the reviewed workspace from the working directory of the process, not from their caller. So a test cannot give them a temporary workspace, and a review of a path depends on where the command starts.

Evidence (origin/main 9068795)

git grep -n "Path.cwd()" -- src/devops_cli/ai/review/ src/devops_cli/security/ finds 11 reads:

  • src/devops_cli/ai/review/exporter.py: 2 (the workspace root and the allowed roots)
  • src/devops_cli/ai/review/pipeline.py: 1
  • src/devops_cli/ai/review/runner.py: 2 (the allowed roots and the git root)
  • src/devops_cli/security/base.py: 2 (the candidate roots and a fallback)
  • src/devops_cli/security/kubelinter.py, mypy.py, osv_scanner.py and popeye.py: 1 each

#772's acceptance criterion: the orchestrator receives the reviewed workspace (root, listing, reading, sibling and manifest discovery), its scanners and its enrichers through its constructor, and no review module probes Path.cwd(). tests/test_review_pipeline.py::test_review_pipeline_stages, tests/test_review_repos.py::TestReviewReposSubdirectories::test_review_path_summary_in_repos_directory and tests/test_review_security_tools.py::test_pipeline_multi_scanner_aggregation pass a temporary workspace and fakes, and each runs in under 5 s.

Acceptance criteria

  • No module under src/devops_cli/ai/review/ or src/devops_cli/security/ reads Path.cwd() or os.getcwd(). Only the command layer reads the working directory, one time, and gives the workspace down. A test holds this.
  • The three tests named above use a temporary workspace and fakes, and each runs in under 5 s.

Order

After #1978, #1983 and #1984 merge, because they change security/mypy.py, security/sarif.py and review/canary.py.

Source: #772

Activity

  1. added
    source/agent
    type/refactor
    on Oct 24, 2026
  2. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/refactor. The candidate proposes a refactor to improve how the review orchestrator and scanners handle workspace paths.
    • Priority: P2-Medium. This change improves testability and consistency of path handling but is not critical for core functionality.
    • Value: Medium. The change improves the reliability of path reviews and makes testing easier, which benefits users indirectly.
    • Effort: High. The change requires modifying multiple modules under ai/review/ and security/ to remove Path.cwd() calls and pass workspace information through constructors.
    • Related: fix(review): a path review of single files runs its criteria from the repository root, not from the file's folder #1038, which asks for a different change. Both items relate to path reviews but the candidate focuses on eliminating Path.cwd() usage while item #1038 addresses a specific issue with file path handling in single-file reviews.
  3. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    Added scope, 2026-10-24 (from #1978). The review tests that build an orchestrator with no executor (about 34 test files) get ToolExecutorFake through the constructor. Then the root conftest no longer wraps DirectToolExecutor.run to answer the canary requests (pin_review_tool_canaries), which is a patch of a devops-cli name.

  4. added a commit that references this issue on Oct 24, 2026
    e075035
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

    source/agenttype/refactor

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions