forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on main

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)
🐛 fix(clippy): params structs for the d8dad92 list doorsAhmet Kaan Gümüş · 62f10ea
🐛 fix(clippy): params structs for the d8dad92 list doors

-d warnings gate red on main: too_many_arguments on the new filter list
functions (db/service appointment list_for_requester 8/7, db/service exam
list_windowed 9/7), type_complexity on the courses filter resolve,
extra_unused_lifetimes on pomodoro whole_log. RequesterListParams and
WindowedListParams params structs (SettingsParams precedent), the courses
tuple factored into ResolvedCourseFilter, every caller and test call site
migrated; no suppressions.
🐛 fix(ci): cancel the run when Clippy failsAhmet Kaan Gümüş · 57527df
🐛 fix(ci): cancel the run when Clippy fails

A red Clippy left Build-and-test running to its 90-minute ceiling even
though the deploy gates on both, so the outcome was already decided.
New clippy-guard job (needs: clippy, if: failure()) cancels the run via
the API the moment Clippy concludes red; parallelism is untouched since
the guard only ever runs on the failure path.
✨ feat(api): server-side filters on the list doorsAhmet Kaan Gümüş · d8dad92
✨ feat(api): server-side filters on the list doors

A caller no longer has to download a capped collection and narrow it
in the client:

- events, exams: the WindowParams pair is SQL (no whole-table load)
  and gains starts_before/ends_before, so a past/completed view is
  expressible
- sessions: starts_after/starts_before, half-open months
- homework: due_after/due_before (the open/past tabs), class_course
- meals menus: slot (was a post-page JS filter — page counts lied)
- users (admin): roles= comma set; courses: kind, q, taught
- appointments + slots: teacher (or me), starts_after/starts_before,
  status
- pomodoro log: from/to, with the focus total summed in SQL
- messages and boards: q (folded literal substring)
- pool questions: ?status= is a WHERE, not a post-filter
- bank/course-notes id filters: garbage is a 400 naming the field,
  not an empty page

Absent params return today's response byte-shape; page and count
share one WHERE.
🧹 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.
Merge branch 'lane/fix-tests'Ahmet Kaan Gümüş · df8847eBrowse files
🐛 fix(schedule): code-review findings on the holiday and section surfacesAhmet Kaan Gümüş · ecd544b
🐛 fix(schedule): code-review findings on the holiday and section surfaces

A PATCH that moves a lesson onto an instant another lesson of the same section
already starts at now answers the coded 409 session_time_taken instead of a
500 — the new UNIQUE (class_course, starts_at) was mapped on the create door
only.

The materialize route rejects an unrepresentable from/to (i64::MAX and friends)
with a 400 naming the field, instead of panicking inside the day math; the
guard is checked arithmetic over the largest offset the timezone allow-list can
produce, and zoned_day's own contract is untouched.

The profile course block withholds class, class_name and grade_level from a
viewer who fails the same bar the classes block in the same response applies —
a student could read another student's class name and grade through a shared
catalogue course.

visible_instances resolves the sections a teacher is assigned in with one
statement instead of a query per taught course plus one per instance; every new
per-section surface pays that read.
🧪 test(schema): the same-instant lesson fixtures the uniqueness wall outlawedAhmet Kaan Gümüş · 89b83c8
🧪 test(schema): the same-instant lesson fixtures the uniqueness wall outlawed

UNIQUE (class_course, starts_at) makes two lessons of one section starting
together a coded 409, and three fixtures still created them:

- partial_patch_sessions: both concurrency tests POSTed a lesson at one shared
  instant in a 20-round loop; each round now gets its own instant, the racing
  PATCH targets and every assertion unchanged.
- regress_badges' bell helper forced several lessons of one section to
  starts_at = 1; the shift is now relative to each row's own start, so they
  stay distinct.

GitHub's suite was red on exactly this class.
🧪 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.
Merge branch 'lane/sections'Ahmet Kaan Gümüş · 721daa1
Merge branch 'lane/sections'

# Conflicts:
#	src/service/course_session.rs
✨ 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): per-section course lists behind the catalogue rowAhmet Kaan Gümüş · 6ecaebc
✨ feat(courses): per-section course lists behind the catalogue row

