```python
def shelf_fit(widths: list, shelf: int) -> int:
    """Fit books onto a shelf in arrival order until one doesn't fit."""
    if not isinstance(widths, list):
        raise ValueError("widths must be a list")
    if not isinstance(shelf, int) or isinstance(shelf, bool):
        raise ValueError("shelf must be a non-negative integer")
    if shelf < 0:
        raise ValueError("shelf must be a non-negative integer")
    
    current_width = 0
    count = 0
    
    for width in widths:
        if not isinstance(width, int) or isinstance(width, bool):
            raise ValueError("each spine width must be a positive integer")
        if width <= 0:
            raise ValueError("each spine width must be a positive integer")
        
        if current_width + width <= shelf:
            current_width += width
            count += 1
        else:
            break
            
    return count
```