Skip to content

Add diagnostics#5

Merged
FeodorFitsner merged 9 commits intomainfrom
diag
Feb 24, 2026
Merged

Add diagnostics#5
FeodorFitsner merged 9 commits intomainfrom
diag

Conversation

@FeodorFitsner
Copy link
Copy Markdown
Contributor

No description provided.

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.
@FeodorFitsner FeodorFitsner merged commit 011fde9 into main Feb 24, 2026
1 check passed
@FeodorFitsner FeodorFitsner deleted the diag branch February 24, 2026 20:03
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