Repository navigation
feat(analytics): record runtime outcomes and refusals - #419
Conversation
Astra reviewReviewed StandardsNo blocking method or YAGNI findings. The five emitter schemas and later enrichment fields are explicitly requested, not speculative additions. Spec
Verification: isolated real-HTTP smoke with fixture identity/version and a failing PostHog client. Six requests covering success, invalid operation, capacity refusal, source failure, and PUT/GET bytes produced exactly six stdout events; PostHog failures left the expected responses unchanged. No production or running development instance was touched. Summary: Standards 0 blockers, no blocking method/YAGNI issue; Spec 1 blocker, P2 incorrect capacity-refusal outcome. |
Opus reviewTwo findings, most severe first. Neither is a runtime bug: the accumulator, the finalizer, the detached best-effort delivery, the shared PostHog client and the refusal paths all hold up. Both findings are about the event's field meanings. Those meanings get baked into PostHog data, and #393, #396 and #399 build on them. 1. Intent: tier 1 requests put the operation name in
|
|
Reviewed StandardsThe Effect shape holds.
The old SpecIssue 388 narrows §14, and the build order puts metering and the rest of the request event on ticket 15. This diff has the accumulator, one emit from the finalizer, stdout plus the shared PostHog client,
Four schema fields sit outside the emitter sentences in that decision.
Issue 388The ticket's build list is in the code. One record per hop, a finalizer, best-effort stdout and PostHog, probability 1, absent fields omitted, five schemas with only the request event emitted, and "readers stay unwatched" gone from the analytics package. The glossary and The done-when cases are in That
MethodA hop is a mutable record in a Cut Pre-decode Standards: 2 findings. The one to fix is the visit sentence dropped from the analytics header. Review by Grok 4.7, Grok Build. |
|
Addressed the Astra, Opus and Grok Build reviews in Fixed
Kept as is
Verification
GitHub reports |
145d878 to
3ff7560
Compare
1335f04 to
163140e
Compare
Runtime calls lacked a single record tying their identity, operations, refusals and timing together, making failures and limit usage hard to inspect.
This adds scoped wide events that finalize once on success, failure or interruption. Runtime call and bytes routes emit to stdout and the shared PostHog client without waiting for delivery. Attribution comes from trusted runtime state, local output is compact, and the five event schemas are ready for the later emitters.
Stacked on
tier2/387-limits-registry; this PR intentionally targets that branch, notmain. Implements the observability work in #384 §14.Closes #388.
Verification
pnpm typecheckandpnpm lintpassed.pnpm test --maxWorkers=2: 1,014 tests passed across 88 files.Implemented with OpenAI GPT-6 Astra using omp.