def test_review_changes_docker_path_error():
    """Test that review_changes tool raises error for inaccessible paths"""

    with tempfile.TemporaryDirectory() as tmpdir:
        # Set up directories to simulate Docker mount
        host_workspace = Path(tmpdir) / "host_workspace"
        host_workspace.mkdir()
        container_workspace = Path(tmpdir) / "container_workspace"
        container_workspace.mkdir()

        # Create a path outside the mounted workspace
        outside_path = Path(tmpdir) / "outside_workspace"
        outside_path.mkdir()

        original_env = os.environ.copy()
        try:
            # Simulate Docker environment
            os.environ["WORKSPACE_ROOT"] = str(host_workspace)

            # Reload the module
            importlib.reload(utils.file_utils)
            utils.file_utils.CONTAINER_WORKSPACE = container_workspace

            # Import after reloading to get updated environment
            from tools.precommit import Precommit

            # Create tool instance
            tool = Precommit()

            # Test path translation with an inaccessible path
            request = tool.get_request_model()(
                path=str(outside_path),  # Path outside the mounted workspace
                review_type="quick",
                severity_filter="all",
            )

            # This should raise a ValueError
            import asyncio

            with pytest.raises(ValueError) as exc_info:
                asyncio.run(tool.prepare_prompt(request))

            # Check the error message
            assert "not accessible from within the Docker container" in str(exc_info.value)
            assert "mounted workspace" in str(exc_info.value)

        finally:
            os.environ.clear()
            os.environ.update(original_env)
            importlib.reload(utils.file_utils)
Test that review_changes tool raises error for inaccessible paths
tests/test_docker_path_integration.py