Skip to content

Add an interception app configuration hook before startup - #2560

Closed
faresobeid wants to merge 1 commit into
mainfrom
feat/interception-app-hook
Closed

Add an interception app configuration hook before startup#2560
faresobeid wants to merge 1 commit into
mainfrom
feat/interception-app-hook

Conversation

@faresobeid

@faresobeid faresobeid commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

InterceptionServer.start() freezes its aiohttp router before returning, so a subclass cannot register additional routes after super().start(). Add a protected _configure_app(app) hook after the built-in routes are registered and before AppRunner.setup() freezes the application.

The default hook is a no-op. Server startup, authentication, tunnel exposure and cleanup remain owned by the existing lifecycle.

Validation: a local HTTP regression fails with 404 before the change and passes afterward. It verifies registration before freeze, exactly one hook call, unchanged authorization on /state, and listener shutdown. The offline suite passed 83 tests; 76 live tests were excluded. Ruff and all-file pre-commit checks passed.

Note

Add interception app configuration hook before startup

Adds an end-to-end test in test_e2e.py that defines an InterceptionServer subclass overriding application configuration before startup. The test verifies the subclass route is reachable after startup, the configured application becomes router-frozen, protected state routes still reject requests, and the server stops accepting connections after shutdown.

Macroscope summarized cd47bf9.

@faresobeid faresobeid closed this Sep 10, 2026
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