cli/pkg/cmd/root
William Martin 998b6212b3
Add skills specific telemetry
* Add skills specific telemetry

* Remove VisibilityFuture, inline goroutine at call sites

The VisibilityFuture/FetchRepoVisibilityAsync/Wait wrapper was an
unidiomatic async abstraction built for a single pattern used in
exactly two call sites. In Go the channel is already the future;
wrapping it in a struct with a Wait(timeout) method adds no value.

Delete the abstraction and inline a local visResult struct,
buffered channel, goroutine, and select at each call site. Behavior
is preserved exactly: err -> "unknown", timeout -> "unknown",
success+public -> include skill_names.

FetchRepoVisibility (synchronous) is kept as-is.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix nonsense copilot tests

* Update telemetry tests for public-only dims and search event removal

Production telemetry emission changed:
- preview: skill_owner/skill_repo/skill_name (renamed from skill_names)
  are now emitted only when repo_visibility=public.
- install: skill_owner/skill_repo/skill_names are now emitted only
  when repo_visibility=public.
- search: the initial skill_search event was removed entirely; the
  skill_search_install event no longer carries query/owner dims.

Update tests to match: rename skill_names -> skill_name in preview,
make owner/repo assertions conditional on public visibility in both
preview and install, and reduce the search test to a single event
with explicit Empty assertions for the removed query/owner dims so a
privacy regression cannot pass silently.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Test CategorizeHost and switch telemetry to skill_host_type

Add TestCategorizeHost covering all four classification branches
(github.com, ghes, tenancy, uncategorized) with cases verified
against the real ghauth implementation rather than guessed.

Update install and preview unit tests to assert the new
skill_host_type dimension name, and fix a typo in the preview
acceptance txtar (skill_hos_type -> skill_host_type).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Shrink visibility wait and test unknown visibility

The 2s visibilityWaitTimeout was wildly overprovisioned: by the time
telemetry emission reaches the select, the command has already done
several serial GitHub REST calls (and for install, a git sparse-checkout
plus possibly interactive prompts), so the one-call visibility fetch
has almost always completed. Drop the timeout to 200ms — a short safety
net for a stalled REST call, not a wait budget for a healthy one.

Also adds a table-driven case to TestFetchRepoVisibility covering an
unknown/future visibility value from the API, addressing @babakks'
review nitpick.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-17 19:58:59 +02:00
..
alias.go Do not send telemetry for aliases 2026-04-17 14:28:49 +02:00
alias_test.go Allow creating of nested aliases (#7457) 2023-05-25 09:46:45 +09:00
extension.go Add sampled command telemetry 2026-04-16 21:42:46 +02:00
extension_registration_test.go Add sampled command telemetry 2026-04-16 21:42:46 +02:00
extension_test.go Add small wait to extension update tests 2025-01-16 14:10:42 +01:00
help.go Update a11y text based on draft feedback 2025-04-28 15:01:15 -04:00
help_reference.go update generated content for man pages and website 2024-05-17 09:30:53 -04:00
help_test.go Add sampled command telemetry 2026-04-16 21:42:46 +02:00
help_topic.go Apply review feedback 2026-04-17 12:28:52 +02:00
help_topic_test.go fix: resolve copyloopvar issues 2025-11-03 20:05:26 +00:00
official_extension_stub.go Remove dispatch after install, install only 2026-04-16 10:38:33 -06:00
official_extension_stub_test.go Remove dispatch after install, install only 2026-04-16 10:38:33 -06:00
root.go Add skills specific telemetry 2026-04-17 19:58:59 +02:00