Skip to content

Add a minimal if pipeline is compatible mode#428

Draft
f-wright wants to merge 5 commits into
mainfrom
francine/per-detector-inference-image-flavor
Draft

Add a minimal if pipeline is compatible mode#428
f-wright wants to merge 5 commits into
mainfrom
francine/per-detector-inference-image-flavor

Conversation

@f-wright

@f-wright f-wright commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Replaces the global useMinimalImage boolean with a tri-state inferenceImageMode that can be set to standard, minimal_if_compatible, or fully_minimal. The new minimal_if_compatible mode picks the minimal inference image per-detector based on a minimal_compatible flag the cloud is adding on fetch-model-urls, while leaving detectors without that annotation on the full image.
  • All three decision sites — the deployment the model-updater creates, the OODD-pod creation decision, and the EdgeInferenceManager request-path routing — derive from the same detector_uses_minimal_image(detector_id, db_manager) primitive in app/core/inference_image.py, so they cannot drift out of agreement.
  • Adds hot-swap: when a live primary deployment's image differs from the desired flavor (e.g. operator changes mode, or cloud retrains a pipeline and flips minimal_compatible), the model-updater tears down primary + OODD and recreates them on the correct image. Delete-then-create is the only viable path because deployment names are derived from detector_id alone; 404-tolerant deletes handle crash-mid-swap recovery.

Invariants preserved

  • Image determines OODD topology. Minimal-image → OODD folded into primary (no separate pod). Full-image → separate OODD pod. The same detector_uses_minimal_image call controls both so they cannot disagree.
  • Wire compatibility. minimal_compatible is a new additive field on fetch-model-urls; old edge clients that don't read it are unaffected.
  • Safe defaults. minimal_compatible defaults to False everywhere — unannotated detectors stay on the full image; minimal_if_compatible mode degrades to standard when cloud is older.

Test plan

  • uv run pytest test/core/ test/edge_inference/ test/database_manager/ test/model_updater/ — all tests pass
  • helm template renders without error for inferenceImageMode: standard, minimal_if_compatible, fully_minimal
  • helm template with legacy useMinimalImage: true renders INFERENCE_IMAGE_MODE=fully_minimal
  • helm template with both inferenceImageMode and useMinimalImage set fails with an explicit error
  • Manual e2e: deploy with minimal_if_compatible; stub fetch-model-urls so detector A returns minimal_compatible: true, B returns false; confirm A runs on *-minimal image with no OODD pod, B runs on full image with OODD pod
  • Flip to fully_minimal, re-apply chart; after one model-updater cycle both primaries swap to minimal image and B's OODD pod is torn down
  • Confirm queries during swap window either succeed via readiness check or escalate per configured behavior

🤖 Generated with Claude Code

f-wright and others added 2 commits June 10, 2026 23:51
… / fully_minimal)

Replace the global useMinimalImage boolean with a tri-state inferenceImageMode
and a per-detector minimal_compatible flag that flows from cloud fetch-model-urls
through the model updater. The model-updater, request-path routing, and
OODD-pod creation all derive from the same detector_uses_minimal_image lookup,
so they can't disagree. Includes hot-swap (delete-and-recreate) when a live
deployment's image diverges from the desired flavor.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@f-wright f-wright changed the title Per-detector inference image flavor (standard / minimal_if_compatible… Per-detector inference image flavor (standard / minimal_if_compatible / fully_minimal) Jun 11, 2026
@f-wright f-wright changed the title Per-detector inference image flavor (standard / minimal_if_compatible / fully_minimal) Add a minimal if pipeline is compatible mode Jun 15, 2026
f-wright and others added 3 commits June 15, 2026 17:17
… code, add swap test

- Replace coarse INFERENCE_IMAGE_MODE check in image_queries.py with
  detector_uses_minimal_image so all four OODD-decision sites derive from
  the same primitive (eliminating orphan OODD rows for known-minimal detectors)
- Remove two dead-code calls to get_edge_inference_deployment_name in
  _redeploy_for_flavor_swap whose return values were discarded
- Add test_minimal_to_full_redeploys covering the missing hot-swap direction
- Soften values.yaml comment to accurately describe when the legacy/new
  conflict detection fires

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e edge cases

- Remove deprecated useMinimalImage Helm helper and schema entry; CI and
  helm test now pass inferenceImageMode directly
- Rename INFERENCE_IMAGE_FULL/MINIMAL → FULL/MINIMAL_INFERENCE_IMAGE_URI
- Rename update_models_if_available → sync_models_from_cloud
- Add per-worker TTL cache for uses_separate_oodd to skip repeated DB reads
- _persist_minimal_compatible now returns bool; reconcile only triggers
  flavor swap on minimal_compatible flip in minimal_if_compatible mode
- _redeploy_for_flavor_swap returns bool so a failed swap no longer
  suppresses the pending model rollout (swap_happened stays False)
- Fix stale OODD pod removal via separate_oodd_mismatch check
- Remove incorrect minimal_compatible copy from primary to OODD in
  parse_model_info
- Add tests for cache keying, standard-mode no-redeploy, stale OODD
  removal, failed-swap recovery, and K8s deployment path agreement

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant