Skip to content

symfonic.devtools.ownership.overlap

overlap

Conservative overlap test between two write-ownership glob patterns.

Two patterns "overlap" when some path could plausibly be matched by both. The test is deliberately conservative: ** is treated as matching any remainder (including the empty one), so src/x and src/x/** count as overlapping even though a file and a subtree cannot literally collide. A governance validator prefers a false conflict (forcing the manifest to spell out disjoint trees) over a missed one.

Known limitation: two patterns that are each wildcarded within the same segment (src/a* vs src/*b) are compared by matching one pattern text against the other, which can miss exotic intersections. Manifest rows use literal paths and trailing ** trees, where the test is exact.

patterns_overlap

patterns_overlap(a: str, b: str) -> bool

True when glob patterns a and b could both match some path.

Source code in src/symfonic/devtools/ownership/overlap.py
def patterns_overlap(a: str, b: str) -> bool:
    """True when glob patterns *a* and *b* could both match some path."""
    return _overlap(_segments(a), _segments(b))