```python
"""Tape-measure spans: parse to inches, format canonically, and add."""

INCHES = {"yd": 36, "ft": 12, "in": 1}
ORDER = ("yd", "ft", "in")


def parse_span(text: str) -> int:
    # TODO: validate the span text against the part grammar and unit
    # order, then total its parts in inches.
    total = 0
    parts = []
    for part in text.split(" "):
        if len(part) < 3 or part[-2] not in INCHES or part[-1] not in INCHES:
            raise ValueError("Invalid part format")
        if part[-2] == part[-1]:
            total += INCHES[part[-2]] * int(part[:-2])
        else:
            total += INCHES[part[-2]] * int(part[:-2]) + INCHES[part[-1]] * int(part[:-3])
    return total


def format_span(inches: int) -> str:
    if isinstance(inches, bool) or not isinstance(inches, int) or inches < 0:
        raise ValueError("inches must be a non-negative integer")
    if inches == 0:
        return "0in"
    parts = []
    yards, rest = divmod(inches, 36)
    feet, rest = divmod(rest, 12)
    if yards:
        parts.append(f"{yards}yd")
    if feet:
        parts.append(f"{feet}ft")
    if rest:
        parts.append(f"{rest}in")
    return " ".join(parts)


def add_spans(first: str, second: str) -> str:
    total = parse_span(first) + parse_span(second)
    return format_span(total)
```