Commits
2026-09-25
🧪 test(integration): reconcile two stale assertions with shipped behaviorAhmet Kaan Gümüş · 6d68754
🧪 test(integration): reconcile two stale assertions with shipped behavior bank_question_create_get_list_and_instantiate: d8dad92 documented malformed filter values as a 400 naming the field (mirroring OfferingFilter) — the ?subject=nope arm now asserts that 400 instead of the old empty envelope, and the excludes-intent moved to a valid uuid. chat_rate_limit_refuses_before_anything_is_written: 51e5c7b raised the shipped budgets 100x, so the 20/min premise never trips. The test now pins a low limit via chat_app_limited and still proves the limiter refuses before anything is written. Full suite: 368 passed / 0 failed. Local-Gate: d506ed3a00826385b16be6de5d27a206c6498657 (1629 passed, 592s)
2026-09-24
🧪 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(holidays): the non-teaching calendar over the API and the materialize routeAhmet Kaan Gümüş · 3547dc5
✨ feat(holidays): the non-teaching calendar over the API and the materialize route
`src/web/holidays.rs`: five routes (paged overlap-filtered `GET /holidays`,
`GET /holidays/{id}` for any session, manager-gated `POST`/`PATCH`/`DELETE`),
nested ungated beside `/terms` and tagged in the spec. `HolidayLimits` and the
weekly-plan materialize caps join `GET /limits`, and `max_course_sections` is
published with them.
`POST /instances/{id}/weekly-plan/materialize` turns a section's resolved plan
into dated lessons over a range: dry run by default, the same call with
`apply: true` commits, holidays and already-scheduled starts are reported as
skipped, and the response reuses `SessionResponse`. Slot DTOs carry the new
optional topic.
Also closes a wave-1 defect: `service::course_session::materialize` captured
`&PgPool`/`&ClassCourse` in its `tx_with_retry` closure, so its future was not
Send and no route could await it — now owned captures.✨ 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
✨ feat: the podcast job's row and audio now live in the backend - backend-owned row, mp3 ingest, read gates without the serviceAhmet Kaan Gümüş · c44f362
✨ feat: the podcast job's row and audio now live in the backend - backend-owned row, mp3 ingest, read gates without the service
The job record lived only in the podcast service's own volume, so a restart
or a wiped volume lost every in-flight job a caller was polling and the mp3 it
was about to download. The backend now owns both ends of that state:
* `migrations/school/20260917000003_podcast.sql` — `podcast_job`, the job's
own row (user/source/format/state/stage/progress/error_code/audio_*/
duration/eta/created/updated). No `school` column: the school IS the
database, and the row's tenancy is (this database, user_id).
* `POST /podcast/jobs` mints the id, writes the row, THEN dispatches
`podcast.submit` with `{job_id, source_id, format, user_id}`; the service
echoes that id in its receipt (mismatch = 502 + a failed/bad_reply row).
No worker = 503 and no row; a refusal or transport failure tombstones the
row with the reason code — nothing is left claiming `queued`.
* The service reports every transition back through `podcast.report` (the new
client-initiated capability call, School-scoped, wired through
`src/ai/capability.rs`), which validates the echo, the jobs.py transition
table, the retention window and the done-means-audio rule before one
conditional UPDATE keyed on the state it read.
* The finished mp3 arrives as a `BlobUploadRequest` stream (exactly `size`
raw bytes), lands under the school's own blob root at
`podcast/<job-id>.<ext>` (temp+rename, row stamped in the same act, file
removed again if the row write finds the job gone), and `POST`ing a done
report before it is refused `audio_missing`.
* The read doors — `GET /podcast/jobs/{id}`, `.../result`,
`.../audio` — answer from the row with no service round trip: 404 for an
unknown or foreign job (foreign ids read as absent), 409 `not_ready` /
`audio_missing`, 410 past PODCAST_JOB_RETENTION_SECS, and a read-side-only
projection that presents a queued/running row nobody has updated inside its
ETA-scaled window as failed/interrupted — the GET writes nothing and a real
report overwrites it. `podcast.status`/`podcast.result` capabilities are
deleted with their payloads; the old `GET /podcast/audio?path=…` door is
gone (it named a cross-volume path and could not be owner-scoped).
Also: `AppError::Expired` (410) + the two room matches that needed it,
MIN_PROTECTED 323 -> 337 (real swept count), the three clippy fixes on the
committed tree, README regenerated, and the .sqlx entries for both lanes'
queries. This commit completes the tree that 7c96e47 half-staged: that commit
took the shared files (server/protocol/constant/db-mod/ai-capability) while
leaving `src/ai/podcast.rs`, `src/web/podcast.rs` and `tests/podcast.rs` at
their old versions, so main did not compile until this one.✨ 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.fix: 🌙 two clock-dependent assertions in the suiteAhmet Kaan Gümüş · 1675e73
fix: 🌙 two clock-dependent assertions in the suite - the rate-limit outage test asserted a single-shot read of a row a parked fold may write the instant the table returns; it now asserts the arithmetic (never folded twice, nothing lost) after two round barriers. This is the failure that reddened CI run 35170750886. - the cross-tenant search probe matched a username as a substring of the raw JSON, which also hits the hex of a UUIDv7 id: "ada" rides inside 01a0adad-…, so a correctly scoped response failed for a slice of every ~17.5-minute wall-clock window and passed outside it. It compares the parsed username/display_name now.
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).
🔧 chore: give ResolvedTenant its core home and make constant.rs a leafAhmet Kaan Gümüş · d0dce85
🔧 chore: give ResolvedTenant its core home and make constant.rs a leaf Two structural defects a knowledge-graph pass over src/+tests/+migrations surfaced. Both were verified against the real `use` lines before being called defects — a module cycle is legal Rust, so only the layering facts count. No behavior change: every moved item is byte-identical in name, type, value, element order and doc text. - `ResolvedTenant` was *declared* in `src/web/tenant_state.rs` but *built and returned* by `Tenants::resolve` (`src/tenant.rs`), so the core tenant registry imported the web layer. The struct moves to `src/tenant.rs`; its `impl FromRequestParts` stays in the web module (same crate, local type). That deletes the crate's only core→web import edge, and with it the three module cycles running through `state.rs` and `ai::server`. - `constant.rs` is documented "Validation limits, in one place" but imported four domain enums to hold non-limit vocabularies: `ROLES` → `domain/role.rs`, `THEMES`/`LANGUAGES` → `domain/preferences.rs`, `SENDER_FOLDERS`/ `RECIPIENT_FOLDERS` → `domain/message.rs`, and the 34-row `BADGES` catalogue → `domain/badge.rs`. Each now lives in the module that owns its type, so `constant.rs` imports nothing from `crate::domain` and ten `constant ↔ domain` cycles disappear. `AI_PRINCIPAL_KEY` and `PALETTE_COLOR_*` stayed put. Measured on the same corpus: 20 → 7 reported import cycles — all ten constant↔domain and all three tenant↔web cycles gone. The surviving seven are intra-layer domain cycles plus the ai↔web pair; the AI bridge is a peer front-end reusing web authorization helpers, which is deliberate, not an inversion. Tests: the published-or-excluded guard in `limits_completeness` read only `src/constant.rs`, so the five moved tables silently left its scan — the one place this move weakened coverage. It now covers them by name, and its `references()` check no longer counts a bare `use` line as "published", which the first witness attempt proved had made the guard vacuous. Witnessed by mutating BADGES and then ROLES out of `/limits`: each FAILs naming the moved table, and each restore is sha256-identical. Gates: no SQL touched (.sqlx and migrations clean), prepare DB unchanged; SQLX_OFFLINE=true cargo check --all-targets, clippy -D warnings, limits_completeness, spec_bounds all green; cargo nextest run 1386/1386 across 47 binaries (doc_sync included).
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.✨ 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-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.
🐛 fix: settings attendance reads as a sorted setAhmet Kaan Gümüş · d111b5a
🐛 fix: settings attendance reads as a sorted set Child tables have no ord. GET/PATCH returned alpha order after the first save; defaults now match, tests pin that.
🐛 fix: board roster tests write board_participantAhmet Kaan Gümüş · 2ba3280
🐛 fix: board roster tests write board_participant The junction FKs to app_user, so fabricated UserId::generate() and UPDATE board SET participants (dropped column) 23503/fail in CI.
✨ 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-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.
🗃️ feat: VPS deploy workflow + exe-relative migrations + CORS anywhere modeAhmet Kaan Gümüş · b2780eb
🗃️ feat: VPS deploy workflow + exe-relative migrations + CORS anywhere mode
- .github/workflows/main.yml: im-style deploy on push to main — pinned
ubuntu-24.04 runner, Postgres sidecar (max_connections=500) for the
per-test-database suite, clippy -D warnings + full nextest gate,
--release build under SQLX_OFFLINE, SSH release-dir swap + systemd user
unit restart, /health gated on THIS build's process (MainPID exe) with
rollback, independent after-the-fact verify.
- deploy/hezarfen.service: the shipped user unit; secrets and deployment
knobs live in ~/hezarfen/hezarfen.env on the server (never in-repo).
- migrations_path: fall back to migrations/ beside the executable when the
compile-time CARGO_MANIFEST_DIR path is absent — a deployed binary was
looking for its schema on the build machine and aborting boot.
- CORS_ALLOWED_ORIGINS=*: anywhere-mode, every origin mirrored WITH
credentials ("allow CORS to anywhere for now"); SameSite=Lax stays the
cross-site guard. Default mirror mode unchanged; test pins star mode.2026-09-12
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.Merge branch 'layer-split/notes_board'Ahmet Kaan Gümüş · e1b6791
Merge branch 'layer-split/notes_board' # Conflicts: # src/db/mod.rs # src/domain/rag_output.rs # src/service/course.rs # src/service/mod.rs # src/web/course_notes.rs
Merge branch 'layer-split/bank'Ahmet Kaan Gümüş · 164e756
Merge branch 'layer-split/bank' # Conflicts: # src/db/mod.rs # src/domain/bank_question.rs # src/domain/pomodoro.rs # src/domain/pool_question.rs # src/service/mod.rs # src/web/bank_questions.rs # src/web/exams/mod.rs
Merge branch 'layer-split/exam_artifacts'Ahmet Kaan Gümüş · 312f795
Merge branch 'layer-split/exam_artifacts' # Conflicts: # src/db/exam_attempt.rs # src/db/mod.rs # src/domain/attendance.rs # src/domain/chatbot_thread.rs # src/domain/homework_submission.rs # src/domain/session_attendance.rs # src/service/course.rs # src/service/mod.rs # src/web/exams/mod.rs
🧹 chore: split note_file/course_note/course_note_file/board/board_stroke into domain/db/service layersAhmet Kaan Gümüş · a15d2d2Browse files
🧹 chore: split bank_question, bank_question_image, pool_question, solution into domain/db/service layersAhmet Kaan Gümüş · d0c4bb1Browse files
🧹 chore: split exam_answer/exam_result/answer_image/question_image into domain/db/service layersAhmet Kaan Gümüş · 61990deBrowse files
Merge branch 'layer-split/meal'Ahmet Kaan Gümüş · b0e9ab8
Merge branch 'layer-split/meal' # Conflicts: # src/db/mod.rs # src/service/mod.rs
Merge branch 'layer-split/chatbot'Ahmet Kaan Gümüş · f360d85
Merge branch 'layer-split/chatbot' # Conflicts: # src/db/mod.rs # src/service/mod.rs
🧹 chore: split meal_attendance, meal_ledger, menu, menu_dish, dietary_profile into domain/db/service layersAhmet Kaan Gümüş · d548120
🧹 chore: split meal_attendance, meal_ledger, menu, menu_dish, dietary_profile into domain/db/service layers - db/: menu (publish/read/find/list/CAS cap update/cascading delete + bump_menu_and_write), menu_dish (create/read/listings/count/patch/delete), meal_attendance (mark/list_for_menu/list_for_student), meal_ledger (append/read/price_snapshot/list_for_student/balance_of + KindTotal), dietary_profile (read/tags_of/save). Bodies byte-identical; entity fields pub(crate) for cross-layer construction (exam precedent). - service/: menu owns MENU_LOCK (multi-call count-then-write span) and every dish write (add_dish with the MAX_DISHES_PER_MENU gate, update_dish/delete_dish) plus menu/dish read pass-throughs; meal_ledger owns charge_booking/reverse_booking/credit orchestration; meal_attendance and dietary_profile are read-through pass-throughs. - domain/: pure remnants only — ids, newtypes, getters, sign convention, charge_for/reversal_for row builders, conflicts; ULID IDS minters stay; persistence tests ride with their fns into db/. - web/meals.rs: handlers call service::* only; MENU_LOCK leases and the dish-cap gate moved out; validation order preserved. - re-pointed merged callers (service/meal_booking, db/meal_booking, db/exam_attempt doc link) and test imports (integration, regress_meals). cargo check --all-targets clean; cargo test --lib 577 passed 0 failed; cargo test --test regress_meals 18 passed 0 failed.
🧹 chore: split chatbot_message, chatbot_thread, rag_output into domain/db/service layersAhmet Kaan Gümüş · 4ddbd6eBrowse files
🧹 chore: split profile, badge, builder into domain/db/service layersAhmet Kaan Gümüş · 7f616c0
🧹 chore: split profile, badge, builder into domain/db/service layers
C3 identity lane. Moves, not rewrites:
- badge: BadgeStats::load / BadgeAward::list_for / sync (UPSERT with the
earned_at = NONE idempotency stays whole) -> db::badge, with the
award-key mint and the persistence tests; BadgeStat/BadgeStats/earned/
BadgeAward (pure rules) stay in domain::badge; service::badge wraps
list_for/sync for the web layer.
- profile: ProfileStats::load (+ PomodoroTotals, persistence tests) ->
db::profile; newtypes + getters stay; service::profile::load wraps.
- builder: find_by_username/read/create(create_session)/find_by_token/
delete_by_token -> db::builder; the idempotent seed ensure ->
service::builder (ensure_admin precedent); both tests ride their fns.
- preferences, key: fully pure (validated newtypes, composite-id
helpers) — stay domain-only, no db/service modules created.
Entity fields the split constructs from are now pub(crate) (Builder,
BuilderSession, ProfileStats), matching the user split.
Callers re-pointed crate-wide: web/{users,exams/mod,questions,homework,
sessions,auth,extractor,builder,tenant_state}, service/exam_attempt.rs
(badge::sync after start), database.rs (control seed), tests/
{builder_api,e2e,integration}; cross-lane compile fixups in
domain/pomodoro.rs and domain/session_attendance.rs (their lanes
re-point on merge). constant.rs doc link -> crate::db::badge::list_for.Merge branch 'layer-split/user'Ahmet Kaan Gümüş · f30faee
Merge branch 'layer-split/user' # Conflicts: # src/domain/appointment_slot.rs # src/domain/exam_question.rs # src/domain/user.rs # src/service/course.rs # src/web/courses.rs # src/web/sessions.rs
Merge branch 'layer-split/meal_booking'Ahmet Kaan Gümüş · 78600f5
Merge branch 'layer-split/meal_booking' # Conflicts: # src/service/mod.rs
Merge branch 'layer-split/exam_attempt'Ahmet Kaan Gümüş · 7267caa
Merge branch 'layer-split/exam_attempt' # Conflicts: # src/db/mod.rs # src/domain/exam_attempt.rs # src/service/mod.rs # src/web/courses.rs # src/web/exam_ws.rs # src/web/exams/attempts.rs # src/web/exams/mod.rs # tests/regress_course_delete.rs
Merge branch 'layer-split/course'Ahmet Kaan Gümüş · ecd88d4
Merge branch 'layer-split/course' # Conflicts: # src/service/mod.rs
🧹 chore: split exam_attempt into domain/db/service layersAhmet Kaan Gümüş · c13b51d
🧹 chore: split exam_attempt into domain/db/service layers
src/domain/exam_attempt.rs keeps the pure core (ExamAttemptId, AttemptStatus,
the entity + getters, deadline/status arithmetic); fields went pub(crate) so
the layers can mint and target rows.
src/db/exam_attempt.rs takes every query: finish/set_left (the two
field-scoped writes), the reads (read, read_latest_for_user, list_*,
any_for_exam), and the write_unfrozen[_with] freeze-gate transaction gateway
with FROZEN_SLOT and the THROW markers.
src/service/exam_attempt.rs owns the workflows and the cross-call state:
EXAM_LOCK moves here from web/exams/mod.rs (it spans multi-call workflows —
start's writer lease, saves' reader leases), the sitting gates
(ensure_sittable/ensure_student/ensure_student_now/ensure_enrolled/
check_rejoin/writable_attempt) move out of the handlers, as do course_of
(web may not be imported from service) and question_of_exam (the answer
funnel's lookup). start keeps its name from the domain; start_attempt /
finish_attempt / save_answer_checked are the handler workflows extracted
whole, windows and term gates and all, in the original gate order.
web/exams/attempts.rs keeps authz extractors, DTOs, and response assembly
only; exam_ws.rs, exams/{mod,questions,images,review}.rs and courses.rs
re-point to the service paths; domain/exam_question.rs and
question_image.rs call the db-layer write_unfrozen* directly. Doc links to
moved items re-pointed. Tests ride with their layer: persistence
(field-scoped write) tests in db, workflow (start/retake/race) tests in
service; assertions unchanged, only paths and call shapes.