forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to tests/common/mod.rsClear filter

2026-09-24

✨ 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: 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

✨ 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).

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.
🧹 style: zero clippy/rustc warnings project-wideAhmet Kaan Gümüş · c782987
🧹 style: zero clippy/rustc warnings project-wide

Box the large LoginResponse::LoggedIn variant and drop the
let-and-return in login_as_school.

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

2026-09-07

🔒 fix: telemetry privacy sweep, in-flight gauge guards, request-id validation, tenant gauge on createAhmet Kaan Gümüş · ae0957a
🔒 fix: telemetry privacy sweep, in-flight gauge guards, request-id validation, tenant gauge on create

- No account name reaches an exported log record: the admin seed
  (domain/user.rs), the ADMIN_USERNAME refusal and the builder seed
  (domain/builder.rs) log the event without the `username` field.
- The forbidden-key list moves to tests/common (`FORBIDDEN_TELEMETRY_KEYS`,
  `is_forbidden_key`), gains `username`/`email` and the header prefixes, and
  is used by both the HTTP-edge and the AI-bridge guard tests. The telemetry
  suite now also exports tracing EVENTS through an in-memory log exporter and
  holds log records to the same rule.
- `http.server.active_requests` and `ai_requests_inflight` are closed by a
  `Drop` guard, so a dropped request future (client hang-up, outer timeout)
  no longer leaks the gauge upwards. A cancelled request is recorded as 499.
- A caller-supplied `x-request-id` is only kept when it is at most 64 chars of
  `[A-Za-z0-9._-]`; anything else is dropped and a UUID is minted, so a client
  cannot write free text onto `http.request.id` of every span.
- `tenant_cache_size` is reported by `Tenants::create` and by the bootstrap
  insert, not only by the lazy-dial path.
- The keepalive logs its first `up` verdict, which its comment already claimed.

Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s
✨ 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.
✅ test: production-mode isolation runs by default against a throwaway SurrealDBAhmet Kaan Gümüş · 7d4bd21
✅ test: production-mode isolation runs by default against a throwaway SurrealDB

Every cross-school probe now runs twice: in memory mode and against a real
server the suite starts itself, where all schools share one namespace and
isolation rests on the per-connection database pin alone. Remote-only
checks: the namespace lists exactly the created databases and loses one on
delete, raw counts on a school's handle see only its rows, an id copied
from one school is absent in the other, and a suspended school reconnects
with its rows intact. `HEZARFEN_SKIP_REMOTE=1` is the only escape.
✨ 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.

2026-08-19

✨ feat: course notes uploadable by responsible teacher+Ahmet Kaan Gümüş · 6b1748c
✨ feat: course notes uploadable by responsible teacher+

Mirror of the personal-note stack scoped to a course: course_note +
course_note_file tables, /course-notes routes (POST/GET list?course=,
GET/PATCH/DELETE /{id}, POST/GET /{id}/files, GET/DELETE /{id}/files/{fid}).

Write = can_manage_course (creator, assigned teacher, manager+; live
Teacher role floor). Read = can_view_course (manage or enrolled).
Blob-first upload, cap via cap::claim_and_create (MAX_COURSE_NOTE_FILES),
create-vs-deleted-course refused via cap::touch_and_create, course delete
cascades note/file rows and unlinks blobs.

Tests: 8 integration cases (authz matrix, demoted creator, cross-course
file IDOR, cap 409/413, blob cleanup, cascade 404), race-contract cases
in regress_course_child_orphans, domain unit tests. README Endpoints
table regenerated via doc_sync; Layout updated.

2026-08-12

🧪 test: pay the api-read err-code coverage debtAhmet Kaan Gümüş · a3cf87f
🧪 test: pay the api-read err-code coverage debt

`unavailable`, `not_json` and `too_large` shipped code-read only. Each now
has a test that bites when its branch is removed (both were checked against
a mutated source):

- `unavailable` behaviourally, over real QUIC: `app_with_ai_health` hands the
  test the `DbHealth` flag, so the socket can be taken down under a running
  app and put back — the second read answering 200 is what proves the refusal
  was the flag's doing.
