forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to service/src/capabilities.pyClear filter

2026-09-22

fix(report): drop ReportSchool.slug; school identity is the uuidAhmet Kaan Gümüş · a79354b
fix(report): drop ReportSchool.slug; school identity is the uuid

The backend no longer sends slug on the report-school payload. A stray slug key is ignored, and docs plus ZEKA_SCHOOLS examples name the hyphenated school uuid.

2026-09-18

fix(report): label the Sube cells with class names, never raw idsAhmet Kaan Gümüş · 440bab7
fix(report): label the Sube cells with class names, never raw ids

The live school report printed `01a0b1a6-...` in every Sube cell: the
summaries carry class IDS and the document had nothing else to print. The
backend now sends the school's class list as a sibling key
(`classes: [{id, name}]`, `all_classes`), so the document prints the name a
manager recognizes.

- report package: `StaffBundle.class_names` (id -> display name) threaded
  through `load_staff_bundle` / `load_bundle`; `build._class_labels` maps the
  ids, and an unmapped id becomes `text.CLASS_LABEL_UNKNOWN`
  ("Adi bilinmeyen sube"), never the raw id. An absent map (older backend)
  uses the same label and still builds the document.
- identity vs label: the Sube x ders table still buckets by class IDENTITY
  (two classes whose label is the fallback cannot merge into one row) and
  sorts by the DISPLAY name; the overview's Sube count counts identities, so
  labelling never moves a number.
- handlers.report accepts `classes: [{id, name}]` (the backend's shape,
  preferred) and `class_names: {<id>: name}` as a fallback; a malformed list,
  or an entry with no usable id, is `bad_request`. The log line carries
  `sinif_adi_yok=<n>` so a missing or stale map is visible outside the
  document.
- capabilities: the pin flips -- the backend's constant (constant.rs:645),
  its dispatch and `POST /runs/{run_day}/report` all landed 2026-09-18, so
  `insight.report` joins BACKEND_CALLABLE_CAPABILITIES.
- docs: the label rule and the `classes` key in `## insight.report`,
  RAPORLAR.md rule 9 + limit 7, CIKTI-SOZLESMESI.md status line.
- tests: fixtures now carry class IDS plus a name map; they pin names over
  ids, name-order sorting, both payload shapes, the unmapped and the
  absent-map fallbacks, and the malformed-list refusal. Five of them fail
  pre-fix (stash probe).
feat(insight): serve the school report document as insight.reportAhmet Kaan Gümüş · 1d00d9d
feat(insight): serve the school report document as insight.report

The fourth served capability, and the only `insight.*` handler that reads
nothing over the bridge: the backend reads its own `zeka_*` rows and
dispatches them, and the service renders the school report from the payload
alone -- no store, no database (standing rule).

- capabilities: INSIGHT_REPORT plus the ReportRequest/ReportResponse
  contract. It stays OUT of BACKEND_CALLABLE_CAPABILITIES: the service side
  is ready, the backend's dispatch table has no sender for it yet. The tuple,
  the test pin and the `## insight.report` status line flip together.
- handlers.report: `kind` is `okul` (the other report types have no request
  contract and are refused by name); rows arrive as the backend's own row
  structs and are stamped with the frame's school -- a row claiming another
  school is refused, not overwritten; `run_day` comes from the request or the
  newest run row; the HTML rides in the response frame, capped at half the
  8 MiB frame limit.
- refusals are typed for the backend to map: bad_request, insufficient_rows,
  document_too_large, internal. Never a half-built, and never a truncated,
  document.
- docs: `## insight.report` contract table in BACKEND-GEREKSINIMLERI.md.
- tests: tests/test_report_capability.py drives the handler end to end with
  rows built by the production writers (no `school` key, exactly what the
  backend sends) and covers every refusal path; fails 6+6 pre-fix.
feat(insight): 🔑 reads run as the dispatch's requester, refusals stay typedAhmet Kaan Gümüş · d57406c
feat(insight): 🔑 reads run as the dispatch's requester, refusals stay typed

Every insight.* read went out as the bridge's synthetic `ai` principal, which
the backend deliberately lets see no course (ai/server.rs:853-867), so
/marks/{user}, attendance, pomodoro, profile and the homework report all came
back 403 or empty -- a dispatched analysis could not read its own data.

