feat(apollo-vertex): typed telemetry seam for solution-tests#971
feat(apollo-vertex): typed telemetry seam for solution-tests#971frankkluijtmans wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a typed telemetry “seam” to the Apollo Vertex Solution Tests template so host apps can optionally receive strongly-typed analytics events for Solution Tests actions and related UI interactions.
Changes:
- Introduces
SolutionTestEventMap(+ related types) and optionalconfig.trackcallback inSolutionTestsConfig. - Emits telemetry events from Solution Tests mutation hooks and several UI interaction points.
- Exports the telemetry types from the package barrel and documents the telemetry contract in the template page.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/apollo-vertex/registry/solution-tests/use-solution-tests.ts | Adds track calls to run/create/toggle-active/delete mutations (tracking on onMutate). |
| apps/apollo-vertex/registry/solution-tests/use-run-results.ts | Adds track calls for adopt job / update baseline mutations. |
| apps/apollo-vertex/registry/solution-tests/use-force-stop.ts | Adds track calls for force-stopping batch and run mutations. |
| apps/apollo-vertex/registry/solution-tests/use-baseline-jobs.ts | Adds track call for removing a baseline mutation. |
| apps/apollo-vertex/registry/solution-tests/solution-tests-view.tsx | Tracks tab view and row expansion UI interactions. |
| apps/apollo-vertex/registry/solution-tests/run-details.tsx | Tracks run result inspection events. |
| apps/apollo-vertex/registry/solution-tests/index.ts | Re-exports telemetry types from config.ts. |
| apps/apollo-vertex/registry/solution-tests/expanded-run-tests.tsx | Tracks opening run details from expanded runs view. |
| apps/apollo-vertex/registry/solution-tests/expanded-agents.tsx | Tracks viewing raw expected output in the agent expanded view. |
| apps/apollo-vertex/registry/solution-tests/config.ts | Defines SolutionTestEventMap and typed TrackSolutionTestEvent; adds optional track to config + resolved config. |
| apps/apollo-vertex/app/templates/solution-tests/page.mdx | Documents the track callback and event contract; adds telemetry notes under customizing. |
Comments suppressed due to low confidence (1)
apps/apollo-vertex/app/templates/solution-tests/page.mdx:135
- The table is presented right after saying
SolutionTestEventMapis the source of truth, but it only lists the action events and omits the UI interaction events that are also part of the map. Add a clarifying sentence so readers don’t assume the table is exhaustive.
`SolutionTestEventMap` is the single source of truth for the event contract, so
the callback is fully typed: `properties` is narrowed to the payload of the
`event` you pass. Compose the map into your own app's event map to keep the
wiring type-safe end to end.
| Omit it and tracking is a no-op. Because the events fire from the mutation hooks | ||
| (`useRunTests`, `useCreateTest`, and friends), only the smart container reports | ||
| them. A bare `SolutionTestsView` wired to your own handlers does not. |
| mutationFn: ({ testIds }: { testIds?: string[]; mode: RunTestsMode }) => | ||
| actions.runTests(testIds), | ||
| // Track the user action on trigger (not success) — we want intent, not outcome. | ||
| onMutate: ({ testIds, mode }) => | ||
| track?.("VS.SolutionTest.Run", { mode, testCount: testIds?.length ?? 0 }), |
e61305f to
a04ba38
Compare
|
Apollo Coded App preview deployments are ready.
|
a04ba38 to
a3b5f47
Compare
📊 Coverage + size by packagePer-package bundle size on this PR (no JS/TS source changes detected under
"Coverage" is each package's own |
Dependency License Review
License distribution
Excluded packages
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (3)
apps/apollo-vertex/app/templates/solution-tests/page.mdx:122
- The telemetry section says events only fire from the mutation hooks and that a bare
SolutionTestsViewwon't emit them, butSolutionTestsViewnow emits several UI interaction events itself (TabViewed,TestExpanded,BatchExpanded). This doc should distinguish between action events (from hooks) vs UI interaction events (from the view).
Omit it and tracking is a no-op. Because the events fire from the mutation hooks
(`useRunTests`, `useCreateTest`, and friends), only the smart container reports
them. A bare `SolutionTestsView` wired to your own handlers does not.
apps/apollo-vertex/registry/solution-tests/use-solution-tests.ts:49
- The PR description says telemetry events fire "on success", but the implementation (and this docs page) describe firing on intent (
onMutate) rather than on success. Please align the PR description with the actual behavior, or switch the implementation/docs toonSuccessif success-only is intended.
// Track the user action on trigger (not success) — we want intent, not outcome.
onMutate: ({ testIds, mode }) =>
track?.("VS.SolutionTest.Run", { mode, testCount: testIds?.length ?? 0 }),
apps/apollo-vertex/app/templates/solution-tests/page.mdx:134
- The event contract (
SolutionTestEventMap) includes UI interaction events (tab viewed, row expanded, etc.), but the Telemetry table only lists the action events. Either list the UI events too or explicitly state the table is action-only and point readers toSolutionTestEventMapfor the full set.
`SolutionTestEventMap` is the single source of truth for the event contract, so
the callback is fully typed: `properties` is narrowed to the payload of the
`event` you pass. Compose the map into your own app's event map to keep the
wiring type-safe end to end.
| mutationFn: ({ testIds }: { testIds?: string[]; mode: RunTestsMode }) => | ||
| actions.runTests(testIds), | ||
| // Track the user action on trigger (not success) — we want intent, not outcome. | ||
| onMutate: ({ testIds, mode }) => | ||
| track?.("VS.SolutionTest.Run", { mode, testCount: testIds?.length ?? 0 }), |
Adds an optional, fully-typed
tracktelemetry callback toSolutionTestsConfigso a host can route Solution Tests action events to its own analytics backend, defaulting to a no-op when omitted. Each action hook (run, create, toggle-active, delete, force-stop batch/run, adopt/update/remove baseline) fires a named event on success, withSolutionTestEventMapas the single typed source of truth for event names and payloads, exported from the package barrel. The docs page gains a Telemetry section documenting the callback, the event contract, and a bullet under Customizing.👨 Generated with Kluijt Code