`CourseSectionRef` and `CourseResponse.sections`: every catalogue row now
carries its sections (instance id, resolved title, class, grade level, hours,
teachers, roster size), truncated to `MAX_COURSE_SECTIONS` while
`class_course_count` keeps the untruncated total. `list_courses`/`get_course`
populate it through one batched builder — seven statements per page, nothing
per row — and a non-manager sees only the sections they reach.

`GET /courses/me` and the profile course block switch from catalogue rows to
one row per section with the section's resolved title. Reach is the union of
the class-roster/homeroom/taught set and the user's own instance enrollments,
so a hand-placed enrollment keeps appearing exactly as it did before.
✨ 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)
🐛 fix(podcast): later reports overwrite the stored source statusesAhmet Kaan Gümüş · 5d43523
🐛 fix(podcast): later reports overwrite the stored source statuses

The report UPDATE kept the first non-null sources value (COALESCE
old-first), so a job whose early running report stamped pending never
learned the terminal ok/skipped statuses — live result doors showed
pending forever. New value now wins; a report that omits sources still
keeps the previous one. Regression pin: running report carries pending,
the done report's statuses must survive to the result door.
Local-Gate: 990f3981b70f8f451ad75bc1f9688a2e3cbf2897 (1518 passed, 450s)
✨ feat(podcast): dispatch every attachment as sources, not just the newest PDFAhmet Kaan Gümüş · 979d53f
✨ feat(podcast): dispatch every attachment as sources, not just the newest PDF

The submit door now lists all of the note's attachments (id ASC), stats each
blob, and dispatches the present ones as `sources` — `source_key` rides on as
the first source's key, one-release compat. A blob that is gone is skipped with
a log line; `409 source_missing` now means zero attachments or zero present
blobs, and a note id with any single attachment is a valid job.

`podcast.report` gains additive `sources` (`{key, name, status}`, `ok` or
`skipped:<code>`), stored verbatim into the job row's new JSONB `sources`
column and replayed by `GET /podcast/jobs/{id}/result`. `newest_pdf` is
deleted with its service wrapper — clean cutover.
Local-Gate: fe26c0cd12b31b6a48cacff9a3a6119bd241d89e (1518 passed, 459s)
🐛 fix(rag): send the caller's scope pairs on study framesAhmet Kaan Gümüş · 987866d
🐛 fix(rag): send the caller's scope pairs on study frames

The door authorized the pair but the frame carried only asker_role, so
the service's fail-closed guard had no grant for student/teacher/parent
and answered role_denied — the study actions never worked for those
roles. The frame now carries the same backend-computed pair list the
chat path grants with.
Local-Gate: 65e598f47ebccf205e95c26007671ece85818a66 (1516 passed, 449s)
🐛 fix(rag): resolve the study pair through the search foldAhmet Kaan Gümüş · 1e8567d
🐛 fix(rag): resolve the study pair through the search fold

Citations carry ders in the service's slug vocabulary (lowercase,
diacritic-stripped) while scope pairs carry course titles, and the
door compared them byte-exact — so Soru üret/Özetle on a study answer
403'd for every role. Exact match stays the fast path; the folded
fallback refuses with a 400 when two distinct titles fold equal,
never a first-wins guess.
Local-Gate: 3bdd611a53d3849b1f5d3473cf39d86c08fb3768 (1515 passed, 455s)
✨ feat(podcast): persist the transcript and serve it on the result doorAhmet Kaan Gümüş · 64eabd4
✨ feat(podcast): persist the transcript and serve it on the result door

The service's done report now carries the narration text; the backend
stores it in podcast_job.transcript (fill-once, blank means absent so a
progress report cannot stick an empty string) and returns it from
GET /podcast/jobs/{id}/result under the same owner-scoping and expiry
rules as the audio. Reports without the field keep passing, so older
service builds are unaffected.
Local-Gate: 2824ca0c3e6cf2366b8f62c09f5babe384f6e0db (1512 passed, 449s)
fix: retry a failed compose-up instead of staying downAhmet Kaan Gümüş · f195e7a
fix: retry a failed compose-up instead of staying down

Keep Type=oneshot and `up -d`. systemd 259 honors Restart=on-failure
for oneshot (measured: the restart counter advanced). Attached
`podman compose up` does not: podman-compose 1.6 only runs down on
SIGINT, and a container start failure exits 0, so Type=simple
Restart= would never see the failure. RestartSec=1500s is past the
longest deploy health gate (rag, 960s), so a background retry cannot
undo a rollback.
✨ 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: send a reconnect's index replay to the new workerAhmet Kaan Gümüş · c1d2674
fix: send a reconnect's index replay to the new worker

