Skip to content

feat(cloud): opt-in raw uploads with per-shot IWR6843 L3 dumps - #287

Merged
jewbetcha merged 3 commits into
mainfrom
feat/cloud-raw-uploads
Sep 29, 2026
Merged

jewbetcha merged 3 commits into
mainfrom
feat/cloud-raw-uploads

Conversation

@jewbetcha

Copy link
Copy Markdown
Member

What does this PR do?

Adds an opt-in raw upload mode to the cloud uploader, so testers can send raw radar data and IWR6843 L3 dumps to FlightWeb.

  • openflight-cloud raw on|off sets upload_raw in cloud.json. It is off by default, and filtered uploads are unchanged for everyone else.
  • In raw mode, sessions upload with every entry type except kld7_buffer (deprecated hardware, about 860 KB per line). The per-line guard rises from 32 KB to 1 MB, and the manifest carries "raw": true.
  • Each iwr6843_capture entry already names the shot's dump file and shot_number. After a session uploads, each dump is sent to PUT /v1/sessions/{id}/captures/iwr6843/{shot_number}, and FlightWeb matches it to the shot by that number.
  • The dump queue lives in the session's .pushed marker, so large session files aren't re-read on every timer tick.
  • The server now saves IWR6843 dumps whenever raw uploads are enabled, not only under --debug.
  • status shows raw mode and the number of queued dumps. push --dry-run lists the dumps and their total size.

The server side is jewbetcha/flightweb#1.

Why was this required?

We need raw radar data (OPS243 rolling buffers and IWR6843 L3 dumps) from real sessions to test and tune the radar pipelines. Today the uploader strips all of it, and L3 dumps never leave the Pi. The dumps are only useful when paired with each shot's measured data, so they have to be matched to their shot_detected entries. Keeping it opt-in preserves the "raw radar data never leaves your Pi" default for everyone else.

Automated tests

New tests/test_cloud_raw_uploads.py (16 tests) covers:

  • filtered mode unchanged; raw mode keeps raw radar entries but drops kld7_buffer; the 1 MB line guard
  • matching dumps to shot numbers, including relative capture paths
  • push uploading the session and then its dumps; filtered config never sending dumps
  • a failed dump staying queued and succeeding on the next push; rejected or missing dumps parked; 401 stopping uploads
  • dry-run and status output
  • client URL, headers and status-code mapping
  • config round-trip and the raw on/off CLI

Full suite: 1628 passed, 10 skipped. Ruff is clean, and pylint has no new warning types.

Manual (human) testing

  • Ran the raw filter over real session logs. A 223 MB trackman session comes to 7.4 MB inflated and 2.3 MB gzipped, well under the 20 MB and 64 MB caps. A 117 MB session comes to 1.2 MB gzipped.
  • Ran push --dry-run and status with raw on against a real IWR session (7 shots). Dry-run listed rolling_buffer_capture, iwr6843_capture and the other raw entries, and found all 7 dump references. The dumps showed as not on disk because the paths point at the Pi.
  • Not yet run on a Pi against the deployed server. That will follow once flightweb#1 ships.

Checklist

  • Single feature/fix — this PR is scoped to one thing with a clear story above
  • Automated tests included — new or updated tests cover this change
  • Manual testing described — I documented what I verified by hand above
  • Python tests pass (uv run pytest tests/ -v)
  • Pylint passes (uv run pylint src/openflight/ --fail-under=9)
  • Ruff passes (uv run ruff check src/openflight/)
  • UI builds (cd ui && npm run build) (no UI changes)
  • UI lint passes (cd ui && npm run lint) (no UI changes)
  • Updated docs or CHANGELOG if needed
  • No unrelated changes mixed in

🤖 Generated with Claude Code

`openflight-cloud raw on` (off by default) uploads sessions unfiltered
(minus kld7_buffer), saves IWR6843 dumps even without --debug, and PUTs
each shot's dump to /v1/sessions/{id}/captures/iwr6843/{shot_number}
after the session uploads, matched by shot_number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 14:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Raw-mode configuration, queue durability, and dry-run behavior have unresolved correctness and privacy issues.

Review effort: Balanced
Findings: 1 High severity · 5 Medium severity · 1 Low severity

Open (7)
What changed in this PR

Adds opt-in raw cloud uploads, including IWR6843 L3 dump collection and per-shot upload support.

Changes:

  • Adds raw-mode configuration, CLI controls, filtering, and upload APIs.
  • Persists and retries per-shot capture queues.
  • Adds documentation and comprehensive tests.
File Description
tests/​test_cloud_raw_uploads.py Tests raw filtering, uploads, retries, CLI, and status.
src/​openflight/​server.py Enables IWR6843 dump saving in raw mode.
src/​openflight/​cloud/​spool.py Persists capture queues in pushed markers.
src/​openflight/​cloud/​filtering.py Adds raw-mode filtering and capture discovery.
src/​openflight/​cloud/​config.py Adds the upload_raw setting.
src/​openflight/​cloud/​commands.py Orchestrates capture uploads and reporting.
src/​openflight/​cloud/​client.py Adds the binary capture upload endpoint.
src/​openflight/​cloud/​cli.py Adds raw on|off.
docs/​using/​cloud-sync.md Documents raw upload usage.
docs/​reference/​cloud-uploader-spec.md Defines the raw upload wire contract.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/openflight/cloud/config.py Outdated
Comment thread src/openflight/cloud/cli.py Outdated
session_id,
capture.get("kind", filtering.IWR6843_CAPTURE_KIND),
capture["shot_number"],
capture_path.read_bytes(),
Comment on lines +237 to +240
has_captures = config.upload_raw and any(
spool.pending_captures(p) for p in spool.session_files(log_dir) if spool.is_pushed(p)
)
if not pending and not (has_captures and not dry_run):
Comment on lines +213 to +215
marker["captures_pending"] = pending
marker["captures_parked"] = list(marker.get("captures_parked") or []) + newly_parked
_write_json(_sidecar(path, PUSHED_SUFFIX), marker)
Comment thread src/openflight/server.py
try:
from .cloud.config import load_config

config = load_config()
Comment on lines +193 to +195
## 4b. Opt-in raw uploads (radar testing)

A device whose owner runs `openflight-cloud raw on` (config `"upload_raw": true`)
jewbetcha and others added 2 commits September 29, 2026 07:47
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jewbetcha
jewbetcha merged commit ea02313 into main Sep 29, 2026
14 checks passed
@jewbetcha
jewbetcha deleted the feat/cloud-raw-uploads branch September 29, 2026 14:51
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