- `not_json` and both `too_large` paths at module level: no allowlisted route
  answers non-JSON or 8 MiB today, so a QUIC-level test would need a seam in
  the release binary to invent one. Two pure extractions instead —
  `dispatch_api` (everything after the arm check, so a stub router can be
  dispatched into without a listener) and `write_answer` (the framing, so the
  oversize-Ok downgrade can be read back off a buffer). No release behaviour
  moves: the refusal order is unchanged and the downgrade is the same code.

The downgrade test also pins that nothing of the oversize frame reaches the
wire before the refusal — `write_frame` size-checks before its first byte.

2026-07-31

feat: 🖍️ collaborative whiteboard domain, REST and limitsAhmet Kaan Gümüş · 5dfce55
feat: 🖍️ collaborative whiteboard domain, REST and limits

Boards are an ad-hoc invite list: the creator names participants, and
every participant draws. Clearing, locking, closing and deleting are the
creator's alone.

Strokes are an append-only log and a clear NEVER deletes — it bumps the
board's epoch, so the live canvas empties while the whole history stays
replayable. The clear marker row doubles as the epoch index, carrying the
epoch it closed and that epoch's final stroke count, which is why there
is no epochs table.

Growth is bounded by two counters claimed together in one conditional
write: epoch_stroke_count resets on a clear and caps the live canvas
(recoverable — clear and keep drawing), while total_stroke_count never
resets and stamps closed_at when the lifetime cap is hit, leaving the
board permanently read-only but fully readable. board_count on user
bounds the open-a-new-board escape hatch.

Outsiders get 404 everywhere so a board's existence never leaks;
a participant lacking creator rights gets 403, since existence has
already been disclosed to them.

The WebSocket room lands separately.

2026-07-23

🎨 style(chatbot): rename thread/message off the mail collisionAhmet Kaan Gümüş · 92b232b
🎨 style(chatbot): rename thread/message off the mail collision

The AI chatbot's storage and web layer reused "conversation" and
"chat_message", the latter one underscore away from the human-to-human
mail `message` feature — every reader had to disambiguate two unrelated
tables by eye.

Rename the whole chatbot feature to a `chatbot_*` vocabulary:

  conversation  -> chatbot_thread    (ChatbotThread*, CHATBOT_THREAD_*)
  chat_message  -> chatbot_message   (ChatbotMessage*, CHATBOT_MESSAGE_*)
  /chat/conversations -> /chatbot/threads
  max_chat_conversations -> max_chatbot_threads
  max_chat_message_len   -> max_chatbot_message_len
  chat_history_turns     -> chatbot_history_turns
  RATE_LIMIT_CHAT_PER_MINUTE -> RATE_LIMIT_CHATBOT_PER_MINUTE
  DTO conversation_id -> thread_id

The out-of-process AI-service wire contract is deliberately untouched:
ai/chat.rs payload types, AI_CHAT_CAPABILITY ("chat.reply"), the serde
field names and the hab/1 ALPN stay as-is — other-language services
match on those literals. ai/chat.rs remains "the chat.reply payloads",
a separate concern from the chatbot feature it feeds.

Clean break, no row migration (pre-customer, FE not yet synced): old
conversation/chat_message rows in the volume are abandoned. Frontend
must adopt the new routes, the thread_id field, and the renamed
settings keys.
✨ feat(chat): relay chatbot over the AI bridgeAhmet Kaan Gümüş · b0aa0a1
✨ feat(chat): relay chatbot over the AI bridge

The backend relays between the frontend and an out-of-process AI service:
it owns auth, rate limiting, persistence and payload format, and may
inspect an answer before the frontend sees it. No rule or intent tables —
conversation is free-form.

Two-phase by design. POST persists the pending assistant row *before*
dispatching, then returns 202, so a reload never loses an answer; the
client either polls the message or opens an SSE stream. Both read the
same DTO, so they cannot disagree. Deltas are sliced from the finished
text because hab/1 is unary — the event shape exists so real streaming
drops in later without a client change.

A turn always settles. Every failure after the rows are written marks the
row failed with a machine-readable code, a boot sweep flips rows orphaned
by a restart, and a pending row older than five minutes reads as timed
out — projected at read, never written back, so a slow-but-alive answer
is not raced. An over-long answer is clipped and flagged rather than
dropped; an empty one fails.

Message ids come from a monotonic ULID generator: the two rows one POST
writes share a millisecond routinely, and a random tie-break rendered the
answer above its own question and handed the service [assistant, user],
breaking the documented oldest-first history contract.