A RAG restart leaves the dying connection registered until the 30s idle
timeout. Equal load picked the older id, so the replay that fires on
register was sent to a connection that then timed out, and the school's
notes never re-entered the in-memory index. Equal load now prefers the
newer id. The blob-write stall is also 15s, under the 30s idle timeout,
so a stalled blob resets its stream instead of dropping the connection.
Local-Gate: 295251821acae9b52e92214d17dec1bac2baf67e (1513 passed, 521s)
test: force both orders in delete-vs-write racesAhmet Kaan Gümüş · 1a7d5c3
test: force both orders in delete-vs-write races

A barrier start is a coin toss under load. The tests required delete to
win a round, so a run where the writer won every overlap panicked even
though no orphan was left. Each witness now awaits delete-first and
write-first, and a concurrent round that does not sweep is not a failure.
🐛 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): send the school's class names with the report payloadAhmet Kaan Gümüş · 49f9665
✨ feat(insight): send the school's class names with the report payload

The live document printed raw class UUIDs under its Şube header: the
summaries' own evidence carries class ids, so the renderer had nothing else
to print. A machine identifier on the most human-facing artifact we ship is
exactly the defect the report exists to remove.

Additive payload key `classes: [{id, name}]` — a sibling of `school`, not a
member of it: it is a lookup for the rows, not part of the school's identity.
Read whole from the school's own `class_group` in name order (tens of rows);
a class a row names but the list does not carry is absent on purpose, and the
renderer falls back to an honest label rather than a name invented here. The
row lists are untouched.

Pinned in the payload contract test (the encoded JSON carries `classes`) and
in the round-trip test (a class created through `POST /classes` arrives with
its name).
Local-Gate: c07c6c1e530a9d2924068b3471ee5dbc2c98fd93 (1497 passed, 451s)
🐛 fix(insight): size the report deadline under the request envelopeAhmet Kaan Gümüş · 8ce2e1d
🐛 fix(insight): size the report deadline under the request envelope

Two verifier flags, one cause: the report door waits on its dispatch inside
one HTTP request, and the request-timeout middleware (30 s) drops the handler
future wherever it stands — mid-write included — answering its own 503 whose
"the write may or may not have applied" prose is wrong for a door that knows
nothing was stored, while a drop inside the store window stranded a
`.report-<uuid>.tmp`.

`AI_INSIGHT_REPORT_TIMEOUT_SECS` drops 300 → 25, so the service loses the
race on purpose and the door's own error path fires first: the honest
"nothing was stored" 503, and no temp is ever opened. The constant's comment
now states the relationship and that raising it needs the ceiling raised
with it; the row reads before the dispatch share the same envelope, which is
why the margin is not spent elsewhere.

Pinned as a compile-time assertion beside the report contract tests: a
raised deadline without a raised ceiling fails the build, proven by flipping
the value to 30 (E0080, the message) and reverting.
Local-Gate: c92220e9d9b886dc45b86b88c2ff7ecc6a54ce7a (1497 passed, 443s)
📄 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(insight): name the requester and fill a school-wide refresh rosterAhmet Kaan Gümüş · 0f55f34
✨ feat(insight): name the requester and fill a school-wide refresh roster

Every `insight.*` dispatch now carries `requested_by` — the caller the door
authenticated, which the service passes as `on_behalf_of` so its per-student
reads (`/marks/{user}` and the rest) answer as that teacher or manager instead
of the synthetic `ai` principal those reads refuse with a 403.

`insight.refresh` also always fills `user_ids`: a caller-named list passes
through exactly as given, while an empty body is filled from the school's own
student roster (every user holding the `student` role), because the service's
own roster discovery reads homework `assigned` lists, which a live school
rarely fills — so an empty body used to sweep nobody. The payload's new
`roster_source` records which roster the list was, and the refresh log names it
so the run ledger's counts are explainable. A school with no students dispatches
an empty list and answers 0 honestly; a roster past
`MAX_INSIGHT_REFRESH_STUDENTS` is refused rather than clipped.
Local-Gate: 644eaaee78ddae2e35af223da2719c3a55697a86 (1488 passed, 466s)
🐛 fix(ai): withdraw a capability a service refuses as unknownAhmet Kaan Gümüş · 0eb20f9
🐛 fix(ai): withdraw a capability a service refuses as unknown

