Add diagnostics#5
Merged
FeodorFitsner merged 9 commits intomainfrom Feb 24, 2026
Merged
Conversation
Introduce a memory diagnostics subsystem and UI: add src/diagnostics.py to collect periodic memory samples, tracemalloc traces, and type histograms (configurable via environment variables), and expose a DiagnosticsView component (src/components/diagnostics_view.py) with an on-demand dump button. Wire diagnostics into the app: DiagnosticsView is shown on the hidden route and diagnostics.enable_for_page(page) is called at startup (src/components/app.py, src/main.py). Add default MEM_DIAG-related environment variables to fly.toml and remove the old ad-hoc mem-watch code from main.py. Diagnostics output is logged to the "memdiag" logger and can be triggered by SIGUSR1 or programmatically.
Allow pre-release installs in Dockerfile and add uv prerelease setting in pyproject. Tune Fly envs (session timeout, diagnostic intervals, trace/top limits, control scan max nodes) and introduce MEM_DIAG_CONTROL_SCAN and MEM_DIAG_GC_OBJECTS flags. In diagnostics, broaden control detection, add a dedicated _iter_control_children helper, and use new flags to optionally enable control tree scanning and GC object counting; replace ad-hoc field traversal with the helper and streamline scanning logic.
Tune runtime diagnostics settings in fly.toml (disable MEM_DIAG by default, shorten sampling/trace intervals, enable collect-on-sample and gen2 collection, adjust type-hist defaults, and add malloc tuning vars). Extend src/diagnostics.py to improve diagnostics data and robustness: add trace-focus defaults and CSV env parsing; record GC collection details on sample; collect session-level stats with safe attribute access and session index sizing; compute recent trend summaries (RSS, controls, tuples per active page); include summary_trends in reports; add focused trace reporting (top_growth_focus) and helpers to identify focus files; and harden session stats collection with guarded error handling. These changes provide richer, safer memory telemetry for debugging and monitoring.
Add a GitHub Actions workflow that deploys the app to Fly.io. The workflow triggers on pushes to main and manual dispatch, uses a concurrency group to cancel in-progress deploys for the same ref, sets up flyctl via superfly/action, and runs `flyctl deploy --remote-only --config fly.toml` using the FLY_API_TOKEN secret.
Add uv.lock to the repository and remove the blanket "*.lock" ignore entry from .gitignore (previously commented guidance for poetry was removed as well). This ensures dependency lockfiles are tracked for reproducible installs and deterministic dependency resolution.
Add .dockerignore and switch the Docker base image to python:3.10-slim. Set UV_PYTHON_DOWNLOADS=never and UV_LINK_MODE=copy and pass --python /usr/local/bin/python to uv sync invocations to force use of the system Python and avoid downloading/installing alternate interpreters. Also remove the prerelease setting from pyproject.toml.
Drop the hardcoded --python /usr/local/bin/python option from both uv sync invocations in the Dockerfile. This avoids depending on a specific Python binary path in the image and lets uv use the default interpreter configured in the environment.
Upgrade the project's Python target to 3.14 by updating .python-version, the Dockerfile base image, and pyproject.toml's requires-python. The dependency lockfile was regenerated to align with the new interpreter. Note: this may remove compatibility with older Python releases — rebuild environments/containers and run the test suite after pulling these changes.
Compute an app version in CI (derive from pyproject version and GITHUB_RUN_NUMBER) and pass it as a build-arg to flyctl. Update Dockerfile to accept ARG/ENV APP_VERSION so the runtime can access it. Add src/utils/app_version.py to read APP_VERSION (falling back to pyproject.toml locally). Replace the inline version display in the app bar with a popup menu and About dialog that shows app, Flet, Flutter, and Python versions.
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.
No description provided.