forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to tests/ai_protocol.rsClear filter

2026-09-23

✨ feat: school identity is the uuid; drop the slugAhmet Kaan Gümüş · 2918040
✨ feat: school identity is the uuid; drop the slug

The school slug is gone from every surface: the session cookie prefix,
the /schools/{id} builder routes, FILES_PATH blob dirs, the hab/2 frame
school value, DTOs, and the /limits contract. SchoolId::try_parse is the
one wire parse (hyphenated uuid only); a non-uuid frame school answers
unknown_school. Register gets a public picker via the new unauthenticated
GET /auth/schools returning active [{id, name}]. The control migration
drops school_slug and the slug column, which invalidates every existing
session — old cookie prefixes cannot resolve.
Local-Gate: 3fafffd98aec59c68e2606833b87785d0abf2fee (1510 passed, 425s)

2026-09-17

🧪 test: a hang names itself - bounded frame waits + nextest slow-timeoutAhmet Kaan Gümüş · b7a8017
🧪 test: a hang names itself - bounded frame waits + nextest slow-timeout

One unbounded await in a bridge test held CI's Test step for 3h38m (run
35251780342), and because Deploy is serialized behind that job every later
push queued behind it. Two bounds, both naming the culprit:

* .config/nextest.toml: slow-timeout 120s, terminate-after 2 — a test that
  makes no progress is terminated and reported by name instead of hanging.
* every frame read and client handshake in the bridge tests (ai_bridge,
  ai_protocol, podcast) goes through frame_or_fail/connect_or_fail, which
  panic with the wait's name after 10s instead of blocking forever.

Local evidence: cargo nextest run --test ai_bridge --test podcast -j 16 ->
110 tests run: 110 passed in 41.2s.
✨ feat: ZEKA no longer touches the database directly - the insight.* storage surfaceAhmet Kaan Gümüş · 7c96e47
✨ feat: ZEKA no longer touches the database directly - the insight.* storage surface

No AI service may hold a school database credential, so the nine reads and
writes ZEKA performed against its own zeka_* tables become named operations
the backend serves: insight.summary|recommendation|segment|profile|run.upsert,
insight.pending.list, insight.retention.sweep, insight.departed.purge and the
deployment-scoped insight.schools.list.

They ride a new client-initiated capability call (CapabilityRequest ->
CapabilityResponse, mirroring Request/Response field for field) and are
mounted as HTTP doors on the same functions (manager+; the school directory is
the builder's, outside the school gate). Every statement runs inside the
school the frame named, in one transaction per batch.
fix: 🧪 the three gates the merged /rag tree left redAhmet Kaan Gümüş · ebffd41
fix: 🧪 the three gates the merged /rag tree left red

- the rag.chat byte pin now expects serde's real field order (the wave-1 test
  was compiled but never executed)
- /rag joins the gated-nest list the route guard checks by name
- README's endpoint table regenerated after the /ai/capabilities security
  annotation landed
- ignore src/graphify-out, where the graphify hook writes inside the tree
✨ feat: add the /rag nest over the course-note RAG bridgeAhmet Kaan Gümüş · a61e0a6
✨ feat: add the /rag nest over the course-note RAG bridge

A separate rag_thread/rag_message pair of tables and a Module::Chatbot gated
/rag nest, mirroring the chatbot's asynchronous send: POST answers 202 with a
pending assistant row, an in-process task settles it, and both the poll read
and the SSE stream project a stale pending row as failed.

Every question is scoped server-side to the asker's own (sinif, ders) pairs —
class-section instances, a linked parent's children, school-wide club/study memberships
— never from the body. Each citation's corpus doc_id is resolved per candidate
to a course-note file the asker may view, and the two storage caps refuse an
over-bound reply whole rather than clipping it. rag.index replies now stamp
each file's rag_doc_id, the missing link between a citation and its file.

The chatbot's SSE helpers move to web/mod.rs so both nests stream through one
implementation, and the instance/course visibility gates move from web to
service so the scope deriver and the routes share one rule.

Gates: cargo check --all-targets, clippy -D warnings, limits_completeness,
spec_bounds, doc_sync (README regenerated), protected_routes_require_session
(MIN_PROTECTED 269 -> 318, the real swept count), ai_bridge (75 tests).
✨ feat: publish the rag.chat payloads and a GET /ai/capabilities probeAhmet Kaan Gümüş · 94cffa0
✨ feat: publish the rag.chat payloads and a GET /ai/capabilities probe

Add the rag.chat capability's wire contract (scoped question -> answer with
citations), the max-scope-pairs and rate-limit constants, and an authenticated
discovery route listing each capability's connected worker fleet. Document the
payloads and the rag.index reply's file<->doc_id echo in the README.

2026-09-16

✨ feat: the class×course instance is the academic anchor (K-12 remodel)Ahmet Kaan Gümüş · ae84034
✨ feat: the class×course instance is the academic anchor (K-12 remodel)

`course` was a school-wide singleton: enrollment, exams, sessions,
roll-call and homework all keyed on it, so two class sections teaching the same
course shared one roster, one exam set and one timetable. This moves the
academic anchor to `class_course` — the per-class instance — and rebuilds
the academic model around Turkish K-12.

