Skip to content

refactor(api): inline import-time _routes global into start()#983

Merged
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:audit/arch-21-inline-routes-global
Jun 12, 2026
Merged

refactor(api): inline import-time _routes global into start()#983
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:audit/arch-21-inline-routes-global

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

Summary

The API server module built its aiohttp route list in a module-level _routes global at import time.
This created an import-time side effect, and the value was only ever read once, inside start().

This change moves the route-list construction into start() as a local variable and removes the global.
Behavior is unchanged: the same routes are registered on the application before the server starts.

Testing

  • uv run pytest tests/node/api/test_server.py -q (19 passed)
  • just check (lint, format, typecheck, spell, mdformat, lock) all pass

🤖 Generated with Claude Code

Build the aiohttp route list inside start() instead of at module
import time.
This removes an import-time side effect and a module-level global
that was only ever read in one place.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger merged commit f30c324 into leanEthereum:main Jun 12, 2026
13 of 14 checks passed
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