A service that advertises `insight.refresh` in its `Hello` and then answers
the dispatch with `unknown_capability` has contradicted its own handshake.
The door read that advertisement as availability, queued the work with a
`202`, and the refusal could only ever be a WARN — the user saw success and
nothing happened. `rag.index`, `insight.refresh` and `insight.student` have
each bitten this way.

Now the registry withdraws the contradicted claim (`Registry::withdraw`):
`Worker::offers` — what `pick`, `has_capability` and the snapshots read — is
false for it, so routing drops the name and `GET /ai/capabilities` stops
listing it. Every door already branches on `has_capability`, so the next
call takes the `503` path it already had instead of queuing work nobody will
do. The WARN names the service, the capability and the refusal code.

Only a permanent, self-contradictory refusal does this. `unknown_capability`
is the one code the protocol defines for "no operation by this name" — its
example service-defined code (`unsupported_image`) is a verdict about a
payload, not a claim about what the worker serves. Transient verdicts
(`unavailable`, `timed_out`, `internal`, `capacity`) leave the claim
standing, so a busy or restarting service keeps getting the next request.

The withdrawal is per connection, never durable: every reconnect inserts a
fresh worker built from its `Hello` alone, so a service that fixes itself
restores the capability with no operator action.

Tests: a refused refresh flips the next `POST /insights/refresh` to 503 and
drops the capability from discovery (proved failing before the change); an
`unavailable` refusal keeps both the 202 and the listing; a reconnect
restores it — plus two registry unit tests.
Local-Gate: 8718d07b6fbc70148eebea518febeb7bba764a46 (1486 passed, 474s)
🎧 feat(podcast): the history can be scoped to one course noteAhmet Kaan Gümüş · 81a8384
🎧 feat(podcast): the history can be scoped to one course note

`GET /podcast/jobs` gains an optional `?source_id=` filter, so the studio
panel can list one note's own episodes instead of the caller's whole
history. The filter is part of the paging statement's `from_where`, so the
page and the count run the same predicate and `total` stays the filtered
count; the compare is `lower(source_id) = $2` against the canonical key, so
an equivalently-spelled note id still matches every row it names.

Omitted, the door answers exactly what it always did. A `source_id` that is
not a uuid is a `400` naming the field rather than a nil id answering a
silently empty page. School scoping, ordering and the staleness projection
are untouched: a foreign note id is an empty page, not a window across
schools.

The param is published on the route (`IntoParams` + `params(...)`); the
README endpoint table is unchanged.
🎧 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(podcast): the submit door resolves the note's PDF and hands the service its blob keyAhmet Kaan Gümüş · 5f9e97c
🎧 feat(podcast): the submit door resolves the note's PDF and hands the service its blob key

`podcast.submit` now carries `source_key` — the blob key of the note's newest
`application/pdf` attachment, resolved by the backend before the job row is
written. The service extracts the source with pymupdf, so it needs the file
itself: a note id alone names nothing it can open.

- `db::course_note_file::newest_pdf` reads the note's newest PDF (UUIDv7 id
  order is mint order), and the key it hands on is the row's own id — the same
  key the attachment's blob is stored under in the school's blob directory.
- `POST /podcast/jobs` refuses `409 source_missing` before anything is written
  when the note has no PDF attachment, or when that attachment's blob is not
  present on this host — instead of queueing a job the service can only fail
  later in its `kaynak` stage.
- The payload keeps `source_id` for the record and the report echo; a report
  now matches the row's note id, never a fixed literal.
- `tests/podcast.rs`: the submitting tests mint a real course note with a PDF
  (teacher cookie, real doors) and witness the dispatch's `source_key`, both
  refusal shapes (no row written, nothing dispatched), and that the newest PDF
  — not the newest file — is the source. Pre-fix those four witnesses fail
  with `202` + a queued row, which is the behaviour this change removes.