`requested_by` now travels on every insight.* payload; the service threads it
as `on_behalf_of` through every requester-observing read (Source gains the
parameter on each method; run_school, discover_students, _fetch_student and the
class roster pass it down). The one deliberate exception is the per-student
`/homework` feed behind `upcoming`: it keeps impersonating that student,
because the requester's view is the whole school's homework and would pollute
one student's profile with other students' due dates. A missing `requested_by`
(older backend) keeps today's behaviour and logs the fallback loudly once per
dispatch -- the service never refuses work for a missing field.

A read that still hits HTTP 401/403 is no longer a bare exception: SourceError
carries a typed `not_permitted` with path+status, and the answers surface it in
`coverage.unavailable.permission` / `failed[]`, so a caller can tell "the
requester may not read this" from "the service broke".

Tests: `RequesterIdentityTests` records (method, on_behalf_of) per read and
asserts per path -- requester reads as requested_by, the per-student /homework
as the student, the school-wide roster read as requested_by, the fallback as
None with a log line, and a 403 as the typed signal. 685 pass (63 skipped).
feat(capabilities): 🔌 register the insight.* handlers and gate the Hello frame on themAhmet Kaan Gümüş · 618a44d
feat(capabilities): 🔌 register the insight.* handlers and gate the Hello frame on them

The dispatch table was empty while the Hello frame announced three names, so
every dispatched insight.student / insight.refresh was answered
`unknown_capability` -- live, against the deployed backend. handlers.wire()
registers all three on the runtime path (bridge.run_once), and
capabilities.verify_dispatchable() refuses to boot when an advertised name has
no handler, so advertising and dispatch cannot drift apart again.

