refactor: split dashboard.py into package#98
Merged
pratyush618 merged 2 commits intomasterfrom May 1, 2026
Merged
Conversation
Move the 572-line single-file dashboard into a dashboard/ package with errors, static, routes, server, and per-feature handlers/ submodules. Public API (serve_dashboard, build_scaler_response, StaticAssets) stays at taskito.dashboard via re-exports. No behavior changes.
Strip ASCII control characters (CR, LF, null, etc.) and cap length before passing self.path to logger.exception, defeating log-forging via crafted request URLs. Addresses CodeQL log-injection alerts on do_GET / do_POST exception paths.
Collaborator
Author
|
Fixed CodeQL log-injection alerts: added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dashboard.pyinto adashboard/packagedashboard/handlers/(jobs, dead_letters, metrics, logs, queues, scaler)server.pyat 218 linesLayout
dashboard/__init__.py— re-exports the public API (serve_dashboard,build_scaler_response,StaticAssets, plus the test-internals_make_handler,_content_type_for,_resolve_static_node)dashboard/errors.py—_BadRequest,_NotFounddashboard/static.py—StaticAssets,_get_default_assets, content-type table, missing-assets HTMLdashboard/routes.py—GET_ROUTES,GET_PARAM_ROUTES,POST_ROUTES,POST_PARAM_ROUTESdashboard/server.py—DashboardHandler,serve_dashboard,_make_handlerdashboard/handlers/— per-feature handler functionsWhy
handlers/settings.pyinstead of stretching the single fileTest plan
uv run ruff check py_src/uv run mypy py_src/taskito/ --no-incrementaluv run python -m pytest tests/python/test_dashboard.py tests/python/test_dashboard_static.py tests/python/test_keda.py -v— 64 passeduv run python -m pytest tests/python/ -v— 465 passed, 9 skippedfrom taskito.dashboard import serve_dashboard,build_scaler_response,StaticAssets,_content_type_for,_resolve_static_node,_make_handler) keep working — verified by test suite