The conversation cap counts and creates under a lock — SurrealDB
BEGIN/COMMIT does not serialize cross-record counts, and 16 concurrent
creators over-admitted a cap of 5 to 20 without it.

Every authenticated role may chat, parents included. Foreign threads are
404, never 403.
✨ feat(ai): QUIC bridge for out-of-process AI servicesAhmet Kaan Gümüş · dc49954
✨ feat(ai): QUIC bridge for out-of-process AI services

The AI features live in separate projects, so they need a transport. QUIC:
each request rides its own bidirectional stream on the service's single
long-lived connection, which puts multiplexing in the transport — no
correlation-id bookkeeping, no head-of-line blocking between concurrent
requests, one handshake instead of one per request.

The backend listens and the services dial in, so a service can sit behind
NAT, restart without the backend knowing its address, and scale out by
opening a second connection (each connection is an independent worker).

Protocol "hab/1", also the ALPN so an incompatible service is refused at the
TLS handshake rather than one frame later. Frames are length-prefixed JSON
(u32 big-endian) because the services will not be Rust; the length is checked
against an 8 MiB cap before any buffer is allocated. The control stream
carries Hello/Greeting and then stays open — its closure is the goodbye, so
there is no heartbeat frame, and a silent death is caught by the QUIC idle
timeout.

Routing is least-inflight rather than round-robin: AI request costs are
wildly uneven, and taking turns would pile a second long inference onto a
busy worker while an idle one sits next to it. Selection and the in-flight
increment happen under one lock so concurrent dispatches cannot overshoot a
worker's declared max_concurrent, which a Lease releases on drop.

Services authenticate with a shared token (constant-time compare); the
certificate only proves the backend, and is self-signed at boot unless a PEM
pair is configured. Since that regenerates per boot, GET /ai/certificate
publishes it (PEM + sha256) for a service to pin — public because a server
certificate is handed to every peer in the TLS handshake anyway, and 404 when
the bridge is off. A service must re-fetch on every reconnect, not once at
startup.

Off unless AI_QUIC_ADDR is set, so the API is unchanged for deployments
without AI. Set without AI_SHARED_TOKEN it refuses to boot rather than listen
unauthenticated.

2026-07-22

✨ feat(deletes): guard course, exam-kind, and term removalAhmet Kaan Gümüş · 9191711
✨ feat(deletes): guard course, exam-kind, and term removal

Three referential-integrity guards, all 409 instead of silently taking
dependent data with them:

- DELETE /courses/{id} refuses while anyone is enrolled. The cascade
  used to delete the enrollments along with the course, so a roster
  could vanish on a misclick; the check and the delete are held under
  ENROLL_LOCK so a concurrent enroll cannot slip in behind it.
- PATCH /settings refuses to drop an exam kind whose exams already
  carry marks. Weights resolve live, so removing the kind would
  re-weight every one of those marks to 1 without touching a row. The
  check is re-run per CAS retry against the snapshot the save is
  conditioned on, under an EXAM_LOCK writer lease so grading cannot
  land the first mark mid-flight. An unmarked kind still leaves freely.
- DELETE /terms/{id} refuses while any course links it, rather than
  unlinking those courses. Guarded by a new TERM_LOCK, taken by the
  course writes that assign a term. Lock order: never held together
  with ENROLL_LOCK; if a path ever needs both, ENROLL_LOCK first.

No rows change; existing courses with a roster and terms with linked
courses simply need emptying before deletion. Frontend must surface
the new 409 on all three.

2026-07-21

🐛 fix(db): retry boot connect, refuse while socket downAhmet Kaan Gümüş · bebca49
🐛 fix(db): retry boot connect, refuse while socket down

Two failures survived 6627128, which only classified errors from queries
in flight *at* the drop — queries arriving after it produce no error at
all, so there was nothing to classify.

Boot did one connect() and exited on refusal. The runtime then restarted
the process, it failed again in ~100ms, and a few seconds of startup skew
burned the whole restart budget: 6 deaths in 0.6s in the field log, then
down for 12h. Now retries 1s doubling to 5s, forever — only the dial,
since bad credentials never heal by waiting.

A query issued while the socket is down does not fail. The SDK's
router_reconnect loops on 1s retries and stops draining route_rx, so the
query parks until the database returns and only then executes. Reproduced:
POST /auth/login gave no response at 25s, and the keepalive went silent
4m17s before firing two pings in the same millisecond on heal.

