feat(vehicle): Vehicle Learning Confidence Decay & Prune (P2-3)#37
Merged
Merged
Conversation
…(P2-3)
P2-2 Evidence Store üzerine zaman-bazlı decay, stale-prune ve duplicate suppression ekler.
SALT-OKUNUR/yardımcı katman — Evidence Store'u DEĞİŞTİRMEZ (decay read-time hesaplanır,
diske yazılmaz); P2-1 confidence FORMÜLÜ değişmez. Cloud/SQL/LLM/Native/hot-path YOK.
- vehicleLearningDecay.ts (yeni):
* calculateDecayedConfidence/applyDecay: üstel yarı-ömür (weak45/candidate90/strong180 gün);
SAAT-SIÇRAMA GÜVENLİ elapsed=max(0,now-lastSeen) → saat geri giderse negatif decay YOK;
[0,1] clamp; yeni kanıt decay olmaz; firstSeen/lastSeen/observationCount KORUNUR
* isPruneCandidate/pruneCandidates: decay'li confidence<0.20 VE ≥180 gün VE weak/candidate →
prune ADAYI (strong ASLA); fiziksel silmez, pruneCandidate:true işaretler (audit)
* createObservationIdentity: evidenceId|fingerprintHash|ECU|rawResponse-hash|zaman-kovası
* DuplicateObservationCache (bounded 2048 FIFO, RAM-only, O(1)): shouldCount — aynı gözlem
aynı pencerede sayılmaz; farklı araç/ECU/response ayrı; reset/dispose zero-leak
* flat API: shouldCountObservation/resetDuplicateCache/dispose (tekil cache)
Girdi kayıtları mutate edilmez. Dokunulmadı: native OBD · poll · Discovery Pipeline ·
Fingerprint · Auto Learning · VKB · Manufacturer Intelligence · Diagnostic · Evidence Store
davranışı · PID/DID registry · SQL/Supabase · cloud · LLM · PR #11/#20.
18 test. tsc -b temiz · eslint temiz · 2540 test yeşil (23 bilinen env-gated, ilgisiz).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fauew13VP3vbfKqnocPdfX
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Amaç
P2-2 Evidence Store üzerine zaman-bazlı decay + stale-prune + duplicate suppression ekler → eski/tekrar-doğrulanmayan kanıtın güveni zamanla düşer; tek-seferlik/yanlış sinyaller bilgi tabanını şişirmez.
PR #36 merge sonucu
✅ PR #36 (P2-2) merge edildi — merge commit
94c30c1, main →94c30c1, tüm CI yeşildi. Branch silinmedi. Bu PR güncel main'den açıldı.Yeni dosyalar
src/platform/vehicleLearningDecay.tssrc/__tests__/vehicleLearningDecay.test.tsDeğişen dosyalar
Hiçbiri — tamamen additive, salt-okunur.
Decay formülü
decayed = clamp01( confidence · 0.5^(elapsedDays / halfLife) )elapsedDays = max(0, now − lastSeen) / gün→ sistem saati geriye giderse negatif decay yok (CLAUDE.md Clock Jump Protection). Yeni kanıt (elapsed=0) → decay yok. [0,1] clamp; 0 altına inmez.firstSeen/lastSeen/observationCountkorunur.Prune kuralları
Prune adayı (fiziksel silme değil —
pruneCandidate:trueişaretler, audit):Duplicate identity modeli
createObservationIdentity=evidenceId | fingerprintHash | ECU(normalize) | rawResponse-hash(FNV-1a) | zaman-kovası(60s).DuplicateObservationCache: bounded 2048 FIFO, RAM-only (yeniden başlatmada sıfırlanır), O(1) lookup, reset/dispose zero-leak.API
applyDecay·calculateDecayedConfidence·isPruneCandidate·pruneCandidates·createObservationIdentity·shouldCountObservation·resetDuplicateCache·dispose.Testler (18)
✓ yeni kanıt decay yok · ✓ 90 gün sonra azalır · ✓ strong yavaş/weak hızlı · ✓ 180+ gün zayıf prune-candidate · ✓ strong prune edilmez · ✓ saat-geri negatif yok · ✓ [0,1] clamp · ✓ firstSeen/lastSeen sabit · ✓ aynı gözlem duplicate sayılmaz · ✓ farklı araç/ECU/response/pencere ayrı · ✓ bounded FIFO · ✓ reset/dispose · ✓ girdi mutate edilmez · ✓ boş/bozuk fail-soft.
Risk analizi
Düşük — additive + salt-okunur. Katman çökse bile OBD/Discovery/Fingerprint/Auto Learning/Evidence Store/VKB/Manufacturer Intelligence/Diagnostic aynen sürer (her fonksiyon fail-soft). Girdi mutate edilmez; hot-path yok; O(1) + bounded cache; zero-leak dispose. Dokunulmadı: native OBD · poll · Discovery Pipeline · Fingerprint · Auto Learning · VKB · Manufacturer Intelligence · Diagnostic · Evidence Store davranışı · PID/DID registry · SQL/Supabase · cloud · LLM · PR #11/#20.
Doğrulama
tsc -b --noEmittemiz ·eslinttemizMerge YAPILMADI.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Fauew13VP3vbfKqnocPdfX