flightlens 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. flightlens-1.1.0/.dockerignore +18 -0
  2. flightlens-1.1.0/.github/workflows/ci.yml +93 -0
  3. flightlens-1.1.0/.github/workflows/docs.yml +48 -0
  4. flightlens-1.1.0/.github/workflows/fuzz.yml +44 -0
  5. flightlens-1.1.0/.github/workflows/release.yml +144 -0
  6. flightlens-1.1.0/.gitignore +40 -0
  7. flightlens-1.1.0/.python-version +1 -0
  8. flightlens-1.1.0/CHANGELOG.md +188 -0
  9. flightlens-1.1.0/CONTRIBUTING.md +57 -0
  10. flightlens-1.1.0/Dockerfile +40 -0
  11. flightlens-1.1.0/LICENSE +21 -0
  12. flightlens-1.1.0/PKG-INFO +228 -0
  13. flightlens-1.1.0/README.md +196 -0
  14. flightlens-1.1.0/SECURITY.md +44 -0
  15. flightlens-1.1.0/docker-compose.yml +20 -0
  16. flightlens-1.1.0/docs/changelog.md +1 -0
  17. flightlens-1.1.0/docs/checks.md +593 -0
  18. flightlens-1.1.0/docs/getting-started.md +75 -0
  19. flightlens-1.1.0/docs/how-it-works.md +238 -0
  20. flightlens-1.1.0/docs/img/aircraft-dark.png +0 -0
  21. flightlens-1.1.0/docs/img/aircraft-light.png +0 -0
  22. flightlens-1.1.0/docs/img/crash-dark.png +0 -0
  23. flightlens-1.1.0/docs/img/crash-light.png +0 -0
  24. flightlens-1.1.0/docs/img/library-dark.png +0 -0
  25. flightlens-1.1.0/docs/img/library-light.png +0 -0
  26. flightlens-1.1.0/docs/img/spectrum-dark.png +0 -0
  27. flightlens-1.1.0/docs/img/spectrum-light.png +0 -0
  28. flightlens-1.1.0/docs/index.md +45 -0
  29. flightlens-1.1.0/docs/real-log-results.md +165 -0
  30. flightlens-1.1.0/docs/replay/integration-plan.md +363 -0
  31. flightlens-1.1.0/docs/replay.md +185 -0
  32. flightlens-1.1.0/docs/sitl-log-library.md +85 -0
  33. flightlens-1.1.0/docs/validation.md +110 -0
  34. flightlens-1.1.0/docs/writing-a-check.md +47 -0
  35. flightlens-1.1.0/mkdocs.yml +56 -0
  36. flightlens-1.1.0/pyproject.toml +88 -0
  37. flightlens-1.1.0/scripts/benchmark.py +146 -0
  38. flightlens-1.1.0/scripts/build_dist.py +74 -0
  39. flightlens-1.1.0/scripts/fetch_px4_logs.py +116 -0
  40. flightlens-1.1.0/scripts/fuzz.py +190 -0
  41. flightlens-1.1.0/scripts/gen_check_docs.py +79 -0
  42. flightlens-1.1.0/scripts/sitl_campaign.py +201 -0
  43. flightlens-1.1.0/src/flightlens/__init__.py +3 -0
  44. flightlens-1.1.0/src/flightlens/__main__.py +3 -0
  45. flightlens-1.1.0/src/flightlens/api.py +997 -0
  46. flightlens-1.1.0/src/flightlens/backup.py +264 -0
  47. flightlens-1.1.0/src/flightlens/checks/__init__.py +5 -0
  48. flightlens-1.1.0/src/flightlens/checks/_util.py +204 -0
  49. flightlens-1.1.0/src/flightlens/checks/attitude.py +129 -0
  50. flightlens-1.1.0/src/flightlens/checks/baro.py +173 -0
  51. flightlens-1.1.0/src/flightlens/checks/base.py +72 -0
  52. flightlens-1.1.0/src/flightlens/checks/battery.py +151 -0
  53. flightlens-1.1.0/src/flightlens/checks/clipping.py +95 -0
  54. flightlens-1.1.0/src/flightlens/checks/compass.py +111 -0
  55. flightlens-1.1.0/src/flightlens/checks/control.py +284 -0
  56. flightlens-1.1.0/src/flightlens/checks/esc.py +203 -0
  57. flightlens-1.1.0/src/flightlens/checks/estimator.py +115 -0
  58. flightlens-1.1.0/src/flightlens/checks/events.py +103 -0
  59. flightlens-1.1.0/src/flightlens/checks/flight.py +269 -0
  60. flightlens-1.1.0/src/flightlens/checks/gps.py +194 -0
  61. flightlens-1.1.0/src/flightlens/checks/lanes.py +87 -0
  62. flightlens-1.1.0/src/flightlens/checks/motors.py +194 -0
  63. flightlens-1.1.0/src/flightlens/checks/power.py +265 -0
  64. flightlens-1.1.0/src/flightlens/checks/preflight.py +93 -0
  65. flightlens-1.1.0/src/flightlens/checks/spectrum.py +234 -0
  66. flightlens-1.1.0/src/flightlens/checks/tuning.py +211 -0
  67. flightlens-1.1.0/src/flightlens/checks/vibration.py +156 -0
  68. flightlens-1.1.0/src/flightlens/checks/wind.py +108 -0
  69. flightlens-1.1.0/src/flightlens/cli.py +957 -0
  70. flightlens-1.1.0/src/flightlens/demo.py +96 -0
  71. flightlens-1.1.0/src/flightlens/engine.py +306 -0
  72. flightlens-1.1.0/src/flightlens/fleet.py +175 -0
  73. flightlens-1.1.0/src/flightlens/htmlreport.py +263 -0
  74. flightlens-1.1.0/src/flightlens/intervals.py +44 -0
  75. flightlens-1.1.0/src/flightlens/lttb.py +54 -0
  76. flightlens-1.1.0/src/flightlens/metrics.py +241 -0
  77. flightlens-1.1.0/src/flightlens/model.py +228 -0
  78. flightlens-1.1.0/src/flightlens/ops.py +213 -0
  79. flightlens-1.1.0/src/flightlens/parsers/__init__.py +86 -0
  80. flightlens-1.1.0/src/flightlens/parsers/_mapping.py +83 -0
  81. flightlens-1.1.0/src/flightlens/parsers/ardupilot.py +838 -0
  82. flightlens-1.1.0/src/flightlens/parsers/dataflash.py +310 -0
  83. flightlens-1.1.0/src/flightlens/parsers/mappings/ardupilot.yaml +322 -0
  84. flightlens-1.1.0/src/flightlens/parsers/mappings/mavlink.yaml +170 -0
  85. flightlens-1.1.0/src/flightlens/parsers/mappings/px4.yaml +321 -0
  86. flightlens-1.1.0/src/flightlens/parsers/mavlink.py +422 -0
  87. flightlens-1.1.0/src/flightlens/parsers/tlog.py +559 -0
  88. flightlens-1.1.0/src/flightlens/parsers/ulog.py +657 -0
  89. flightlens-1.1.0/src/flightlens/profiles.py +292 -0
  90. flightlens-1.1.0/src/flightlens/provenance.py +70 -0
  91. flightlens-1.1.0/src/flightlens/py.typed +0 -0
  92. flightlens-1.1.0/src/flightlens/replay.py +384 -0
  93. flightlens-1.1.0/src/flightlens/retention.py +62 -0
  94. flightlens-1.1.0/src/flightlens/reviews.py +107 -0
  95. flightlens-1.1.0/src/flightlens/schema.py +193 -0
  96. flightlens-1.1.0/src/flightlens/sim/__init__.py +7 -0
  97. flightlens-1.1.0/src/flightlens/sim/benchmark.py +646 -0
  98. flightlens-1.1.0/src/flightlens/sim/dfwriter.py +78 -0
  99. flightlens-1.1.0/src/flightlens/sim/manoeuvre.py +128 -0
  100. flightlens-1.1.0/src/flightlens/sim/plane.py +114 -0
  101. flightlens-1.1.0/src/flightlens/sim/telemetry.py +303 -0
  102. flightlens-1.1.0/src/flightlens/spectrum.py +290 -0
  103. flightlens-1.1.0/src/flightlens/store.py +535 -0
  104. flightlens-1.1.0/src/flightlens/summary.py +153 -0
  105. flightlens-1.1.0/src/flightlens/templates/report.html.j2 +216 -0
  106. flightlens-1.1.0/src/flightlens/tuning.py +243 -0
  107. flightlens-1.1.0/src/flightlens/validate.py +354 -0
  108. flightlens-1.1.0/src/flightlens/worker.py +427 -0
  109. flightlens-1.1.0/testdata/expected/README.md +4 -0
  110. flightlens-1.1.0/testdata/logs/LICENSE.pyulog.md +28 -0
  111. flightlens-1.1.0/testdata/logs/README.md +1 -0
  112. flightlens-1.1.0/testdata/logs/SOURCES.md +11 -0
  113. flightlens-1.1.0/testdata/logs/px4-v1.13-sitl-tagged.ulg +0 -0
  114. flightlens-1.1.0/testdata/logs/px4-v1.6-sample-appended.ulg +0 -0
  115. flightlens-1.1.0/tests/__init__.py +0 -0
  116. flightlens-1.1.0/tests/conftest.py +52 -0
  117. flightlens-1.1.0/tests/fuzz_regressions/ulog-damaged-firmware-version.json +1455 -0
  118. flightlens-1.1.0/tests/fuzz_regressions/ulog-parameter-not-a-number.json +1447 -0
  119. flightlens-1.1.0/tests/fuzz_regressions/ulog-reader-loops-forever.json +787 -0
  120. flightlens-1.1.0/tests/fuzz_regressions/ulog-topic-without-timestamp.json +991 -0
  121. flightlens-1.1.0/tests/test_api.py +201 -0
  122. flightlens-1.1.0/tests/test_api_replay.py +96 -0
  123. flightlens-1.1.0/tests/test_ardupilot.py +300 -0
  124. flightlens-1.1.0/tests/test_checks_m2.py +228 -0
  125. flightlens-1.1.0/tests/test_cli.py +58 -0
  126. flightlens-1.1.0/tests/test_clipping_and_px4_vibration.py +79 -0
  127. flightlens-1.1.0/tests/test_data_safety.py +328 -0
  128. flightlens-1.1.0/tests/test_dataflash.py +175 -0
  129. flightlens-1.1.0/tests/test_demo.py +64 -0
  130. flightlens-1.1.0/tests/test_depth_checks.py +216 -0
  131. flightlens-1.1.0/tests/test_e2e_replay.py +210 -0
  132. flightlens-1.1.0/tests/test_engine.py +104 -0
  133. flightlens-1.1.0/tests/test_environment_checks.py +166 -0
  134. flightlens-1.1.0/tests/test_fixed_wing.py +144 -0
  135. flightlens-1.1.0/tests/test_fleet.py +140 -0
  136. flightlens-1.1.0/tests/test_fuzz.py +151 -0
  137. flightlens-1.1.0/tests/test_ground_rules.py +94 -0
  138. flightlens-1.1.0/tests/test_intervals.py +31 -0
  139. flightlens-1.1.0/tests/test_operations.py +255 -0
  140. flightlens-1.1.0/tests/test_parsers.py +48 -0
  141. flightlens-1.1.0/tests/test_profiles.py +325 -0
  142. flightlens-1.1.0/tests/test_real_logs.py +32 -0
  143. flightlens-1.1.0/tests/test_release.py +60 -0
  144. flightlens-1.1.0/tests/test_replay.py +250 -0
  145. flightlens-1.1.0/tests/test_reports_reviews.py +311 -0
  146. flightlens-1.1.0/tests/test_review_fixes.py +104 -0
  147. flightlens-1.1.0/tests/test_spectrum.py +164 -0
  148. flightlens-1.1.0/tests/test_tlog.py +252 -0
  149. flightlens-1.1.0/tests/test_ulog.py +115 -0
  150. flightlens-1.1.0/tests/test_validation.py +125 -0
  151. flightlens-1.1.0/tests/test_vibration.py +80 -0
  152. flightlens-1.1.0/uv.lock +1948 -0
  153. flightlens-1.1.0/web/index.html +17 -0
  154. flightlens-1.1.0/web/package-lock.json +2312 -0
  155. flightlens-1.1.0/web/package.json +31 -0
  156. flightlens-1.1.0/web/src/App.tsx +78 -0
  157. flightlens-1.1.0/web/src/api.ts +400 -0
  158. flightlens-1.1.0/web/src/components/Chart.tsx +298 -0
  159. flightlens-1.1.0/web/src/components/ReviewBox.tsx +102 -0
  160. flightlens-1.1.0/web/src/components/Severity.tsx +106 -0
  161. flightlens-1.1.0/web/src/components/Thresholds.tsx +160 -0
  162. flightlens-1.1.0/web/src/components/Timeline.tsx +129 -0
  163. flightlens-1.1.0/web/src/components/TrackView.tsx +141 -0
  164. flightlens-1.1.0/web/src/components/server.ts +30 -0
  165. flightlens-1.1.0/web/src/components/theme.ts +41 -0
  166. flightlens-1.1.0/web/src/format.ts +60 -0
  167. flightlens-1.1.0/web/src/main.tsx +13 -0
  168. flightlens-1.1.0/web/src/pages/Aircraft.tsx +355 -0
  169. flightlens-1.1.0/web/src/pages/Compare.tsx +423 -0
  170. flightlens-1.1.0/web/src/pages/EventsView.tsx +89 -0
  171. flightlens-1.1.0/web/src/pages/FlightPage.tsx +228 -0
  172. flightlens-1.1.0/web/src/pages/Library.tsx +354 -0
  173. flightlens-1.1.0/web/src/pages/Overview.tsx +303 -0
  174. flightlens-1.1.0/web/src/pages/QualityView.tsx +138 -0
  175. flightlens-1.1.0/web/src/pages/SignalsView.tsx +125 -0
  176. flightlens-1.1.0/web/src/pages/SpectrumView.tsx +382 -0
  177. flightlens-1.1.0/web/src/pages/TuningView.tsx +185 -0
  178. flightlens-1.1.0/web/src/replay/Hud.tsx +117 -0
  179. flightlens-1.1.0/web/src/replay/ReplayView.tsx +324 -0
  180. flightlens-1.1.0/web/src/replay/Scene3D.tsx +369 -0
  181. flightlens-1.1.0/web/src/replay/clock.ts +148 -0
  182. flightlens-1.1.0/web/src/replay/data.ts +232 -0
  183. flightlens-1.1.0/web/src/replay/replay.test.ts +155 -0
  184. flightlens-1.1.0/web/src/signals.ts +51 -0
  185. flightlens-1.1.0/web/src/styles.css +429 -0
  186. flightlens-1.1.0/web/tsconfig.json +18 -0
  187. flightlens-1.1.0/web/vite.config.ts +9 -0
