honcho/tests/dreamer
Vineeth Voruganti de428780a6 fix(scopes): close auth and observed-position gaps, paginate membership
Review response for #884.

Security:
- gate `SessionCreate.scopes` behind a workspace-level key; the session-create
  route is self-authorizing, so a peer- or session-scoped token could mint scope
  peers and join sessions to scopes it had no access to via `POST /scopes`
- refuse a reserved-but-nonexistent name in two observed positions that used the
  permissive guard: chat `target` and session-context `peer_target`. Both let a
  caller act on `scope.X` before it existed, then create the scope

Facade:
- exclude scope peers from `GET /sessions/{id}/peers` and refuse the membership
  -config read for a real scope, matching its write side
- replace `GET /scopes/{id}/sessions` with `POST /scopes/{id}/sessions/list`
  returning `Page[Session]`; the add route now returns 204. Membership was
  unbounded on both, while every other list surface paginates
- rename `crud.get_scope` to `get_scope_or_raise`

Tests:
- add a missing-name axis to the route-policy table (`Case.refuse_missing`), which
  is what surfaced the two guard gaps above
- delete 14 hand-written tests the table now enumerates; 52 -> 39 functions in
  test_scopes.py with more cases covered
- tighten the squatter assertion from `!= 422` to `< 400`, which was passing on 5xx
- assert the FastAPI-internals traversal still derives positions, so a framework
  upgrade can't silently empty the suite

Docs:
- drop internal ticket and RFC references from the published OpenAPI descriptions
  and surrounding comments; state the behavior instead
- move implementation reasoning out of the `PUT /peers/{id}` docstring, which
  FastAPI publishes, into a comment
2026-08-12 11:36:54 -04:00
..
__init__.py fixes: update unified tests, bugs in dream scheduling (#322) 2026-01-13 12:33:59 -05:00
test_card_refresh.py fix(scopes): close auth and observed-position gaps, paginate membership 2026-08-12 11:36:54 -04:00
test_dream_scheduler.py fix(dreamer): threshold and time-guard semantics (#573) 2026-04-30 11:40:51 -04:00
test_dream_v2_rollups.py feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
test_dreamer_integration.py feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
test_model_config_usage.py fix: optimize deriver and dreamer prompt cache prefixes (#806) 2026-06-15 10:58:02 -07:00
test_trees.py Fix surprisal tree kwarg mismatch (#749) 2026-06-19 13:49:04 -04:00