Skip to content

The platform's routes go first, so nothing has to be policed - #133

Merged
czpython merged 1 commit into
mainfrom
commonzenpython/eng-779-platform-routes-mount-first
Jul 27, 2026
Merged

The platform's routes go first, so nothing has to be policed#133
czpython merged 1 commit into
mainfrom
commonzenpython/eng-779-platform-routes-mount-first

Conversation

@czpython

Copy link
Copy Markdown
Owner

The guard #131 added to keep an extension out of the subject namespace read every declared route's path and compared it to the segment. Both halves of that were wrong.

parent.include_router(child) leaves a lazily-flattened entry behind that carries no path at all, so an extension composing its own routers stopped loading:

AttributeError: '_IncludedRouter' object has no attribute 'path'

And a path string was never enough to decide the question. @router.get("/{resource}") names no segment and still answers /api/x/widget; a mount("/", …) has no path to read. Inspection cannot tell whether a route will match a segment — only routing can.

So the platform stops asking and simply goes first:

platform = [cls._get_transcript_routes()]
if cls.subject_type:
    platform.append(cls._get_subject_routes(cls.subject_type))
return [*platform, *declared]

Both platform routers are confined to their own segment, so matching them first takes nothing from an extension anywhere else and leaves it no way to take a read druks serves — not with a catch-all, not by composing routers, and not by overriding get_routers to put its own first. The guard, its exception and the two tests that policed spelling are gone; what replaces them is a request proving a {anything:path} route still loses /widget and still wins everything else.

One collision inspection did have to keep: transcripts is the segment every extension's agent-call reads live on, so a subject of that name is refused where the extension is declared, not where it would have been confusing.

The convention this documented was also written down wrong. night_watch and pull_request are snake_case and both are URL segments — what the spelling tells you is who owns the segment, not whether it is a URL. And usage still declared the tag the platform now stamps, so every one of its operations carried it twice.

@czpython
czpython force-pushed the commonzenpython/eng-779-platform-routes-mount-first branch from 14a953b to eac9a76 Compare July 27, 2026 15:11
@czpython
czpython enabled auto-merge (squash) July 27, 2026 15:12
@czpython
czpython merged commit 6f775e2 into main Jul 27, 2026
1 check passed
@czpython
czpython deleted the commonzenpython/eng-779-platform-routes-mount-first branch July 27, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant