Skip to content

feat(server): implement AppState, staged shot pipeline, and deprecate legacy camera - #228

Open
dieterolson wants to merge 3 commits into
open-flight:mainfrom
dieterolson:feat/server-appstate-and-staged-pipeline
Open

feat(server): implement AppState, staged shot pipeline, and deprecate legacy camera#228
dieterolson wants to merge 3 commits into
open-flight:mainfrom
dieterolson:feat/server-appstate-and-staged-pipeline

Conversation

@dieterolson

Copy link
Copy Markdown
Contributor

Summary

This PR implements the architectural improvements outlined in Upstream Design Proposal #20:

  1. AppState Lifecycle Encapsulation: Encapsulates runtime server state, hardware bindings, and synchronization structures into a clean dataclass AppState with get_app_state() singleton and reset_app_state() lifecycle resets. Maintains 100% backward-compatibility for existing module-level consumers and pytest fixtures.
  2. Staged Shot Processing Pipeline: Decomposes the 260-line monolithic on_shot_detected callback into isolated, testable pipeline stages (_stage_inclinometer_and_iwr, _stage_kld7, _stage_camera, _stage_launch_fallback, _stage_speed_and_spin_adjustments, _stage_carry_and_ballistics, _stage_session_logging, _stage_dispatch_and_simulators).
  3. K-LD7 Orientation Deduplication: Unifies vertical launch and horizontal path frame processing into a single helper _process_kld7_orientation, eliminating ~120 lines of duplicate RADC buffer extraction logic.
  4. Legacy Camera Tracker Deprecation: Added DeprecationWarning to CameraTracker initialization and marked module paths with deprecation notices.
  5. Comprehensive Unit Testing: Added TestAppState, TestStagedShotPipeline, and TestCameraDeprecation unit tests in tests/test_server.py.

Verification

  • Unit & Integration Tests: 1,356 passed, 15 skipped, 0 failures across 1,371 tests (uv run pytest).
  • Linters & Code Style:
    • uv run ruff check src/ tests/ (100% clean)
    • uv run ruff format --check src/ tests/ (100% formatted)
    • uv run pylint src/openflight/server.py src/openflight/camera_tracker.py rated 9.70/10.

…lows to uv

- Create openflight.club_data as canonical single source of truth for club physics profiles
- Consolidate optimal smash, launch angle, speed, and spin models across modules
- Add cross-module consistency and monotonic progression unit tests in test_club_data.py
- Migrate pytest.yml and pylint.yml to astral-sh/setup-uv@v5 and uv sync
- Add ruff lint/format checks and vitest UI unit test jobs in CI workflows
- Resolve Windows platform skips for file permissions, symlinks, and bash setup scripts
@dieterolson
dieterolson requested a review from jewbetcha as a code owner August 21, 2026 09:21
@jewbetcha

Copy link
Copy Markdown
Member

Great. Good to go once CI passes

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.

2 participants