@@ -0,0 +1,18 @@
1
+ .git
2
+ .venv
3
+ **/__pycache__
4
+ .pytest_cache
5
+ .mypy_cache
6
+ .ruff_cache
7
+ data
8
+ testdata/real
9
+ web/node_modules
10
+ web/dist
11
+ *.report.json
12
+ *.report.html
13
+ *.tsbuildinfo
14
+ private-logs
15
+ .github
16
+ tests
17
+ docs
18
+ testdata
@@ -0,0 +1,93 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [ubuntu-latest, windows-latest, macos-latest]
14
+ python: ["3.12", "3.13"]
15
+ runs-on: ${{ matrix.os }}
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v5
19
+ with:
20
+ python-version: ${{ matrix.python }}
21
+ - run: uv sync
22
+ - run: uv run ruff check .
23
+ - run: uv run ruff format --check .
24
+ - run: uv run mypy
25
+ - run: uv run pytest
26
+
27
+ web:
28
+ runs-on: ubuntu-latest
29
+ defaults:
30
+ run:
31
+ working-directory: web
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: 22
37
+ cache: npm
38
+ cache-dependency-path: web/package-lock.json
39
+ - run: npm ci
40
+ - run: npm test
41
+ - run: npm run build
42
+
43
+ e2e:
44
+ # The Replay tab in a real browser (tests/test_e2e_replay.py).
45
+ runs-on: ubuntu-latest
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+ - uses: actions/setup-node@v4
49
+ with:
50
+ node-version: 22
51
+ cache: npm
52
+ cache-dependency-path: web/package-lock.json
53
+ - run: cd web && npm ci && npm run build
54
+ - uses: astral-sh/setup-uv@v5
55
+ with:
56
+ python-version: "3.13"
57
+ - run: uv sync
58
+ - run: uv run playwright install --with-deps chromium
59
+ - run: uv run pytest tests/test_e2e_replay.py
60
+
61
+ audit:
62
+ # Known vulnerabilities in what FlightLens ships: the Python runtime
63
+ # dependencies and the packages bundled into the web UI. Dev-only tools
64
+ # (vite, esbuild) never reach users and are not gated here.
65
+ runs-on: ubuntu-latest
66
+ steps:
67
+ - uses: actions/checkout@v4
68
+ - uses: astral-sh/setup-uv@v5
69
+ - name: Python dependencies (pip-audit)
70
+ run: |
71
+ uv export --format requirements-txt --no-dev --no-emit-project --no-hashes > /tmp/requirements.txt
72
+ uvx pip-audit -r /tmp/requirements.txt --progress-spinner off
73
+ - uses: actions/setup-node@v4
74
+ with:
75
+ node-version: 22
76
+ cache: npm
77
+ cache-dependency-path: web/package-lock.json
78
+ - name: Web UI dependencies (npm audit)
79
+ working-directory: web
80
+ run: npm audit --omit=dev --audit-level=high
81
+
82
+ docker:
83
+ runs-on: ubuntu-latest
84
+ needs: [test, web]
85
+ steps:
86
+ - uses: actions/checkout@v4
87
+ - run: docker build -t flightlens:ci .
88
+ - name: Smoke test
89
+ run: |
90
+ docker run -d --name fl -p 8000:8000 flightlens:ci
91
+ for i in $(seq 1 30); do curl -sf localhost:8000/api/health && break; sleep 1; done
92
+ curl -sf localhost:8000/ | grep -q FlightLens
93
+ curl -sf -F file=@testdata/logs/px4-v1.13-sitl-tagged.ulg localhost:8000/api/logs
@@ -0,0 +1,48 @@
1
+ name: Docs
2
+
3
+ # Builds the documentation site on every change (strict: broken links fail) and
4
+ # publishes it to GitHub Pages from main. Enable Pages with "GitHub Actions" as
5
+ # the source in the repository settings once.
6
+
7
+ on:
8
+ push:
9
+ branches: [main]
10
+ pull_request:
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: astral-sh/setup-uv@v5
21
+ with:
22
+ python-version: "3.13"
23
+ - run: uv sync --group docs
24
+ - name: Check reference matches the code
25
+ run: |
26
+ uv run --group docs python scripts/gen_check_docs.py
27
+ git diff --exit-code docs/checks.md
28
+ - run: uv run --group docs mkdocs build --strict --site-dir site
29
+ env:
30
+ NO_MKDOCS_2_WARNING: "1"
31
+ - uses: actions/upload-pages-artifact@v3
32
+ if: github.ref == 'refs/heads/main'
33
+ with:
34
+ path: site
35
+
36
+ deploy:
37
+ if: github.ref == 'refs/heads/main'
38
+ needs: build
39
+ runs-on: ubuntu-latest
40
+ permissions:
41
+ pages: write
42
+ id-token: write
43
+ environment:
44
+ name: github-pages
45
+ url: ${{ steps.deployment.outputs.page_url }}
46
+ steps:
47
+ - id: deployment
48
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,44 @@
1
+ name: Fuzz
2
+
3
+ # A long campaign against both log parsers, weekly and on demand. Every pull
4
+ # request already runs the short Hypothesis version (tests/test_fuzz.py).
5
+ # Failing inputs are uploaded as an artifact; turn each into a regression case
6
+ # in tests/fuzz_regressions/ when fixing it.
7
+
8
+ on:
9
+ schedule:
10
+ - cron: "17 3 * * 1"
11
+ workflow_dispatch:
12
+ inputs:
13
+ iterations:
14
+ description: Mutants to try
15
+ default: "20000"
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ fuzz:
22
+ runs-on: ubuntu-latest
23
+ timeout-minutes: 90
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: astral-sh/setup-uv@v5
27
+ with:
28
+ python-version: "3.13"
29
+ - run: uv sync
30
+ - name: Hypothesis, many examples
31
+ env:
32
+ FLIGHTLENS_FUZZ: "1000"
33
+ run: uv run pytest tests/test_fuzz.py -q
34
+ - name: Mutation campaign
35
+ run: >
36
+ uv run python scripts/fuzz.py
37
+ --iterations "${{ github.event.inputs.iterations || '20000' }}"
38
+ --seed "${{ github.run_number }}"
39
+ --out fuzz-failures
40
+ - if: failure()
41
+ uses: actions/upload-artifact@v4
42
+ with:
43
+ name: fuzz-failures
44
+ path: fuzz-failures/
@@ -0,0 +1,144 @@
1
+ name: Release
2
+
3
+ # Push a tag like v1.1.0 (matching the version in pyproject.toml) to publish:
4
+ # - the wheel and sdist to PyPI (trusted publishing: no token stored here;
5
+ # configure the "pypi" environment and the publisher on pypi.org once),
6
+ # - a multi-arch Docker image (amd64, arm64) to ghcr.io/<owner>/flightlens,
7
+ # - a GitHub release with the CHANGELOG section and the built files.
8
+
9
+ on:
10
+ push:
11
+ tags: ["v*"]
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ check:
18
+ runs-on: ubuntu-latest
19
+ outputs:
20
+ version: ${{ steps.v.outputs.version }}
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: astral-sh/setup-uv@v5
24
+ with:
25
+ python-version: "3.13"
26
+ - id: v
27
+ name: Tag matches the package version
28
+ run: |
29
+ version=$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)
30
+ test "v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME != v$version"; exit 1; }
31
+ grep -q "^## \[$version\]" CHANGELOG.md || { echo "CHANGELOG.md has no [$version] section"; exit 1; }
32
+ echo "version=$version" >> "$GITHUB_OUTPUT"
33
+ - run: uv sync
34
+ - run: uv run ruff check . && uv run ruff format --check . && uv run mypy
35
+ - run: uv run pytest
36
+ - name: Validation benchmark
37
+ run: uv run python scripts/benchmark.py --out /tmp/validation.md
38
+
39
+ build:
40
+ needs: check
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: astral-sh/setup-uv@v5
45
+ with:
46
+ python-version: "3.13"
47
+ - uses: actions/setup-node@v4
48
+ with:
49
+ node-version: 22
50
+ cache: npm
51
+ cache-dependency-path: web/package-lock.json
52
+ - run: uv run python scripts/build_dist.py
53
+ - name: The wheel installs and runs on its own
54
+ run: |
55
+ uv venv /tmp/fl && uv pip install --python /tmp/fl/bin/python dist/*.whl
56
+ cd /tmp && /tmp/fl/bin/flightlens version
57
+ /tmp/fl/bin/flightlens demo --data /tmp/demo --seed-only
58
+ - name: SBOM (CycloneDX) of the installed wheel and the bundled web UI
59
+ # kept out of dist/: everything in dist/ is uploaded to PyPI
60
+ run: |
61
+ mkdir sbom
62
+ uvx --from cyclonedx-bom cyclonedx-py environment /tmp/fl/bin/python \
63
+ --of JSON -o "sbom/flightlens-${GITHUB_REF_NAME}-python.cdx.json"
64
+ (cd web && npm ci && npm sbom --sbom-format cyclonedx --omit dev) \
65
+ > "sbom/flightlens-${GITHUB_REF_NAME}-web.cdx.json"
66
+ - uses: actions/upload-artifact@v4
67
+ with:
68
+ name: dist
69
+ path: dist/
70
+ - uses: actions/upload-artifact@v4
71
+ with:
72
+ name: sbom
73
+ path: sbom/
74
+
75
+ pypi:
76
+ needs: build
77
+ runs-on: ubuntu-latest
78
+ environment: pypi
79
+ permissions:
80
+ id-token: write
81
+ steps:
82
+ - uses: actions/download-artifact@v4
83
+ with:
84
+ name: dist
85
+ path: dist/
86
+ - uses: pypa/gh-action-pypi-publish@release/v1
87
+
88
+ image:
89
+ needs: check
90
+ runs-on: ubuntu-latest
91
+ permissions:
92
+ contents: read
93
+ packages: write
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - uses: docker/setup-qemu-action@v3
97
+ - uses: docker/setup-buildx-action@v3
98
+ - uses: docker/login-action@v3
99
+ with:
100
+ registry: ghcr.io
101
+ username: ${{ github.actor }}
102
+ password: ${{ secrets.GITHUB_TOKEN }}
103
+ - id: meta
104
+ uses: docker/metadata-action@v5
105
+ with:
106
+ images: ghcr.io/${{ github.repository_owner }}/flightlens
107
+ tags: |
108
+ type=semver,pattern={{version}}
109
+ type=semver,pattern={{major}}.{{minor}}
110
+ type=raw,value=latest
111
+ - uses: docker/build-push-action@v6
112
+ with:
113
+ context: .
114
+ platforms: linux/amd64,linux/arm64
115
+ push: true
116
+ tags: ${{ steps.meta.outputs.tags }}
117
+ labels: ${{ steps.meta.outputs.labels }}
118
+ cache-from: type=gha
119
+ cache-to: type=gha,mode=max
120
+
121
+ github-release:
122
+ needs: [check, build, pypi, image]
123
+ runs-on: ubuntu-latest
124
+ permissions:
125
+ contents: write
126
+ steps:
127
+ - uses: actions/checkout@v4
128
+ - uses: actions/download-artifact@v4
129
+ with:
130
+ name: dist
131
+ path: dist/
132
+ - uses: actions/download-artifact@v4
133
+ with:
134
+ name: sbom
135
+ path: sbom/
136
+ - name: Release notes from CHANGELOG.md
137
+ run: |
138
+ awk -v v="${{ needs.check.outputs.version }}" '
139
+ $0 ~ "^## \\[" v "\\]" {on=1; next}
140
+ on && /^## \[/ {exit}
141
+ on {print}' CHANGELOG.md > notes.md
142
+ - env:
143
+ GH_TOKEN: ${{ github.token }}
144
+ run: gh release create "$GITHUB_REF_NAME" dist/* sbom/* --title "FlightLens $GITHUB_REF_NAME" --notes-file notes.md
@@ -0,0 +1,40 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+
11
+ # reports produced while developing
12
+ *.report.html
13
+ *.report.json
14
+
15
+ # private logs never go in the repo
16
+ private-logs/
17
+
18
+ node_modules/
19
+ .DS_Store
20
+
21
+ # downloaded public logs for local testing
22
+ testdata/real/
23
+
24
+ # local data folder (flightlens serve)
25
+ data/
26
+ web/dist/
27
+ *.tsbuildinfo
28
+
29
+ # generated benchmark and SITL campaign logs (regenerate, never commit)
30
+ sitl-logs/
31
+ testdata/sitl/
32
+ bench-logs/
33
+
34
+ # web UI bundled into the wheel by scripts/build_dist.py
35
+ src/flightlens/web/
36
+ flightlens-demo/
37
+
38
+ # docs site build output
39
+ site/
40
+ fuzz-failures/
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,188 @@
1
+ # Changelog
2
+
3
+ All notable changes to FlightLens. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [Semantic Versioning](https://semver.org/). A check's own version (shown by
6
+ `flightlens checks` and stored in every report) changes whenever its logic or
7
+ thresholds do.
8
+
9
+ ## [1.1.0] - 2026-11-24
10
+
11
+ The first public release. FlightLens reads PX4 `.ulg`, ArduPilot `.bin` and
12
+ MAVLink `.tlog` logs and gives a health verdict, ranked findings and the
13
+ evidence behind them, from the command line, a local web app or Docker, and
14
+ replays every flight in 3D with flight instruments and synced charts.
15
+ 25 checks, validated on real public logs and a 54-log fault benchmark;
16
+ per-aircraft trends and threshold profiles; printable reports; engineer
17
+ review; backup and restore; metrics and logs for running it as a service.
18
+ (1.0.0 was prepared but never published; its changes are part of this release.)
19
+
20
+ ### Added
21
+ - **Replay** (`docs/replay.md`): a Replay tab on every
22
+ flight. A 3D aircraft flies the logged path with the logged attitude, with
23
+ flight instruments, a map, synced charts (follow mode) and the timeline on
24
+ one clock; chase, orbit, top and cockpit cameras; play, speed (0.25x-16x),
25
+ loop a range (shift-drag), keyboard control; "Replay from here" on every
26
+ finding and event; `?t=` links. Works for PX4, ArduPilot and telemetry
27
+ logs, offline; three.js loads only when the tab is opened. A browser
28
+ without WebGL gets an explanation in the 3D panel; the rest still works.
29
+ - The replay is built with every analysis (`replay.parquet`, `replay.json`):
30
+ slerp-interpolated attitude, never interpolated across gaps over 1 s;
31
+ served as `/api/flights/{id}/replay` and `/replay.bin` (about 3 MB per hour
32
+ of flight). Flights analyzed before 1.1 show as outdated.
33
+ - PX4 logs carry the attitude quaternion (`att.q0`-`q3`; mapping
34
+ `px4-2026.11.6`).
35
+ - `flightlens replay-info <log>`; a scripted known-manoeuvre flight
36
+ (`flightlens.sim.manoeuvre`, demo flight `quad-12-manoeuvres.bin`) against
37
+ which the replay is checked: exact for onboard logs, within 0.2° and 0.17 m
38
+ for telemetry logs (see `docs/validation.md`).
39
+ - Browser tests of the Replay tab (Playwright) and web unit tests (vitest),
40
+ both in CI.
41
+ - **ESC, barometer and wind checks** (`esc.health`, `baro.health`,
42
+ `wind.speed`) with new signals `esc.N.rpm/temp/curr`, `baro.alt`,
43
+ `baro.alt2`, `wind.n/e` and `airspeed` (mappings `px4-2026.11.5`,
44
+ `ardupilot-2026.11.5`). The barometer is judged by its drift between takeoff
45
+ and landing against GPS *at rest*, never against GPS in flight: on real
46
+ crashes GPS altitude lagged by 24 m while the barometer was right. Wind
47
+ leaves impacts out (the estimator read 13.5 m/s for 0.7 s at a real crash).
48
+ Calibrated on 20 real ArduPilot and 28 public PX4 logs: no Problem on any
49
+ of them. 8 benchmark scenarios (54 logs).
50
+ - **Operations**: `/api/health` reports the database, job workers and disk
51
+ (503 when down); Prometheus metrics at `/metrics`; request and analysis logs,
52
+ as text or JSON (`--log-format json`), with an `X-Request-ID` on every
53
+ response; `--workers N` parallel analysis; uploads refused with 503 when the
54
+ queue is full and 507 when the disk is nearly full; graceful shutdown that
55
+ lets running analyses finish and resumes unfinished ones at the next start
56
+ (database schema 5: job attempts). Opening a library from the CLI no longer
57
+ fails the jobs of a server that is running on it.
58
+ - **Data safety**: the database schema is versioned (`PRAGMA user_version`)
59
+ with ordered, transactional migrations; an upgrade keeps a copy of the old
60
+ database and a newer library is refused. `flightlens backup` (consistent
61
+ while the server runs) and `flightlens restore` (into a new folder only,
62
+ SHA-256 checked, path-safe); `flightlens prune` for retention (lists first,
63
+ keeps reviewed flights, deletes only with `--yes`).
64
+ - **MAVLink telemetry logs (`.tlog`)** from ArduPilot and PX4, as Mission
65
+ Planner and QGroundControl record them: an own MAVLink v1/v2 decoder
66
+ (signed frames, CRC-checked, damaged bytes skipped; definitions tested
67
+ against pymavlink), vehicle selection among the senders, a versioned
68
+ signal mapping (`mavlink.yaml`), arming, modes, landed state, motors,
69
+ parameters and status texts; radio packet loss is reported. A telemetry
70
+ generator in the simulator puts 5 tlog scenarios in the benchmark (46 logs)
71
+ and one in the demo.
72
+ - **Rate-loop tuning** (`control.tuning`): the roll and pitch rate controllers'
73
+ step response, estimated from normal flying by regularised deconvolution
74
+ (as PID-Analyzer and PX4 Flight Review do), with overshoot, falls-short,
75
+ does-not-follow and sluggish findings. Judged only when at least 20 windows
76
+ with a coherence of 0.6 support it; checked against simulated loops of known
77
+ damping (peaks within 0.15). A "Tuning" tab plots the response per axis.
78
+ ArduPlane rate data now comes from `PIDR/PIDP/PIDY`.
79
+ - **Autopilot power** (`power.supply`), **battery reserve at landing**
80
+ (`battery.reserve`, ignoring estimates that follow voltage sag), **compass
81
+ interference** (`compass.interference`), **estimator lane switches**
82
+ (`estimator.lanes`) and **RC link** (`rc.link`, PX4).
83
+ - The fault benchmark grows to 41 logs (tuning, brown-out, battery reserve,
84
+ compass and lane-switch faults, each with a healthy case near the limit).
85
+ - **Printable reports**: a self-contained HTML report per flight (evidence
86
+ charts, provenance, reviews; print to PDF), from the "Report" link or
87
+ `flightlens analyze --html`.
88
+ - **Outdated-analysis detection**: flights analyzed by an older check or signal
89
+ mapping are marked with the reason, and can be re-analyzed in one click
90
+ (library) or one by one (flight page).
91
+ - **Engineer review**: mark findings confirmed, false alarm or accepted with a
92
+ note; reviews never change the verdict, appear in reports, and export as a
93
+ `flightlens validate` manifest (`flightlens reviews export`).
94
+ - **Threshold profiles**: per-aircraft threshold overrides, hand-written (YAML,
95
+ API) or learned from the aircraft's own flights without a Problem
96
+ (vibration, motor balance and battery attention levels; clamped, problem
97
+ levels never learned). Assigned on the Aircraft page, which re-analyzes the
98
+ aircraft's flights; `--profile` on `analyze`, `batch` and `validate`;
99
+ `flightlens profile learn` and `profile show`. Reports record the profile's
100
+ name, source and digest.
101
+ - **Flight comparison**: two flights overlaid on their common signals, aligned
102
+ at takeoff, with health-metric changes and a findings diff (new, gone, both).
103
+ Opened from the library (select two), an aircraft's flight list, or a flight.
104
+ - **ArduPilot `.bin` logs**: an independent DataFlash reader (no pymavlink) and a
105
+ versioned signal mapping, with the same checks and report as PX4. A 100 MB log
106
+ loads in about 3 s.
107
+ - **Fixed-wing support and crash diagnosis**: airborne time from `STAT.isFlying`;
108
+ new checks for crash or hard landing (with earlier findings of the same flight
109
+ linked as likely causes), takeoff that never left the ground, refused arming
110
+ (with the reasons), attitude beyond the configured limit, control surface at
111
+ full travel, and out-of-trim.
112
+ - **Gyro noise spectrum and notch-filter advice** (`vibration.spectrum`): Welch
113
+ spectrum from raw gyro (PX4 `sensor_gyro_fifo` / `sensor_combined`, ArduPilot
114
+ batch sampler or `GYR`), motor noise told apart from frame resonance by its
115
+ response to throttle, and concrete `INS_HNTCH_*` / `IMU_GYRO_*` values. A
116
+ "Noise spectrum" tab with the spectrum and a spectrogram.
117
+ - **Validation**: `flightlens validate` scores FlightLens against labelled logs
118
+ (per-check recall, precision, false alarms, timing); a 27-log generated fault
119
+ benchmark runs in CI (`docs/validation.md`);
120
+ `scripts/sitl_campaign.py` records ArduPilot SITL fault flights.
121
+ - **`flightlens demo`**: generated example flights, one known fault each, opened
122
+ in the web app; `--read-only` (also on `serve`) refuses uploads, edits and
123
+ deletes for a public demo.
124
+ - **Aircraft and health over time**: flights are grouped into aircraft by the
125
+ autopilot board serial (PX4 `sys_uuid`, ArduPilot board UID) or a user-given
126
+ name, which new flights from the same board inherit. Each flight stores trend
127
+ metrics (vibration, battery internal resistance, lowest cell voltage, motor
128
+ output and imbalance, estimator innovations, gyro noise, trim, score), and the
129
+ Aircraft page flags drift against the aircraft's own history ("maintenance
130
+ due") with small-multiple trend charts.
131
+ - Time in the air and sorties in the summary; "never armed" instead of a
132
+ misleading duration.
133
+ - The wheel bundles the web UI, so `pip install flightlens` then
134
+ `flightlens serve` needs no Node; release workflow for PyPI, a multi-arch GHCR
135
+ image and GitHub releases; documentation site.
136
+
137
+ ### Changed
138
+ - Checks judge only time in the air (armed, not landed, and the altitude really
139
+ changed); short impacts are reported by the crash check, not as vibration,
140
+ clipping or battery sag.
141
+ - Yaw is never tracked on fixed wing, and an axis whose setpoint never changes is
142
+ skipped.
143
+ - The evidence chart opens zoomed on the finding, with one chart per unit.
144
+ - Flight modes in the summary include a mode selected before arming.
145
+ - The board name is read from ArduPilot banners that write the UID in groups
146
+ (`CUAVv5-bdshot 00270035 3156500F 20333543`); it was missing before.
147
+ - `flightlens serve` in a source checkout prefers `web/dist` over a bundled copy.
148
+
149
+ ### Fixed
150
+ - From 71 real Mission Planner telemetry logs: a ground run-up whose noisy
151
+ barometric altitude crossed 1 m counted as a flight (the climb is now
152
+ measured after a running median); a flight that never left the ground could
153
+ be called healthy (*healthy* now needs 10 s in the air); GPS findings came
154
+ from time on the ground (GPS is now judged in the air); Betaflight's
155
+ `Arming disabled:` reasons are recognised.
156
+ - Damaged or hostile logs can no longer hang or crash the parsers (found by
157
+ fuzzing): a PX4 log that sent the ULog reader (pyulog 1.3.0) into an endless
158
+ loop is now refused with a clear error; ULog topics without a timestamp,
159
+ non-numeric parameters and damaged version/time fields are reported as data
160
+ quality issues instead of crashing; DataFlash message types whose FMT
161
+ definition is damaged (wrong column types, no timestamp) are skipped.
162
+
163
+ ### Security
164
+ - Restore refuses crafted backups: archive names with backslashes (a path
165
+ escape on Windows), invalid flight ids in the manifest or database, database
166
+ triggers or views, and backups larger than the free disk space.
167
+ - Every response carries `X-Content-Type-Options`, `Referrer-Policy` and
168
+ `X-Frame-Options`; the web UI has a Content-Security-Policy (inline scripts
169
+ allowed only by hash). `serve` warns when it listens beyond this computer.
170
+ - Uploads are refused (queue full, low disk) before their body is read.
171
+ - react-router 7.18.6 (moderate advisories in 6.x).
172
+ - Parsers are fuzzed in CI (Hypothesis, `tests/test_fuzz.py`) and weekly with a
173
+ long mutation campaign (`scripts/fuzz.py`).
174
+ - CI audits the Python runtime dependencies (pip-audit) and the web UI's bundled
175
+ packages (npm audit); releases attach CycloneDX SBOMs for both.
176
+ - `react-router-dom` 6.28.0 → 6.30.6 (high-severity open-redirect advisories);
177
+ `vite` 5.4.11 → 5.4.21 (development server only).
178
+ - False "poor yaw tracking" and single-spike "vibration" Problems on ArduPlane
179
+ logs (13 of 15 real logs were affected).
180
+
181
+ ## [0.1.0] - 2026-11-10
182
+
183
+ ### Added
184
+ - PX4 `.ulg` parser with a versioned signal mapping, 10 checks with a verdict and
185
+ a 0–100 health score, calibrated on 28 public PX4 logs.
186
+ - CLI (`analyze`, `batch`, `signals`, `checks`, `serve`) with exit codes for CI.
187
+ - FastAPI backend with an isolated analysis worker, SQLite and Parquet storage;
188
+ React web app; Docker image.
@@ -0,0 +1,57 @@
1
+ # Contributing
2
+
3
+ Thanks for helping make FlightLens better. Bug reports with a log that shows
4
+ the problem are the most useful contribution of all.
5
+
6
+ ## Set up
7
+
8
+ You need Python 3.12+, [uv](https://docs.astral.sh/uv/) and Node 20+.
9
+
10
+ ```bash
11
+ uv sync # Python and dev tools
12
+ cd web && npm ci && npm run build # the web UI
13
+ uv run flightlens demo # example flights at http://localhost:8000
14
+ ```
15
+
16
+ ## Before you open a pull request
17
+
18
+ ```bash
19
+ uv run ruff check . && uv run ruff format --check . && uv run mypy
20
+ uv run pytest
21
+ cd web && npm run build
22
+ ```
23
+
24
+ CI runs the same on Linux, Windows and macOS, plus the fault benchmark, a
25
+ dependency audit and a Docker build.
26
+
27
+ ## Adding or changing a check
28
+
29
+ Read [docs/writing-a-check.md](docs/writing-a-check.md). In short:
30
+
31
+ - A check without the data it needs reports **not evaluated**, never OK.
32
+ - Bump the check's `version` whenever its logic or defaults change; reports
33
+ record it, and older analyses are then marked outdated.
34
+ - Set thresholds from real logs where possible and say where they came from in
35
+ the module docstring. Add a benchmark scenario in
36
+ `src/flightlens/sim/benchmark.py` with the fault and, if it has a limit, a
37
+ healthy flight just below it.
38
+ - Run `uv run python scripts/gen_check_docs.py` and
39
+ `uv run python scripts/benchmark.py` to refresh the generated docs.
40
+
41
+ ## Mappings
42
+
43
+ Firmware-specific names live only in
44
+ `src/flightlens/parsers/mappings/*.yaml`. Bump a mapping's `version` whenever
45
+ you change it.
46
+
47
+ ## Logs
48
+
49
+ **Never commit private or company flight logs**, nor details that identify an
50
+ aircraft or operator. Use the generated flights (`flightlens.sim`), the public
51
+ sample logs in `testdata/logs/`, or public PX4 Flight Review logs
52
+ (`scripts/fetch_px4_logs.py`, gitignored). Your own labelled logs belong in
53
+ `private-logs/`, which is gitignored.
54
+
55
+ ## Reporting security problems
56
+
57
+ See [SECURITY.md](SECURITY.md).
@@ -0,0 +1,40 @@
1
+ # FlightLens: one container with the web UI, API and analysis engine.
2
+ # docker compose up -d --build → http://localhost:8000
3
+
4
+ # --- 1. Build the web UI -------------------------------------------------------
5
+ FROM node:22-alpine AS web
6
+ WORKDIR /web
7
+ COPY web/package.json web/package-lock.json ./
8
+ RUN npm ci --no-audit --no-fund
9
+ COPY web/ ./
10
+ RUN npm run build
11
+
12
+ # --- 2. Python runtime -----------------------------------------------------------
13
+ FROM python:3.13-slim
14
+ ENV PYTHONDONTWRITEBYTECODE=1 \
15
+ PYTHONUNBUFFERED=1 \
16
+ UV_COMPILE_BYTECODE=1 \
17
+ UV_LINK_MODE=copy
18
+ COPY --from=ghcr.io/astral-sh/uv:0.10.12 /uv /usr/local/bin/uv
19
+ WORKDIR /app
20
+
21
+ # Dependencies first, so code changes don't reinstall them.
22
+ COPY pyproject.toml uv.lock README.md ./
23
+ RUN uv sync --frozen --no-dev --no-install-project
24
+ COPY src ./src
25
+ RUN uv sync --frozen --no-dev
26
+ COPY --from=web /web/dist ./web/dist
27
+
28
+ # Run as an unprivileged user; flights live in the /data volume.
29
+ RUN useradd --system --uid 10001 --no-create-home flightlens \
30
+ && mkdir /data && chown flightlens /data
31
+ USER flightlens
32
+ ENV FLIGHTLENS_DATA=/data \
33
+ FLIGHTLENS_WEB=/app/web/dist \
34
+ FLIGHTLENS_LOG_FORMAT=json \
35
+ PATH="/app/.venv/bin:$PATH"
36
+ VOLUME ["/data"]
37
+ EXPOSE 8000
38
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
39
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health', timeout=3)" || exit 1
40
+ CMD ["flightlens", "serve", "--host", "0.0.0.0", "--port", "8000"]