docs: add Phase 1 ADRs and update PROJECT.md with completed decisions

ADR 0002: hexagonal/ports-and-adapters architecture — components/ layout,
  protocol.py per component, composition root, core/ for concentrated math.
ADR 0003: @dataclass(slots=True, frozen=True) on hot path; Pydantic retained
  only at REST/config/DB boundaries. Pose/GPSPoint migration deferred to Phase 2.
ADR 0004: Stage 2 as independent iteration — own phases 1-6, own requirements,
  stage1 code treated as MVP starting capital.

PROJECT.md: Stage 2 Key Decisions updated from Pending → Accepted with Phase 1
  implementation notes, deferred work list, and final architecture summary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Yuzviak
2026-05-11 09:23:09 +03:00
parent 0bb94da3c4
commit a11ed15187
8 changed files with 623 additions and 303 deletions
+64 -37
View File
@@ -1,71 +1,98 @@
---
gsd_state_version: 1.0
milestone: v1.0
milestone_name: milestone
status: Phase 1 complete
last_updated: "2026-04-01T21:05:00Z"
milestone: v2.0
milestone_name: Stage 2 — Hexagonal architecture + try02 idea integration + real-flight fixture
status: phase_1_complete
last_updated: "2026-05-11T00:00:00Z"
last_activity: 2026-05-11 — Phase 1 complete; 01-08 composition root + YAML config shipped; 216/216 tests green
progress:
total_phases: 7
total_phases: 6
completed_phases: 1
total_plans: 3
completed_plans: 3
total_plans: 8
completed_plans: 8
percent: 100
---
# Project State
## Project Reference
See: .planning/PROJECT.md (updated 2026-04-01)
See: .planning/PROJECT.md (updated 2026-05-10)
**Core value:** Flight controller must receive valid MAVLink GPS_INPUT at 5-10Hz with position accuracy ≤50m for 80% of frames — without this, the UAV cannot navigate in GPS-denied airspace.
**Current focus:** Phase 2Visual Odometry Pipeline
**Current focus:** Stage 2 / Phase 1Hexagonal Refactor & Composition Root
## Current Phase
**Phase:** 1 — ESKF Core (✓ Complete)
**Next action:** Run `/gsd:plan-phase 2` to plan Phase 2 (Visual Odometry Pipeline)
**Phase:** 1 — Hexagonal Refactor & Composition Root (COMPLETE)
**Next phase:** Phase 2 — Acceptance Criteria + Test Taxonomy + Observability Spine
## Roadmap Summary
### Stage 1 (v1.0 — archived under `.planning/archive/v1.0/`)
Treated as MVP starting capital, not active backlog. ESKF + cuVSLAM/ORB VO + GPR + MAVLink + 195 passing tests + 8 SITL skipped. Refactoring is allowed and expected.
### Stage 2 (v2.0 — current iteration, Phases 16)
| Phase | Name | Status |
|-------|------|--------|
| 1 | ESKF Core | ✓ Complete |
| 2 | Visual Odometry Pipeline | Pending |
| 3 | Satellite Matching + GPR | Pending |
| 4 | MAVLink I/O | Pending |
| 5 | End-to-End Pipeline Wiring | Pending |
| 6 | Docker SITL Harness + CI | Pending |
| 7 | Accuracy Validation | Pending |
| 1 | Hexagonal Refactor & Composition Root | **Complete** (8/8 plans, 216 tests green) |
| 2 | Acceptance Criteria + Test Taxonomy + Observability Spine | Pending |
| 3 | Safety Anchor State Machine & Geometry-Gated Verifier | Pending |
| 4 | Conditional Multi-Scale VPR + Flight Data Recorder | Pending |
| 5 | MAVLink Source-Aware Output & Spoofing/Blackout Handling | Pending |
| 6 | Real-Flight Fixture (Azaion 10.05.2026) + CLI + Per-Env Docker | Pending |
## Key Files
- `.planning/PROJECT.md` — project context and requirements
- `.planning/REQUIREMENTS.md`36 v1 requirements with traceability
- `.planning/ROADMAP.md`7-phase execution plan
- `.planning/PROJECT.md` Stage 2 project context
- `.planning/REQUIREMENTS.md`52 Stage 2 requirements with traceability
- `.planning/ROADMAP.md`Stage 2 roadmap, 6 phases
- `.planning/archive/v1.0/` — Stage 1 historical record (PROJECT/REQUIREMENTS/ROADMAP/phases)
- `.planning/codebase/` — codebase map (ARCHITECTURE, CONCERNS, STACK, etc.)
- `_docs/01_solution/solution.md` — authoritative architecture spec
- `_docs/00_problem/acceptance_criteria.md`43 test scenarios
- `_docs/00_problem/acceptance_criteria.md`to be rewritten with formal AC-1.x (Phase 2)
## Session Notes
- Initialized 2026-04-01
- Brownfield: scaffold exists (~2800 lines), critical algorithms missing (ESKF, MAVLink, real TRT/cuVSLAM)
- cuVSLAM + TRT available only on Jetson; dev/CI uses OpenCV ORB stub + MockInferenceEngine
- Pipeline direction: top-down (API → ESKF → VO → satellite → GPS_INPUT)
- 2026-04-01 — Project initialized; Stage 1 brownfield scaffold (~2800 lines)
- Stage 1 complete — 195 passing + 8 SITL skipped tests, all 7 phases shipped, archived to `.planning/archive/v1.0/`
- 2026-05-10 — Stage 2 opened as independent iteration with own phase numbering (16); 52 requirements drafted
- 2026-05-10 — Stage 2 ROADMAP.md created; 100% requirement coverage; traceability populated in REQUIREMENTS.md
- Stage 2 strategy: refactor stage1 working code to hexagonal layout, re-implement try02 concepts (NOT layout details), formalize AC, add Azaion real-flight fixture
- Code from stage1 is MVP — refactoring is allowed and expected; no regression in 195 stage1 tests is the floor
- 2026-05-11 — Phase 1 complete: Plans 01-01 through 01-08 executed; 216/216 tests passing; ARCH-01..07 all satisfied
## Phase 1 Execution Summary (2026-04-01)
## Stage 2 Phase Dependency Order
**Status:** ✓ Complete — All 3 plans executed, 35 tests passing
```
Phase 1 (ARCH refactor — Protocol surfaces stabilize first)
Phase 2 (AC + TEST taxonomy + structlog spine)
Phase 3 (SAFE state machine + VERIFY anchor gates)
Phase 4 (Conditional VPR + FDR — needs trigger semantics from SAFE)
Phase 5 (MAVOUT — source labels + spoofing + blackout — needs SAFE labels + FDR audit)
Phase 6 (FIXTURE — Azaion real-flight + CLI + per-env Docker — exercises everything end-to-end)
```
**Deliverables:**
- `src/gps_denied/schemas/eskf.py` (68 lines) — ESKF data contracts (ConfidenceTier, ESKFState, ESKFConfig, IMUMeasurement)
- `src/gps_denied/core/eskf.py` (359 lines) — 15-state ESKF with IMU prediction, VO/satellite updates, confidence tiers
- `src/gps_denied/core/coordinates.py` (176 lines added) — Real K-matrix projection, ray-ground intersection, gps_to_pixel inverse
- `tests/test_eskf.py` (290 lines) — 18 ESKF unit tests
- `tests/test_coordinates.py` (+200 lines) — 17 coordinate chain tests
## Current Position
**Requirements Covered:** ESKF-01 through ESKF-06 (all 6 Phase 1 requirements)
Phase: 1 — Hexagonal Refactor & Composition Root
Plan: 08 (COMPLETE — final plan of phase)
Status: Phase 1 complete — all 8 plans executed, 216/216 tests green, ARCH-01..07 satisfied
Last activity: 2026-05-11 — Plan 01-08 complete; build_pipeline factory + RuntimeConfig + YAML config shipped
**Commits:** 4 total (schemas, core ESKF, coordinates, tests, summaries)
## Key Decisions (Phase 1)
**Verification:** pytest 35/35 passing (100% success)
- ARCH-01: components/{vio,satellite_matcher,gpr,mavlink_io,anchor_verifier,safety_state,flight_recorder,coordinate_transforms}/ created with protocol.py + impls
- ARCH-02: hot_types migration deferred to Phase 2 (Pydantic retained for 216-test stability)
- ARCH-03: pipeline/composition.py build_pipeline(env) as explicit DI root
- ARCH-04: core/ math files retained as single files (eskf, factor_graph, coordinates, chunk_manager, recovery, rotation)
- ARCH-05: typing.Protocol throughout; orchestrator.py has zero concrete adapter imports
- ARCH-06: config/{jetson,x86_dev,ci,sitl}.yaml + RuntimeConfig.env + YamlConfigSettingsSource
- ARCH-07: 216 passed / 8 skipped / 0 failed (baseline was 216+8 skipped)