feat(cli): Concrete auth + lifecycle events; drop start/_completed pairs - #35
Merged
thecodedrift merged 31 commits intoJun 14, 2026
Merged
Conversation
Phase 3 of the telemetry rework. Replace the auth/init/update/onboard/check
start and _completed pairs with concrete state-transition events:
- auth login → cli_authenticated (fresh login only; already-logged-in is not)
- auth logout → cli_logged_out (only when a saved token was removed)
- auth status → no bespoke event; covered by cli_run
- init/update → cli_installed (interactive wizard, non-interactive, update)
- onboard --mark-complete → cli_onboarded (already-done / recipe → cli_run only)
- check → cli_check_completed { errorCount, warningCount, findings }
(only when a scan runs; counts only, never matched code)
Tests: wizard-integration now asserts cli_installed on completion and no
install event on cancel; telemetry.test sample event names updated to cli_run.
Full suite green (256). cli_run still emits per invocation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Phase 4 of the telemetry rework. Replace help_index / help_<topic> /
help_unknown with a single cli_help carrying a topic property (the served
topic, "(index)" for a no-arg invocation, or the attempted topic when
unknown) — help intent is now one event filtered by topic. Remove info's
bespoke cli_info / cli_info_completed events (covered by cli_run) and its
now-unused getTelemetry import.
detect.ts (cli_detect) is not on this branch's lineage — it lives in the
unmerged local-rule-routing stack and is reconciled when both land.
Adds test/help-telemetry.test.ts asserting cli_help { topic } across the
served / index / unknown cases and that no legacy help_* event fires.
Full suite green (259).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
All five phases of the telemetry rework are complete, so finalize on the tip of the stack: apply the analytics delta into the main spec (add the cli_run denominator requirement; rewrite the cli_ taxonomy, the wrong-topic funnel, and the standard-properties scenarios) and move the change to openspec/changes/archive/2026-06-13-restructure-cli-telemetry/. Legacy event sweep is clean (the only _completed is the intentional cli_check_completed concrete event); validate/typecheck/lint/suite green; commands smoke-tested end-to-end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…fecycle * feat/telemetry-rule-events: ci(openspec): Skip the archive check on non-tip stacked PRs
…help * feat/telemetry-auth-lifecycle: ci(openspec): Skip the archive check on non-tip stacked PRs
* feat/telemetry-cli-help: ci(openspec): Skip the archive check on non-tip stacked PRs
This was referenced Jun 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Phase 3 of the CLI telemetry rework: replaces command-level “start/_completed” event pairs for auth + lifecycle commands with concrete state-transition events, aligning runtime emission with the updated OpenSpec taxonomy.
Changes:
- Replace legacy auth telemetry events with
cli_authenticated(fresh login only) andcli_logged_out(token actually removed); auth status relies oncli_run. - Replace init/update/wizard completion telemetry with
cli_installed; remove cancel/completed pairs. - Replace check telemetry with
cli_check_completed { errorCount, warningCount, findings }emitted only when a scan completes; update tests/docs accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/commands/auth.ts | Drops legacy auth start/_completed events; emits concrete auth state events only when appropriate. |
| packages/cli/src/commands/init.ts | Removes init/update legacy events; emits cli_installed for successful non-interactive install/update paths. |
| packages/cli/src/wizard/index.ts | Emits cli_installed on successful interactive wizard completion; removes legacy init completed/cancelled events. |
| packages/cli/src/commands/onboard.ts | Emits cli_onboarded only when onboarding is marked complete; removes other bespoke onboard events. |
| packages/cli/src/commands/check.ts | Switches to cli_check_completed with counts-only payload emitted only when a scan completes. |
| packages/cli/test/wizard-integration.test.ts | Updates wizard integration assertions to cli_installed and “no install event on cancel”. |
| packages/cli/test/telemetry.test.ts | Updates sample event names used by telemetry-client tests to cli_run. |
| openspec/changes/restructure-cli-telemetry/tasks.md | Marks Phase 3 tasks complete and updates the check payload field to findings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
thecodedrift
marked this pull request as ready for review
June 13, 2026 17:25
thecodedrift
commented
Jun 13, 2026
thecodedrift
left a comment
Member
Author
There was a problem hiding this comment.
lgtm. Made feedback upstream on handling a cli_completed event so we can reliably capture timing data
PR #35 review: - check.ts: compute errorCount/warningCount in one loop over results and derive hasErrors from errorCount, instead of one `some` + two `filter` passes over potentially large scan output. - wizard-integration test: assert on the event name across all capture calls rather than not.toHaveBeenCalledWith("cli_installed"), so a call with extra properties can't produce a false negative. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR #36 review: the served-topic and no-arg help-telemetry tests asserted cli_help was emitted but not that the implementation avoids dual-emitting a legacy help_* event. Both now map captured calls to their event names and assert none start with help_ (and specifically not help_index). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Per review feedback: instead of repeating a "no help_* event" assertion
inside every behavioral help-telemetry test (over-testing), keep those
tests purely behavioral (cli_help { topic }) and add a single source-scan
test that asserts no help_* event-name literal remains anywhere under
src/. That states the contract once, confidently.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…fecycle * feat/telemetry-rule-events: fix(cli): Resolve cli_run identity at invocation start, not end fix(cli): Only emit cli_rule_created/improved when rules are written fix(cli): Resolve cli_run identity fresh; tighten cli_error + drop cli_version docs(openspec): Address review on the telemetry contract
…help * feat/telemetry-auth-lifecycle: fix(cli): Resolve cli_run identity at invocation start, not end refactor(cli): Single-pass check counts; robust cli_installed assertion fix(cli): Only emit cli_rule_created/improved when rules are written fix(cli): Resolve cli_run identity fresh; tighten cli_error + drop cli_version docs(openspec): Address review on the telemetry contract # Conflicts: # openspec/changes/restructure-cli-telemetry/tasks.md
* feat/telemetry-cli-help: fix(cli): Resolve cli_run identity at invocation start, not end test(cli): Prove help_* removal once via a source scan, not per-test test(cli): Assert no legacy help_* event on served-topic and index paths refactor(cli): Single-pass check counts; robust cli_installed assertion fix(cli): Only emit cli_rule_created/improved when rules are written fix(cli): Resolve cli_run identity fresh; tighten cli_error + drop cli_version docs(openspec): Address review on the telemetry contract
…bility
The archive commit synced the pre-review delta spec, so the capability
spec carried the stale cli_check_completed{ filesScanned } and a fuzzy
cli_help index-marker description. Reconcile the synced spec (and the
archive design flow diagram) with the corrected contract: findings
replaces filesScanned, and cli_help documents the exact literal
"(index)" for the no-topic invocation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…fecycle * feat/telemetry-rule-events: refactor(cli): Uppercase the CLI acronym in CliError/CliErrorCode # Conflicts: # packages/cli/src/commands/auth.ts
…help * feat/telemetry-auth-lifecycle: refactor(cli): Uppercase the CLI acronym in CliError/CliErrorCode
* feat/telemetry-cli-help: refactor(cli): Uppercase the CLI acronym in CliError/CliErrorCode
Match the source rename — the CLI acronym is uppercase in the CLIError class and CLIErrorCode type, so the spec prose and archived contract use the same casing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…fecycle * feat/telemetry-rule-events: docs(openspec): Uppercase CLIError/CLIErrorCode in the change contract
…help * feat/telemetry-auth-lifecycle: docs(openspec): Uppercase CLIError/CLIErrorCode in the change contract
* feat/telemetry-cli-help: docs(openspec): Uppercase CLIError/CLIErrorCode in the change contract
The acronym rename landed on the runner branch, but auth.ts is owned by this phase and its edits sat on the same lines, so the merge kept the old casing and left the type unresolved. Rename auth.ts here so the type checks across the stack. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…help * feat/telemetry-auth-lifecycle: fix(cli): Carry the CLIErrorCode rename into auth.ts
* feat/telemetry-cli-help: fix(cli): Carry the CLIErrorCode rename into auth.ts
…fecycle * feat/telemetry-rule-events: refactor(cli): Uppercase the acronym in CLIErrorEnvelope too
…help * feat/telemetry-auth-lifecycle: refactor(cli): Uppercase the acronym in CLIErrorEnvelope too
* feat/telemetry-cli-help: refactor(cli): Uppercase the acronym in CLIErrorEnvelope too
…fecycle * feat/telemetry-rule-events: refactor(cli): Uppercase the acronym in CLIConfig
…help * feat/telemetry-auth-lifecycle: refactor(cli): Uppercase the acronym in CLIConfig
* feat/telemetry-cli-help: refactor(cli): Uppercase the acronym in CLIConfig
chore(openspec): Finalize + archive restructure-cli-telemetry
feat(cli): Collapse help_* into cli_help { topic }; drop cli_info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 of the telemetry rework (stacked on the rule-events phase).
Replaces the auth / init / update / onboard / check start +
_completedpairs with concrete state-transition events:auth login→cli_authenticated(fresh login only — already-logged-in is not a new auth)auth logout→cli_logged_out(only when a saved token was actually removed)auth status→ no bespoke event; covered bycli_runinit/update→cli_installed(interactive wizard, non-interactive, and update)onboard --mark-complete→cli_onboarded(already-done / recipe-print →cli_runonly)check→cli_check_completed { errorCount, warningCount, findings }— only when a scan actually runs; counts only, never matched code (findingsreplaces the unavailablefilesScanned)Tests:
wizard-integrationnow assertscli_installedon completion and no install event on cancel;telemetry.testsample event names updated tocli_run. Full suite green (256).Part of the
restructure-cli-telemetryOpenSpec change. Phase 4 (cli_help) + Phase 5 (finalize/archive) remain.Stack generated by Git Town