Commits
2026-09-19
fix(bridge): 🧵 3.11'in wait_for'u iptali yutuyordu — köprü kapanmıyorduAhmet Kaan Gümüş · a4b3874
fix(bridge): 🧵 3.11'in wait_for'u iptali yutuyordu — köprü kapanmıyordu
`asyncio.wait_for`, Python 3.11'de dışarıdan gelen iptali (CancelledError)
tam içteki awaitable BİTTİĞİ anda gelirse YUTAR ve sonucu döndürür:
except CancelledError:
if fut.done():
return fut.result() # 3.12+ bu dalı taşımaz (bkz. 3.14 tasks.py)
`register()` kayıt selamlaşmasını bu çağrıyla okuduğu için, dışarıdan gelen
iptal (testlerde `gorev.cancel()`) selamlaşma okumasıyla yarışı kaybedince
iptal yutuluyordu: `run_forever` iptal edilmemiş gibi davranıp
`wait_closed()`ta asılı kalıyor, bağlantı hiç kapanmıyordu. Test de
`await gorev` ile onu beklediği için kilitlenme oluşuyordu — CI'da iki QUIC
testi (test_kayit_hello_ile_yalniz_rag_yeteneklerini_ilan_eder,
test_yanlis_parmak_izi_baglanmaz_dogrusu_baglanir) faulthandler'ın 120 sn
zaman aşımına kadar asılı kalıyordu; 3.14'te aynı süit geçiyordu.
- `BridgeTransport.register()` ve `read_blob()`: `wait_for` yerine
`asyncio.timeout` — iptali aynen geçirir, zaman aşımı yine TimeoutError.
- Aynı sınıf süpürüldü: http ara katmanının istek son-tarihi de
`asyncio.timeout`a geçti (istemci kopması/sunucu kapanışı da yutulmasın).
- Testlerde iptal bekleyişi sınırlandı (`_iptal_et_ve_bekle`): yutulan bir
iptal artık asılı kalmaz, 15 sn sonra ADIYLA AssertionError verir; CI'ın
kendi `timeout`/faulthandler katmanı yerinde kalır.
Ölçüm (3.11 venv): iki test önce `Timeout (>25.0s) from pytest-timeout` ile
düşüyordu, sonra 1,55 sn; tam `tests/unit` 3.11'de 1400 passed/34 skipped,
3.14'te 1400 passed/34 skipped. Fix'siz ağaç + yeni test dosyası 15 sn'de
adlandırılmış AssertionError ile düşüyor (regresyon boş değil).2026-09-18
✨ feat(bridge): serve rag.summarize and rag.questions over hab/2Ahmet Kaan Gümüş · d70189f
✨ feat(bridge): serve rag.summarize and rag.questions over hab/2
Two one-shot, scope-addressed capabilities join the dial-in contract: the
backend sends {scope{sinif,ders,pages,span_ids,scope_label}, asker,
asker_role} (+ n/difficulty/seed_question) and the dispatcher routes them
to the already-implemented RagService.summarize / generate_questions.
The service dict carries role.sinif + role.ders_list (these paths have no
pair list, so can_access reads the legacy fields) and user=asker for the
budget counter. Reply mapping tolerates every refusal shape; question rows
keep the service's own soru/cevap/zorluk keys.✨ feat(bridge): 🧩 rag.index served end to end — blob reads, note index, chat channelAhmet Kaan Gümüş · 0877e45
✨ feat(bridge): 🧩 rag.index served end to end — blob reads, note index, chat channel The live service advertised `rag.index` and then typed-refused every request (`index_path_unwired`), so the note "Özet oluştur" surface could never fill: the backend stored no `rag_output` row. The refusal is gone; the capability is now served for real. * transport: `read_blob()` opens the client-initiated stream the contract names (one `BlobRequest` → `BlobResponse` header → exactly `size` RAW bytes), bridged from the executor thread by `_LoopBlobReader`; the transport installs it on the dispatcher at registration. * indexing (`service/notes_index.py`): the note's own title+content always, plus every attachment read over its own blob stream — PDFs through the corpus's own canonical loader, plain text decoded directly — chunked, embedded in one pass (`embed_both`), and written into the school's note index. * store (`index/notes.py`): one bucket per school, `replace_note()` swaps a note's rows as a unit (a re-index cannot duplicate); `rag.chat` merges this channel's ranked hits into the subject corpus's (`Generator(note_index=…)`), with `chunks_by_id`/`span_meta` consulting the live index through `NoteAwareChunks`. * one refused attachment never aborts an index: the note body lands, the answer names what failed (`failed[]`), and the reply echoes `files[].id` so the backend can stamp the doc id it minted. Honest limit (documented in `index/notes.py` and PROJECT_STATE): a note's (class, subject) is not on the wire — the payload carries the course uuid only — so the note channel is school-scoped; the (class, subject) gate cannot be applied to it. The note index is in-process: a restart loses it and the next note edit re-dispatches. Tests: `test_bridge_transport.py` runs the acceptance path against the fake QUIC backend (blob bytes served on a client stream, `files[0].id` echoed) and proves a refused blob is reported, not fatal; `test_notes_index.py` covers the offline indexing path (body-only, re-index dedup, failure isolation, school filter, `rerank_select` compatibility). Pre-fix run (src stashed) shows `'index_path_unwired' != 'malformed'` plus both acceptance tests failing. Unit suite: 1387 passed, 34 skipped. PDF branch smoke-checked against a real 4.5 KB textbook PDF (15 units → 5 children).
2026-09-17
feat(bridge): 🛰️ hab/2 QUIC taşıması — rag.chat telden servis edilirAhmet Kaan Gümüş · ab15dc3
feat(bridge): 🛰️ hab/2 QUIC taşıması — rag.chat telden servis edilir Backend QUIC sunucusudur, servis dial-out eder; eksik olan taşıma yazıldı: - transport.py: sertifika (GET /ai/certificate, HER yeniden bağlanmada) + ALPN hab/2 + Hello/Greeting + QUIC PING + gelen Request'i transport-bağımsız dağıtıcıya verme + üstel geri çekilmeyle SINIRSUZ yeniden bağlanma. Boot politikası: backend yokken süreç çıkmaz, bekler, backend gelince kendiliğinden kaydolur. TLS: AI_TLS_FINGERPRINT doluysa pinlenir (uyuşmazsa bağlanılmaz), boşsa TOFU + her açılışta uyarı. - contract.py: el sıkışma/çerçeveleme sabitleri, build_hello/parse_greeting, encode_frame/FrameStream (uzunluk öneki gövde ayrılmadan ÖNCE denetlenir). - İlan edilen yetenekler rag.chat + rag.index'tir; chat.reply KARŞILANIR ama İLAN EDİLMEZ (o yetenek chatbot'undur). rag.index hâlâ TİPLİ REDDEDER (index_path_unwired) — sahte bir tamam yok. - Testler ağ/DB olmadan: sahte QUIC sunucusu (tests/unit/_fake_bridge.py, src.bridge'ten BAĞIMSIZ yazıldı) ile kayıt, okul eko'su, tipli redler, kopma sonrası yeniden kayıt, backend-yokken boot, yanlış pin reddi. - requirements.txt: aioquic (kardeş servislerle aynı taşıma).