Schema (migrations/school/20260916000001_k12_remodel.sql): `class_course`
becomes an instance (ders_saati, counts_toward_karne, enrollment_count,
class_course_teacher); enrollment re-keys to (class_course, app_user);
exam carries class_course + term (+ exam_audience for shared exams);
course_session / session_attendance / homework re-key; `class_member` is a
soft-leave history table (uuid PK, joined_at/left_at, partial unique index
on the live stint); `academic_year` sits above `term`; `class_group` links
a year, not a term; new `course_membership` (clubs/study), `karne_snapshot`;
settings gain branches/excuse_kinds/absence limits/timezone; profile gains
branch. Drops/recreates the identity-changing tables (pre-customer; the
migration resets every counter on a kept table that pointed at a dropped
one).

Layers: domain/db/service/web rewritten to the instance seam, with
`ensure_instance_teacher` gating instance writes (D10), the report card computed per
instance and weighted by ders_saati, an absence report, `/instances`
and `/academic-years` nests, and `/classes/{id}/instances`. Capacity and
the seat-claim 409 are gone; detach sweeps the whole instance subtree and
unlinks its blob keys.

Gates: cargo check --all-targets, SQLX_OFFLINE check (cache regenerated),
doc_sync, spec_bounds, limits_completeness, clippy -D warnings all green;
cargo nextest run 1370/1370.

2026-09-14

✨ feat: compose-stack deploy plus in-tree schema workAhmet Kaan Gümüş · 57fad2c
✨ feat: compose-stack deploy plus in-tree schema work

Production deploy is podman compose (postgres + backend + openobserve)
instead of a systemd binary. CI stays a throwaway postgres sidecar.
Operator credentials live in ~/hezarfen_backend/hezarfen_backend.env
(0600); the deploy never writes that file.

Also lands the working-tree schema/junction and .sqlx updates that were
already sitting next to this change.

2026-09-12

🧪 test: port e2e, rate_limit, ai_bridge, ai_protocol to the Postgres harnessAhmet Kaan Gümüş · e0e3597
🧪 test: port e2e, rate_limit, ai_bridge, ai_protocol to the Postgres harness

e2e: spawn_server_with_ai re-pointed at init_test_tenants; the board
helpers read and seed through runtime sqlx (stroke ids, payloads,
epoch, participants roster); promote writes app_user; ULID literals
became common::ABSENT_ID.

rate_limit: the durable-window trio stands on one control database's
rate_limit table (two UserRateLimiters, pools dialed before the clock
freezes); fold reads are query_scalar; the down-database leg takes the
fold's table away and hands it back instead of flipping the deleted
health flag; embedded-engine caveats deleted.

ai_bridge/ai_protocol: bootstrap renames plus the chatbot history seed
inserted over sqlx; the down-socket test outages the school registry
table and recovers, keeping both original assertions.

src/rate_limit.rs: rebuilt the wave-1-deleted epoch-roll unit test
(a_wall_epoch_roll_charges_no_request_twice + its admits helper) over
the control database, driving sync_once's epochs directly.

2026-09-07

✨ feat: OpenTelemetry bootstrap — OTLP traces/metrics/logs, request spans, request idsAhmet Kaan Gümüş · 057a7fa
✨ feat: OpenTelemetry bootstrap — OTLP traces/metrics/logs, request spans, request ids

Telemetry is off unless OTEL_EXPORTER_OTLP_ENDPOINT is set, mirroring the
AI bridge's "off unless configured" shape. With it unset the process logs
exactly as before; every instrument binds to the noop meter provider, so
call sites never branch on whether telemetry is on.

Privacy is the design constraint (KVKK): a span carries the method, the
route TEMPLATE, the status, a random request id and the school slug —
never a user, an IP, a URL path, a body, a header or a cookie.
tests/telemetry.rs fails the build if a forbidden attribute key appears.

New variables (all documented in .env.example):
  OTEL_EXPORTER_OTLP_ENDPOINT   presence turns export on
  OTEL_EXPORTER_OTLP_PROTOCOL   grpc (default) | http/protobuf
  OTEL_EXPORTER_OTLP_HEADERS    read by the SDK
  OTEL_SERVICE_NAME             read by the SDK, defaults hezarfen_backend
  OTEL_TRACES_SAMPLER(_ARG)     read by the SDK, parent-based always-on
  LOG_FORMAT                    pretty (default) | json; anything else refuses to boot
  DEPLOY_ENV                    deployment.environment.name

Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s

2026-09-05

✨ feat: per-school modules; a disabled module answers 403 on every route in its nestAhmet Kaan Gümüş · 5d7f87c
✨ feat: per-school modules; a disabled module answers 403 on every route in its nest

