Skip to content

fix(types): declare the server telemetry events the engine already emits - #297

Merged
willwashburn merged 3 commits into
mainfrom
claude/posthog-workspace-metrics-k7ag27
Jul 25, 2026
Merged

fix(types): declare the server telemetry events the engine already emits#297
willwashburn merged 3 commits into
mainfrom
claude/posthog-workspace-metrics-k7ag27

Conversation

@willwashburn

@willwashburnwillwashburn commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

Fourteen relaycast_server_* event names are emitted by the engine but missing from SERVER_TELEMETRY_EVENTS. parseInternalTelemetryEvent validates the name against a zod enum built from that list, and the hosted sink invokes the capture as a floating void capture...(...) — so each of these threw into an unhandled rejection and was dropped before reaching PostHog, silently and with nothing logged.

The affected events:

action_registered / action_invoked / action_deleted
route_resolved / route_feedback_recorded / routing_config_updated
directory_agent_created|updated|deleted / directory_rating_upserted / directory_search_executed
channel_muted / channel_unmuted
relayfile_inbound_delivered

relaycast_server_action_invoked is among them, which means action usage — arguably the clearest signal that a workspace is doing real work — has never been visible in analytics.

Changes

  • packages/types/src/telemetry.ts: add the 14 names to SERVER_TELEMETRY_EVENTS, with REQUIRED_SERVER_EVENT_PROPS entries. The required lists are deliberately conservative — only properties present at every emit site — because a missing required property throws and drops the event through the exact same path this PR is fixing. (emitServerEvent always injects workspace_id, so that one is always safe.)
  • packages/engine/src/lib/__tests__/serverTelemetryCatalog.test.ts: a guard test that scans every emitServerEvent call site in the engine and asserts its event name is declared. A second assertion fails if a call shape changes such that the guard can no longer read the name, so it can't silently stop guarding.

Not included, flagged for a follow-up rather than widened into this PR: command_registered / command_deleted / command_invoked and workspace_stream_updated are declared but emitted by nothing (the command_* trio looks like the pre-rename ancestor of action_*). Deciding whether to delete or wire those up is a separate call.

Test Plan

  • Tests added/updated — new catalog guard test
  • Verified the guard actually goes red: removing relaycast_server_action_invoked from the catalog fails the test with that exact name, and passes again when restored
  • npx turbo test --filter=@relaycast/types --filter=@relaycast/engine — 511 tests passing
  • npx turbo build for both packages

Generated by Claude Code

Review in cubic

Fourteen `relaycast_server_*` names were emitted by the engine but missing
from `SERVER_TELEMETRY_EVENTS`. `parseInternalTelemetryEvent` validates the
name against a zod enum built from that list, and the hosted sink invokes it
as a floating `void capture...(...)`, so each one threw into an unhandled
rejection and was dropped before reaching PostHog — silently, for actions,
routing, the agent directory, channel mute/unmute, and inbound Relayfile
delivery. `relaycast_server_action_invoked` was among them.
Adds the missing names with conservative required-property lists (only
fields present at every emit site, since a missing required property drops
the event the same way), and a guard test in the engine that diffs every
`emitServerEvent` call site against the catalog so a new emit site can't go
invisible again.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CxUMkEa2foSTbw88sqEFWA
@coderabbitai

coderabbitaiBot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@willwashburn, you've reached your PR review limit, so we couldn't start this review.

Next review available in:49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d1016a49-ecf9-4587-ba51-29d2c8974ad4

📥 Commits

Reviewing files that changed from the base of the PR and between c767168 and 70b69e5.

📒 Files selected for processing (1)
  • packages/types/CHANGELOG.md
📝 Walkthrough

Walkthrough

The server telemetry catalog now declares 14 additional engine-emitted events with required payload properties. A Vitest suite scans engine emission sites to ensure emitted event names remain catalogued, and changelogs document the fix.

Changes

Server telemetry catalog coverage

