Skip to content

Fix undefined names, bind services to localhost, and add ruff CI - #209

Merged
WhoIsMrSentry merged 42 commits into
mainfrom
cursor/audit-ruff-bind-tests-2243
Oct 12, 2026
Merged

WhoIsMrSentry merged 42 commits into
mainfrom
cursor/audit-ruff-bind-tests-2243

Conversation

@WhoIsMrSentry

Copy link
Copy Markdown
Owner

Özet

Denetim raporundaki ruff F821 / kullanılmayan import, ağ bind güvenliği, test toplama ve depo hijyeni maddeleri kapatıldı. Kamera, autonomy, VLM ve Ollama HTTP sunucuları varsayılan olarak 127.0.0.1 dinler; mevcut server.host anahtarı durur, Pi tarafı env ile 0.0.0.0 seçebilir. Davranış bunun dışında aynı bırakıldı.

Değişiklik tipi

  • Hata düzeltmesi
  • Yeni özellik
  • Refactor
  • Dokümantasyon güncellemesi
  • Test güncellemesi

Ne değişti

Tanımsız isimler (F821 / F811 / F823 / F601)

  • Eksik importlar eklendi: time (common/health.py, camera/services/capture.py), threading (autonomy/.../decision.py, OLED, wakeword, Google VLM client), check_latency, typing adları, asynccontextmanager, FastAPI ve benzerleri.
  • arduino_serial/xArduinoSerialService.py: cute_mapping.json artık json + Path ile yüklenir. Bare except: pass kalktı; hata loglanır. Çift HeadArbiterTransportWrapper importu kaldırıldı; sarmalayıcı metot içinden import edilir.
  • job_types.get_job_registry_async içinde global _global_registry eklendi (F823, gerçek UnboundLocalError).
  • laya_engine içindeki yinelenen instructions anahtarında çalışma anındaki (ikinci) metin bırakıldı.
  • command_router gölgelemesi kasıtlı uyumluluk; # noqa: F811.

Kullanılmayan import / değişken (F401 / F841)

  • Güvenli olanlar temizlendi. __init__.py yeniden dışa aktarımları ruff per-file-ignores ile duruyor.
  • Testlerin monkeypatch ettiği modül adları geri kondu (xArduinoSerialService.os, _default_serial_device, tts.Path, tts.requests, _load_piper_api, _wav_bytes_to_pcm) ve kontrat / bootstrap / console yeniden dışa aktarımları # noqa: F401 ile korundu.

Ağ bind

  • Yeni yardımcı: modules/common/bind_host.py. Env, YAML server.host değerinin önüne geçer; env yoksa açık 0.0.0.0 korunur.
  • Env adları: CAM_HOST, AUTONOMY_HOST, VLM_HOST, OLLAMA_SERVICE_HOST. OLLAMA_HOST Ollama daemon URL’sidir, bind için kullanılmaz.
  • Gateway, speak ve speech bind’i değişmedi (0.0.0.0 / SENTRYBOT_HOST).
  • Belgelendi: docs/PI_DEPLOYMENT_RUNTIME.md, README.md, modules/ai_provider/README.md.

Testler

  • Pi donanım / Pillow ve textual isteyen modüller, import’tan önce pytest.importorskip ile atlanır.
  • test_face_renderer_begin_uses_config_brightness: FaceRenderer.begin zaten bright ve fps değerlerini config’ten EyeEngine’e geçiriyor. Pillow kurulu ortamda test geçiyor; Pillow yoksa modül artık collection error yerine skip olur.