Those two pings rule out a plain timeout middleware — a parked query still
runs, so a timeout-sourced 503 would let a client retry double-apply a
mark or an exam answer. Instead the keepalive (now 5s) publishes DbHealth
and db_guard refuses at the edge, before anything is queued, which is what
keeps Retry-After: 1 honest. The 30s request timeout is only a backstop
for requests racing detection; those answer DbTimeout — same 503, no
Retry-After, "may or may not have applied". WS and SSE are unaffected:
both return their response immediately and stream afterwards.

Known gap: exam_ws socket-loop queries run after the upgrade response, so
db_guard does not cover them; they still park and heal on reconnect.

Verified in podman against the existing volume: boot with the database
down backs off and stays alive, requests during an outage answer 503 in
0.3ms, recovery needs no restart.

2026-07-17

✨ feat(subjects)!: course subjects, required on every exam questionAhmet Kaan Gümüş · 022aaaa
✨ feat(subjects)!: course subjects, required on every exam question

Each course now owns its curriculum as subjects (name + optional
description; course link fixed at creation). Every exam question must
be tagged with a subject of its exam's own course, so exam content is
attributable to a topic.

- POST/GET /courses/{id}/subjects (manage / course-visibility, paged)
- GET/PATCH/DELETE /subjects/{id}; delete is a 409 while any question
  still references the subject — re-tag or delete those questions first
- course delete cascades its subjects

BREAKING: question create/update payloads require subject_id, and
questions written before subjects existed are destroyed on boot
(answers first) — nothing truthful to backfill, pre-customer clean
break.

2026-07-15

✨ feat(notes): file attachments with school-set size capAhmet Kaan Gümüş · f1b532b
✨ feat(notes): file attachments with school-set size cap

Blobs live on disk under FILES_PATH (same volume as the DB), named by
the row's ULID so user input never shapes a path; the note_file row
keeps only metadata. DB-blob storage rejected: multi-MB PDFs bloat
surrealkv's LSM tree and buffer whole in RAM on every read.

- POST/GET /notes/{id}/files, GET/DELETE /notes/{id}/files/{file_id};
  owner-only through the owning note, staff included
- max_file_bytes in settings (1 KiB-25 MiB hard cap, default 5 MiB),
  enforced on streamed bytes (413), inside the settings CAS guard;
  option<int> so pre-field volumes boot without a backfill
- 10 files per note; deleting a note removes rows first, blobs after,
  so a crash strands at worst an unreachable blob
✨ feat(web)!: paginate every list endpointAhmet Kaan Gümüş · f3d2b0a
✨ feat(web)!: paginate every list endpoint

Every array-returning GET now accepts `?limit=&offset=` and returns a
`{ items, total, limit, offset }` envelope instead of a bare array.
Paging is opt-in: omitting `limit` returns the full list (limit echoes
null), so callers that need the whole set — an exam's questions during a
sitting, roster/grade pickers — are never silently truncated. `total`
always carries the unpaged count, so a frontend can render "100 of 256"
and drive a pager without a second request.

Windowing is a slice over the already-ordered domain list (the domain
layer is untouched); endpoints that embed people run that join over the
page alone. `limit` must be 1..=500 and `offset` >= 0 (else 400); an
offset past the end yields an empty page, not an error.

Covers all 17 list GETs, including /courses/me, /work/me, /work/{user},
and /users/search — whose hard 10-row cap is dropped in favour of the
same paging. Not paged: /exams/{id}/attempt/{questions,answers}, the
marks & attendance report objects, /exams/{id}/live, and /settings.

Shared machinery lives in web::page (Page<T>, PageParams, paginate).
Docs updated across the OpenAPI spec (utoipa query params + Page_*
response schemas), the Swagger UI it feeds, and the README (a Paging
section plus a `· paged` tag on every list row).

BREAKING CHANGE: list endpoints return a pagination envelope, not a bare
JSON array — clients must read `.items`. /users/search no longer caps at
10 results.

2026-07-14

✨ feat(exams)!: move weight off exams onto their kindAhmet Kaan Gümüş · 3681441
✨ feat(exams)!: move weight off exams onto their kind

Weighting is school policy, not per-exam data: each settings
exam_kinds entry is now {name, weight} (1-100, defaults all 1) and
mark reports resolve weights at read time, so editing a kind
reweights every exam of that kind at once; an exam keeping a
since-removed kind counts as 1.