- `.sqlx`: one new query entry, regenerated on a scratch prepare DB.
Local-Gate: 5d93323e202eaafb074ee46e3eaa1c0b38229725 (1473 passed, 443s)
🐛 fix(tenant): the boot sweeps every school database to the school-schema headAhmet Kaan Gümüş · ee72900
🐛 fix(tenant): the boot sweeps every school database to the school-schema head

A school database is migrated exactly twice in its life — at mint (`bring_up`,
through the create path and the provisioning finish) and at boot (the
template, and now this sweep). Nothing else ever touches its schema: a re-dial
applies no migrations, and the boot's reconcile only reaches rows still marked
`provisioning`. A school minted before a migration landed therefore kept
yesterday's tables for good — which is how the live deployment answered

    relation "podcast_job" does not exist

on POST /podcast/jobs while the template already carried the podcast migration.

The missing half of the boot is now there: after the control database and the
template are ensured, every school database in the registry is dialled,
brought to the school-schema head and closed again. Nothing about a school no
request has reached is cached, so no pool for an unserved school survives the
sweep. The invariant it restores: **every school database in the control
database is at the school-schema head after boot.**

- Failure policy: one school failing never takes the boot down. It is logged
  at ERROR with its id and slug and left exactly as it stood — the sweep
  writes no registry row and no status, so a failed school is as usable (or
  unusable) as it was and the next boot retries it; sqlx's tracking table is
  what makes a retry of a half-applied migration safe.
- Observability: one INFO line per boot (`school schema sweep: N schools,
  M migrated`) plus one line per school, only when it actually applied
  something — the pending count comes off `_sqlx_migrations` before the
  migrator runs, so a school already at head costs one connection and no line.
- `migrate_school`, not the bare migrator: the chatbot/RAG interrupted-turn
  sweep is exactly as due on a school being swept as on one being minted.

The witness is in tests/persistence.rs: a school created through the normal
path, then rolled back to what an older head left behind — the table a later
migration created dropped and its `_sqlx_migrations` row deleted — reads
`relation "podcast_job" does not exist` before the sweep, and after it the
table is back, empty and recorded as applied, so the next boot is a no-op.
Every persistence test's second boot runs the sweep too (reboot()).
cargo check --all-targets and clippy -D warnings clean; persistence 11/11.
Local-Gate: 05ce93b5c478baa9a9ae80dd0bc8f99044a31f53 (1470 passed, 450s)
🐛 fix(deploy): the operator-secret assertion named an unbound variableAhmet Kaan Gümüş · c2ac4f8
🐛 fix(deploy): the operator-secret assertion named an unbound variable

The post-up env assertion aborted the deploy script with 'container: unbound
variable' AFTER the new stack was already healthy, so every deploy reported
failure while the correct build stayed live. Bind the container name before
the inspect, and translate the block's comments (this repo is English-only).
Local-Gate: 6992a743739affc85cebb7777608ffc3eb73a386 (1469 passed, 542s)
🚀 ci: a local full-suite gate lets a verified push skip the runner suiteAhmet Kaan Gümüş · 125a9b4
🚀 ci: a local full-suite gate lets a verified push skip the runner suite

The suite is 565s on this machine and ~55min on a 4-core runner, so the
default path is unchanged (GitHub runs Clippy, the suite, the release build,
the pack and the deploy) and a second path runs the suite here instead:

- scripts/gate-local.sh: clippy + the whole nextest suite + the doc gate with
  CI's env, then a stamp in .git/local-gate/<tree>.ok and a
  `Local-Gate: <tree> (<n> passed, <t>s)` trailer. --scope is quick iteration
  and never produces the trailer; Postgres and cargo-nextest are checked first
  with the exact command that fixes each.
- .github/workflows/main.yml: a 'Decide test gate' step verifies that trailer
  against HEAD^{tree} and skips the test steps only when it matches, so a
  stale or copy-pasted trailer falls back to running the suite. The job-level
  if and the Deploy gate accept the skipped-dispatch variants, and the
  dispatch gains a `tests` input (auto/skip/force).
- .githooks/pre-push: refuses a forged or stale trailer; an ordinary untested
  push stays legitimate. SKIP_LOCAL_GATE=1 bypasses it loudly.
- AGENTS.md documents both paths.
Local-Gate: 76d42499f683a9315fd9daa3325dde5c859676c8 (1469 passed, 536s)
📝 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.
⏱️ ci: a stalled run now fails in ninety minutes and names its testAhmet Kaan Gümüş · a39278e
⏱️ ci: a stalled run now fails in ninety minutes and names its test

