server: document category const on Browser*Event schemas#260
Conversation
Each Browser*Event schema now declares the category field that the event already carries on the wire (set by Event.Category in lib/events/event.go). Schemas use a const so generated clients can narrow the category by event variant. Coverage: 27 of 30 Browser*Event schemas. Skips live_view_connect, live_view_disconnect, and captcha_solve_result — those are emitted by external producers (Neko, captcha solvers), and their category values should be confirmed with the producers before locking them down. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a04ed01. Configure here.
| @@ -614,6 +1004,21 @@ func (e BrowserServiceCrashedEventDataPhase) Valid() bool { | |||
| } | |||
| } | |||
|
|
|||
| // Defines values for BrowserSystemOomKillEventCategory. | |||
| const ( | |||
| System BrowserSystemOomKillEventCategory = "system" | |||
There was a problem hiding this comment.
Generated constant System breaks naming pattern, risks collision
Low Severity
The generated constant for BrowserSystemOomKillEventCategory is named just System instead of BrowserSystemOomKillEventCategorySystem, which is the pattern followed by all 26 other category constants (e.g., BrowserServiceCrashedEventCategorySystem, BrowserCdpConnectEventCategorySystem). This happens because oapi-codegen's name deduplication strips the suffix when the type name already ends with the CamelCase'd enum value. The bare System export in the oapi package is a latent collision risk and inconsistent with the rest of the generated API surface. A workaround in the OpenAPI spec (e.g., adjusting the schema name) or an output-options override in the codegen config could produce a more specific name.
Reviewed by Cursor Bugbot for commit a04ed01. Configure here.
Monitoring Plan: Add
|


Summary
categoryconst to 27 of 30Browser*Eventdocumentation schemas inserver/openapi.yaml.CategoryGo field onevents.Eventthat the VM already sets on every emitted event (server/lib/events/event.go:38), so consumers can read it directly off the per-variant schema instead of falling back to the baseTelemetryEvent.server/lib/oapi/oapi.goso the Go types pick up the new constants.Source-of-truth for the const values:
Browser{Console,Network,Page,Interaction,Monitor}*Event(22)console/network/page/interaction/system)cdpmonitor/*.go,screenshot.go,devtoolsproxy/proxy.go,monitor.goBrowserApiCallEventapicmd/api/api/middleware.go:67BrowserCdpConnectEvent/BrowserCdpDisconnectEventsystemlib/devtoolsproxy/proxy.go:474,491BrowserSystemOomKillEventsystemlib/sysmon/sysmon.go:180BrowserServiceCrashedEventsystemcmd/supervisord-shim/main.go:234Skipped (left as-is, no
categorydeclared on the per-variant schema):BrowserLiveViewConnectEvent/BrowserLiveViewDisconnectEvent— emitted by Neko (external)BrowserCaptchaSolveResultEvent— emitted by external captcha solverTheir producers live outside this repo, so I didn't want to lock down a const without confirmation. Worth a follow-up to either declare them here (likely
systemfor live_view; captcha is less obvious) or document them as freeform on those schemas. Wire emission for these still flows through the baseTelemetryEventschema, which already declarescategorywith the full enum.Companion to https://github.com/kernel/kernel/pull/2252 (kernel/kernel openapi) — same field, mirrored on the doc-only schemas here.
Test plan
cd server && make oapi-generateregenerates cleanlycd server && go vet ./...cleancd server && go build ./...cleancd server && go test -race $(go list ./... | grep -v /e2e$)— all packages pass🤖 Generated with Claude Code
Note
Low Risk
OpenAPI and generated Go type changes only; runtime category assignment is unchanged and three external-producer events are intentionally left undocumented.
Overview
Documents
categoryon 27 per-variantBrowser*Eventschemas inserver/openapi.yaml, each as a fixed const (console,network,page,interaction,api, orsystem) aligned with what the VM already puts onevents.Event.server/lib/oapi/oapi.gois regenerated so typed events exposeCategory, enum constants, andValid()helpers.BrowserLiveView*andBrowserCaptchaSolveResultEventare unchanged (no locked const) because those producers sit outside this repo.Reviewed by Cursor Bugbot for commit a04ed01. Bugbot is set up for automated code reviews on this repo. Configure here.