forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to service/src/source.pyClear filter

2026-09-18

feat(insight): 🔑 reads run as the dispatch's requester, refusals stay typedAhmet Kaan Gümüş · d57406c
feat(insight): 🔑 reads run as the dispatch's requester, refusals stay typed

Every insight.* read went out as the bridge's synthetic `ai` principal, which
the backend deliberately lets see no course (ai/server.rs:853-867), so
/marks/{user}, attendance, pomodoro, profile and the homework report all came
back 403 or empty -- a dispatched analysis could not read its own data.

`requested_by` now travels on every insight.* payload; the service threads it
as `on_behalf_of` through every requester-observing read (Source gains the
parameter on each method; run_school, discover_students, _fetch_student and the
class roster pass it down). The one deliberate exception is the per-student
`/homework` feed behind `upcoming`: it keeps impersonating that student,
because the requester's view is the whole school's homework and would pollute
one student's profile with other students' due dates. A missing `requested_by`
(older backend) keeps today's behaviour and logs the fallback loudly once per
dispatch -- the service never refuses work for a missing field.

A read that still hits HTTP 401/403 is no longer a bare exception: SourceError
carries a typed `not_permitted` with path+status, and the answers surface it in
`coverage.unavailable.permission` / `failed[]`, so a caller can tell "the
requester may not read this" from "the service broke".

Tests: `RequesterIdentityTests` records (method, on_behalf_of) per read and
asserts per path -- requester reads as requested_by, the per-student /homework
as the student, the school-wide roster read as requested_by, the fallback as
None with a log line, and a 403 as the typed signal. 685 pass (63 skipped).

2026-09-16

createMuhammet Ozdemir · 98b2423Browse files