mirror of
https://github.com/azaion/autopilot.git
synced 2026-06-21 15:51:10 +00:00
[AZ-659] [AZ-660] [AZ-661] Archive batch 18; update state and cumulative review
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Batch 18 — Cycle 1 Implementation Report
|
||||
|
||||
**Tasks**: AZ-659, AZ-660, AZ-661
|
||||
**Completed**: 2026-05-20
|
||||
**Status**: All tests pass; code review PASS_WITH_WARNINGS; committed `0854d3b`
|
||||
|
||||
---
|
||||
|
||||
## AZ-659 — frame_ingest publisher (3 pts)
|
||||
|
||||
**Files added/changed**:
|
||||
- `crates/frame_ingest/src/internal/publisher.rs` — `FramePublisher`, `FrameReceiver`, `ConsumerId`, `PublisherStats`
|
||||
- `crates/frame_ingest/src/internal/mod.rs` — exports `publisher`
|
||||
- `crates/frame_ingest/src/lib.rs` — `FrameIngestHandle` extended with `subscribe_as`, `publisher`, `dropped_frames`, `publishes_total`
|
||||
- `crates/frame_ingest/tests/publisher.rs` — AC-1/2/3 integration tests
|
||||
|
||||
**ACs**: All passing.
|
||||
|
||||
---
|
||||
|
||||
## AZ-660 — detection_client gRPC bi-directional stream (5 pts)
|
||||
|
||||
**Files added/changed**:
|
||||
- `crates/detection_client/Cargo.toml` — added `tonic`, `prost`, `tonic-prost-build`, `protoc-bin-vendored`
|
||||
- `crates/detection_client/build.rs` — proto codegen via `tonic-prost-build`
|
||||
- `crates/detection_client/proto/detections.proto` — gRPC contract (FrameRequest / DetectionResponse bi-di stream)
|
||||
- `crates/detection_client/src/internal/mod.rs` — module registry
|
||||
- `crates/detection_client/src/internal/proto.rs` — generated code re-export
|
||||
- `crates/detection_client/src/internal/budget.rs` — `BudgetTracker` (drop-oldest VecDeque, default capacity 2)
|
||||
- `crates/detection_client/src/internal/stats.rs` — `DetectionStats` (lock-free AtomicU64 counters)
|
||||
- `crates/detection_client/src/internal/runtime.rs` — supervisor + `run_stream_session` with bounded backoff reconnect
|
||||
- `crates/detection_client/src/lib.rs` — `DetectionClient`, `DetectionClientConfig`, `DetectionClientHandle`, `DetectionEvent`, `ConnectionState`
|
||||
- `crates/detection_client/tests/stream.rs` — AC-1/2/3/4 integration tests (fixture in-process gRPC server)
|
||||
|
||||
**ACs**: All passing.
|
||||
|
||||
---
|
||||
|
||||
## AZ-661 — schema validation + model_version + latency degradation (2 pts)
|
||||
|
||||
Implemented inside the same `detection_client` crates (AC-660 and AC-661 share the same modules):
|
||||
- `src/internal/latency.rs` — `LatencyWindow` ring-buffer + `DegradationTransition` latch
|
||||
- `src/internal/runtime.rs::handle_response` — schema version check, model_version latch, Tier1 degradation evaluation after every response
|
||||
- `crates/detection_client/tests/stream.rs` — AC-1/2/3 integration tests
|
||||
|
||||
**ACs**: All passing.
|
||||
|
||||
---
|
||||
|
||||
## Code Review
|
||||
|
||||
**Verdict**: PASS_WITH_WARNINGS — see `_docs/03_implementation/reviews/batch_18_review.md`.
|
||||
|
||||
Findings:
|
||||
- F1 (Medium, fixed): dead code in `handle_response` (`let now`, `let _ = in_flight`) removed.
|
||||
- F2–F4: Low findings, no action required this batch.
|
||||
|
||||
---
|
||||
|
||||
## Architecture / Doc Updates
|
||||
|
||||
- `_docs/02_document/module-layout.md` — `frame_ingest` and `detection_client` sections updated to reflect actual streaming API.
|
||||
|
||||
---
|
||||
|
||||
## Remaining tasks in `todo/`
|
||||
|
||||
9 tasks remaining across 3 components (movement_detector, semantic_analyzer, scan_controller).
|
||||
@@ -0,0 +1,85 @@
|
||||
# Cumulative Code Review — Batches 16-18 (Cycle 1)
|
||||
|
||||
**Scope**: AZ-658, AZ-680, AZ-681, AZ-659, AZ-660, AZ-661
|
||||
**Date**: 2026-05-20
|
||||
**Overall Verdict**: PASS_WITH_WARNINGS
|
||||
|
||||
---
|
||||
|
||||
## Scope Summary
|
||||
|
||||
| Batch | Tasks | Components |
|
||||
|-------|-------|-----------|
|
||||
| 16 | AZ-658 frame_ingest decoder | frame_ingest |
|
||||
| 17 | AZ-680 operator_bridge command dispatch; AZ-681 safety+BIT ack | shared, scan_controller, mission_executor, operator_bridge |
|
||||
| 18 | AZ-659 frame_ingest publisher; AZ-660 detection_client gRPC stream; AZ-661 schema+health | frame_ingest, detection_client |
|
||||
|
||||
---
|
||||
|
||||
## Cross-Batch Architecture Consistency
|
||||
|
||||
### Layer compliance (all batches)
|
||||
|
||||
No layer violations found across batches 16-18. Every crate imports only `shared` (Layer 1) for cross-component types. Cross-component dispatch uses traits in `shared::contracts`. The `detection_client` receives a `broadcast::Receiver<Frame>` injected by the composition root — it does not import `frame_ingest`.
|
||||
|
||||
### Pattern consistency
|
||||
|
||||
| Pattern | Batches 16-18 usage |
|
||||
|---------|---------------------|
|
||||
| Async actor model | All components expose `run()` → `JoinHandle` + `Handle`. ✓ |
|
||||
| `shared::models` for data | `Frame`, `DetectionBatch`, `BoundingBox`, `Detection` all come from `shared`. ✓ |
|
||||
| `shared::contracts` for cross-cutting dispatch | `ScanCommandRouter`, `MissionSafetyRouter`, `BitReportSeverityLookup` added in batch 17; `detection_client` and `frame_ingest` do not need new traits. ✓ |
|
||||
| Lock-free counters | `AtomicU64` used uniformly across `detection_client::DetectionStats`, `frame_ingest::PublisherStats`. ✓ |
|
||||
| Broadcast channels for fan-out | Batch 18 adds `FramePublisher` (wrapping `tokio::sync::broadcast`) for the frame pipeline; consistent with the existing telemetry broadcast pattern. ✓ |
|
||||
|
||||
### Interface wiring readiness
|
||||
|
||||
The composition root (`crates/autopilot/src/runtime.rs`) still needs to wire:
|
||||
- `frame_ingest.handle().subscribe_as(ConsumerId::DetectionClient)` → raw receiver forwarded to `DetectionClient::run(frame_rx)`
|
||||
- `detection_client_handle.subscribe_events()` → event receiver forwarded to `scan_controller` and `telemetry_stream`
|
||||
|
||||
Neither wiring is in scope for batches 16-18 — they belong to the final runtime composition task. No interface mismatch found.
|
||||
|
||||
---
|
||||
|
||||
## Findings (cumulative, deduplicated)
|
||||
|
||||
| # | Severity | Category | File:Line | Title | Batch | Disposition |
|
||||
|---|----------|----------|-----------|-------|-------|-------------|
|
||||
| 1 | Low | Architecture | `detection_client/src/lib.rs` | `pub mod internal` exposes proto server types to external crates | 18 | Accepted: required for integration test fixture server; practical risk negligible |
|
||||
| 2 | Low | Maintainability | `detection_client/src/internal/stats.rs:66` | `note_orphan_response` increments `stream_errors_total` — imprecise bucket | 18 | Accepted: additive counter, low severity; add `orphan_responses_total` in next stats refactor |
|
||||
| 3 | Low | Performance | `detection_client/src/internal/runtime.rs:build_request` | Pixel buffer copy per gRPC frame | 18 | Accepted: unavoidable with current prost stack; revisit when `prost bytes` feature is evaluated |
|
||||
| 4 | Low | Architecture | `crates/autopilot/src/runtime.rs:84` | Pre-existing dead-code lint on `vlm_provider_name` | 16 | Pre-existing; tracked in `_docs/_process_leftovers/2026-05-20_autopilot_clippy.md` |
|
||||
|
||||
**Critical**: 0 | **High**: 0 | **Medium**: 0 (one Medium from batch 18 was fixed inline)
|
||||
|
||||
---
|
||||
|
||||
## Per-Batch Batch Review Cross-Reference
|
||||
|
||||
| Batch | Per-batch verdict | Findings fixed | Open low/med |
|
||||
|-------|------------------|----------------|-------------|
|
||||
| 16 | PASS_WITH_WARNINGS | — | 1 Low (FFmpeg EAGAIN string match), 1 Low (autopilot dead-code) |
|
||||
| 17 | PASS | — | None |
|
||||
| 18 | PASS_WITH_WARNINGS | F1 Medium (dead code) fixed inline | 3 Low accepted |
|
||||
|
||||
---
|
||||
|
||||
## Open Risks
|
||||
|
||||
1. **`mission_executor` polling race** — `ac1_multirotor_happy_path_reaches_done` (and the earlier `ac3`) intermittently fail under load. Tracked in `_docs/_process_leftovers/2026-05-20_mission_executor_ac3_flake.md`. Not a production defect; fix in the next `mission_executor` batch.
|
||||
|
||||
2. **Composition root wiring gap** — `frame_ingest` publisher and `detection_client` supervisor are not yet wired in `autopilot/src/runtime.rs`. This is expected and intentional; the composition root is wired in a dedicated final-assembly task once all leaf components are done.
|
||||
|
||||
3. **Real `../detections` service not tested** — `detection_client` tests use a fixture in-process gRPC server. End-to-end integration against the real service is scoped to the suite-level e2e harness.
|
||||
|
||||
---
|
||||
|
||||
## Quality Gate Status (batches 16-18 combined)
|
||||
|
||||
- `cargo fmt --all`: clean
|
||||
- `cargo clippy -p frame_ingest -p detection_client --all-targets -- -D warnings`: clean
|
||||
- `cargo test -p frame_ingest -p detection_client`: all passing (17 unit + 3 publisher + 5 rtsp_lifecycle + 10 detection_client unit + 7 detection_client integration)
|
||||
- `cargo test --workspace`: one pre-existing flake in `mission_executor` (documented, not blocking)
|
||||
|
||||
**Verdict: PASS_WITH_WARNINGS — no Critical or High findings; proceed to batch 19.**
|
||||
Reference in New Issue
Block a user