The Build-and-test job gets a 90-minute timeout-minutes (default 360 min,
since the run holds the serial deploy lock) and the Test step gets a
shell-level timeout --foreground 4200 - above the 41m18s/60m25s green Test
steps, below the job limit. Before Test: df/free/nproc/nextest
version/.config/nextest.toml + show-config test-groups; then, via if: always(),
the docker log, df/free, docker system df and the pg_stat_activity breakdown +
the 20 longest queries: if the stall is on the DB side, its name stays in the
log.
🧪 test: a hang names itself - bounded frame waits + nextest slow-timeoutAhmet Kaan Gümüş · b7a8017
🧪 test: a hang names itself - bounded frame waits + nextest slow-timeout

One unbounded await in a bridge test held CI's Test step for 3h38m (run
35251780342), and because Deploy is serialized behind that job every later
push queued behind it. Two bounds, both naming the culprit:

* .config/nextest.toml: slow-timeout 120s, terminate-after 2 — a test that
  makes no progress is terminated and reported by name instead of hanging.
* every frame read and client handshake in the bridge tests (ai_bridge,
  ai_protocol, podcast) goes through frame_or_fail/connect_or_fail, which
  panic with the wait's name after 10s instead of blocking forever.

Local evidence: cargo nextest run --test ai_bridge --test podcast -j 16 ->
110 tests run: 110 passed in 41.2s.
🧪 test(bridge): the podcast report/upload handshake over a real QUIC streamAhmet Kaan Gümüş · 61960a5
🧪 test(bridge): the podcast report/upload handshake over a real QUIC stream

Three bridge-level tests for the podcast job's own rows, driven through real
client-initiated frames against a live bridge: the running/done/refused report
sequence with the row re-read after each refusal, the upload landing the exact
bytes under the school's own blob directory and stamping audio_key +
duration_secs (done accepted only after it), and the two-school test proving
the frame's school — not the payload — decides which database a report or an
upload can touch (no bytes under the other school, its row untouched).
`an_upload_past_the_audio_ceiling_is_refused_before_a_byte_is_read` sends no
body on purpose: the refusal must come off the frame alone.
✨ 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 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.
fix(deploy): a two-file --env-file dropped the operator file; single channel + envZekaDeploy · 4a2411d
fix(deploy): a two-file --env-file dropped the operator file; single channel + env

In podman-compose 1.6.0, `--env-file` is a SINGLE-valued argument and only the
LAST file is resolved (podman_compose.py:2941-2946, :2559). The unit's and the
deploy's two-file call (operator first, then stack.env) therefore never read
the operator file at all: the stack ran with the compose defaults
(DATABASE_URL password `hezarfen`, bridge token `change-me`) and the deploy's
"cannot be empty" gate only inspected the file, so nothing went red (hit in
production, 2026-09-17).

- unit: the operator file enters the unit's environment via `EnvironmentFile=`,
  and the single `--env-file` passed to compose is stack.env (ExecStart + ExecStop).
- deploy remote script: the operator file is read line by line into the process
  (no shell expansion), and the compose calls use a single `--env-file`.
- new gate: once the stack is up, the container's environment must carry the
  operator file's VALUES verbatim (AI_SHARED_TOKEN, POSTGRES_PASSWORD,
  AI_QUIC_ADDR, BUILDER_USERNAME); otherwise rollback.
- AI_SHARED_TOKEN and AI_QUIC_ADDR were added to the required-key list.

The environment variable overrides --env-file values (podman_compose.py:2562),
so the two channels cannot clash; Docker Compose v2's "the later file wins on a
clashing key" behaviour does not apply to this provider.
fix(clippy): then_some in the insight about-drop, small refusal enum in worker_forAhmet Kaan Gümüş · 5bb7de4
fix(clippy): then_some in the insight about-drop, small refusal enum in worker_for

CI Clippy red with -D warnings: unnecessary_lazy_evaluations at
src/web/insights.rs:694 and result_large_err at src/web/podcast.rs:476
(the Err half was a 128-byte axum Response). worker_for now returns a
small NoWorker enum and the four doors build the 503 at the call site
via NoWorker::refusal(), so status and body are unchanged.