mirror of
https://github.com/azaion/autopilot.git
synced 2026-06-22 18:41:10 +00:00
[AZ-649] [AZ-674] [AZ-667] telemetry + vlm schema + mapobjects hydrate batch 6
AZ-649 mission_executor telemetry forwarding: - shared::models::telemetry::UavTelemetry canonical model - TelemetryForwarder with atomic ArcSwap snapshot + 3 lossy tokio::sync::broadcast channels (MissionExecutor, ScanController, MavlinkUplink) + per-consumer drop counters - MavlinkProjection::from_mavlink for HEARTBEAT/GLOBAL_POSITION_INT/ ATTITUDE/SYS_STATUS - spawn_mavlink_pump bridges mavlink_layer into the forwarder at the binary edge AZ-674 vlm_client schema validation + model_version tracking: - AssessmentParser owns schema validation + model-version state - wire::read_response_raw splits raw bytes from parsing so invalid payloads can be logged size-capped - VlmStatus gains an Inconclusive variant; exhaustive-match test guards downstream consumers - VlmPipelineStatus mirrors the new variant in shared::models::poi AZ-667 mapobjects_store hydrate + pending logs + cascade: - SyncState enum aligned with description.md (FreshBoot, Synced, CachedFallback, Degraded, Failed) - Store::hydrate(MapObjectsBundle) replaces in-memory map atomically; freshness=Stale -> CachedFallback - classify() + end_of_pass append MapObjectObservation events to pending_observations (New/Moved/Existing/RemovedCandidate) - apply_decline + LocalAppended ignored items append to pending_ignored - drain_pending() returns and clears both logs - cascade_mission(id) purges by_cell + IgnoredSet + pending logs - Health surface reports sync_state, pending_obs, pending_ign Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
use base64::Engine;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(test)]
|
||||
use shared::models::vlm::VlmAssessment;
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
|
||||
@@ -64,7 +65,11 @@ pub async fn write_request<W: AsyncWrite + Unpin>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn read_response<R: AsyncRead + Unpin>(r: &mut R) -> Result<VlmAssessment, WireError> {
|
||||
/// Read one length-prefixed frame body. The body is returned as raw
|
||||
/// bytes; JSON parsing is the [`crate::internal::parser`]'s job
|
||||
/// (AZ-674 §AC-2 — schema-invalid responses must be observable as
|
||||
/// `VlmAssessment{ status: SchemaInvalid }`, not as `Err`).
|
||||
pub async fn read_response_raw<R: AsyncRead + Unpin>(r: &mut R) -> Result<Vec<u8>, WireError> {
|
||||
let mut lenbuf = [0u8; 4];
|
||||
r.read_exact(&mut lenbuf).await?;
|
||||
let len = u32::from_be_bytes(lenbuf);
|
||||
@@ -76,6 +81,14 @@ pub async fn read_response<R: AsyncRead + Unpin>(r: &mut R) -> Result<VlmAssessm
|
||||
if n != body.len() {
|
||||
return Err(WireError::UnexpectedEof);
|
||||
}
|
||||
Ok(body)
|
||||
}
|
||||
|
||||
/// Legacy combined-read helper used by the in-tree wire-layer tests.
|
||||
/// Production code calls `read_response_raw` + `AssessmentParser::parse`.
|
||||
#[cfg(test)]
|
||||
pub async fn read_response<R: AsyncRead + Unpin>(r: &mut R) -> Result<VlmAssessment, WireError> {
|
||||
let body = read_response_raw(r).await?;
|
||||
let assessment: VlmAssessment = serde_json::from_slice(&body)?;
|
||||
Ok(assessment)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user