CI ve .gitignore

  • pyproject.toml [tool.ruff]: Python 3.10, seçilen kurallar E9, F401, F811, F821, F823, F841. __init__.py için F401 yok sayılır.
  • .github/workflows/pytest.yml içine ruff==0.17.0 adımı eklendi.
  • .gitignore: __init__.py satırı yoktu (silinecek bir girdi bulunamadı). *.ini daraltılıp *.local.ini yapıldı; pytest.ini izlenmeye devam eder.
  • İzlenen modules/modules/state_manager/data/*.sqlite3-wal/shm silindi.

Etkilenen modüller

common, camera, autonomy, vlm_bridge, ai_provider, arduino_serial, agent_core, gateway, visual_output, voice, runtime_console, system_control ve ilgili testler.

Doğrulama

  • Lokal çalıştırma tamamlandı
  • İlgili testler geçiyor
  • Gerekli doküman/konfig güncellemeleri yapıldı

Test sonuçları

Önce (denetim, x86 venv, Pi kütüphaneleri yok):

  • ruff F+E9: 641 bulgu (504 F401, 78 F821, 36 F841, 15 F541, 6 F811, 1 F601, 1 F823)
  • pytest: 904 passed, 1 failed (test_face_renderer_begin_uses_config_brightness), 12 collection error

Sonra (bu dal, ruff 0.17.0, pytest 9.1.1, Pillow kurulu, textual kurulu değil):

  • python3 -m ruff check .: All checks passed (seçilen kurallar)
  • python3 -m pytest -q tests: 959 passed, 2 skipped, 0 failed (29.56s). Skip’ler textual eksikliği: test_textual_tui, test_sentrybot_launcher. Collection error yok.

Arduino Kontrat Kontrolü (uygunsa)

  • contract.py dışında elle Arduino payload yazılmadı
  • Kritik komutlar /arduino/request kullanıyor
  • Yeni komut ailesi builder + validator + test içeriyor (bu PR’da yeni komut yok)
  • contract.py / contract_validators.py yeniden dışa aktarımları korundu; payload üreticilerine dokunulmadı.

Risk ve geri alma

Loopback varsayılanı, YAML’de açıkça 0.0.0.0 yazılmamış kamera/autonomy/VLM/Ollama süreçlerini yalnızca localhost’a çeker. LAN erişimi için ilgili server.host: 0.0.0.0 veya env (CAM_HOST vb.) yeterlidir. Geri alma: bu dalı revert etmek.

İlgili issue

Denetim raporu (sentrybot_audit); bağlı issue numarası yok.

Takip işleri (bu PR dışında)

  • Bağımlılık sabitleme: pin’siz requirements.txt dosyaları ve lockfile yok.
  • Büyük dosya bölme: agent_api_compat.py (~1154), evaluate_laya_action_proposals.py (~1021), companion_execution_loop.py (~852), laya_engine.py (~809), runtime/schemas.py (~721).
  • .sentrybot/ AI metadata, AGENTS.md, opencode.json yerleşimi.
  • circuit/arduino.pdf (~2.3 MB) ve 3d_Print/ ikili dosyaları.
  • Gateway kimlik doğrulama / API anahtarı.
  • Voice/speech regresyon testleri.
  • Doğrudan main’e push alışkanlığı.
Open in Web Open in Cursor 

cursoragent and others added 30 commits October 7, 2026 09:16
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
…orts

Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
…servos

Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
cursoragent and others added 7 commits October 11, 2026 11:46
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
@github-actions github-actions Bot added module: arduino_serial Changes in modules/arduino_serial module: gateway Changes in modules/gateway module: camera Changes in modules/camera module: autonomy Changes in modules/autonomy area: ci CI / workflows / automation changes area: docs Documentation changes (README, docs/) module: vlm_bridge Changes in modules/vlm_bridge labels Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Latest Pytest Result ✅

@cursor
cursor Bot force-pushed the cursor/audit-ruff-bind-tests-2243 branch from 772131f to 4a6da8f Compare October 12, 2026 08:39
@cursor cursor Bot changed the title fix: ruff tanımsız isimler, loopback bind ve test toplama Fix undefined names, bind services to localhost, and add ruff CI Oct 12, 2026
@cursor
cursor Bot force-pushed the cursor/audit-ruff-bind-tests-2243 branch from 4a6da8f to 378eb9d Compare October 12, 2026 08:44
@WhoIsMrSentry
WhoIsMrSentry marked this pull request as ready for review October 12, 2026 08:46
@WhoIsMrSentry
WhoIsMrSentry merged commit c66ec3a into main Oct 12, 2026
3 checks passed
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Oct 12, 2026
…ts-2243

Fix undefined names, bind services to localhost, and add ruff CI
cursoragent and others added 4 commits October 12, 2026 13:06
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Co-authored-by: Emir HAMURCU <WhoIsMrSentry@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI / workflows / automation changes area: docs Documentation changes (README, docs/) module: arduino_serial Changes in modules/arduino_serial module: autonomy Changes in modules/autonomy module: camera Changes in modules/camera module: gateway Changes in modules/gateway module: vlm_bridge Changes in modules/vlm_bridge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants