[AZ-622] Phase D: build_pre_constructed seeds c3 GPU runtimes

build_pre_constructed now populates c3_lightglue_runtime
(LightGlueRuntime) + c3_feature_extractor (FeatureExtractor) on top
of AZ-619/620/621. Strategy-specific BUILD_MATCHER_* flag mismatch
raises AirborneBootstrapError naming the missing flag and the c3_matcher
consumer; the c7 InferenceRuntime built earlier in the bootstrap is
reused as the engine source so no double-build at this layer.

C3MatcherConfig gains optional lightglue_weights_path: Path | None
for the operator's deployment config; production main() (AZ-624)
populates it. Real LightGlue inference correctness is verified by
AZ-624's Jetson AC-5 run per the AZ-622 Tier-2 Note.

Phase tests for AZ-619/620/621 gain an autouse _stub_c3_matcher_builders
fixture so additivity assertions remain valid as the bootstrap grows.

Code review: PASS_WITH_WARNINGS (3 Low: signature drift from spec,
_is_build_flag_on duplication across 3 runtime_root modules, and
BuildConfig literal mirrored with per-strategy build configs). All
deferred to future hygiene PBIs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-19 08:56:04 +03:00
parent eaf2f47f69
commit 5c4d129f80
10 changed files with 856 additions and 19 deletions
@@ -0,0 +1,54 @@
# AZ-622 — Phase D: build_pre_constructed seeds c3_lightglue_runtime + c3_feature_extractor
**Task**: AZ-622_pre_constructed_phase_d_c3_runtimes
**Name**: AZ-618 Phase D: build_pre_constructed seeds c3_lightglue_runtime + c3_feature_extractor
**Description**: Fourth subtask of AZ-618. Extends `airborne_bootstrap.build_pre_constructed(config)` to populate the C3 matcher GPU runtimes shared with C2.5.
**Complexity**: 3 points
**Dependencies**: AZ-619, AZ-620, AZ-621, AZ-278 (LightGlueRuntime helper). All in `done/` once prior phases land.
**Component**: runtime_root (cross-cutting)
**Tracker**: AZ-622
**Epic**: AZ-602 (parent: AZ-618 umbrella)
## Outcome
- `build_pre_constructed(config)` adds keys `c3_lightglue_runtime` (single shared `LightGlueRuntime` instance) and `c3_feature_extractor` (ALIKED / DISK extractor) on top of AZ-619..AZ-621.
- BUILD-flag mismatch raises `AirborneBootstrapError`.
- New unit tests under `tests/unit/runtime_root/test_az622_pre_constructed_phase_d.py`.
## Scope
### Included
- Internal builders `_build_c3_lightglue_runtime(config)` and `_build_c3_feature_extractor(config)`.
- The `LightGlueRuntime` MUST be the SAME instance shared between C3 and C2.5 (per AZ-344 AC-10 — identity-share avoids double GPU memory).
- BUILD-flag mismatch handling.
- Unit tests.
### Excluded
- C282 RANSAC + C5 helpers (AZ-623), main() wiring (AZ-624).
- The cross-component identity-share assertion (one instance shared across C3 + C2.5 in the actual graph) is verified at the AZ-624 integration AC, not here.
## Acceptance Criteria
**AC-622.1**: `build_pre_constructed(config)` adds keys `c3_lightglue_runtime` and `c3_feature_extractor` on top of AZ-619..AZ-621.
**AC-622.2**: BUILD-flag mismatch (e.g., `BUILD_C3_MATCHER_DISK_LIGHTGLUE=OFF` with config selecting `c3_matcher.strategy="disk_lightglue"`) surfaces a clear `AirborneBootstrapError` naming both the missing flag and consuming component.
**AC-622.3**: `pytest tests/unit/runtime_root/test_az622_pre_constructed_phase_d.py` exercises AC-622.1 + AC-622.2.
## Tier-2 Note
Real LightGlue inference correctness is verified by AZ-624's Jetson AC-5 run; unit tests here stub via `BUILD_*` flag selection or factory monkeypatch.
## Constraints
- MUST NOT introduce new `BUILD_*` env flags.
- MUST reuse the existing per-strategy `BUILD_C3_MATCHER_*` matrix.
- MUST be additive on top of AZ-619..AZ-621.
## Evidence
- Umbrella spec: `_docs/02_tasks/todo/AZ-618_airborne_bootstrap_pre_constructed.md`
- LightGlueRuntime helper: `src/gps_denied_onboard/helpers/lightglue_runtime.py`
- C3 matcher factory: `src/gps_denied_onboard/runtime_root/matcher_factory.py`