Skip to content

fix(db): Supabase name drift alignment — system_configs/linking_codes (PR-SQL-3A)#34

Merged
selimmujdeci merged 1 commit into
mainfrom
fix/supabase-name-drift
Jul 10, 2026
Merged

fix(db): Supabase name drift alignment — system_configs/linking_codes (PR-SQL-3A)#34
selimmujdeci merged 1 commit into
mainfrom
fix/supabase-name-drift

Conversation

@selimmujdeci

Copy link
Copy Markdown
Owner

Amaç

Kodda kullanılan eski Supabase tablo adlarını canlı/kanonik adlarla hizalar. Yalnız kod düzeltmesi — migration/SQL/şema değişikliği yok, production'a yazma yok, iş mantığı değişmedi.

🔒 Migration oluşturulmadı · SQL yazılmadı · production DB'ye çağrı yok · şema değişmedi.

Kolon paritesi sonucu (ön kontrol)

Öğe Kod alanları Canlı tablo Parite Karar
system_configsruntime_policies id, key, name, value, unit, updated_at (read) · value, updated_at, .eq(key) (write) runtime_policies (id/key/name/value/unit/updated_at + …) Hizalandı
linking_codesvehicle_linking_codes vehicle_id, code, expires_at (insert) vehicle_linking_codes (vehicle_id/code/expires_at/…) Hizalandı
push_subscriptionsvehicle_push_tokens endpoint, subscription, user_id · onConflict:'endpoint' vehicle_push_tokens (fcm_token, platform, vehicle_id) KAPSAM DIŞI (Web Push ≠ FCM; kör rename akışı kırardı)

Yapılan isim hizalamaları

  • superAdminService.ts: getSystemPolicies (read) + updatePolicy (write) → .from('runtime_policies') (eskiden system_configs)
  • SuperAdminShell.tsx: boş-durum UI metni system_configsruntime_policies
  • website/src/app/api/vehicle/code/route.ts: .from('linking_codes').from('vehicle_linking_codes')

Kapsam dışı bırakılan öğe

push_subscriptions — kolon paritesi yok. Canlı vehicle_push_tokens bir FCM token tablosu (fcm_token/platform); kod ise Web Push alanları (endpoint/subscription/user_id, onConflict 'endpoint') kullanıyor. Semantik olarak farklı tablolar → dokunulmadı, raporlandı. (Bu ayrı bir değerlendirme gerektirir — web-push tablosu eksik mi yoksa özellik dormant mı.)

Değişen dosyalar

src/platform/superadmin/superAdminService.ts · src/components/admin/SuperAdminShell.tsx · website/src/app/api/vehicle/code/route.ts · src/__tests__/supabaseNameDrift.test.ts (yeni)

Testler

supabaseNameDrift.test.ts — Supabase .from() hedeflerini açıkça kilitler:

  • getSystemPoliciesruntime_policies OKUR (system_configs değil)
  • updatePolicyruntime_policies YAZAR (+ audit_logs akışı korundu)
  • ✓ superAdminService kaynağında from('system_configs') KALMADI (?raw kaynak-kilit)
  • ✓ website vehicle/code API'de from('linking_codes') KALMADI, vehicle_linking_codes VAR
  • (push_subscriptions senaryosu N/A — kapsam dışı)

Test sonuçları

  • tsc -b --noEmit temiz
  • eslint temiz
  • Unit testler: 2493 geçti (23 bilinen env-gated hata, ilgisiz)
  • Production build yeşil (vite build ✓ 1m09s)

Risk analizi

Düşük. Şema değişmediği için DB verisi etkilenmez. Kolon paritesi doğrulanan 2 hizalamada field-mapping korundu; iş mantığı/fallback değişmedi. Parite olmayan push_subscriptions bilinçli dışarıda → yanlış-mapping runtime kırılması engellendi.

Dokunulmayanlar (kural)

remote_commands · memberships/tenant · radar_reports/raw_community_events · sentry_clips (bucket) · PR #11/#20 · branch silme · merge.

Production DB'ye yazılmadığı doğrulaması

PR yalnız TypeScript kod değişikliği + test içerir. Hiçbir migration/SQL/production DB çağrısı yok; canlı şema ve veri değişmedi.

Merge YAPILMADI.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fauew13VP3vbfKqnocPdfX

…s (PR-SQL-3A)

Kodda kullanılan eski tablo adlarını canlı/kanonik adlarla hizalar. YALNIZ kod
düzeltmesi — migration/SQL/şema değişikliği YOK, production'a yazma YOK. İş mantığı
değişmedi (sadece .from() hedefi + kolon paritesi doğrulandı).

Parite doğrulandı → hizalandı:
- system_configs → runtime_policies (superAdminService getSystemPolicies/updatePolicy);
  kolonlar id/key/name/value/unit/updated_at canlı runtime_policies'te mevcut.
- linking_codes → vehicle_linking_codes (website vehicle/code API);
  insert {vehicle_id, code, expires_at} canlı şemayla birebir uyumlu.

Parite YOK → KAPSAM DIŞI (raporlandı):
- push_subscriptions → vehicle_push_tokens: kod endpoint/subscription/user_id +
  onConflict:'endpoint' kullanıyor; canlı tablo fcm_token/platform/vehicle_id (FCM≠Web Push).
  Kör rename akışı kırardı → DOKUNULMADI.

- src/__tests__/supabaseNameDrift.test.ts: .from() hedeflerini kilitler (mock) +
  eski adların aktif kod yolunda kalmadığını ?raw kaynak-kilidiyle doğrular.

Dokunulmadı: remote_commands · memberships/tenant · radar_reports/raw_community_events ·
sentry_clips (bucket). tsc -b temiz · eslint temiz · 2493 test yeşil (23 bilinen env-gated) ·
production build yeşil.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fauew13VP3vbfKqnocPdfX
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
car-launcher-pro Ready Ready Preview, Comment Jul 10, 2026 4:39am
carospro Ready Ready Preview, Comment Jul 10, 2026 4:39am

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