[AZ-645] [AZ-646] [AZ-647] mission_client: middle-waypoint POST + mapobjects pull/push
ci/woodpecker/push/build-arm Pipeline failed

Batch 3 of greenfield Step 7 — mission_client epic AZ-638 close-out.

AZ-645 (Middle-waypoint POST)
- post_middle_waypoint(mission_id, &Mission) -> Result<MissionUpdateAck, PostError>
- Bounded retry (default 3 attempts) shared with the rest of missions_api
- Health: last_middle_waypoint_post_status (ok/error)

AZ-646 (Pre-flight MapObjects pull)
- pull_mapobjects(mission_id) -> Result<MapObjectsBundle, PullError>
- Schema-validated against bundled shared/contracts/mapobjects-bundle.json
- Typed errors: Unreachable / SchemaInvalid / MaxRetriesExceeded / Internal
- Health: mapobjects_pull_state, last_mapobjects_pull_ts

AZ-647 (Post-flight push + durable disk queue)
- push_mapobjects_diff(mission_id, MapObjectsDiff) -> PushReport
- recover_pending_pushes() -> Vec<PushReport> for crash recovery
- Write-ahead atomic-rename persistence under ${state_dir}/mapobjects_push/
- Per-endpoint independent retry: observations + ignored_items
- Partial success rewrites the disk file with only the failing portion
- Health: mapobjects_push_pending, last_push_ts, per-endpoint last error

Infrastructure
- Schemas: shared/contracts/mapobjects-{bundle,observations,ignored}.json
- Restructured schema/ into mission.rs + mapobjects.rs sub-modules
- New mapobjects_sync/ (pull, push, queue)
- workspace dep tempfile=3; mission_client dev-deps add tempfile + chrono

Tests
- 12/12 ACs verified locally (4 AZ-645 + 4 AZ-646 + 5 AZ-647)
- mission_client suite: 15 unit + 18 integration = 33 tests pass
- AZ-646 AC-4 proxy: 1000-object + 1000-ignored bundle within 30s
- AZ-647 AC-5 proxy: 5000-obs + 500-ignored push within 2min

Code review verdict: PASS_WITH_WARNINGS (inline). Cumulative review
(K=3 trigger) PASS_WITH_WARNINGS — full report in
_docs/03_implementation/cumulative_review_batches_01-03_cycle1_report.md.

Open follow-ups (non-blocking):
- module-layout.md: rename push_mapobjects -> push_mapobjects_diff (Step 13)
- ExponentialBackoff still duplicated across crates; promote to shared::retry
  when the third caller lands (likely detection_client AZ-660/661)
- state_dir default is relative; composition root must override

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-19 12:54:15 +03:00
parent 1c993d86b3
commit 0a87c0f716
25 changed files with 2911 additions and 233 deletions
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://azaion/contracts/mapobjects-observations.json",
"title": "MapObjectsObservationsPush",
"description": "Post-flight observations payload POSTed to /missions/{id}/mapobjects. Wire contract co-owned with the external missions repo. Local validator and bundled-schema copy live in autopilot/crates/mission_client/src/internal/schema/mapobjects.rs (AZ-647).",
"type": "object",
"required": ["mission_id", "observations"],
"additionalProperties": false,
"properties": {
"mission_id": { "type": "string", "minLength": 1 },
"observations": {
"type": "array",
"items": { "$ref": "#/definitions/observation" }
}
},
"definitions": {
"observation": {
"type": "object",
"required": [
"id", "h3_cell", "class", "class_group",
"mission_id", "uav_id",
"observed_at_monotonic_ns", "observed_at_wallclock",
"gps_lat", "gps_lon", "mgrs",
"size_width_m", "size_length_m", "confidence", "diff_kind"
],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "format": "uuid" },
"h3_cell": { "type": "integer", "minimum": 0 },
"class": { "type": "string" },
"class_group": { "type": "string" },
"mission_id": { "type": "string" },
"uav_id": { "type": "string" },
"observed_at_monotonic_ns": { "type": "integer", "minimum": 0 },
"observed_at_wallclock": { "type": "string", "format": "date-time" },
"gps_lat": { "type": "number", "minimum": -90, "maximum": 90 },
"gps_lon": { "type": "number", "minimum": -180, "maximum": 180 },
"mgrs": { "type": "string" },
"size_width_m": { "type": "number", "minimum": 0 },
"size_length_m": { "type": "number", "minimum": 0 },
"confidence": { "type": "number", "minimum": 0, "maximum": 1 },
"diff_kind": {
"type": "string",
"enum": ["NEW", "MOVED", "EXISTING", "REMOVED_CANDIDATE"]
},
"photo_ref": { "type": "string" },
"raw_evidence": {}
}
}
}
}