Twenty-one modules, one per router nest, with an explicit dependency graph
derived from the record links (exams need courses and subjects, marks need
exams, …) and four packages for the catalog. The enabled set lives on the
school's control row and rides the tenant resolution that already happens
once per request; every nest carries a route_layer gate, the four child
creates inside /courses are gated by their own module, and the AI blob
stream refuses `module_disabled` when course notes are off.
🎨 style: cargo fmtAhmet Kaan Gümüş · 2bf64d3Browse files
✨ feat: AI bridge speaks hab/2; every frame names its schoolAhmet Kaan Gümüş · cedd07f
✨ feat: AI bridge speaks hab/2; every frame names its school

The shared AI fleet now serves every school: `Request`, `ApiRequest` and
`BlobRequest` carry `school`, responses echo it, api-reads and blob opens
resolve that school's database and files, and rag answers land in the same
school. New refusals `unknown_school` / `school_suspended`; hab/1 is rejected
at ALPN and at `Hello`.
✨ feat: one database per school behind a control registry; login names the schoolAhmet Kaan Gümüş · b7dfc0c
✨ feat: one database per school behind a control registry; login names the school

Namespace `hezarfen` now holds one DATABASE per school (name = slug) plus a
`control` database with the school registry, builder accounts and builder
sessions. `Tenants` keeps one separately-connected handle per school; the
shadow `web::tenant_state::State` resolves the school from the
`<slug>.<token>` cookie so every handler's `st.db` is school-scoped by
construction. `POST /auth/login` / `register` carry `school`; a suspended
school answers 403 everywhere. `BUILDER_USERNAME`/`BUILDER_PASSWORD` seed the
vendor account; the boot admin seed is gone. No customers, no compat shims.
✨ feat: course-note file bytes stream to AI services over QUICAhmet Kaan Gümüş · 6d3456a
✨ feat: course-note file bytes stream to AI services over QUIC

A service opens a client-initiated bidi stream and writes one
`BlobRequest {id, file, on_behalf_of?}` — told apart from an `ApiRequest`
by its required `file` (vs `path`), api read tried first so every frame
that parsed before still does. The backend answers one header frame
`BlobResponse` tagged by `status`: `ok {id, name, content_type, size}`
then exactly `size` RAW bytes (streamed off disk, no length prefix, the
8 MiB frame cap does not apply) then FIN; or `err {id, code, message}`
followed by nothing.

Authorization is the api-read principal model plus the very guard
`download_file` carries: `on_behalf_of` re-read live, then the file's
note and that note's course through `can_view_course`. Scope is
`course_note_file` only, so a personal note's file id reads `not_found`.
Codes: `not_found`, `forbidden`, `unknown_user`, `unavailable`.

`RagIndexPayload` gains `author` so a service knows who to read as.

Ref #27

2026-08-12

2026-08-11

🤖 feat: tell the AI service which role is askingAhmet Kaan Gümüş · d5def02
🤖 feat: tell the AI service which role is asking

The chatbot has to answer a student differently than a manager, but
the bridge payload never said who was on the other end — only the
prompt and the turn history crossed. Carry the asker's school role
with the request so the service can scope its answer.

The role is read live off the authenticated session on every request
and there is no DTO field for it, so a client cannot claim a role it
does not hold. It rides as a bare lowercase slug from Role::as_str(),
named asker_role rather than role so it is not confused with the
message-author role already on each history turn.

Breaking for the AI services: the field is required, so they must
read it before this binary goes up.

2026-07-24

⬆️ chore(deps): bump all dependencies to latestAhmet Kaan Gümüş · 43e9f86
⬆️ chore(deps): bump all dependencies to latest

Major bumps: axum-extra 0.10→0.12, tower-http 0.6→0.7,
getrandom 0.3→0.4, base64 0.22→0.23, reqwest (dev) 0.12→0.13.
Plus axum 0.8.9, surrealdb 3.2.3, tokio 1.53.1 and transitive
updates via cargo update. No API breakage; full suite green.

Also drop a stale mut in tests/ai_protocol.rs (unused_mut warning).

2026-07-23

✅ test(ai): bridge behaviour + hab/1 wire contractAhmet Kaan Gümüş · 574b614
✅ test(ai): bridge behaviour + hab/1 wire contract

Two suites, both driving real quinn clients over real TLS on loopback.

ai_bridge covers the transport: registration, capability routing, 12
concurrent requests gated behind a barrier (which deadlocks if they are not
genuinely multiplexed), every rejection code, timeouts and slot release,
disconnect/reconnect, certificate pinning with both the right and the wrong
certificate, and a 512 KiB multi-packet payload.

ai_protocol covers the wire, and imports none of the crate's protocol types:
frames are byte literals and answers are parsed as untyped JSON, the way a
Python service would. That separation is the point — ai_bridge shares the
Rust structs with the backend, so it is structurally blind to wire changes.
Mutation-checked: a serde-only rename of deadline_ms and a big-endian to
little-endian framing flip each leave ai_bridge fully green while
ai_protocol fails.

It pins the exact key sets of every frame, all reject-code and status
spellings, refusal of an unpublished status tag, acceptance of unknown fields
in both directions (a newer service must run against an older backend),
byte-for-byte payload passthrough across eight JSON shapes, unique request
ids, out-of-order answers landing on the right caller, and a request stream
torn down once its deadline passes. Its raw module doubles as the reference
client implementation for a new service repo.