forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/web/podcast.rsClear filter

2026-09-23

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

📄 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 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)
✨ 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.
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.
docs: correct the bridge's tenancy claim — school is stamped, echo not verifiedAhmet Kaan Gümüş · ee1f8f9
docs: correct the bridge's tenancy claim — school is stamped, echo not verified

The bridge correlates replies by frame id only (ai::server dispatch matches
Response.id and never compares the school field), so the docs' claim that it
'refuses an answer that does not echo the school' was false. State the true
posture: request-side stamping plus the service's own honesty.
✨ feat: the podcast relay — four podcast.* capabilities and their audio streamAhmet Kaan Gümüş · 5a5a483
✨ feat: the podcast relay — four podcast.* capabilities and their audio stream

The backend had no dispatch site for podcast.submit/status/result/cancel, so the service's registration was unreachable. New AI_PODCAST_*_CAPABILITY constants, ai::podcast payload types + dispatch, and a /podcast nest gated on the chatbot module: POST /podcast/jobs (202 receipt), GET /podcast/jobs/{id}, GET /podcast/jobs/{id}/result, POST /podcast/jobs/{id}/cancel. Each door answers 503 with no worker declaring its capability, and relays the service's own refusal code as a status (not_found → 404, not_ready/llm_unavailable → 409, busy → 503, timed_out → 504, transport/protocol/bad_reply → 502).

The produced audio never crosses the bridge: podcast.result answers audio_id as a path relative to PODCAST_OUTPUT_ROOT, which the deployment points at the school's own directory under FILES_PATH, and GET /podcast/audio?path= streams it in bounded 64 KiB chunks out of the school-scoped State's files_path. That door refuses absolute paths, ./.. segments, backslashes, colons and symlinks resolving out of the school's directory with 400, and 401 without a session.

tests/podcast.rs drives all four capabilities over a real QUIC bridge against a fake service, plus the 503s (no worker and no bridge), the refusal→status mapping, the module gate, the session gate, and every audio-door refusal against a file that really exists. README endpoints table regenerated with UPDATE_DOCS=1.

Known pending, owned by lane/insight: tests/integration.rs's hand-written MODULE_PREFIXES needs a (Module::Chatbot, "/podcast") row, so the route-mount gate stays red for /podcast until that row lands.