Layer / File(s)Summary
Expand telemetry catalog and payload requirements
packages/types/src/telemetry.ts, packages/types/CHANGELOG.md, CHANGELOG.md
The catalog and required property mappings now include action, directory, routing, channel mute/unmute, and inbound relayfile telemetry events; changelogs document the update.
Validate emitted event names
packages/engine/src/lib/__tests__/serverTelemetryCatalog.test.ts
A Vitest suite scans engine TypeScript sources, parses emitServerEvent(...) calls, and verifies every emitted event name exists in SERVER_TELEMETRY_EVENTS.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels:size:L

Poem

I’m a rabbit with telemetry ears,
Cataloguing events that once vanished in fears.
Mute, route, relay, and action in line,
Their payloads now validate fine.
Tests hop through source code bright—
No event gets lost tonight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly summarizes the main change: adding missing server telemetry event declarations emitted by the engine.
Description check✅ PassedThe description directly describes the telemetry catalog fix, guard test, and affected events in the changeset.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/posthog-workspace-metrics-k7ag27

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/types/CHANGELOG.md`:
- Line 18: Shorten the telemetry release-note bullet to one concise,
impact-first statement describing the affected server action, directory, route,
channel-muted, and relayfile telemetry domains without catalog, parser,
validation, or sink details. Apply the same causal-chain reduction at
packages/types/CHANGELOG.md:18-18 and CHANGELOG.md:34-34, preserving only the
shipped user-visible impact at both sites.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 24d91597-45b4-4fcf-b9d6-6a5beed5be84

📥 Commits

Reviewing files that changed from the base of the PR and between 680b75e and c767168.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • packages/engine/src/lib/__tests__/serverTelemetryCatalog.test.ts
  • packages/types/CHANGELOG.md
  • packages/types/src/telemetry.ts

Comment threadpackages/types/CHANGELOG.md Outdated

### Fixed

- `SERVER_TELEMETRY_EVENTS` now declares the 14 event names the engine already emits (`relaycast_server_action_*`, `relaycast_server_directory_*`, `relaycast_server_route*`, `relaycast_server_channel_muted` / `_unmuted`, `relaycast_server_relayfile_inbound_delivered`). `parseInternalTelemetryEvent` rejected them as unknown, so every one was dropped instead of captured.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Shorten the telemetry release note. Keep this as one impact-first bullet; omit catalog, parser, validation, and sink implementation details.

  • packages/types/CHANGELOG.md#L18-L18: Replace the detailed internal explanation with a concise impact statement.
  • CHANGELOG.md#L34-L34: Trim the causal chain while retaining the affected telemetry domains.

As per coding guidelines, changelog entries should be “one short, impact-first bullet per user-visible change” and omit internal details unless they explain shipped impact.

📍 Affects 2 files
  • packages/types/CHANGELOG.md#L18-L18 (this comment)
  • CHANGELOG.md#L34-L34
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/types/CHANGELOG.md` at line 18, Shorten the telemetry release-note
bullet to one concise, impact-first statement describing the affected server
action, directory, route, channel-muted, and relayfile telemetry domains without
catalog, parser, validation, or sink details. Apply the same causal-chain
reduction at packages/types/CHANGELOG.md:18-18 and CHANGELOG.md:34-34,
preserving only the shipped user-visible impact at both sites.

Source: Coding guidelines

claude added 2 commits July 25, 2026 12:21
The root changelog is the cross-package, user-facing narrative. This change
is single-package (the engine side is test-only, which AGENTS.md says to
omit) and no self-hoster or hosted user sees a behavior difference — it is
hosted-analytics plumbing. The entry also carried the implementation
backstory and referenced the hosted sink, which lives in another repo.
Keeps one concise bullet in the types changelog, under Added since what
ships there is the widened export surface.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CxUMkEa2foSTbw88sqEFWA
Main refiled the pending 6.0.4–6.2.0 entries under release headings (#298)
and added scripts/cut-changelog.mjs (#299). The textual merge landed this
branch's types entry inside the now-released [6.2.0] block, which would have
credited an unreleased change to a shipped version — moved it back under
[Unreleased], and raised that heading from Patch to Minor since widening an
exported const/union is additive.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CxUMkEa2foSTbw88sqEFWA
@willwashburn
willwashburn merged commit 918c35c into mainJul 25, 2026
5 checks passed
@willwashburn
willwashburn deleted the claude/posthog-workspace-metrics-k7ag27 branch July 25, 2026 16:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@willwashburn@claude