Commits
2026-09-25
🧹 chore(rate-limit): raise the shipped budgets 100xAhmet Kaan Gümüş · 51e5c7b
🧹 chore(rate-limit): raise the shipped budgets 100x Default budgets when the env is unset: auth 1000/min per IP, API 30000/min per IP, chatbot 2000/min per user, RAG 600/min per user, keyless overflow 60000/min. An explicit RATE_LIMIT_* still wins. The per-route enforcement census uses a small census budget so CI does not hammer 30000 requests per route; production-scale boundary stays in the in-memory limiter tests.
2026-09-24
✨ feat(limits): publish the holiday PATCH bound, raise the profile section capAhmet Kaan Gümüş · d9d0403
✨ feat(limits): publish the holiday PATCH bound, raise the profile section cap `UpdateHoliday.name` now carries the same published `max_length` its create twin does, so a client validates a PATCH against the same bound the server re-checks — the runtime refusal was already there, only the contract was silent. `MAX_PROFILE_COURSES` goes 20 -> 100: the profile course block became one row per section, and a teacher's sections are their courses multiplied by the classes they teach, so the course-era figure truncated a real timetable. It stays a cap on the response, not on membership — `/courses/me` and `/classes/me` carry the full lists, and the bound is published so a client can page for the rest.
🧪 test(schedule): the materializer, the holiday calendar and section lists end to endAhmet Kaan Gümüş · aa7132a
🧪 test(schedule): the materializer, the holiday calendar and section lists end to end `tests/regress_schedule.rs`: 20 tests over the new surface — holiday CRUD with its role gates and the overlap window filter, dry-run vs apply vs idempotent re-apply, the holiday skip, both coded refusals, the range and candidate caps, `session_time_taken` on a hand-made lesson at a generated instant, and the per-section course lists (catalogue row, `/courses/me`, the profile block, reach filtering). The four generated-lesson tests assert the slot's own weekday, the +180 school zone, the topic fallback chain and the instance's first assigned teacher. One stale pin moved in `tests/integration.rs` (`session_crud_follows_course_management`): it created two lessons of one section at the same instant, a premise the new UNIQUE (class_course, starts_at) wall outlaws — the second lesson now gets its own instant and the assertions about the manager's rights are unchanged. `tests/regress_profile.rs` and `tests/persistence.rs` needed no change. README's generated `## Endpoints` table picks up the five `/holidays` routes and the materialize route.
✨ feat(schedule): holiday calendar, slot topics, and the weekly-plan materializer coreAhmet Kaan Gümüş · 7c481f7
✨ feat(schedule): holiday calendar, slot topics, and the weekly-plan materializer core Schema (migrations/school/20260924000001_holidays_and_materialize.sql): a school-wide `holiday` table over instant ranges, an optional `topic` on both weekly-plan slot tables, and UNIQUE (class_course, starts_at) on course_session so two lessons of one section cannot start together. Domain: `holiday` (name/kind/range newtypes, inclusive `overlaps`) and `calendar` (the school-zone day math hoisted out of web/attendance, which now imports it). `WeeklySlot` carries an optional topic; `overlaps` is unchanged. Db: `holiday` CRUD + overlap-paged list + the materializer's unpaged read; `course_session::insert_many` (one unnest INSERT .. ON CONFLICT DO NOTHING RETURNING, so the reported rows are the rows actually inserted) plus `existing_starts`; a duplicate start on the single-session route now answers 409 session_time_taken instead of a 500. Service: `holiday` pass-throughs and `course_session::materialize` — one transaction, archived-year wall, row lock on the instance, refusals coded instance_has_no_weekly_plan / instance_has_no_teacher, a range cap of 366 days and a candidate cap of 500, holidays and already-scheduled starts skipped and counted, nothing ever deleted. Dry run is side-effect free. The HTTP surface, per-section course lists, and the integration suite follow in later commits.
✨ feat(courses): grade-ladder course templates with per-class overridesAhmet Kaan Gümüş · 450bc8c
✨ feat(courses): grade-ladder course templates with per-class overrides course_offering per (course x grade_level 0..=12), per-class overrides on class_course (nullable scalars + *_inherited flags), subjects/weights/ weekly-plan axis tables, instance_resolve with batched twin, resolved title/description on instance-scoped reads, six new route groups, integration scenario test, README regenerated. Evolution migrations squashed into the base schema (20260912000002_courses + 20260916000001_k12_remodel). Local-Gate: 246daa3fb3ee7b0ff507a95d6ab346bab1333a37 (1556 passed, 455s)
2026-09-23
✨ feat(profile): add gender, address, and emergency contact to the user row Local-Gate: 1f2b0abcf3798a63b2c5365e0d15c9f708f45833 (1523 passed, 430s)Ahmet Kaan Gümüş · f151345
✨ feat(profile): add gender, address, and emergency contact to the user row Local-Gate: 1f2b0abcf3798a63b2c5365e0d15c9f708f45833 (1523 passed, 430s)
✨ 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-22
🐛 fix: scope manager study questions to the school and publish its nameAhmet Kaan Gümüş · 20e856a
🐛 fix: scope manager study questions to the school and publish its name
An admin with no personal class row was dispatched to rag.chat with zero
scope pairs, so every study question abstained. Managers and admins now
get every class-course pair. A rag.index registration replays notes that
have files, because that index is in-memory and a restart wipes it.
GET /school returns {id, name} to every school session. No slug.2026-09-20
✨ feat(users): give students a school-issued student numberAhmet Kaan Gümüş · 777c7df
✨ feat(users): give students a school-issued student number
Every school numbers its students its own way ("1234", "9-B/17"), and the
account carried no field for it: the office kept the mapping outside the
product. The number is now a first-class optional field on the user row,
unique inside the school (per-school uniqueness is the per-school database)
and held by students only.
- migrations/school/20260920000001_student_number.sql: `app_user
.student_number TEXT NULL`, the partial unique index over its non-NULL
values, and a CHECK (student_number IS NULL OR role = 'student'). The boot
sweep applies the file to already-provisioned schools like every other
school migration.
- domain: `StudentNumber`, a validated newtype (trimmed, non-blank, at most
MAX_STUDENT_NUMBER_LEN = 32) in the shape of `Username`, plus the one
spelling of the non-student refusal both the web gate and the database map
answer; `User` carries `Option<StudentNumber>`.
- db: `create_with_role` binds it into the mint; `set_profile` writes it and
maps the index's 23505 to the coded 409 and the row's 23514 to the same 400
the handler gate answers; `set_role_cascade` clears it in the same statement
that leaves the `student` role. The CHECK is what closes the read-then-write
race the handler-side gate cannot see: a profile save carrying a number from
a `student` snapshot while a promotion commits first is refused by the row
itself, and a test pins exactly that (it writes a teacher holding a number
without the CHECK).
- web: `POST /users` and both profile doors (`PATCH /users/me`,
`PATCH /users/{id}/profile`) accept it under the merge semantics the other
patchable fields have (omitted = keep, blank = clear), with the role gate as
a 400 and a duplicate as a 409 carrying `code: student_number_taken`.
`UserResponse` (admin reads, create/patch echoes, `/auth/me`) and `PersonRef`
(pickers, students lists) carry it; the school-wide public profile
deliberately does not — an office identifier is not broadcast school-wide.
- /limits publishes `max_student_number_len`; spec_bounds pins both new
`max_length` annotations and the README's bound count moves to 224.
- tests: the mint and both patch doors — trimmed storage, 33 chars a 400,
whitespace read as absent, a duplicate a coded 409 on both paths, a
non-student a 400, blank clearing, a promotion clearing with the role change
(and a demotion back not restoring it), and the stale-snapshot race at the
db layer.
Evidence: the partial index refuses a duplicate (23505 naming
app_user_student_number) and admits both rows once dropped inside a
rolled-back transaction; with the 409 mapping removed both write paths answer
500 and the tests fail; with the CHECK removed the race test writes the
forbidden row (role: Teacher, student_number: Some(...)) and fails.
Local-Gate: 2c10aae51c575b7f4207fa310d8938070c0fbb80 (1509 passed, 572s)2026-09-18
✨ feat(rag): relay rag.summarize and rag.questions over the bridgeAhmet Kaan Gümüş · 69d4295
✨ feat(rag): relay rag.summarize and rag.questions over the bridge The RAG service has had two study features the backend never dispatched: a scope summary and a set of generated practice questions, each one-shot and addressed to exactly one (sınıf, ders) corpus. - constant.rs: AI_RAG_SUMMARIZE_CAPABILITY / AI_RAG_QUESTIONS_CAPABILITY with 25 s deadlines — a waiting door must finish under the 30 s request envelope; MAX_RAG_QUESTIONS is published at /limits. - ai/rag_study.rs: the two payload/reply contracts and their dispatch, wire-key pinned. - web/rag.rs: POST /rag/summarize and POST /rag/questions over the same QUIC bridge and the same 503 capability gate as the rest of the nest. The asker's (sınıf, ders) pairs come from their memberships; the body only names a target inside them (403/400 otherwise). An abstention is a complete 200; only role_required/scope_mismatch — the backend's own bug — is a 502. README endpoints table regenerated; AI bridge prose extended with both contracts and the honest RAG-side limits. Local-Gate: 852ea13260383ac5c071fce412db110becbcbdde (1505 passed, 473s)
📄 feat(insight): render and serve a school-level report documentAhmet Kaan Gümüş · 541d9b7
📄 feat(insight): render and serve a school-level report document
`insight.report` is the third outbound ZEKA dispatch, and the first that
carries its data: the service may not read a school database, so the backend
reads its own `zeka_*` rows (four new school-wide bulk reads, projected
straight into the serde rows the storage surface already writes) and sends
them in the request. The service renders, the backend stores.
* `POST /insights/runs/{run_day}/report` — manager+, synchronous: build the
payload, dispatch with `AI_INSIGHT_REPORT_TIMEOUT_SECS`, store the returned
HTML under the school's own blob directory (`zeka_report/<day>.html`, temp
name + rename, never a partial file), answer `200` with what was stored.
A run day with no ledger row is a legal request; the service's `notes` say
what it found. Its typed refusals map per class: `bad_request` 400,
`insufficient_rows` 409 `report_empty`, `document_too_large` 413,
`internal` 500, anything else 409 `report_refused`. An empty document is
refused, never persisted — a blank page must not read as a report.
* `GET /insights/runs/{run_day}/report` — manager+, streams the stored
document (`text/html; charset=utf-8`, nosniff, private no-store);
`409 report_missing` when nothing was generated, a day the ledger has never
heard of included.
Both doors share one path (one `routes!(generate_report, serve_report)`), so
no nest or `MODULE_PREFIXES` change; `MIN_PROTECTED` 338 → 340 (derived).
`pump` moves from the podcast nest to `web` as a shared blob-stream helper.
Known gap, reported rather than widened here: the wire `RecommendationRow`
carries no `dismissed_at`, so the service's dismissal gate cannot fire on
this payload.🎧 feat(podcast): the history lists the caller's own episodesAhmet Kaan Gümüş · 6ed7e12
🎧 feat(podcast): the history lists the caller's own episodes GET /podcast/jobs answers the caller's own jobs, newest first, paged via ?limit=&offset= with the shared page envelope — the door a produced episode was missing: without it a finished job is reachable only by remembering which note produced it. Every row is the backend's own podcast_job record plus the title of the course note it narrates, read over the page alone (a second statement, not a join inside the paging statement: the count that pages the list must count jobs). A note that is gone leaves source_title null; duration_secs and finished_at stay null until the episode finishes. The read-side staleness projection applies here exactly as it does on the per-id door, and writes nothing. Tenant scoping is the door's own school database; nobody reads anyone else's jobs.
2026-09-17
📝 docs: rewrite the Turkish comments and doc comments in EnglishAhmet Kaan Gümüş · 7fec874
📝 docs: rewrite the Turkish comments and doc comments in English The Rust repo's own language is English; Turkish had leaked in from the sibling AI services. Translate every comment and doc comment to English using the code's own vocabulary (şube -> class section, dönem -> term, sınıf öğretmeni -> homeroom teacher, ortak sınav -> shared exam, karne -> report card, …). Quoted Turkish letters/words that are themselves the data under test (the text-fold examples in `text_fold`/`settings`, the non-ASCII filename sample) are kept. The README endpoint table is generated from those doc comments, so it is regenerated. AGENTS.md records the convention going forward: Turkish survives only where it is the data under test or user-visible content.
✨ 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.
merge: 🔀 lane/insight + lane/podcast — the zeka insight nest and the podcast relayAhmet Kaan Gümüş · e66cef0
merge: 🔀 lane/insight + lane/podcast — the zeka insight nest and the podcast relay Both lanes append to constant.rs/lib.rs/ai+web mod.rs in disjoint regions; the two conflicts were adjacent-line appends, resolved by keeping both sides. tests/integration.rs MODULE_PREFIXES carries both new nest rows (renamed 23 -> 25) from lane/insight.
✨ feat: ZEKA's insight capabilities — its school schema, the dispatch contract, and the /insights nestAhmet Kaan Gümüş · b0b5e0c
✨ feat: ZEKA's insight capabilities — its school schema, the dispatch contract, and the /insights nest
`hezarfen_zeka` already dials the QUIC bridge correctly and declares three
capabilities the backend did not know (`insight.student`, `insight.class`,
`insight.refresh`), and it writes nine `zeka_*` tables the school schema did
not contain — so nothing could route to it and nothing could read what it
computed. This lands all three missing pieces.
* the migration: `migrations/school/20260917000002_zeka.sql`, the service's
DDL copied verbatim (every FK resolved against the existing school schema:
`app_user`, `course`, `subject` and `exam_question (exam, id)`).
* `src/ai/insight.rs`: the payload contract for the three capabilities,
mirroring the service's TypedDicts, plus the two dispatches the backend can
route today — `compute_student` and `refresh`. `insight.class` stays
contract-only: its request names a course the service would have to
enumerate a roster for, and the bridge's read allowlist carries no member
listing yet (`hezarfen_zeka/service/docs/BACKEND-GEREKSINIMLERI.md` item 3).
* `src/web/insights.rs`: the nest. `POST /insights/students/{id}` and
`POST /insights/refresh` (manager+) queue a detached dispatch and answer
`202` — the service writes its own rows, so a client polls the read routes;
`503` when no worker offers the capability and nothing is queued.
`GET /insights/me`, `GET /insights/students/{id}` (teacher+ narrowed to the
students they reach through a shared instance, or a parent holding a live
link; anyone else reads `404`, never `403`) and `GET /insights/runs`
(manager+) read the tables back. The service's output contract's own gates
hold on the read side: the attention list never reaches the student it is
about, a card's `about` never reaches a student caller, dismissed/expired
cards and `confidence: none` segments are filtered out.
Gated on `Module::Chatbot` like the other two AI nests, with its tag prose in
`src/lib.rs`, the README endpoints table regenerated, and the `.sqlx` cache
refreshed for the seven new statements.✨ feat: the podcast relay — four podcast.* capabilities and their audio streamAhmet Kaan Gümüş · 5a5a483
✨ feat: the podcast relay — four podcast.* capabilities and their audio stream
The backend had no dispatch site for podcast.submit/status/result/cancel, so the service's registration was unreachable. New AI_PODCAST_*_CAPABILITY constants, ai::podcast payload types + dispatch, and a /podcast nest gated on the chatbot module: POST /podcast/jobs (202 receipt), GET /podcast/jobs/{id}, GET /podcast/jobs/{id}/result, POST /podcast/jobs/{id}/cancel. Each door answers 503 with no worker declaring its capability, and relays the service's own refusal code as a status (not_found → 404, not_ready/llm_unavailable → 409, busy → 503, timed_out → 504, transport/protocol/bad_reply → 502).
The produced audio never crosses the bridge: podcast.result answers audio_id as a path relative to PODCAST_OUTPUT_ROOT, which the deployment points at the school's own directory under FILES_PATH, and GET /podcast/audio?path= streams it in bounded 64 KiB chunks out of the school-scoped State's files_path. That door refuses absolute paths, ./.. segments, backslashes, colons and symlinks resolving out of the school's directory with 400, and 401 without a session.
tests/podcast.rs drives all four capabilities over a real QUIC bridge against a fake service, plus the 503s (no worker and no bridge), the refusal→status mapping, the module gate, the session gate, and every audio-door refusal against a file that really exists. README endpoints table regenerated with UPDATE_DOCS=1.
Known pending, owned by lane/insight: tests/integration.rs's hand-written MODULE_PREFIXES needs a (Module::Chatbot, "/podcast") row, so the route-mount gate stays red for /podcast until that row lands.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: announce an exam to sibling instances (shared-exam write surface)Ahmet Kaan Gümüş · 1824c34
✨ feat: announce an exam to sibling instances (shared-exam write surface)
b3f7395 gave `exam_audience` a read role; this gives it its writes. An exam
is owned by the instance it was created on and can now be addressed to
further instances — one sitting, one mark, standing in every addressed
section's exam list, marks report and the report card.
- `POST /exams/{id}/audience` announces the exam to another instance: the
target must teach the exam's own catalog course and sit under the same
academic year (400 otherwise), the owner itself is refused (400), an
archived target year is a 409, and a repeat announce is a no-op 200.
The write needs management rights over the exam's **owner** instance —
the target instance's teachers have no say.
- `GET /exams/{id}/audience` lists the set (owner first, then announcement
order), visible exactly as the exam is; drafts stay a 404 to everyone but
an addressed instance's manager. `DELETE /exams/{id}/audience/{instance}`
withdraws one; the owner's pair is not withdrawable (400) and a pair that
holds no row is a 404.
- Grading, statistics, results and the live monitor now accept teacher+
rights over any instance the exam is addressed to, so an announced-to
section's teacher grades its own students; the monitor's roster read is
deduped by student and ordered, so a sitter in two addressed sections
appears once.
- `sweep_instance_subtree` clears both directions of `exam_audience` before
the rows they name — an exam a sibling announced *here* referenced the
`class_course` row the caller deletes and refused the delete with a 23503.
Tests: regress_exam_delete.rs pins the announce/withdraw surface end to end
(owner-first order, the same-year and same-course 400s, the 409, the no-op)
and the sweep's answer-image blobs — the drawing row's bytes land on disk
and are gone with the row, with a mutation witness.
Gates: prepare_db, SQLX_OFFLINE=true check --all-targets (cache: 1 dropped,
7 added, all audience-shaped), doc_sync, spec_bounds, limits_completeness,
clippy -D warnings all green; cargo nextest run 1385/1385 across 47 binaries.✨ feat: archive an academic year, attribute shared-exam marks, index the new FKsAhmet Kaan Gümüş · b3f7395
✨ feat: archive an academic year, attribute shared-exam marks, index the new FKs
Follow-ups on the K12 remodel:
- `POST /academic-years/{id}/archive` (Manager+): stamps `archived_at`
idempotently, making the existing `academic_year_archived` guard reachable —
every write into an archived year now 409s while reads stay 200. No
unarchive; no PUT.
- Marks and the report card attribute an exam via its `exam_audience` rows, not only its
owner instance: a shared exam's mark now stands in every addressed class section's
report instead of vanishing when the owner instance isn't in the student's
list. Owner-only exams are unchanged (the owner audience row always exists).
- `GET /instances/me` now serves the full visibility set (live member ∪
instance teacher ∪ class-section homeroom), so a teacher's own list is meaningful.
- Migration `20260916000002_k12_indexes.sql` adds the indexes the remodel's
drop/recreate left out: `enrollment(app_user)` (dropped with its table),
`course_membership(app_user)`, and `exam_audience(class_course)` (read by
every per-instance exam read).
Tests: the archived-year e2e now archives via the route; new regressions pin
the sweep's `term.exam_count` release (the term becomes deletable) and the
blueprint sweep's blob unlink, each with a mutation witness; new shared-exam
attribution tests (fail-pre-fix/pass-post-fix for both reads) and the
`/instances/me` union.
Gates: check --all-targets (offline cache regenerated), doc_sync,
spec_bounds, limits_completeness, clippy -D warnings all green;
cargo nextest run 1376/1376.✨ 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.✨ feat: an empty user search lists everyone the caller may seeAhmet Kaan Gümüş · 6cf8640
✨ feat: an empty user search lists everyone the caller may see GET /users/search no longer refuses a blank `q`. Omitted, empty and whitespace-only are the same input now: each returns the caller's visible directory, which is what a receiver picker opens with — staff see the school, while a student or parent still see only the staff they may write to, and naming a role outside that set is still a 403. `role` still narrows, an unknown role is still a 400, and `limit`/`offset` bounds are unchanged. The store already treated a blank needle as "no clause"; this drops the web-layer guard that contradicted it and pins the behavior on both sides (blank == omitted == whitespace-only, and blank still narrowed below staff).
✨ feat: an admin mints a school account directlyAhmet Kaan Gümüş · 57de5b3
✨ feat: an admin mints a school account directly POST /users creates the person plus the school's app_user in one call, born with the role the caller names (student by default) — no self-registration and no register-then-promote two-step. Reuses the register credential rules: a username new everywhere mints the person, an existing person attaches only when the password matches (409 otherwise), a name already taken in the school is a 409, and the reserved staff-reading names are a 400.
2026-09-15
🆔 fix: one id convention — every id is a v7 uuid, none is a v4Ahmet Kaan Gümüş · d40e4c9
🆔 fix: one id convention — every id is a v7 uuid, none is a v4 The crate mints UUIDv7 from the process-wide monotonic generator, but four sites still minted a v4: - ChoiceId (an exam choice's stable id) and the blob names of answer images, bank-question images and homework files: now next_uuid(), like their siblings (question_image already was) - test_suffix()'s 5-hex tail is not an id — it is the random half of a test database's name — so it draws from the OS rng: a v7's leading hex digits *are* the mint time, which is exactly what two processes minting in the same millisecond share - the request-id layer installed tower-http's MakeRequestUuid (a v4); it now mints through the crate's own generator, same wire shape The manifest drops uuid's v4 feature, and a guard test scans src/ so a stray v4 fails the suite. (tower-http's request-id feature still enables uuid/v4 in the dependency graph; nothing here calls it.)
🐛 fix: a school's registry row and its database are never one writeAhmet Kaan Gümüş · 8e58afe
🐛 fix: a school's registry row and its database are never one write
Three consequences of that one fact — partial states the code could leave
behind and nothing could repair.
**A school is `provisioning` until its schema exists** (new control
migration). The row commits before the database does (`CREATE DATABASE` cannot
join that transaction), so a boot cut short in between used to advertise a
school that answered every request with a `500`; the next boot's
`reconcile_provisioning` now finishes it. While it is being made, the school's
own doors refuse it (`403`) and the two builder routes that need its database
(`enter`, `admin-password`) answer `409` instead of a table-less 500.
`provisioning` is the boot's word alone — the PATCH parser still refuses it,
and a client can never ask for it.
**`Tenants::drop` dropped the database last**, after destroying the memberships
and the entitlements: a transient failure left a school that still stood with
every one of its people locked out and nothing able to put them back. The
database goes first (it is the half that can fail on its own — `DROP DATABASE`
cannot join a transaction either) and everything after it is one transaction,
so a failure leaves "database gone, registry rows intact", which re-running the
same call completes.
**`PATCH /schools/{slug}` wrote name and status as two statements**; a failure
between them left half a patch. Both fields are one statement now, with
`COALESCE` over the row being written — an omitted field keeps its stored value
and a concurrent patch of the other field cannot be reverted.
Local: cargo nextest run --no-fail-fast → 1375 passed. clippy clean.
Live: a seeded `provisioning` row comes back `active` with a 70-table database
and the boot logs the finish; lifecycle probe 200/400/201/204 on the running
server; 8-boot template race 8/8 up, 0 refusals; 4-boot race on a fresh control
database 4/4 up.2026-09-14
📝 docs: drop stale process-lock commentsAhmet Kaan Gümüş · 5ff42c5
📝 docs: drop stale process-lock comments PRESENCE_LOCK and the other named process locks are gone. Comments and README still talked as if they serialized writes.
📝 docs: regen PATCH /schools/{slug} endpoint cellAhmet Kaan Gümüş · eaa4976
📝 docs: regen PATCH /schools/{slug} endpoint cell
doc_sync: slug no longer names the database (uuid does).✨ feat: mint OpenObserve OTLP Basic from ZO_ROOT_USER_*Ahmet Kaan Gümüş · 9ce59bf
✨ feat: mint OpenObserve OTLP Basic from ZO_ROOT_USER_* When OTEL_EXPORTER_OTLP_ENDPOINT is set and HEADERS is not, the process builds Authorization=Basic from ZO_ROOT_USER_EMAIL/PASSWORD. No hand base64 in the env file.
🔧 chore: underscore names hezarfen_backend_*Ahmet Kaan Gümüş · 6fecf55
🔧 chore: underscore names hezarfen_backend_* Containers, image, volumes, and the compose user unit follow the crate name. Hyphenated leftovers (hezarfen.service, hezarfen-compose.service) are disabled on deploy.
✨ 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.
🧪 test: spec_bounds rows for split login DTOsAhmet Kaan Gümüş · 612a884
🧪 test: spec_bounds rows for split login DTOs Person-scoped login replaced Credentials with RegisterCredentials, LoginCredentials, and SelectSchool. The bound table still named the old schema, so CI's full suite failed after 50 minutes.
🔧 chore: default HTTP bind port 7656Ahmet Kaan Gümüş · 81ac0fb
🔧 chore: default HTTP bind port 7656 Unset PORT now binds 7656 instead of 8080: parse_port, the user unit, compose, Containerfile, CI health-gate fallback, and README.
2026-09-13
✨ feat: person-scoped login; select school afterAhmet Kaan Gümüş · fae1f79
✨ feat: person-scoped login; select school after Login is username+password only. A person is global, memberships are per-school (role stays on app_user), and POST /auth/school binds when the account belongs to more than one school.
2026-09-12
🧹 chore: drop keepalive-era telemetry instruments + tighten claim-fn visibility; Postgres docs (README/CLAUDE.md); ship migrations/ in the imageAhmet Kaan Gümüş · a2a344c
🧹 chore: drop keepalive-era telemetry instruments + tighten claim-fn visibility; Postgres docs (README/CLAUDE.md); ship migrations/ in the image
2026-09-11
✨ feat: optional student label on pomodoro sessionsAhmet Kaan Gümüş · 54ec62d
✨ feat: optional student label on pomodoro sessions
POST /pomodoro/start accepts an optional {label} body (trimmed, blank
stored as absent, >100 chars rejected). The label rides the finish
re-file, is returned on start/finish and in both log endpoints, and is
published as pomodoro.max_label_len on GET /limits. SCHEMAFULL field
added; pre-feature rows read as no label.🧹 chore: move cap/field_update/page toolkits from domain to new db layerAhmet Kaan Gümüş · 3763468Browse files
🧹 chore: drop stale multi-replica prose; single process is the contractAhmet Kaan Gümüş · 8b8a45d
🧹 chore: drop stale multi-replica prose; single process is the contract
2026-09-08
🧪 fix: request-id bound reaches /limits; registry-read probe no longer depends on span threadAhmet Kaan Gümüş · 282db82
🧪 fix: request-id bound reaches /limits; registry-read probe no longer depends on span thread MAX_REQUEST_ID_LEN sat in src/lib.rs, so the one bound a client can actually hit on a header it sends reached neither GET /limits nor the OpenAPI spec. Moved to src/constant.rs, published as `request.max_request_id_len`, and added to README's /limits sample. probe_registry_reads_per_request counted SurrealDB spans through a thread-local subscriber (`set_default`). tracing caches a callsite's interest process-wide the first time any thread reaches it: under parallel tests that thread is a sibling with no subscriber, so the SDK's callsites were disabled for the whole process before the probe asked and it panicked UNMEASURED (0 in 7 of 8 runs against noisy siblings). It now installs a counting Subscriber globally, with `Interest::sometimes` and an `enabled` that admits only surrealdb callsites on its own thread, so it stores nothing and no sibling test lands in the figure.
2026-09-07
✨ feat: OpenObserve replaces Temps as the telemetry sinkAhmet Kaan Gümüş · 5a1ac42
✨ feat: OpenObserve replaces Temps as the telemetry sink Temps needed a container socket to even start its console, plus a TimescaleDB and a ClickHouse of its own — three services, a locally built image and a socket mount for one dev sink. OpenObserve is one Rust binary with its own storage: no socket, no sidecars, retention per stream in days. compose.yaml drops temps/temps-postgres/temps-clickhouse and their volumes for a single `openobserve` service on docker.io/openobserve/openobserve:v1.0.0-rc2, UI + API + OTLP/HTTP on 127.0.0.1:5080 and OTLP/gRPC on 127.0.0.1:5081, ZO_DATA_DIR=/data on the openobserve-data volume, ZO_COMPACT_DATA_RETENTION_DAYS=90, root user admin@hezarfen.local (local-dev password, and OpenObserve panics at boot on anything weaker than upper+lower+digit+special). The backend's commented OTEL_* block now carries the gRPC form ready to uncomment and the OTLP/HTTP variant beside it. Proved end to end against the real backend over OTLP/gRPC: 18 spans (GET /health ×11, GET /modules/catalog ×5, POST /builder/login, GET unmatched), the http_server_request_duration metric family and 11 log records, all timestamped 2026-09-07 rather than 1970. Privacy check over every span and log attribute key found none of the banned set (url.path, client.address, user_agent.original, user.*, cookie, email, http.*.header.*); no username and no IP but 127.0.0.1 in any body. Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s
✨ feat: Temps telemetry sink in composeAhmet Kaan Gümüş · 849155e
✨ feat: Temps telemetry sink in compose
Temps is the only telemetry sink here (no Grafana). It brings its own two
stores: TimescaleDB for metadata and logs, ClickHouse for spans and metrics.
Neither is published; only the dashboard (3000) and the public ingest
listener (9000) are, both on loopback.
The published image cannot run: ghcr.io/gotempsh/temps:* is alpine/musl but
the binary inside is glibc-linked, so it exits with "exec container process
(missing dynamic library?)". Upstream's supported path is a from-source
build of the whole thing; observability/Containerfile.temps rebases the same
pinned artifact onto debian-slim instead, which takes seconds.
Ingest is OTLP/HTTP protobuf only — no gRPC listener — and the path is
/api/otel/v1/{traces,metrics,logs}, authorised by an API key plus the
project id header. Raw signals are pinned to 90 days, because the ClickHouse
span TTL defaults to 90 while the plugin config defaults to 7.
Verified: a trace, a metric and a log record sent with the OTLP exporter all
land and come back out of the query API.
Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s✨ feat: real /health, error and panic telemetryAhmet Kaan Gümüş · c00f83a
✨ feat: real /health, error and panic telemetry
`/health` (and its `/` mirror) now answers what the process can actually do —
`{status, db, ai:{enabled,workers}}`, 200 when the database is up and 503 with
`"db":"down"` when it is not. It is exempt from the db guard alongside
`/limits`: a probe refused by the outage it exists to report names nothing.
Every `AppError` arm now records a stable snake_case class on the request span
(`error.type`) and counts itself into `errors_total` with that class and the
status. One log line per refusal, by severity: 5xx at error! with the
underlying error (which the arm's own Display hides), 429 and the reconnect
503 at warn!, the caller's 4xx at debug! — no path, no user, no body anywhere.
`record_response` no longer overwrites `error.type` with the status code.
Panics are no longer a dropped connection: a process-wide hook logs
`exception.type/message/stacktrace` and counts `panics_total`, and a
`CatchPanicLayer` inside the trace layer answers the same `{"error":"internal
server error"}` 500 every other internal error answers, tagging its span
`panic`.
Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s2026-09-05
🔒 fix: the registry refuses an unsatisfiable module set; no AI egress without the ai packageAhmet Kaan Gümüş · 8f2c521
🔒 fix: the registry refuses an unsatisfiable module set; no AI egress without the ai package `Tenants::create`/`set_modules` validate the dependency graph themselves. A school without `chatbot` dispatches no rag indexing and the blob stream refuses `module_disabled`, so a customer who did not buy AI ships no data to the AI services.
📝 docs: modules subsection — what a school buys, dependencies, batch semanticsAhmet Kaan Gümüş · 11422c3Browse files
✨ feat: builder sells modules per school, one at a time or in batchesAhmet Kaan Gümüş · c78e41a
✨ feat: builder sells modules per school, one at a time or in batches
`GET|PATCH /schools/{slug}/modules`, `POST|DELETE /schools/{slug}/modules/{module}`;
a batch names modules or whole packages, resolves to one set, is validated
against the dependency graph once and written once, or not at all. Public
`GET /modules/catalog` lists modules, packages and requirements; a school
reads its own set at `GET /modules`. Schools can be created with a narrowed
set.✨ 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.