[eas-cli] Support drill-down from event lists in observe:session - #3987
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3987 +/- ##
==========================================
+ Coverage 60.57% 60.66% +0.10%
==========================================
Files 955 955
Lines 42073 42174 +101
Branches 8834 8867 +33
==========================================
+ Hits 25480 25580 +100
- Misses 16499 16500 +1
Partials 94 94 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a1b6e80 to
360878d
Compare
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
| const { startTime, endTime } = resolveTimeRange(timeRangeFlags); | ||
|
|
||
| const eventNameChoice: EventNameChoice = eventNameFlag | ||
| ? { name: eventNameFlag, isMetric: isKnownMetricName(eventNameFlag) } |
There was a problem hiding this comment.
We're likely going to have custom metrics down the line so you could track timings of custom values here in which case this would break since it assumes built-in metrics or nothing.
There was a problem hiding this comment.
Maybe we can be explicit here and ask for a metric or an event name?
There was a problem hiding this comment.
I think the right way to handle this is to extend the isKnownMetricName method to include custom metrics, once they are supported.
Make the sessionId positional arg optional. When it's omitted and the command is running interactively, walk the user through picking an event whose session they want to inspect. Non-interactive without a session ID still errors as before. New flags on observe:session: - --event-name: metric alias/full-name or custom log event name. When it names a known metric (via isKnownMetricName from metricNames.ts) the picker queries fetchObserveEventsAsync; otherwise it queries fetchObserveCustomEventsAsync. - --sort: reuses EventsOrderPreset (fastest/slowest/newest/oldest) from observe/fetchEvents.ts. If omitted in interactive mode the user is prompted; the choice list adapts to the event kind (fastest/slowest are metric-only). - --days/--start/--end via ObserveTimeRangeFlags for the candidate window (default 60 days). Interactive picker flow when no session ID is given: 1. Event-name prompt (skipped if --event-name is passed). Options merge METRIC_SHORT_NAMES with ObserveQuery.customEventNamesAsync results, labelled per kind and with per-name counts for log events. 2. Sort-order prompt (skipped if --sort is passed). Log events see only newest/oldest. 3. Candidate-event prompt over the first 25 events fetched with that sort/window. Candidates without a sessionId are filtered out. On selection, the sessionId feeds the existing single-session timeline. Combining picker flags with a positional sessionId is now an explicit error since they describe how to find a session, not how to display one. The existing single-session path is unchanged. Also adds isKnownMetricName to observe/metricNames.ts — a non-throwing predicate over METRIC_ALIASES, NAVIGATION_METRIC_ALIASES, and their full name sets, used by the picker to route to metric- vs log-event fetchers without a try/catch around resolveMetricName. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ve commands Observe commands read flags['non-interactive'] and flags.json directly, so --json didn't imply non-interactive. Resolve both through resolveNonInteractiveAndJsonFlags and use the results, matching the rest of the CLI. --json now correctly implies non-interactive across observe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The nav aliases were renamed to nav_cold_ttr/nav_warm_ttr but the isKnownMetricName test still asserted the old cold_ttr/warm_ttr names. Update the test to the current alias names. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The customEventList query document omitted orderBy, so session log candidates were sorted client-side by timestamp. Thread orderBy through customEventListAsync and fetchObserveCustomEventsAsync, request TIMESTAMP ASC/DESC in fetchSessionLogCandidatesAsync, and drop the client-side sort. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds orderBy to the AppObserveCustomEventList operation type; also picks up unrelated schema additions present on the server since the last regeneration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7f9f4a4 to
d140563
Compare
|
✅ Thank you for adding the changelog entry! |

Why
When session ID is omitted and the
observe:sessioncommand is running interactively, walk the user through picking an event whose session they want to inspect. Non-interactive without a session ID still errors as before.The goal is to support a flow similar to that already available on our website, where a user can select an event from a displayed list, and navigate to the session timeline that contains that event.
How
Add new flags
--event-nameand--sort-order. If these are not provided, user will be prompted first to select from a list of event names (including custom events, if applicable), then select a sort order. The command also now takes the same time period flags as the other commands (--days,--start,--end).Once the user has made the above selections, the user can choose from the list of events shown (up to 25), and the session for that event will be shown.
Test Plan