Commits
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-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-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: 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).