Repository navigation
feat: tool report-event for the Claude Code plugin's lineage report - #1718
ralphstodomingo wants to merge 4 commits into
Conversation
- `altimate-code tool report-event <action> --session claude:<id>` sends one `lineage_report` usage event: the action and the session, no model, column or file names. - Only the six report actions and a `claude:` session id are accepted; the telemetry opt-out drops it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VEmKQwEiHMwQ7BdwgPo9sb
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VEmKQwEiHMwQ7BdwgPo9sb
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@codex review against the numbered claims (C1–C4) and the disclosed residuals (R1–R2) in the "Claims (for review)" section of this PR's description: report only a reproducible trace that violates a numbered claim. Instances of the disclosed residuals are not findings. A round with no claim violation ends review. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VEmKQwEiHMwQ7BdwgPo9sb
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…all it carries; the test pins the six actions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VEmKQwEiHMwQ7BdwgPo9sb
|
Review log: claims and residuals Claims (each can be violated by a concrete trace):
Disclosed residuals (accepted; instances are not findings):
Round 1: Codex clean on 5f599dd. CI on 5f599dd caught the |
| timestamp: number | ||
| /** The host agent's session: `claude:<id>`. */ | ||
| session_id: string | ||
| action: "summary_shown" | "open_pressed" | "command_run" | "built" | "build_failed" | "no_browser" |
There was a problem hiding this comment.
[SUGGESTION]: The six lineage-report actions are declared twice: here and in REPORT_ACTIONS (altimate/tool-cli/report-event.ts:8).
Adding an action to this union without adding it to REPORT_ACTIONS compiles Telemetry.track fine but advertises an action the CLI always rejects with exit 1; only the other direction (list first, union second) is caught by typecheck. Deriving the field from the single list (import type { ReportAction } from "../tool-cli/report-event", then action: ReportAction; the module has no imports, so the type-only edge is free) keeps the telemetry reference and the validator from drifting.
There was a problem hiding this comment.
Agreed this is a drift risk, but no fix in this PR: as it stands, the union and REPORT_ACTIONS hold the same six actions, and a test pins that list. Deriving the field from ReportAction with a type-only import is queued for a small follow-up, so this PR can go into today's release without another full CI run.
| import { describe, expect, test } from "bun:test" | ||
| import { REPORT_ACTIONS, reportEvent } from "../../../src/altimate/tool-cli/report-event" | ||
|
|
||
| describe("tool report-event", () => { |
There was a problem hiding this comment.
[SUGGESTION]: These tests cover reportEvent() only; the CLI wiring the PR's claims describe (exit 1 and nothing tracked for a refused action or session) has no test.
test/altimate/tool-cli/cli.test.ts already spawns the real CLI through inShell with ALTIMATE_TELEMETRY_DISABLED=1, so a refused-action and a refused-session case (exit code 1, reason on stderr) is cheap and would lock in C2 end to end. Asserting the send path for C1/C3 could reuse the sink pattern from test/altimate/telemetry/* via APPLICATIONINSIGHTS_CONNECTION_STRING.
There was a problem hiding this comment.
Not in this PR. C2's CLI path was checked by hand from source: a valid call exits 0, and a bad action or a bad session each exits 1 with the reason and sends nothing. A spawned-CLI test of those exits in cli.test.ts, plus a sink check for C1 and C3, is queued for the same follow-up.
| } | ||
|
|
||
| const ToolReportEventCommand = cmd({ | ||
| command: "report-event <action>", |
There was a problem hiding this comment.
[SUGGESTION]: docs/docs/usage/tool.md documents every other tool subcommand (list, context, run, daemon); this one is now user-visible in tool --help but has no entry there.
A short section saying it is the Claude Code plugin's hook, takes one of the six actions plus claude:<id>, and sends a single lineage_report event under the usual telemetry opt-out would keep the page complete and put the privacy contract where people reading tool docs will see it.
There was a problem hiding this comment.
Good point. A short report-event section in docs/docs/usage/tool.md (what calls it, the six actions, claude:<id>, one lineage_report event under the usual opt-out) is queued for the follow-up. Until then, the telemetry reference page describes the event.
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Verified the claimed behavior against the shipped CLI path: the command is registered under Issue Details (click to expand)SUGGESTION
Files Reviewed (6 files)
Fix these issues in Kilo Cloud Reviewed by deepseek-v4.1-flash-1017 · Input: 120.3K · Output: 24.9K · Cached: 3.1M Review guidance: REVIEW.md from base branch |
sahrizvi
left a comment
There was a problem hiding this comment.
Consensus review (panel: Claude as lead, and Codex): approve.
I ran the command from source against a local capture sink. A valid call sends one lineage_report with action, the claude:<id> session (in ai.session.id) and the timestamp, plus the shared envelope every event carries, and nothing from the cwd or project. ALTIMATE_TELEMETRY_DISABLED, OPENCODE_DISABLE_TELEMETRY and telemetry.disabled (global and project config) all suppress it. A bad action or session exits 1 with the reason and sends nothing from this command. A send that fails or hangs never changes the exit code. Marker guard ok (checked by hand too), typecheck passes, and test/altimate/tool-cli, test/cli/help and test/telemetry give 502 pass at head against 499 at base, with no regressions.
Remaining minors, none blocking (inline):
- Help text says nothing is sent when telemetry is off, but the existing one-time
telemetry_opted_outmarker can be: wording about pre-existing, documented behaviour. first_launchcan go out with the event, even on a refused call: pre-existing once-per-install event, no data from the plugin.- A hanging endpoint holds the command for about 10 s: pre-existing flush budget, and the plugin calls it in the background.
- The CLI wiring is untested and
ALL_EVENT_TYPESomits the event: test-only, safe in the follow-up you queued.
Nits are in a separate comment.
|
|
||
| const ToolReportEventCommand = cmd({ | ||
| command: "report-event <action>", | ||
| describe: "record what a person did with the Claude Code plugin's lineage report (usage telemetry; nothing is sent when telemetry is off)", |
There was a problem hiding this comment.
Minor (not blocking): the help text overstates the opt-out. With telemetry off, lineage_report is never sent (checked against a capture sink with each switch). But the first opted-out run on a machine that has a machine id still sends the one-time telemetry_opted_out marker, as docs/docs/reference/telemetry.md describes for every command. Suggest "usage telemetry, under the usual opt-out" here and the same in C3. Not blocking: wording about pre-existing, documented behaviour.
| .option("session", { type: "string", describe: "the Claude Code session: claude:<id>", demandOption: true }), | ||
| handler: async (args) => { | ||
| const { reportEvent } = await import("../../altimate/tool-cli/report-event") | ||
| const event = reportEvent(args.action, args.session) |
There was a problem hiding this comment.
Minor (not blocking): first_launch can go out with this command. The CLI middleware runs the welcome banner before this handler. When .installed-version is present, tool report-event bogus --session claude:abc exits 1 and still sends first_launch, and a valid call sends first_launch + lineage_report (reproduced). C1 and C2 hold for what this command adds; worth wording them that way. Not blocking: a pre-existing once-per-install event (version, is_upgrade, install_method, machine id) carrying nothing from the plugin.
| } | ||
| // Flushed, or dropped under the opt-out, when the CLI exits. | ||
| const { Telemetry } = await import("../../altimate/telemetry") | ||
| Telemetry.track(event) |
There was a problem hiding this comment.
Minor (not blocking): a hanging endpoint holds the command for about 10 s. Against an endpoint that never answers, the call took 10.9 s and exited 0 (unreachable: 0.9 s, exit 0). That is the inherited Telemetry.shutdown() flush budget, and the failure is swallowed correctly. Not blocking, because #1717 says the plugin runs this in the background; just make sure the plugin never awaits it on the report path.
| import { describe, expect, test } from "bun:test" | ||
| import { REPORT_ACTIONS, reportEvent } from "../../../src/altimate/tool-cli/report-event" | ||
|
|
||
| describe("tool report-event", () => { |
There was a problem hiding this comment.
Minor (not blocking): the CLI path is untested. These tests cover reportEvent() only. With Telemetry.track(event) and process.exitCode = 1 removed from the handler in tool.ts, all test/altimate/tool-cli and test/cli/help tests still pass (106). Also, ALL_EVENT_TYPES in test/telemetry/telemetry.test.ts stays at 55 without lineage_report (the recent rules_* events were added there). Test-only, and fine in the spawned-CLI / sink-check follow-up you queued.
|
Consensus review nits (Claude + Codex), PR head
|
🤖 Code Review — OpenCodeReview (Gemini) — No Issues FoundNo supported files changed. |
Issue for this PR
Closes #1717
Type of change
What does this PR do?
What changes for users: the Claude Code plugin can count how its offline lineage report gets used: the summary shown, Open report pressed,
/lineage-reportrun, and the report built, failed, or found no browser. This goes through altimate-code's usage telemetry, under its usual opt-out.altimate-code tool report-event <action> --session claude:<id>sends onelineage_reportevent: the action, the Claude Code session id and a timestamp. Nothing else.claude:<id>, exits 1 and sends nothing. So a path or a name can't ride along.Claims C1–C4 and residuals R1–R2 for review are in the review-log comment.
How did you verify your code works?
test/altimate/tool-cliand every telemetry test file, after mergingmain: 803 pass. The repo typecheck and Marker Guard pass. Linux only.Cost side effects
None. One small usage event per action; no model calls, warehouse queries or cloud resources.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01VEmKQwEiHMwQ7BdwgPo9sb
Summary by cubic
Adds a
tool report-eventcommand so the Claude Code plugin can record how its offline lineage report is used, through the existing altimate-code telemetry and its usual opt-out. The report page itself makes no network requests.altimate-code tool report-event <action> --session claude:<id>sends onelineage_reportevent with the action, session id, and timestamp. Only the six defined actions and aclaude:session id are accepted; anything else exits 1 and sends nothing. The event is added to the telemetry union and documented on the telemetry reference page.New Features
summary_shown,open_pressed,command_run,built,build_failed, andno_browser.claude:sessions, so no extra data can ride along.altimate-code tool --help.Written for commit 354cbe8. Summary will update on new commits.
Summary by CodeRabbit