BREAKING CHANGE: exams lose `weight` on the wire and in storage,
settings `exam_kinds` become objects. No data migration (pre-customer
clean break) — delete ./data/hezarfen.db and reboot.

2026-07-13

🐛 fix(exams): stamp walk-outs per sitting, wipe retakes atomicallyAhmet Kaan Gümüş · 6eb0a28
🐛 fix(exams): stamp walk-outs per sitting, wipe retakes atomically

Three bugs in the attempts/rejoin build, each a wrongful lockout or
data loss once allow_rejoin is off:

- A room's teardown stamped left_at on the *latest* attempt, so a
  stale socket from a finished sitting marked a fresh retake as left,
  locking the student out of a room they never entered. Rooms now
  bind to the sitting they were opened for: state frames and the
  walk-out stamp re-read that attempt by id, never "latest", so a
  superseded room announces its own terminal state and closes.
- Closing one of two tabs counted as leaving while the student was
  still connected. ExamPresence (AppState) counts sockets per
  attempt; only the last socket out stamps the walk-out.
- The retake answer-wipe ran before the attempt create, so a lost
  double-start race could delete answers freshly saved into the
  winner's sitting — or destroy a graded sheet with no retake ever
  created. Wipe + create now run in one transaction and a failed
  create rolls the wipe back. (SurrealDB counts BEGIN/COMMIT as
  response slots: the CREATE result is slot 2.)

Regression tests: e2e rooms for the retake stamp and the second tab,
domain tests for the atomic wipe and the lost race (verified red
against the old ordering), presence unit test. README rejoin
paragraph aligned with the per-sitting semantics.

2026-07-12

✅ test(exams): attempts, questions, answers, and exam-room coverageAhmet Kaan Gümüş · 4169291
✅ test(exams): attempts, questions, answers, and exam-room coverage

- attempt lifecycle: start/resume, async deadline clamping, gates
  (schedule/enrollment/window), double-submit + expiry, mode freeze vs live
  extension, monitor snapshots, SSE headers
- questions: CRUD + validation matrix, RBAC (creator/manager/outsider),
  freeze after attempts, stale kind-bundle PATCH revalidation, cross-exam 404s
- answers: upsert + updated_at monotonicity, kind-coherence 400s, deadline
  cutoff (real clock), review-after-submit, concurrent saves converge,
  teacher sheet is_correct/auto_score, student view never leaks correct
- cascades question→answers and exam/course→everything
- e2e exam room over real TCP: round trip (state/saved/error/finished/Close),
  junk frames survive, all five handshake gates as HTTP statuses, live
  ends_at extension reaches the open room, mid-session expiry
- protected-routes sweep covers every new endpoint incl. the WS upgrade

2026-07-11

✅ test: cover profiles, courses, marks, statistics, and admin seedAhmet Kaan Gümüş · a3d12c3
✅ test: cover profiles, courses, marks, statistics, and admin seed

Integration: course CRUD with creator/manager guards and validation,
idempotent enrollment with roster and /courses/me, in-course exam
creation, grading gated on enrollment and course management, exam
statistics, weighted course averages and self-or-teacher mark reports,
course-delete cascade, concurrent enrollments converging on one row,
profile lifecycle (empty start, /users/me patch semantics, invalid
fields, admin read/edit), and the admin seed (creates a working admin,
idempotent, refuses to promote an existing non-admin).

Persistence: profiles and course marks survive a database reopen.
Common helpers: me_id, create_course, create_exam, enroll.
✅ test: integration, e2e, persistence, and rate-limit suitesAhmet Kaan Gümüş · 905da44
✅ test: integration, e2e, persistence, and rate-limit suites

End-to-end coverage over the assembled router:

- integration.rs: tower::oneshot against an in-memory database — the
  fast path for handler, validation, and access-control behavior.
- e2e.rs: a real TCP listener driven by a reqwest cookie jar,
  exercising the actual session-cookie round trip.
- persistence.rs: the file-backed engine on a tempfile, including
  close-and-reopen to prove data survives a restart.
- rate_limit.rs: both tiers, peer-address vs X-Forwarded-For keying,
  and the shipped limits over every route.
- common/mod.rs: the shared harness — builds the router with limits
  disabled so unrelated suites never trip a limit.