feat(obd): otomatik PID/DID keşif yakalama boru hattı (PR-DISC-1)#22
Merged
Conversation
Araçtan gözlemlenen ancak katalogda (StandardPidRegistry / araç DID profili)
bulunmayan PID ve DID'leri otomatik yakalayan altyapı. Tamamen ADDITIVE
(mevcut dosya değişmedi): PID registry / DTC kataloğu / native katman / hot-poll
mantığı / SQL-Supabase'e DOKUNULMADI. Ağ çağrısı YOK (offline-first).
Yeni modül src/platform/obd/discovery/ (Clean Architecture katmanları):
- discoveryModel.ts — saf veri modeli (DiscoveryRecord) + dedup kimliği +
FNV-1a hash (React/native importu yok)
- DiscoveryCache.ts — hash-tabanlı, SINIRLI (bounded, FIFO eviction) dedup
→ aynı ECU+mode+PID/DID tek kez (zero-leak)
- DiscoveryQueue.ts — offline-first kalıcı FIFO kuyruk (safeStorage; bounded;
drain/peekAll ile ileride uploader'a hazır — ağ YOK)
- discoveryExport.ts — sürümlü yerel JSON export zarfı (Supabase YOK)
- DiscoveryCaptureService.ts — merkezî orkestratör: registry filtresi (bilineni
atla) + dedup + kuyruk + tanı event'i. Bağımlılıklar
enjekte edilebilir (DIP): isPidKnown (varsayılan
STANDARD_PID_MAP salt-okunur), isDidKnown (setKnownDids),
emitDiagnostic (varsayılan recordDiag → 'ecuQuery')
- index.ts — modül genel yüzeyi (facade)
Tanı log entegrasyonu: yeni PID/DID bulununca mevcut 'ecuQuery' stage'iyle
recordDiag'a 'info' event düşer (obdDiagnosticTypes DEĞİŞMEDİ).
Test src/__tests__/discoveryCapture.test.ts (21 kilit):
- duplicate keşif oluşmuyor · registry PID tekrar kaydedilmiyor · yeni DID
yakalanıyor · hash dedup + bounded eviction · queue enqueue/drain/bounded/
kalıcılık · export JSON sürümlü zarf · varsayılan emitör 'ecuQuery' event yazıyor
Güvenlik/performans/bakım: MAC/PII yazılmaz (yalnız PID/DID/ham hex); tüm yapılar
bounded (bellek/disk sabit); soğuk-yol (hot-path'e girmez); yeni bağımlılık yok.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ABwbnF4mBZ8Pz4NisRibVE
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABwbnF4mBZ8Pz4NisRibVE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Konu
Automatic PID/DID Discovery Capture Pipeline — araçtan gözlemlenen ancak katalogda (StandardPidRegistry / araç DID profili) bulunmayan PID ve DID'leri otomatik yakalayan altyapı.
Tamamen ADDITIVE — hiçbir mevcut dosya değişmedi. PID registry / DTC kataloğu / native katman / hot-poll mantığı / SQL-Supabase migration'a DOKUNULMADI. Ağ çağrısı YOK (offline-first). PR #11'e dokunulmadı.
Yeni dosyalar (7) —
src/platform/obd/discovery/discoveryModel.tsDiscoveryRecord) + dedup kimliği + FNV-1a hash (React/native importu yok)DiscoveryCache.tsDiscoveryQueue.tsdrain/peekAllile ileride uploader'a hazır — ağ yok)discoveryExport.tsDiscoveryCaptureService.tsindex.tssrc/__tests__/discoveryCapture.test.tsDeğişen dosyalar: yok (0).
Mimari özeti (Clean Architecture / SOLID — GEMINI.md kalite kuralları)
Bir PID/DID gözlemi
capture(input)ile şu boru hattından geçer:reason: 'known') → registry'de olanları tekrar kaydetme.DiscoveryCache) — aynı kimlik ikinci gözlemde elenir (reason: 'duplicate').Bağımlılık tersine çevirme (DIP):
isPidKnown(varsayılanSTANDARD_PID_MAP— salt-okunur, registry'ye dokunulmaz),isDidKnown(setKnownDidsile profil DID'leri),emitDiagnostic(varsayılanrecordDiag) dışarıdan enjekte edilebilir → gevşek bağlaşım + test edilebilirlik.Tanı log entegrasyonu (item 6): yeni keşif, mevcut
ecuQuerystage'iylerecordDiag'ainfoevent olarak yazılır —obdDiagnosticTypesdeğişmedi.Discovery modeli
timestamp · vehicleProfile · ecuAddress · protocol · mode · pidOrDid · request · rawResponse · decodedValue? · supported · discoverySource (PID/DID) · firmwareVersion?— hepsi görev tanımıyla birebir; opsiyoneller gerçekten bilinmeyebilenler (uydurma yok).Test sayısı
21 test (yeşil): model/hash · cache (dedup + bounded) · queue (enqueue/peekAll/drain/bounded/kalıcılık) · export JSON · servis kuralları (known/duplicate/yeni DID/setKnownDids/farklı-ECU/reset) · varsayılan
ecuQueryevent wiring.tsc -btemiz; regresyon kasası 110/110.Risk analizi
Çok düşük. Tamamen additive, izole modül; hiçbir mevcut kod yolu (hot-poll, native, registry, DTC) değişmedi — singleton export edilir ama henüz hiçbir tüketiciye bağlanmadı (altyapı PR'ı). Tüm yapılar bounded (bellek/disk sabit → zero-leak); soğuk-yol (hot-path'e girmez); yeni bağımlılık yok. Güvenlik: kayıtlarda MAC/PII yok (yalnız PID/DID + ham hex); export/kuyruk yalnız yerel, ağ yok.
🤖 Generated with Claude Code