- insight.student: one student, computed and written now; `since` moves the
  attention window's term start, `sections` narrows the four summary modules
  (an unrequested module is written `null` = "not computed", which the
  backend's SummaryRow keeps apart from `{}`).
- insight.class: the course roster derived from that course's addressed
  homework (the only id source the bridge read allowlist exposes), computed as
  a cohort; `topic_gaps` stays empty and `coverage.unavailable` says why.
- insight.refresh: the school sweep through run_school(nightly=True), so the
  zeka_run ledger row that GET /insights/runs serves is written (running +
  verdict). A discovered roster also purges departed students and sweeps
  retention; `user_ids` is a subset, not a roster, and never purges.
- run_school gains nightly/sections/outcomes; a scoped compute writes no
  ledger, no purge and no sweep. Purge is now gated on a discovered roster,
  which also closes the silent data-loss path in `cli --students`.

Tests: tests/test_handlers.py (fail-pre-fix dispatch, contract fields per
capability, boot self-check, scoped-refresh no-purge); the truth pins in
tests/test_capabilities.py and the purge expectations in test_pipeline.py are
updated to the merged backend dispatch (insight.student + insight.refresh
sent, insight.class still not).

2026-09-17

docs(capabilities): 🧭 acilis satiri iki yonu ayiriyor (cagrilabilir vs depo yolu)Ahmet Kaan Gümüş · 3c46936
docs(capabilities): 🧭 acilis satiri iki yonu ayiriyor (cagrilabilir vs depo yolu)

Acilis log satiri hala "backend'in tanidigi: chat.reply, rag.index; 3 yetenek
TANIMSIZ" diyordu. `BACKEND_KNOWN_CAPABILITIES` zaten backend'in ZEKA'ya
`Request` GONDEREBILDIGI adlarin listesiydi; ama depo yolu (`insight.*`,
istemci-baslatimli) 2026-09-17'de acildiktan sonra satir "backend insight'i hic
bilmiyor" diye okunuyordu -- iki operatoru yaniltti.

- Sabit `BACKEND_CALLABLE_CAPABILITIES` olarak yeniden adlandirildi; anlami
  belirsiz birakmiyor (cagrilabilir = sunucu-baslatimli yon).
- `summary()` iki yonu AYRI soyluyor: cagrilabilir kume + "servis->backend depo
  yolu: kopru/insight.* -- bu liste onu kapsamaz" + servis tarafi islerin HENUZ
  cagrilmadigi.
- Modul dokumani iki yonu numarali tanimliyor; sabitin kapsamadigi yon acikca
  yazili.
- `tests/test_capabilities.py`: `test_backend_can_call_none_of_them` (ayni
  kesisim-bos gercegi) + `test_summary_names_the_callable_direction_only` (yeni
  ifade; eski "TANIMSIZ" metni geri gelirse duser).
- Ayni sinif metinler supuruldu: `docs/BACKEND-GEREKSINIMLERI.md` (Madde 1
  basligi + DURUM notu), `README.md` (iki madde), `paket/OKU.md`,
  `docs/CIKTI-SOZLESMESI.md`.

Kapi: `scripts/ci-yerel.sh --konteyner` -> BUTUN KATMANLAR GECTI (667 test OK,
63 atlandi; konteyner kosu kaniti + compose denetimi dahil).
♻️ refactor: ZEKA'yı köprü deposuna taşı — veritabanı erişimi tamamen kaldırıldıAhmet Kaan Gümüş · d98ed4b
♻️ refactor: ZEKA'yı köprü deposuna taşı — veritabanı erişimi tamamen kaldırıldı

Değişmez kural: bir AI servisi uygulama veritabanına asla doğrudan erişmez.
ZEKA'nın kendi deposu yoktur; hesapladığı her satır ve okuduğu her liste
backend'e QUIC köprüsünden `insight.*` yetenek çağrısıyla gider.

* silindi: pg_client.py, store_pg.py, tenants.py, store_factory.py,
  schema/, psycopg bağımlılığı, ZEKA_PG_DSN ve ZEKA_DB_*/ZEKA_SCHOOL_* knobs
* yeni: store.py köprü deposu (BridgeStore + okul kapsamlı SchoolStore,
  BridgeCaller seam, 500'lük gruplar, 2 deneme + atla -> partial), protocol.py
  yetenek çerçevesi, bridge.call_capability
* açılış hiçbir şey açmaz; backend yokken loglanır ve geri çekilerek denenir
* yazma düşerse koşu partial olur, okulun günü kapanmaz ve `store`
  failed_modules ile koşu defterine yazılır (kalıcı kayıt)
* okul listesi backend'den (insight.schools.list); ZEKA_SCHOOLS yalnız filtre
* CLI/compose/env/docs: DSN ve şema yükleme yolları kaldırıldı
feat(tenants): 🏫 ZEKA'yı çok okullu yap: kontrol DSN'i, okul başına veritabanıAhmet Kaan Gümüş · 1fd6960
feat(tenants): 🏫 ZEKA'yı çok okullu yap: kontrol DSN'i, okul başına veritabanı

ZEKA_PG_DSN artık KONTROL veritabanıdır; her okulun çıktısı kendi veritabanına yazılır. Ad backend'in kendi kuralından türer ({kontrol}_school_{uuid}, tenant.rs:112) ve slug'dan uuid'ye çözümleme kontrol veritabanındaki school satırından yapılır (TTL'li tek sorgu, okul başına N+1 yok). Desene güvenilmez: kütükte olmayan okul reddedilir.

Okul havuzları SINIRLIDIR: ZEKA_MAX_SCHOOL_POOLS (vars. 8) + ZEKA_SCHOOL_POOL_TTL_SECS (vars. 900s), LRU tahliye ve tahliyede bağlantının GERÇEKTEN kapanması (pg_stat_activity ile ölçülür).

Açılış okul satırı istemez, okul veritabanına bağlanmaz: eksik/migrate edilmemiş okul veritabanı İSTEK hatasıdır (unavailable / school_not_migrated), asla kontrol ya da başka bir okula düşülmez. ZEKA_SCHOOLS artık filtredir (varsayılan boş = bütün aktif okullar).

LLM adları filo standardına TEMİZ KESİM: LLM_API_KEY / LLM_BASE_URL / LLM_MODEL_*; eski DeepSeek/SEGMENT_* adları reddedilir.

Kapı: scripts/ci-yerel.sh --konteyner 5/5 yeşil (konteyner kanıtı yeni cok-okullu açılış adımını da ölçer).

2026-09-16

createMuhammet Ozdemir · 98b2423Browse files