Commits
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).
🔧 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-14
🗃️ feat: pre-prod schema: person join key, drop school password copyAhmet Kaan Gümüş · 804bd3c
🗃️ feat: pre-prod schema: person join key, drop school password copy app_user no longer stores password_hash (login already verifies control person). School rows carry person uuid + created_at. class_blueprint is uuid-keyed; exam child rows composite-FK to (exam, question); pool/solution images are child tables; graded_at/marked_at/enrollment timestamps added. Left alone: occupancy/refcount counters (cap locks, not lies), ledger source, menu derived id, school.slug PK, fee_plan JSONB.
2026-09-12
2026-09-11
🧹 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.🧹 chore: split note/session/settings into domain/db/service layersAhmet Kaan Gümüş · efea304
🧹 chore: split note/session/settings into domain/db/service layers
Pilot wave of the three-layer split. All query execution for the three
domains now lives in src/db/{note,session,settings}.rs as free fns taking
db first; web handlers call service::<x>::* only; domain keeps pure types.
- service/settings.rs gains the PATCH workflow (apply) and SETTINGS_LOCK —
it spans a multi-call pair (retire names, CAS save, restore), so it is a
service lock, not a db lock. The service takes its own input records
(SettingsPatch/*Input) so wire DTOs stay in web and list validation keeps
its original order, including the try_kept grandfathering that needs the
stored list.
- Note/Session/Settings fields the db layer mints or CAS-binds become
pub(crate); Settings::record_id becomes pub(crate).
- Unit tests rode with their fns: note delete cascade → db/note, session
purge → db/session, settings load/save/CAS → db/settings, the whole
settings edit workflow suite → service/settings.
- Doc links re-pointed (user, class_blueprint, bank_question, exam,
note_file, tests/regress_roles); NoteId::generate's stale
'Note::list_for_user' link now names db::note::list_for.
- Known residual for a later wave: web/notes.rs:411 file.delete() is
note_file-domain persistence (note_file splits in C3).2026-09-07
✨ feat: OpenTelemetry bootstrap — OTLP traces/metrics/logs, request spans, request idsAhmet Kaan Gümüş · 057a7fa
✨ feat: OpenTelemetry bootstrap — OTLP traces/metrics/logs, request spans, request ids Telemetry is off unless OTEL_EXPORTER_OTLP_ENDPOINT is set, mirroring the AI bridge's "off unless configured" shape. With it unset the process logs exactly as before; every instrument binds to the noop meter provider, so call sites never branch on whether telemetry is on. Privacy is the design constraint (KVKK): a span carries the method, the route TEMPLATE, the status, a random request id and the school slug — never a user, an IP, a URL path, a body, a header or a cookie. tests/telemetry.rs fails the build if a forbidden attribute key appears. New variables (all documented in .env.example): OTEL_EXPORTER_OTLP_ENDPOINT presence turns export on OTEL_EXPORTER_OTLP_PROTOCOL grpc (default) | http/protobuf OTEL_EXPORTER_OTLP_HEADERS read by the SDK OTEL_SERVICE_NAME read by the SDK, defaults hezarfen_backend OTEL_TRACES_SAMPLER(_ARG) read by the SDK, parent-based always-on LOG_FORMAT pretty (default) | json; anything else refuses to boot DEPLOY_ENV deployment.environment.name Claude-Session: https://claude.ai/code/session_018sqvyBCZ9kpQP6vnGomT2s
2026-09-05
✨ feat: per-school modules; a disabled module answers 403 on every route in its nestAhmet Kaan Gümüş · 5d7f87c
✨ feat: per-school modules; a disabled module answers 403 on every route in its nest Twenty-one modules, one per router nest, with an explicit dependency graph derived from the record links (exams need courses and subjects, marks need exams, …) and four packages for the catalog. The enabled set lives on the school's control row and rides the tenant resolution that already happens once per request; every nest carries a route_layer gate, the four child creates inside /courses are gated by their own module, and the AI blob stream refuses `module_disabled` when course notes are off.
✨ 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.