From 994f53b6d2055d396dadefa0d7d2923dff1458de Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Mar 2026 15:17:55 +0000 Subject: [PATCH 1/3] chore: bump version to 2.0.0-beta.0 and add comprehensive PR description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update package.json version from 1.10.0-beta.4 to 2.0.0-beta.0 to reflect the breaking changes in this release branch. Add PR_DESCRIPTION.md capturing the full scope of changes for the v2.0.0 release, including: - MCP server with 11 LLM-callable tools - Issues CLI (list, get, count, update, dismiss) - Telemetry instrumentation with opt-out support - Metrics consolidation (7 subcommands → 4) - Deprecated Hookdeck Go SDK removal (API 2024-03-01 → 2025-07-01) - Breaking change: --config flag renamed to --hookdeck-config https://claude.ai/code/session_012a587AhAbbWdqYx76cexPG --- PR_DESCRIPTION.md | 153 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 PR_DESCRIPTION.md diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md new file mode 100644 index 00000000..68581bbc --- /dev/null +++ b/PR_DESCRIPTION.md @@ -0,0 +1,153 @@ +# PR Title + +`v2.0.0: MCP server, telemetry instrumentation, issues CLI, metrics consolidation, and Go SDK removal` + +# PR Description + +Use the content below to update the PR description on GitHub. + +--- + +## Summary + +This is the **v2.0.0** release branch. It combines several feature branches into a single release that includes breaking changes, new functionality, and internal improvements. + +### What's New + +- **MCP Server** (`hookdeck gateway mcp`) — A Model Context Protocol server exposing Hookdeck's API as LLM-callable tools, compatible with Claude Desktop, Cursor, and other MCP clients. +- **Issues CLI** (`hookdeck gateway issue`) — Full CRUD commands for managing Hookdeck issues (delivery failures, transformation errors, backpressure). +- **Telemetry Instrumentation** — Per-request telemetry headers tracking CLI/MCP source, environment, command path, and invocation ID, with opt-out support. +- **`hookdeck telemetry` command** — New command to enable/disable telemetry (`hookdeck telemetry disable` / `hookdeck telemetry enable`). + +### Breaking Changes + +- **Global `--config` flag renamed to `--hookdeck-config`** — The global flag for specifying the CLI config file path has been renamed to avoid conflicts with `--config` flags on source/destination commands that accept JSON objects. Users must update scripts using `hookdeck --config /path` to `hookdeck --hookdeck-config /path`. +- **Metrics subcommands consolidated** — Seven metrics subcommands have been reduced to four resource-aligned commands (`events`, `requests`, `attempts`, `transformations`). The removed commands (`pending`, `queue-depth`, `events-by-issue`) are now served by `hookdeck gateway metrics events` with appropriate `--measures` and flag combinations. See migration table below. +- **Deprecated Hookdeck Go SDK removed** — The vendored `hookdeck-go-sdk` dependency (pinned to API version `2024-03-01`) has been removed. The `listen` command and all internal API calls now use the direct HTTP client against API version `2025-07-01`. This changes the underlying API version for `hookdeck listen` operations. +- **`pkg/config/sdkclient.go` and `pkg/hookdeck/sdkclient.go` removed** — The SDK client wrapper files have been deleted entirely. + +### Metrics Migration Guide + +| Old Command | New Command | +|---|---| +| `hookdeck gateway metrics pending --measures count --granularity 1h` | `hookdeck gateway metrics events --measures pending --granularity 1h` | +| `hookdeck gateway metrics queue-depth --measures max_depth,max_age` | `hookdeck gateway metrics events --measures max_depth,max_age` | +| `hookdeck gateway metrics events-by-issue --measures count` | `hookdeck gateway metrics events --measures count --issue-id ` | + +--- + +## Detailed Changes + +### MCP Server (`hookdeck gateway mcp`) + +A stdio JSON-RPC MCP server that exposes Hookdeck's API for use by AI agents and LLM-powered tools. + +**Tools (11 total):** + +| Tool | Description | +|------|-------------| +| `hookdeck_help` | Get tool overview or detailed help for a specific tool | +| `hookdeck_sources` | Inspect inbound HTTP endpoints (list, get) | +| `hookdeck_destinations` | Inspect delivery targets — HTTP, CLI, MOCK (list, get) | +| `hookdeck_connections` | Inspect and control routes linking sources to destinations (list, get, pause, unpause) | +| `hookdeck_requests` | Query raw inbound HTTP requests before routing (list, get, raw_body, events, ignored_events) | +| `hookdeck_events` | Query processed events routed through connections (list, get, raw_body) | +| `hookdeck_attempts` | Query delivery attempts and retry history (list, get) | +| `hookdeck_transformations` | Inspect JavaScript payload transformations (list, get) | +| `hookdeck_issues` | Inspect aggregated failure signals (list, get) | +| `hookdeck_metrics` | Query aggregate metrics with time ranges and grouping dimensions (events, requests, attempts, transformations) | +| `hookdeck_projects` | List available projects or switch active project (list, use) | +| `hookdeck_login` | Browser-based device authentication (available when unauthenticated) | + +**Key features:** +- Stdio transport compatible with Claude Desktop, Cursor, and other MCP clients +- Structured error translation mapping HTTP status codes to MCP error codes +- In-band browser-based authentication — if unauthenticated, only `hookdeck_login` is available; after auth, all resource tools become available without reconnection +- Comprehensive test coverage (94+ tests in `server_test.go` and `telemetry_test.go`) + +**Configuration example (Cursor / Claude Desktop):** +```json +{ + "mcpServers": { + "hookdeck": { + "command": "hookdeck", + "args": ["gateway", "mcp"] + } + } +} +``` + +### Issues CLI (`hookdeck gateway issue`) + +New subcommand for managing Hookdeck issues with full CRUD support. + +| Command | Description | +|---------|-------------| +| `issue list` | List and filter issues by type, status, trigger ID with pagination | +| `issue get ` | Get detailed issue information | +| `issue count` | Count issues with optional filters | +| `issue update --status ` | Update issue status (OPENED, IGNORED, ACKNOWLEDGED, RESOLVED) | +| `issue dismiss ` | Dismiss an issue (with `--force` to skip confirmation) | + +All commands support `--output json` for machine-readable output. + +### Telemetry Instrumentation + +Per-request telemetry headers (`X-Hookdeck-CLI-Telemetry`) are now sent with API requests, tracking: + +| Dimension | Description | Example | +|-----------|-------------|---------| +| `source` | Request origin | `"cli"` or `"mcp"` | +| `environment` | Runtime environment | `"interactive"` or `"ci"` | +| `command_path` | Command or tool being executed | `"hookdeck listen"`, `"hookdeck_sources/list"` | +| `invocation_id` | Unique per-invocation identifier | `"inv_a1b2c3d4e5f6g7h8"` | +| `device_name` | Hostname | `"my-machine"` | +| `mcp_client` | MCP client identifier (MCP only) | `"cursor/0.42"` | + +**Opt-out:** Users can disable telemetry via: +- `hookdeck telemetry disable` command +- `HOOKDECK_CLI_TELEMETRY_OPTOUT=1` environment variable + +### Go SDK Removal + +The deprecated `github.com/hookdeck/hookdeck-go-sdk v0.7.0` dependency has been removed entirely. All API calls now go through the direct HTTP client (`pkg/hookdeck/client.go`), using API version `2025-07-01` instead of the SDK's pinned `2024-03-01`. + +**Files removed:** +- `pkg/config/sdkclient.go` +- `pkg/hookdeck/sdkclient.go` + +**Files updated:** +- `pkg/listen/listen.go` — Now uses `config.GetAPIClient()` instead of SDK client +- `pkg/listen/source.go` — Direct API calls for source operations +- `pkg/listen/connection.go` — Direct API calls for connection operations +- `pkg/listen/proxy/` — Updated to use `hookdeck.*` types instead of `hookdecksdk.*` +- `pkg/listen/tui/` — Updated type references + +### Other Changes + +- **`REFERENCE.md` updated** — Reflects new commands, renamed flags, and removed metrics subcommands +- **`REFERENCE.template.md` removed** — Template file for reference generation deleted +- **Source/destination `--config` flag** — New `--config` flag on source and destination create/update/upsert commands for passing JSON config objects directly +- **Acceptance test infrastructure** — New parallel test runner (`test/acceptance/run_parallel.sh`), expanded test helpers, and comprehensive test coverage for issues, metrics, and MCP +- **CI workflow updates** — Acceptance test workflow updated for new test structure + +--- + +## Stats + +- **100 files changed** +- **~8,900 additions**, **~610 deletions** +- **45 commits** + +## Test Plan + +- [ ] Acceptance tests pass for issues CLI (`test/acceptance/issue_test.go`) +- [ ] Acceptance tests pass for metrics consolidation (`test/acceptance/metrics_test.go`) +- [ ] MCP server unit tests pass (`pkg/gateway/mcp/server_test.go` — 94+ tests) +- [ ] MCP telemetry tests pass (`pkg/gateway/mcp/telemetry_test.go`) +- [ ] CLI telemetry tests pass (`pkg/cmd/telemetry_test.go`, `pkg/hookdeck/telemetry_test.go`) +- [ ] `hookdeck listen` works correctly with new direct API client +- [ ] `hookdeck gateway mcp` starts and responds to tool calls +- [ ] Telemetry opt-out works via command and environment variable +- [ ] `--hookdeck-config` flag works (and `--config` no longer conflicts) +- [ ] Verify 2.0.0-beta.0 version in build artifacts diff --git a/package.json b/package.json index d4fef50b..2008524c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hookdeck-cli", - "version": "1.10.0-beta.4", + "version": "2.0.0-beta.0", "description": "Hookdeck CLI", "repository": { "type": "git", From 18d1f163791bff2c724666a77d2f70e394041c54 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Mar 2026 15:23:00 +0000 Subject: [PATCH 2/3] feat(mcp): add beta wrapping to MCP command and remove PR_DESCRIPTION.md Add ShortBeta/LongBeta wrapping to the MCP command for consistency with all other gateway subcommands. Remove PR_DESCRIPTION.md as it doesn't belong in the codebase. https://claude.ai/code/session_012a587AhAbbWdqYx76cexPG --- PR_DESCRIPTION.md | 153 ---------------------------------------------- pkg/cmd/mcp.go | 6 +- 2 files changed, 3 insertions(+), 156 deletions(-) delete mode 100644 PR_DESCRIPTION.md diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md deleted file mode 100644 index 68581bbc..00000000 --- a/PR_DESCRIPTION.md +++ /dev/null @@ -1,153 +0,0 @@ -# PR Title - -`v2.0.0: MCP server, telemetry instrumentation, issues CLI, metrics consolidation, and Go SDK removal` - -# PR Description - -Use the content below to update the PR description on GitHub. - ---- - -## Summary - -This is the **v2.0.0** release branch. It combines several feature branches into a single release that includes breaking changes, new functionality, and internal improvements. - -### What's New - -- **MCP Server** (`hookdeck gateway mcp`) — A Model Context Protocol server exposing Hookdeck's API as LLM-callable tools, compatible with Claude Desktop, Cursor, and other MCP clients. -- **Issues CLI** (`hookdeck gateway issue`) — Full CRUD commands for managing Hookdeck issues (delivery failures, transformation errors, backpressure). -- **Telemetry Instrumentation** — Per-request telemetry headers tracking CLI/MCP source, environment, command path, and invocation ID, with opt-out support. -- **`hookdeck telemetry` command** — New command to enable/disable telemetry (`hookdeck telemetry disable` / `hookdeck telemetry enable`). - -### Breaking Changes - -- **Global `--config` flag renamed to `--hookdeck-config`** — The global flag for specifying the CLI config file path has been renamed to avoid conflicts with `--config` flags on source/destination commands that accept JSON objects. Users must update scripts using `hookdeck --config /path` to `hookdeck --hookdeck-config /path`. -- **Metrics subcommands consolidated** — Seven metrics subcommands have been reduced to four resource-aligned commands (`events`, `requests`, `attempts`, `transformations`). The removed commands (`pending`, `queue-depth`, `events-by-issue`) are now served by `hookdeck gateway metrics events` with appropriate `--measures` and flag combinations. See migration table below. -- **Deprecated Hookdeck Go SDK removed** — The vendored `hookdeck-go-sdk` dependency (pinned to API version `2024-03-01`) has been removed. The `listen` command and all internal API calls now use the direct HTTP client against API version `2025-07-01`. This changes the underlying API version for `hookdeck listen` operations. -- **`pkg/config/sdkclient.go` and `pkg/hookdeck/sdkclient.go` removed** — The SDK client wrapper files have been deleted entirely. - -### Metrics Migration Guide - -| Old Command | New Command | -|---|---| -| `hookdeck gateway metrics pending --measures count --granularity 1h` | `hookdeck gateway metrics events --measures pending --granularity 1h` | -| `hookdeck gateway metrics queue-depth --measures max_depth,max_age` | `hookdeck gateway metrics events --measures max_depth,max_age` | -| `hookdeck gateway metrics events-by-issue --measures count` | `hookdeck gateway metrics events --measures count --issue-id ` | - ---- - -## Detailed Changes - -### MCP Server (`hookdeck gateway mcp`) - -A stdio JSON-RPC MCP server that exposes Hookdeck's API for use by AI agents and LLM-powered tools. - -**Tools (11 total):** - -| Tool | Description | -|------|-------------| -| `hookdeck_help` | Get tool overview or detailed help for a specific tool | -| `hookdeck_sources` | Inspect inbound HTTP endpoints (list, get) | -| `hookdeck_destinations` | Inspect delivery targets — HTTP, CLI, MOCK (list, get) | -| `hookdeck_connections` | Inspect and control routes linking sources to destinations (list, get, pause, unpause) | -| `hookdeck_requests` | Query raw inbound HTTP requests before routing (list, get, raw_body, events, ignored_events) | -| `hookdeck_events` | Query processed events routed through connections (list, get, raw_body) | -| `hookdeck_attempts` | Query delivery attempts and retry history (list, get) | -| `hookdeck_transformations` | Inspect JavaScript payload transformations (list, get) | -| `hookdeck_issues` | Inspect aggregated failure signals (list, get) | -| `hookdeck_metrics` | Query aggregate metrics with time ranges and grouping dimensions (events, requests, attempts, transformations) | -| `hookdeck_projects` | List available projects or switch active project (list, use) | -| `hookdeck_login` | Browser-based device authentication (available when unauthenticated) | - -**Key features:** -- Stdio transport compatible with Claude Desktop, Cursor, and other MCP clients -- Structured error translation mapping HTTP status codes to MCP error codes -- In-band browser-based authentication — if unauthenticated, only `hookdeck_login` is available; after auth, all resource tools become available without reconnection -- Comprehensive test coverage (94+ tests in `server_test.go` and `telemetry_test.go`) - -**Configuration example (Cursor / Claude Desktop):** -```json -{ - "mcpServers": { - "hookdeck": { - "command": "hookdeck", - "args": ["gateway", "mcp"] - } - } -} -``` - -### Issues CLI (`hookdeck gateway issue`) - -New subcommand for managing Hookdeck issues with full CRUD support. - -| Command | Description | -|---------|-------------| -| `issue list` | List and filter issues by type, status, trigger ID with pagination | -| `issue get ` | Get detailed issue information | -| `issue count` | Count issues with optional filters | -| `issue update --status ` | Update issue status (OPENED, IGNORED, ACKNOWLEDGED, RESOLVED) | -| `issue dismiss ` | Dismiss an issue (with `--force` to skip confirmation) | - -All commands support `--output json` for machine-readable output. - -### Telemetry Instrumentation - -Per-request telemetry headers (`X-Hookdeck-CLI-Telemetry`) are now sent with API requests, tracking: - -| Dimension | Description | Example | -|-----------|-------------|---------| -| `source` | Request origin | `"cli"` or `"mcp"` | -| `environment` | Runtime environment | `"interactive"` or `"ci"` | -| `command_path` | Command or tool being executed | `"hookdeck listen"`, `"hookdeck_sources/list"` | -| `invocation_id` | Unique per-invocation identifier | `"inv_a1b2c3d4e5f6g7h8"` | -| `device_name` | Hostname | `"my-machine"` | -| `mcp_client` | MCP client identifier (MCP only) | `"cursor/0.42"` | - -**Opt-out:** Users can disable telemetry via: -- `hookdeck telemetry disable` command -- `HOOKDECK_CLI_TELEMETRY_OPTOUT=1` environment variable - -### Go SDK Removal - -The deprecated `github.com/hookdeck/hookdeck-go-sdk v0.7.0` dependency has been removed entirely. All API calls now go through the direct HTTP client (`pkg/hookdeck/client.go`), using API version `2025-07-01` instead of the SDK's pinned `2024-03-01`. - -**Files removed:** -- `pkg/config/sdkclient.go` -- `pkg/hookdeck/sdkclient.go` - -**Files updated:** -- `pkg/listen/listen.go` — Now uses `config.GetAPIClient()` instead of SDK client -- `pkg/listen/source.go` — Direct API calls for source operations -- `pkg/listen/connection.go` — Direct API calls for connection operations -- `pkg/listen/proxy/` — Updated to use `hookdeck.*` types instead of `hookdecksdk.*` -- `pkg/listen/tui/` — Updated type references - -### Other Changes - -- **`REFERENCE.md` updated** — Reflects new commands, renamed flags, and removed metrics subcommands -- **`REFERENCE.template.md` removed** — Template file for reference generation deleted -- **Source/destination `--config` flag** — New `--config` flag on source and destination create/update/upsert commands for passing JSON config objects directly -- **Acceptance test infrastructure** — New parallel test runner (`test/acceptance/run_parallel.sh`), expanded test helpers, and comprehensive test coverage for issues, metrics, and MCP -- **CI workflow updates** — Acceptance test workflow updated for new test structure - ---- - -## Stats - -- **100 files changed** -- **~8,900 additions**, **~610 deletions** -- **45 commits** - -## Test Plan - -- [ ] Acceptance tests pass for issues CLI (`test/acceptance/issue_test.go`) -- [ ] Acceptance tests pass for metrics consolidation (`test/acceptance/metrics_test.go`) -- [ ] MCP server unit tests pass (`pkg/gateway/mcp/server_test.go` — 94+ tests) -- [ ] MCP telemetry tests pass (`pkg/gateway/mcp/telemetry_test.go`) -- [ ] CLI telemetry tests pass (`pkg/cmd/telemetry_test.go`, `pkg/hookdeck/telemetry_test.go`) -- [ ] `hookdeck listen` works correctly with new direct API client -- [ ] `hookdeck gateway mcp` starts and responds to tool calls -- [ ] Telemetry opt-out works via command and environment variable -- [ ] `--hookdeck-config` flag works (and `--config` no longer conflicts) -- [ ] Verify 2.0.0-beta.0 version in build artifacts diff --git a/pkg/cmd/mcp.go b/pkg/cmd/mcp.go index 102c57b1..679ed84f 100644 --- a/pkg/cmd/mcp.go +++ b/pkg/cmd/mcp.go @@ -17,8 +17,8 @@ func newMCPCmd() *mcpCmd { mc.cmd = &cobra.Command{ Use: "mcp", Args: validators.NoArgs, - Short: "Start an MCP server for AI agent access to Hookdeck", - Long: `Starts a Model Context Protocol (MCP) server over stdio. + Short: ShortBeta("Start an MCP server for AI agent access to Hookdeck"), + Long: LongBeta(`Starts a Model Context Protocol (MCP) server over stdio. The server exposes Hookdeck Event Gateway resources — connections, sources, destinations, events, requests, and more — as MCP tools that AI agents and @@ -26,7 +26,7 @@ LLM-based clients can invoke. If the CLI is already authenticated, all tools are available immediately. If not, a hookdeck_login tool is provided that initiates browser-based -authentication so the user can log in without leaving the MCP session.`, +authentication so the user can log in without leaving the MCP session.`), Example: ` # Start the MCP server (stdio transport) hookdeck gateway mcp From 3631b4424a2051aa2d8eb09a1dc323ef07650d8a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Mar 2026 16:02:02 +0000 Subject: [PATCH 3/3] refactor(telemetry): rename env var to HOOKDECK_CLI_TELEMETRY_DISABLED and use enabled/disabled args - Rename HOOKDECK_CLI_TELEMETRY_OPTOUT to HOOKDECK_CLI_TELEMETRY_DISABLED to match Next.js convention and align with the config key name - Change `hookdeck telemetry enable|disable` to `hookdeck telemetry enabled|disabled` - Update all tests and README accordingly https://claude.ai/code/session_012a587AhAbbWdqYx76cexPG --- README.md | 6 +++--- pkg/cmd/telemetry.go | 16 ++++++++-------- pkg/gateway/mcp/telemetry_test.go | 12 ++++++------ pkg/hookdeck/client.go | 2 +- pkg/hookdeck/client_telemetry_test.go | 10 +++++----- pkg/hookdeck/telemetry_test.go | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index bab4507f..4f70be33 100644 --- a/README.md +++ b/README.md @@ -1101,13 +1101,13 @@ The Hookdeck CLI collects anonymous telemetry to help improve the tool. You can ```sh # Disable telemetry -hookdeck telemetry disable +hookdeck telemetry disabled # Re-enable telemetry -hookdeck telemetry enable +hookdeck telemetry enabled ``` -You can also disable telemetry by setting the `HOOKDECK_CLI_TELEMETRY_OPTOUT` environment variable to `1` or `true`. +You can also disable telemetry by setting the `HOOKDECK_CLI_TELEMETRY_DISABLED` environment variable to `1` or `true`. ## Configuration files diff --git a/pkg/cmd/telemetry.go b/pkg/cmd/telemetry.go index 91b40cf5..784b7481 100644 --- a/pkg/cmd/telemetry.go +++ b/pkg/cmd/telemetry.go @@ -14,13 +14,13 @@ func newTelemetryCmd() *telemetryCmd { tc := &telemetryCmd{} tc.cmd = &cobra.Command{ - Use: "telemetry [enable|disable]", + Use: "telemetry [enabled|disabled]", Short: "Manage anonymous telemetry settings", - Long: "Enable or disable anonymous telemetry that helps improve the Hookdeck CLI. Telemetry is enabled by default. You can also set the HOOKDECK_CLI_TELEMETRY_OPTOUT environment variable to 1 or true.", - Example: ` $ hookdeck telemetry disable - $ hookdeck telemetry enable`, + Long: "Enable or disable anonymous telemetry that helps improve the Hookdeck CLI. Telemetry is enabled by default. You can also set the HOOKDECK_CLI_TELEMETRY_DISABLED environment variable to 1 or true.", + Example: ` $ hookdeck telemetry disabled + $ hookdeck telemetry enabled`, Args: cobra.ExactArgs(1), - ValidArgs: []string{"enable", "disable"}, + ValidArgs: []string{"enabled", "disabled"}, RunE: tc.runTelemetryCmd, } @@ -29,18 +29,18 @@ func newTelemetryCmd() *telemetryCmd { func (tc *telemetryCmd) runTelemetryCmd(cmd *cobra.Command, args []string) error { switch args[0] { - case "disable": + case "disabled": if err := Config.SetTelemetryDisabled(true); err != nil { return fmt.Errorf("failed to disable telemetry: %w", err) } fmt.Println("Telemetry has been disabled.") - case "enable": + case "enabled": if err := Config.SetTelemetryDisabled(false); err != nil { return fmt.Errorf("failed to enable telemetry: %w", err) } fmt.Println("Telemetry has been enabled.") default: - return fmt.Errorf("invalid argument %q: must be \"enable\" or \"disable\"", args[0]) + return fmt.Errorf("invalid argument %q: must be \"enabled\" or \"disabled\"", args[0]) } return nil } diff --git a/pkg/gateway/mcp/telemetry_test.go b/pkg/gateway/mcp/telemetry_test.go index a7daaeab..366b9d40 100644 --- a/pkg/gateway/mcp/telemetry_test.go +++ b/pkg/gateway/mcp/telemetry_test.go @@ -183,7 +183,7 @@ func parseTelemetryHeader(t *testing.T, raw string) hookdeck.CLITelemetry { func TestMCPToolCall_TelemetryHeaderSentToAPI(t *testing.T) { // Ensure env-var opt-out is disabled so telemetry flows. - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") capture := &headerCapture{} @@ -213,7 +213,7 @@ func TestMCPToolCall_TelemetryHeaderSentToAPI(t *testing.T) { } func TestMCPToolCall_EachCallGetsUniqueInvocationID(t *testing.T) { - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") capture := &headerCapture{} @@ -243,7 +243,7 @@ func TestMCPToolCall_EachCallGetsUniqueInvocationID(t *testing.T) { } func TestMCPToolCall_TelemetryHeaderReflectsAction(t *testing.T) { - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") capture := &headerCapture{} @@ -274,7 +274,7 @@ func TestMCPToolCall_TelemetryHeaderReflectsAction(t *testing.T) { } func TestMCPToolCall_TelemetryDisabledByConfig(t *testing.T) { - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") capture := &headerCapture{} @@ -298,7 +298,7 @@ func TestMCPToolCall_TelemetryDisabledByConfig(t *testing.T) { } func TestMCPToolCall_TelemetryDisabledByEnvVar(t *testing.T) { - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "true") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "true") capture := &headerCapture{} @@ -320,7 +320,7 @@ func TestMCPToolCall_TelemetryDisabledByEnvVar(t *testing.T) { func TestMCPToolCall_MultipleAPICallsSameInvocation(t *testing.T) { // The "projects use" action makes 2 API calls (list projects, then update). // Both should carry the same invocation ID. - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") capture := &headerCapture{} diff --git a/pkg/hookdeck/client.go b/pkg/hookdeck/client.go index b7b43bd3..35205826 100644 --- a/pkg/hookdeck/client.go +++ b/pkg/hookdeck/client.go @@ -129,7 +129,7 @@ func (c *Client) PerformRequest(ctx context.Context, req *http.Request) (*http.R } singletonDisabled := GetTelemetryInstance().Disabled - if !telemetryOptedOut(os.Getenv("HOOKDECK_CLI_TELEMETRY_OPTOUT"), c.TelemetryDisabled || singletonDisabled) { + if !telemetryOptedOut(os.Getenv("HOOKDECK_CLI_TELEMETRY_DISABLED"), c.TelemetryDisabled || singletonDisabled) { var telemetryHdr string var telErr error if c.Telemetry != nil { diff --git a/pkg/hookdeck/client_telemetry_test.go b/pkg/hookdeck/client_telemetry_test.go index 999df8e7..4ad6a5e7 100644 --- a/pkg/hookdeck/client_telemetry_test.go +++ b/pkg/hookdeck/client_telemetry_test.go @@ -76,7 +76,7 @@ func TestPerformRequestUsesTelemetryOverride(t *testing.T) { require.NoError(t, err) // Clear opt-out env var - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") _, err = client.PerformRequest(context.Background(), req) require.NoError(t, err) @@ -107,7 +107,7 @@ func TestPerformRequestTelemetryDisabledByConfig(t *testing.T) { TelemetryDisabled: true, } - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") req, err := http.NewRequest(http.MethodGet, server.URL+"/test", nil) require.NoError(t, err) @@ -132,7 +132,7 @@ func TestPerformRequestTelemetryDisabledByEnvVar(t *testing.T) { APIKey: "test", } - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "true") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "true") req, err := http.NewRequest(http.MethodGet, server.URL+"/test", nil) require.NoError(t, err) @@ -166,7 +166,7 @@ func TestPerformRequestFallsBackToSingleton(t *testing.T) { tel.SetDeviceName("test-host") tel.SetInvocationID("inv_singleton_test") - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") req, err := http.NewRequest(http.MethodGet, server.URL+"/test", nil) require.NoError(t, err) @@ -205,7 +205,7 @@ func TestPerformRequestTelemetryDisabledBySingleton(t *testing.T) { tel := GetTelemetryInstance() tel.SetDisabled(true) - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") req, err := http.NewRequest(http.MethodGet, server.URL+"/test", nil) require.NoError(t, err) diff --git a/pkg/hookdeck/telemetry_test.go b/pkg/hookdeck/telemetry_test.go index 2bc4d99d..f8c66776 100644 --- a/pkg/hookdeck/telemetry_test.go +++ b/pkg/hookdeck/telemetry_test.go @@ -176,7 +176,7 @@ func TestResetTelemetrySingletonThenRequest(t *testing.T) { })) defer server.Close() - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") // Reset the singleton from any prior test state ResetTelemetryInstanceForTesting() @@ -217,7 +217,7 @@ func TestResetTelemetrySingletonThenRequest(t *testing.T) { func TestResetTelemetrySingletonIsolation(t *testing.T) { // Simulates two sequential CLI command invocations. // Each should have its own telemetry context. - t.Setenv("HOOKDECK_CLI_TELEMETRY_OPTOUT", "") + t.Setenv("HOOKDECK_CLI_TELEMETRY_DISABLED", "") headers := make([]string, 2)