refactor(events): downshift server.stream.events schemas to aragora.events (P4a Batch 1d)#8732
Conversation
…vents (P4a Batch 1d) Complete the downshift of the importable stream event schema surface (StreamEvent, StreamEventType, AudienceMessage) to the aragora.events layer. - aragora/server/stream/events.py is now a DeprecationWarning shim that re-exports the schemas from aragora.events.types (back-compat preserved; the warning message carries the old dotted path). - Repoint the foundation/infrastructure-layer importers off the old path: billing/cost_tracker.py and events/dispatcher.py now import the schemas from aragora.events.types directly, so they no longer contribute the stream.events link to the events->server / billing->server layer edges. Server-side stream runtime stays in place; only the importable schema surface moves. Domain/app callers (debate/, explainability/, ranking/) remain on the shim by-design (their DeprecationWarning is the intended two-sided signal). Refs: P4a layering foundation (epic #8257). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Aragora Code ReviewAdvisory-only review. No issues found. |
Claude independent model reviewReviewer: claude (anthropic) — independent adversarial model review via the Aragora Claude reviewer, grounded on the exact PR head. Verdict: PASS Reviewed the full change against the codebase. The refactor is backward-compatible and correct:
dogfood: yes |
Summary
P4a Batch 1d (Tier 1-2). Completes the downshift of the importable stream event schema surface (
StreamEvent,StreamEventType,AudienceMessage) to thearagora.eventslayer, so foundation/infrastructure modules can reach the event dataclasses without importingaragora.server.The schemas already live in
aragora.events.types; this PR:Turns
aragora/server/stream/events.pyinto aDeprecationWarningshim that re-exports the schemas fromaragora.events.types(back-compat preserved; the warning message carries the old dotted patharagora.server.stream.events).Repoints the foundation/infrastructure-layer importers off the old path:
aragora/billing/cost_tracker.py(BUDGET_ALERT emit path)aragora/events/dispatcher.py(TYPE_CHECKINGimport)so they no longer contribute the
stream.eventslink to theevents -> server/billing -> serverlayer edges.Server-side stream runtime stays in place; only the importable schema surface moves. Domain/app callers (
debate/,explainability/,ranking/) and the server-internal stream modules stay on the shim by-design - theirDeprecationWarningis the intended two-sided signal (VAL-CROSS-004); full caller migration is post-mission shim-retire.Refs: P4a layering foundation, epic #8257.
Validation (worktree off origin/main 3d2af8d)
aragora.server.stream.eventsemits aDeprecationWarningwhose message containsaragora.server.stream.events; the shim re-exports all three symbols and imports onlyaragora.events(allowed-imports check PASS). Robust isolated check (worktree-resolved,__file__asserted, token-filtered):TWO_SIDED_OK: True.mypy --ignore-missing-imports --follow-imports=skip --show-error-codesover the 3 touched files ->Success: no issues found in 3 source files.tests/billing/test_cost_tracker.py tests/server/stream/test_emitter.py tests/events/test_async_dispatcher.py tests/events/test_batch_dispatcher.py tests/events/test_security_dispatcher.py-> 218 passed (shimDeprecationWarningobserved firing viaemitter.py:19).PYTEST_BIN="python3 -m pytest" bash scripts/test_tiers.sh smoke-> 138 passed (exit 0).Risks / notes
DeprecationWarning; symbol identities/values unchanged.events -> serverandbilling -> serverimport-contract baseline edges are intentionally NOT shrunk: both packages retain otheraragora.server.*importers (events:server.handlers.webhooks,server.middleware.tracing[Batch 1b deferred],server.stream.{state_manager,emitter}; billing:server.middleware.auth), so the edges stay alive even though thestream.eventscontribution is removed. Recorded as residual drift for the P4a seal/sweep.docs/METRICS.md/aragora/module_tiers.yamlNOT regenerated (path-frozen at P4a by chore(deps): update audit-vulnerable Python locks #8460/fix(ci): clear base security and smoke blockers #8461/feat(tier4): settle_tier4_pr.py — one-command --settle-apply + receipt-backed preapproval gate #8382 per the path-freeze carve-out); the resulting generated-file drift is recorded for the orchestrator-coordinated phase merge-train regen.